Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
7c13d0b2
提交
7c13d0b2
authored
5月 30, 2017
作者:
Anthony Minessale
提交者:
Mike Jerris
6月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10269: [mod_conference] conference recording pause doesn't work correctly for video #resolve
上级
62901300
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
50 行增加
和
5 行删除
+50
-5
switch_types.h
src/include/switch_types.h
+3
-1
avformat.c
src/mod/applications/mod_av/avformat.c
+37
-4
conference_record.c
src/mod/applications/mod_conference/conference_record.c
+2
-0
switch_core_file.c
src/switch_core_file.c
+8
-0
没有找到文件。
src/include/switch_types.h
浏览文件 @
7c13d0b2
...
...
@@ -2621,7 +2621,9 @@ typedef enum {
typedef
enum
{
SCFC_FLUSH_AUDIO
,
SCFC_PAUSE_READ
SCFC_PAUSE_READ
,
SCFC_PAUSE_WRITE
,
SCFC_RESUME_WRITE
}
switch_file_command_t
;
typedef
enum
{
...
...
src/mod/applications/mod_av/avformat.c
浏览文件 @
7c13d0b2
...
...
@@ -81,6 +81,10 @@ typedef struct record_helper_s {
switch_thread_t
*
video_thread
;
switch_mm_t
*
mm
;
int
finalize
;
switch_file_handle_t
*
fh
;
int
record_timer_offset
;
int
record_timer_paused
;
int
record_timer_resumed
;
}
record_helper_t
;
...
...
@@ -802,7 +806,27 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
uint64_t
delta_tmp
;
switch_core_timer_sync
(
context
->
eh
.
timer
);
delta_tmp
=
context
->
eh
.
timer
->
samplecount
-
last_ts
;
if
(
context
->
eh
.
record_timer_paused
)
{
continue
;
}
else
if
(
context
->
eh
.
record_timer_resumed
)
{
context
->
eh
.
record_timer_resumed
=
0
;
if
(
delta_avg
)
{
delta
=
delta_avg
;
}
else
if
(
context
->
eh
.
mm
->
fps
)
{
delta
=
1000
/
context
->
eh
.
mm
->
fps
;
}
else
{
delta
=
33
;
}
context
->
eh
.
video_st
->
frame
->
pts
+=
delta
;
delta_tmp
=
delta
;
context
->
eh
.
record_timer_offset
=
context
->
eh
.
timer
->
samplecount
-
context
->
eh
.
video_st
->
frame
->
pts
;
context
->
eh
.
record_timer_offset
=
context
->
eh
.
record_timer_offset
>
0
?
context
->
eh
.
record_timer_offset
:
0
;
}
else
{
delta_tmp
=
context
->
eh
.
timer
->
samplecount
-
last_ts
;
}
if
(
delta_tmp
!=
0
)
{
delta_sum
+=
delta_tmp
;
...
...
@@ -818,7 +842,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
delta_avg
=
(
int
)(
double
)(
delta_sum
/
delta_i
);
}
context
->
eh
.
video_st
->
frame
->
pts
=
context
->
eh
.
timer
->
samplecount
;
context
->
eh
.
video_st
->
frame
->
pts
=
context
->
eh
.
timer
->
samplecount
-
context
->
eh
.
record_timer_offset
;
}
else
{
context
->
eh
.
video_st
->
frame
->
pts
=
(
context
->
eh
.
timer
->
samplecount
)
+
1
;
}
...
...
@@ -826,7 +850,6 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
last_ts
=
context
->
eh
.
video_st
->
frame
->
pts
;
//context->eh.video_st->frame->pts = switch_time_now() / 1000 - context->eh.video_st->next_pts;
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pts: %ld\n", context->eh.video_st->frame->pts);
/* encode the image */
...
...
@@ -2098,7 +2121,7 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Error encoding audio frame: %d
\n
"
,
ret
);
continue
;
}
if
(
got_packet
)
{
if
(
context
->
mutex
)
switch_mutex_lock
(
context
->
mutex
);
ret
=
write_frame
(
context
->
fc
,
&
context
->
audio_st
.
st
->
codec
->
time_base
,
context
->
audio_st
.
st
,
&
pkt
);
...
...
@@ -2143,6 +2166,16 @@ static switch_status_t av_file_command(switch_file_handle_t *handle, switch_file
context
->
read_paused
=
SWITCH_TRUE
;
}
break
;
case
SCFC_PAUSE_WRITE
:
context
->
vid_ready
=
0
;
context
->
eh
.
record_timer_paused
=
1
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s pause write
\n
"
,
handle
->
file_path
);
break
;
case
SCFC_RESUME_WRITE
:
context
->
eh
.
record_timer_paused
=
0
;
context
->
eh
.
record_timer_resumed
=
1
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s resume write
\n
"
,
handle
->
file_path
);
break
;
default
:
break
;
}
...
...
src/mod/applications/mod_conference/conference_record.c
浏览文件 @
7c13d0b2
...
...
@@ -133,11 +133,13 @@ switch_status_t conference_record_action(conference_obj_t *conference, char *pat
case
REC_ACTION_PAUSE
:
conference_utils_member_set_flag_locked
(
member
,
MFLAG_PAUSE_RECORDING
);
switch_set_flag
((
&
member
->
rec
->
fh
),
SWITCH_FILE_PAUSE
);
switch_core_file_command
(
&
member
->
rec
->
fh
,
SCFC_PAUSE_WRITE
);
count
=
1
;
break
;
case
REC_ACTION_RESUME
:
conference_utils_member_clear_flag_locked
(
member
,
MFLAG_PAUSE_RECORDING
);
switch_clear_flag
((
&
member
->
rec
->
fh
),
SWITCH_FILE_PAUSE
);
switch_core_file_command
(
&
member
->
rec
->
fh
,
SCFC_RESUME_WRITE
);
count
=
1
;
break
;
}
...
...
src/switch_core_file.c
浏览文件 @
7c13d0b2
...
...
@@ -533,6 +533,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh,
return
SWITCH_STATUS_FALSE
;
}
if
(
switch_test_flag
(
fh
,
SWITCH_FILE_PAUSE
))
{
return
SWITCH_STATUS_SUCCESS
;
}
if
(
!
switch_test_flag
(
fh
,
SWITCH_FILE_NATIVE
)
&&
fh
->
native_rate
!=
fh
->
samplerate
)
{
if
(
!
fh
->
resampler
)
{
if
(
switch_resample_create
(
&
fh
->
resampler
,
...
...
@@ -612,6 +616,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write_video(switch_file_handle_
return
SWITCH_STATUS_FALSE
;
}
if
(
switch_test_flag
(
fh
,
SWITCH_FILE_PAUSE
))
{
return
SWITCH_STATUS_SUCCESS
;
}
return
fh
->
file_interface
->
file_write_video
(
fh
,
frame
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论