Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
fc1ff920
提交
fc1ff920
authored
3月 13, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7508: timing update
上级
8d4686ae
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
6 行删除
+16
-6
mod_vpx.c
src/mod/codecs/mod_vpx/mod_vpx.c
+15
-5
switch_time.c
src/switch_time.c
+1
-1
没有找到文件。
src/mod/codecs/mod_vpx/mod_vpx.c
浏览文件 @
fc1ff920
...
@@ -72,6 +72,7 @@ struct vpx_context {
...
@@ -72,6 +72,7 @@ struct vpx_context {
const
vpx_codec_cx_pkt_t
*
pkt
;
const
vpx_codec_cx_pkt_t
*
pkt
;
vpx_codec_iter_t
iter
;
vpx_codec_iter_t
iter
;
uint32_t
last_ts
;
uint32_t
last_ts
;
switch_time_t
last_ms
;
vpx_codec_ctx_t
decoder
;
vpx_codec_ctx_t
decoder
;
uint8_t
decoder_init
;
uint8_t
decoder_init
;
switch_buffer_t
*
vpx_packet_buffer
;
switch_buffer_t
*
vpx_packet_buffer
;
...
@@ -531,6 +532,8 @@ static void reset_codec_encoder(switch_codec_t *codec)
...
@@ -531,6 +532,8 @@ static void reset_codec_encoder(switch_codec_t *codec)
if
(
context
->
encoder_init
)
{
if
(
context
->
encoder_init
)
{
vpx_codec_destroy
(
&
context
->
encoder
);
vpx_codec_destroy
(
&
context
->
encoder
);
}
}
context
->
last_ts
=
0
;
context
->
last_ms
=
0
;
context
->
framecount
=
0
;
context
->
framecount
=
0
;
context
->
encoder_init
=
0
;
context
->
encoder_init
=
0
;
context
->
pkt
=
NULL
;
context
->
pkt
=
NULL
;
...
@@ -542,7 +545,10 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
...
@@ -542,7 +545,10 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
vpx_context_t
*
context
=
(
vpx_context_t
*
)
codec
->
private_info
;
vpx_context_t
*
context
=
(
vpx_context_t
*
)
codec
->
private_info
;
int
width
=
0
;
int
width
=
0
;
int
height
=
0
;
int
height
=
0
;
uint32_t
dur
;
int64_t
pts
;
vpx_enc_frame_flags_t
vpx_flags
=
0
;
vpx_enc_frame_flags_t
vpx_flags
=
0
;
switch_time_t
now
;
if
(
frame
->
flags
&
SFF_SAME_IMAGE
)
{
if
(
frame
->
flags
&
SFF_SAME_IMAGE
)
{
return
consume_partition
(
context
,
frame
);
return
consume_partition
(
context
,
frame
);
...
@@ -580,9 +586,10 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
...
@@ -580,9 +586,10 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
init_encoder
(
codec
);
init_encoder
(
codec
);
}
}
now
=
switch_time_now
();
if
(
context
->
need_key_frame
!=
0
)
{
if
(
context
->
need_key_frame
!=
0
)
{
// force generate a key frame
// force generate a key frame
switch_time_t
now
=
switch_micro_time_now
();
if
(
!
context
->
last_key_frame
||
(
now
-
context
->
last_key_frame
)
>
KEY_FRAME_MIN_FREQ
)
{
if
(
!
context
->
last_key_frame
||
(
now
-
context
->
last_key_frame
)
>
KEY_FRAME_MIN_FREQ
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"VPX KEYFRAME GENERATED
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"VPX KEYFRAME GENERATED
\n
"
);
...
@@ -594,11 +601,14 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
...
@@ -594,11 +601,14 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
context
->
framecount
++
;
context
->
framecount
++
;
pts
=
(
now
-
context
->
start_time
)
/
1000
;
dur
=
context
->
last_ms
?
(
now
-
context
->
last_ms
)
/
1000
:
pts
;
if
(
vpx_codec_encode
(
&
context
->
encoder
,
if
(
vpx_codec_encode
(
&
context
->
encoder
,
(
vpx_image_t
*
)
frame
->
img
,
(
vpx_image_t
*
)
frame
->
img
,
switch_micro_time_now
()
-
context
->
start_time
,
pts
,
1
,
dur
,
vpx_flags
,
vpx_flags
,
VPX_DL_REALTIME
)
!=
VPX_CODEC_OK
)
{
VPX_DL_REALTIME
)
!=
VPX_CODEC_OK
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"VPX encode error %d:%s
\n
"
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"VPX encode error %d:%s
\n
"
,
...
@@ -610,7 +620,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
...
@@ -610,7 +620,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
context
->
iter
=
NULL
;
context
->
iter
=
NULL
;
context
->
last_ts
=
frame
->
timestamp
;
context
->
last_ts
=
frame
->
timestamp
;
context
->
last_ms
=
now
;
return
consume_partition
(
context
,
frame
);
return
consume_partition
(
context
,
frame
);
}
}
...
...
src/switch_time.c
浏览文件 @
fc1ff920
...
@@ -380,7 +380,7 @@ SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable)
...
@@ -380,7 +380,7 @@ SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable)
static
switch_status_t
timer_generic_sync
(
switch_timer_t
*
timer
)
static
switch_status_t
timer_generic_sync
(
switch_timer_t
*
timer
)
{
{
switch_time_t
now
=
switch_
micro_
time_now
();
switch_time_t
now
=
switch_time_now
();
int64_t
elapsed
=
(
now
-
timer
->
start
);
int64_t
elapsed
=
(
now
-
timer
->
start
);
timer
->
tick
=
(
elapsed
/
timer
->
interval
)
/
1000
;
timer
->
tick
=
(
elapsed
/
timer
->
interval
)
/
1000
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论