Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
2cf9962f
提交
2cf9962f
authored
3月 09, 2016
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8914
上级
86e6480a
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
63 行增加
和
30 行删除
+63
-30
avformat.c
src/mod/applications/mod_av/avformat.c
+33
-25
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+23
-0
switch_channel.c
src/switch_channel.c
+1
-0
switch_core_media.c
src/switch_core_media.c
+5
-5
switch_ivr_play_say.c
src/switch_ivr_play_say.c
+1
-0
没有找到文件。
src/mod/applications/mod_av/avformat.c
浏览文件 @
2cf9962f
...
@@ -628,6 +628,26 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
...
@@ -628,6 +628,26 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
endfor:
endfor:
for
(;;)
{
AVPacket
pkt
=
{
0
};
int
got_packet
=
0
;
int
ret
=
0
;
av_init_packet
(
&
pkt
);
ret
=
avcodec_encode_video2
(
eh
->
video_st
->
st
->
codec
,
&
pkt
,
eh
->
video_st
->
frame
,
&
got_packet
);
if
(
ret
<
0
)
{
break
;
}
else
if
(
got_packet
)
{
switch_mutex_lock
(
eh
->
mutex
);
ret
=
write_frame
(
eh
->
fc
,
&
eh
->
video_st
->
st
->
codec
->
time_base
,
eh
->
video_st
->
st
,
&
pkt
);
switch_mutex_unlock
(
eh
->
mutex
);
av_free_packet
(
&
pkt
);
if
(
ret
<
0
)
break
;
}
}
while
(
switch_queue_trypop
(
eh
->
video_queue
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
while
(
switch_queue_trypop
(
eh
->
video_queue
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
!
pop
)
break
;
if
(
!
pop
)
break
;
img
=
(
switch_image_t
*
)
pop
;
img
=
(
switch_image_t
*
)
pop
;
...
@@ -1296,7 +1316,7 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo
...
@@ -1296,7 +1316,7 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo
pkt
.
data
=
NULL
;
pkt
.
data
=
NULL
;
pkt
.
size
=
0
;
pkt
.
size
=
0
;
if
((
error
=
av_read_frame
(
context
->
fc
,
&
pkt
))
<
0
)
{
if
(
context
->
video_st
.
st
&&
(
error
=
av_read_frame
(
context
->
fc
,
&
pkt
))
<
0
)
{
if
(
error
==
AVERROR_EOF
)
{
if
(
error
==
AVERROR_EOF
)
{
eof
=
1
;
eof
=
1
;
/* just make sure*/
/* just make sure*/
...
@@ -1725,6 +1745,14 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
...
@@ -1725,6 +1745,14 @@ static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, s
//inuse = switch_buffer_inuse(context->audio_buffer);
//inuse = switch_buffer_inuse(context->audio_buffer);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "inuse: %d samples: %d bytes: %d\n", inuse, context->audio_st.frame->nb_samples, bytes);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "inuse: %d samples: %d bytes: %d\n", inuse, context->audio_st.frame->nb_samples, bytes);
if
(
context
->
closed
)
{
inuse
=
switch_buffer_inuse
(
context
->
audio_buffer
);
if
(
inuse
<
bytes
)
{
char
buf
[
SWITCH_RECOMMENDED_BUFFER_SIZE
]
=
{
0
};
switch_buffer_write
(
context
->
audio_buffer
,
buf
,
bytes
-
inuse
);
}
}
while
((
inuse
=
switch_buffer_inuse
(
context
->
audio_buffer
))
>=
bytes
)
{
while
((
inuse
=
switch_buffer_inuse
(
context
->
audio_buffer
))
>=
bytes
)
{
AVPacket
pkt
=
{
0
};
AVPacket
pkt
=
{
0
};
...
@@ -1810,37 +1838,17 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
...
@@ -1810,37 +1838,17 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
context
->
eh
.
finalize
=
1
;
context
->
eh
.
finalize
=
1
;
if
(
context
->
eh
.
video_queue
)
{
if
(
context
->
eh
.
video_queue
)
{
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
switch_rgb_color_t
bgcolor
;
int
x
;
switch_color_set_rgb
(
&
bgcolor
,
"#000000"
);
x
=
(
int
)
handle
->
mm
.
fps
*
1
;
if
(
x
<=
0
)
x
=
100
;
while
(
handle
->
mm
.
vw
&&
x
--
>
0
)
{
switch_image_t
*
blank_img
=
NULL
;
if
((
blank_img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
handle
->
mm
.
vw
,
handle
->
mm
.
vh
,
1
)))
{
switch_img_fill
(
blank_img
,
0
,
0
,
blank_img
->
d_w
,
blank_img
->
d_h
,
&
bgcolor
);
switch_queue_push
(
context
->
eh
.
video_queue
,
blank_img
);
}
}
}
switch_queue_push
(
context
->
eh
.
video_queue
,
NULL
);
switch_queue_push
(
context
->
eh
.
video_queue
,
NULL
);
}
}
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
av_file_write
(
handle
,
NULL
,
NULL
);
}
if
(
context
->
eh
.
video_thread
)
{
if
(
context
->
eh
.
video_thread
)
{
switch_thread_join
(
&
status
,
context
->
eh
.
video_thread
);
switch_thread_join
(
&
status
,
context
->
eh
.
video_thread
);
}
}
if
(
switch_test_flag
(
handle
,
SWITCH_FILE_FLAG_WRITE
))
{
av_file_write
(
handle
,
NULL
,
NULL
);
}
if
(
context
->
file_read_thread_running
&&
context
->
file_read_thread
)
{
if
(
context
->
file_read_thread_running
&&
context
->
file_read_thread
)
{
context
->
file_read_thread_running
=
0
;
context
->
file_read_thread_running
=
0
;
switch_thread_join
(
&
status
,
context
->
file_read_thread
);
switch_thread_join
(
&
status
,
context
->
file_read_thread
);
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
2cf9962f
...
@@ -1356,6 +1356,27 @@ SWITCH_STANDARD_APP(redirect_function)
...
@@ -1356,6 +1356,27 @@ SWITCH_STANDARD_APP(redirect_function)
switch_core_session_receive_message
(
session
,
&
msg
);
switch_core_session_receive_message
(
session
,
&
msg
);
}
}
SWITCH_STANDARD_APP
(
video_set_decode_function
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
char
*
txt
=
(
char
*
)
data
;
int
on
=
0
,
wait
=
0
;
if
(
txt
)
{
on
=
!
strcasecmp
(
txt
,
"on"
);
wait
=
!
strcasecmp
(
txt
,
"wait"
);
}
if
(
data
&&
(
on
||
wait
))
{
switch_channel_set_flag_recursive
(
channel
,
CF_VIDEO_DECODED_READ
);
if
(
wait
)
{
switch_core_session_wait_for_video_input_params
(
session
,
10000
);
}
}
else
{
switch_channel_clear_flag_recursive
(
channel
,
CF_VIDEO_DECODED_READ
);
}
}
SWITCH_STANDARD_APP
(
video_refresh_function
)
SWITCH_STANDARD_APP
(
video_refresh_function
)
{
{
switch_core_session_message_t
msg
=
{
0
};
switch_core_session_message_t
msg
=
{
0
};
...
@@ -6149,6 +6170,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
...
@@ -6149,6 +6170,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SAF_SUPPORT_NOMEDIA
);
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"video_refresh"
,
"Send video refresh."
,
"Send video refresh."
,
video_refresh_function
,
""
,
SWITCH_ADD_APP
(
app_interface
,
"video_refresh"
,
"Send video refresh."
,
"Send video refresh."
,
video_refresh_function
,
""
,
SAF_SUPPORT_NOMEDIA
);
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"video_decode"
,
"Set video decode."
,
"Set video decode."
,
video_set_decode_function
,
"[[on|wait]|off]"
,
SAF_NONE
);
SWITCH_ADD_APP
(
app_interface
,
"send_info"
,
"Send info"
,
"Send info"
,
send_info_function
,
"<info>"
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"send_info"
,
"Send info"
,
"Send info"
,
send_info_function
,
"<info>"
,
SAF_SUPPORT_NOMEDIA
);
SWITCH_ADD_APP
(
app_interface
,
"jitterbuffer"
,
"Send session jitterbuffer"
,
"Send a jitterbuffer message to a session."
,
SWITCH_ADD_APP
(
app_interface
,
"jitterbuffer"
,
"Send session jitterbuffer"
,
"Send a jitterbuffer message to a session."
,
jitterbuffer_function
,
"<jitterbuffer_data>"
,
SAF_SUPPORT_NOMEDIA
);
jitterbuffer_function
,
"<jitterbuffer_data>"
,
SAF_SUPPORT_NOMEDIA
);
...
...
src/switch_channel.c
浏览文件 @
2cf9962f
...
@@ -3246,6 +3246,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
...
@@ -3246,6 +3246,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
switch_event_t
*
event
;
switch_event_t
*
event
;
const
char
*
var
;
const
char
*
var
;
switch_mutex_lock
(
channel
->
profile_mutex
);
switch_mutex_lock
(
channel
->
profile_mutex
);
if
(
channel
->
hold_record
&&
!
channel
->
hold_record
->
off
)
{
if
(
channel
->
hold_record
&&
!
channel
->
hold_record
->
off
)
{
channel
->
hold_record
->
off
=
switch_time_now
();
channel
->
hold_record
->
off
=
switch_time_now
();
...
...
src/switch_core_media.c
浏览文件 @
2cf9962f
...
@@ -11193,14 +11193,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(
...
@@ -11193,14 +11193,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_wait_for_video_input_params(
switch_frame_t
*
read_frame
;
switch_frame_t
*
read_frame
;
switch_status_t
status
;
switch_status_t
status
;
if
(
switch_channel_test_flag
(
session
->
channel
,
CF_VIDEO_READY
)
&&
smh
->
vid_params
.
width
&&
smh
->
vid_params
.
height
)
{
return
SWITCH_STATUS_SUCCESS
;
}
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
status
=
switch_core_session_read_frame
(
session
,
&
read_frame
,
SWITCH_IO_FLAG_NONE
,
0
);
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
))
{
break;
return
SWITCH_STATUS_FALSE
;
}
if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width && smh->vid_params.height && smh->vid_params.fps) {
return SWITCH_STATUS_SUCCESS;
}
}
timeout_ms
-=
(
read_impl
.
microseconds_per_packet
/
1000
);
timeout_ms
-=
(
read_impl
.
microseconds_per_packet
/
1000
);
...
...
src/switch_ivr_play_say.c
浏览文件 @
2cf9962f
...
@@ -536,6 +536,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
...
@@ -536,6 +536,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
file_flags
|=
SWITCH_FILE_FLAG_VIDEO
;
file_flags
|=
SWITCH_FILE_FLAG_VIDEO
;
switch_channel_set_flag_recursive
(
channel
,
CF_VIDEO_DECODED_READ
);
switch_channel_set_flag_recursive
(
channel
,
CF_VIDEO_DECODED_READ
);
switch_core_session_request_video_refresh
(
session
);
switch_core_session_wait_for_video_input_params
(
session
,
10000
);
switch_core_session_wait_for_video_input_params
(
session
,
10000
);
switch_core_media_get_vid_params
(
session
,
&
vid_params
);
switch_core_media_get_vid_params
(
session
,
&
vid_params
);
fh
->
mm
.
vw
=
vid_params
.
width
;
fh
->
mm
.
vw
=
vid_params
.
width
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论