Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
beb1521e
提交
beb1521e
authored
10月 01, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert
上级
8401e716
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
279 行增加
和
301 行删除
+279
-301
avformat.c
src/mod/applications/mod_av/avformat.c
+207
-232
conference_video.c
src/mod/applications/mod_conference/conference_video.c
+3
-1
mod_local_stream.c
src/mod/formats/mod_local_stream/mod_local_stream.c
+67
-63
switch_core_media.c
src/switch_core_media.c
+2
-2
switch_ivr_async.c
src/switch_ivr_async.c
+0
-3
没有找到文件。
src/mod/applications/mod_av/avformat.c
浏览文件 @
beb1521e
差异被折叠。
点击展开。
src/mod/applications/mod_conference/conference_video.c
浏览文件 @
beb1521e
...
...
@@ -1493,7 +1493,9 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
if
(
last
)
{
int
delta
=
now
-
last
;
if
(
delta
>
member
->
conference
->
video_fps
.
ms
*
5000
)
{
switch_core_session_request_video_refresh
(
member
->
session
);
printf
(
"WTF %d %d
\n
"
,
delta
,
member
->
conference
->
video_fps
.
ms
*
5000
);
switch_core_session_request_video_refresh
(
member
->
session
);
}
}
...
...
src/mod/formats/mod_local_stream/mod_local_stream.c
浏览文件 @
beb1521e
...
...
@@ -70,6 +70,7 @@ struct local_stream_context {
int
last_h
;
int
serno
;
int
pop_count
;
int
video_sync
;
switch_image_t
*
banner_img
;
switch_time_t
banner_timeout
;
struct
local_stream_context
*
next
;
...
...
@@ -89,7 +90,6 @@ struct local_stream_source {
char
*
timer_name
;
local_stream_context_t
*
context_list
;
int
total
;
int
first
;
switch_dir_t
*
dir_handle
;
switch_mutex_t
*
mutex
;
switch_memory_pool_t
*
pool
;
...
...
@@ -161,6 +161,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
switch_memory_pool_t
*
temp_pool
=
NULL
;
uint32_t
dir_count
=
0
,
do_shuffle
=
0
;
char
*
p
;
int
old_total
=
0
;
switch_mutex_lock
(
globals
.
mutex
);
THREADS
++
;
...
...
@@ -363,6 +364,16 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
is_open
=
switch_test_flag
(
use_fh
,
SWITCH_FILE_OPEN
);
if
(
is_open
&&
source
->
total
!=
old_total
&&
source
->
total
==
1
)
{
if
(
switch_core_file_has_video
(
&
fh
))
{
flush_video_queue
(
source
->
video_q
);
}
switch_buffer_zero
(
audio_buffer
);
}
old_total
=
source
->
total
;
if
(
source
->
hup
)
{
source
->
hup
=
0
;
if
(
is_open
)
{
...
...
@@ -380,22 +391,21 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
}
if
(
is_open
)
{
int
svr
=
0
;
if
(
switch_core_has_video
()
&&
switch_core_file_has_video
(
use_fh
))
{
switch_frame_t
vid_frame
=
{
0
};
if
(
use_fh
==
&
source
->
chime_fh
&&
switch_core_file_has_video
(
&
fh
))
{
if
(
switch_core_file_read_video
(
&
fh
,
&
vid_frame
,
svr
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_file_read_video
(
&
fh
,
&
vid_frame
,
SVR_FLUSH
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_img_free
(
&
vid_frame
.
img
);
}
}
while
(
switch_core_file_read_video
(
use_fh
,
&
vid_frame
,
svr
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_file_read_video
(
use_fh
,
&
vid_frame
,
SVR_FLUSH
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
vid_frame
.
img
)
{
int
flush
=
1
;
source
->
has_video
=
1
;
if
(
source
->
total
)
{
if
(
switch_queue_trypush
(
source
->
video_q
,
vid_frame
.
img
)
==
SWITCH_STATUS_SUCCESS
)
{
flush
=
0
;
...
...
@@ -455,70 +465,69 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
break
;
}
source
->
prebuf
=
source
->
samples
*
2
*
source
->
channels
;
if
(
!
source
->
total
)
{
flush_video_queue
(
source
->
video_q
);
switch_buffer_zero
(
audio_buffer
);
}
else
if
(
used
>
source
->
samples
*
2
*
source
->
channels
)
{
//if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2 * source->channels)) {
source
->
prebuf
=
source
->
samples
*
2
*
source
->
channels
*
10
;
if
(
!
is_open
||
used
>=
source
->
prebuf
||
(
source
->
total
&&
used
>
source
->
samples
*
2
*
source
->
channels
))
{
void
*
pop
;
uint32_t
bused
;
used
=
switch_buffer_read
(
audio_buffer
,
dist_buf
,
source
->
samples
*
2
*
source
->
channels
);
bused
=
0
;
if
(
!
source
->
total
)
{
flush_video_queue
(
source
->
video_q
);
}
else
{
uint32_t
bused
=
0
;
switch_mutex_lock
(
source
->
mutex
);
for
(
cp
=
source
->
context_list
;
cp
&&
RUNNING
;
cp
=
cp
->
next
)
{
switch_mutex_lock
(
source
->
mutex
);
for
(
cp
=
source
->
context_list
;
cp
&&
RUNNING
;
cp
=
cp
->
next
)
{
if
(
source
->
has_video
)
{
switch_set_flag
(
cp
->
handle
,
SWITCH_FILE_FLAG_VIDEO
);
}
else
{
switch_clear_flag
(
cp
->
handle
,
SWITCH_FILE_FLAG_VIDEO
);
}
if
(
source
->
has_video
)
{
switch_set_flag
(
cp
->
handle
,
SWITCH_FILE_FLAG_VIDEO
);
}
else
{
switch_clear_flag
(
cp
->
handle
,
SWITCH_FILE_FLAG_VIDEO
);
}
if
(
switch_test_flag
(
cp
->
handle
,
SWITCH_FILE_CALLBACK
))
{
continue
;
}
if
(
switch_test_flag
(
cp
->
handle
,
SWITCH_FILE_CALLBACK
))
{
continue
;
}
switch_mutex_lock
(
cp
->
audio_mutex
);
bused
=
(
uint32_t
)
switch_buffer_inuse
(
cp
->
audio_buffer
);
if
(
bused
>
source
->
samples
*
768
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld
\n
"
,
cp
->
func
,
cp
->
file
,
cp
->
line
,
bused
,
(
long
)
source
->
samples
);
switch_buffer_zero
(
cp
->
audio_buffer
);
}
else
{
switch_buffer_write
(
cp
->
audio_buffer
,
dist_buf
,
used
);
switch_mutex_lock
(
cp
->
audio_mutex
);
bused
=
(
uint32_t
)
switch_buffer_inuse
(
cp
->
audio_buffer
);
if
(
bused
>
source
->
samples
*
768
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"Flushing Stream Handle Buffer [%s() %s:%d] size: %u samples: %ld
\n
"
,
cp
->
func
,
cp
->
file
,
cp
->
line
,
bused
,
(
long
)
source
->
samples
);
switch_buffer_zero
(
cp
->
audio_buffer
);
}
else
{
switch_buffer_write
(
cp
->
audio_buffer
,
dist_buf
,
used
);
}
switch_mutex_unlock
(
cp
->
audio_mutex
);
}
switch_mutex_unlock
(
cp
->
audio_mutex
);
}
switch_mutex_unlock
(
source
->
mutex
);
switch_mutex_unlock
(
source
->
mutex
);
while
(
switch_queue_trypop
(
source
->
video_q
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_image_t
*
img
=
(
switch_image_t
*
)
pop
;
switch_image_t
*
imgcp
=
NULL
;
if
(
source
->
total
==
1
)
{
switch_queue_push
(
source
->
context_list
->
video_q
,
img
);
}
else
{
if
(
source
->
context_list
)
{
switch_mutex_lock
(
source
->
mutex
);
for
(
cp
=
source
->
context_list
;
cp
&&
RUNNING
;
cp
=
cp
->
next
)
{
if
(
cp
->
video_q
)
{
imgcp
=
NULL
;
switch_img_copy
(
img
,
&
imgcp
);
if
(
imgcp
)
{
if
(
switch_queue_trypush
(
cp
->
video_q
,
imgcp
)
!=
SWITCH_STATUS_SUCCESS
)
{
flush_video_queue
(
cp
->
video_q
);
while
(
switch_queue_trypop
(
source
->
video_q
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_image_t
*
img
=
(
switch_image_t
*
)
pop
;
switch_image_t
*
imgcp
=
NULL
;
if
(
source
->
total
==
1
)
{
switch_queue_push
(
source
->
context_list
->
video_q
,
img
);
}
else
{
if
(
source
->
context_list
)
{
switch_mutex_lock
(
source
->
mutex
);
for
(
cp
=
source
->
context_list
;
cp
&&
RUNNING
;
cp
=
cp
->
next
)
{
if
(
cp
->
video_q
)
{
imgcp
=
NULL
;
switch_img_copy
(
img
,
&
imgcp
);
if
(
imgcp
)
{
if
(
switch_queue_trypush
(
cp
->
video_q
,
imgcp
)
!=
SWITCH_STATUS_SUCCESS
)
{
flush_video_queue
(
cp
->
video_q
);
}
}
}
}
switch_mutex_unlock
(
source
->
mutex
);
}
switch_
mutex_unlock
(
source
->
mutex
);
switch_
img_free
(
&
img
);
}
switch_img_free
(
&
img
);
}
}
}
...
...
@@ -716,9 +725,6 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
context
->
next
=
source
->
context_list
;
source
->
context_list
=
context
;
source
->
total
++
;
if
(
source
->
total
==
1
)
{
source
->
first
=
1
;
}
switch_mutex_unlock
(
source
->
mutex
);
end:
...
...
@@ -808,7 +814,9 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
return
SWITCH_STATUS_BREAK
;
}
while
(
context
->
ready
&&
context
->
source
->
ready
&&
(
flags
&
SVR_FLUSH
)
&&
switch_queue_size
(
context
->
video_q
)
>
min_qsize
/
2
)
{
context
->
video_sync
=
1
;
while
(
context
->
ready
&&
context
->
source
->
ready
&&
(
flags
&
SVR_FLUSH
)
&&
switch_queue_size
(
context
->
video_q
)
>
min_qsize
)
{
if
(
switch_queue_trypop
(
context
->
video_q
,
&
pop
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_image_t
*
img
=
(
switch_image_t
*
)
pop
;
switch_img_free
(
&
img
);
...
...
@@ -819,10 +827,6 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
return
SWITCH_STATUS_FALSE
;
}
while
(
switch_queue_size
(
context
->
video_q
)
<
5
)
{
return
SWITCH_STATUS_BREAK
;
}
if
((
flags
&
SVR_BLOCK
))
{
status
=
switch_queue_pop
(
context
->
video_q
,
&
pop
);
}
else
{
...
...
@@ -885,7 +889,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
//switch_img_overlay(frame->img, context->banner_img, 0, frame->img->d_h - context->banner_img->d_h, 100);
switch_img_patch
(
frame
->
img
,
context
->
banner_img
,
0
,
frame
->
img
->
d_h
-
context
->
banner_img
->
d_h
);
}
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/switch_core_media.c
浏览文件 @
beb1521e
...
...
@@ -5120,9 +5120,9 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO_READY
))
{
switch_mutex_lock
(
mh
->
file_mutex
);
if
(
smh
->
video_write_fh
&&
switch_channel_ready
(
session
->
channel
)
&&
switch_test_flag
(
smh
->
video_write_fh
,
SWITCH_FILE_OPEN
))
{
switch_status_t
wstatus
=
switch_core_file_read_video
(
smh
->
video_write_fh
,
&
fr
,
0
);
switch_status_t
wstatus
=
switch_core_file_read_video
(
smh
->
video_write_fh
,
&
fr
,
SVR_FLUSH
);
if
(
wstatus
==
SWITCH_STATUS_SUCCESS
)
{
switch_core_session_write_video_frame
(
session
,
&
fr
,
SWITCH_IO_FLAG_NONE
,
SVR_FLUSH
);
switch_core_session_write_video_frame
(
session
,
&
fr
,
SWITCH_IO_FLAG_NONE
,
0
);
switch_img_free
(
&
fr
.
img
);
}
else
if
(
wstatus
!=
SWITCH_STATUS_BREAK
&&
wstatus
!=
SWITCH_STATUS_IGNORE
)
{
smh
->
video_write_fh
=
NULL
;
...
...
src/switch_ivr_async.c
浏览文件 @
beb1521e
...
...
@@ -1113,14 +1113,11 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
switch_size_t
bsize
=
SWITCH_RECOMMENDED_BUFFER_SIZE
,
samples
=
0
,
inuse
=
0
;
unsigned
char
*
data
;
int
channels
=
1
;
switch_codec_implementation_t
read_impl
=
{
0
};
if
(
switch_core_session_read_lock
(
session
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
NULL
;
}
switch_core_session_get_read_impl
(
session
,
&
read_impl
);
bsize
=
read_impl
.
decoded_bytes_per_packet
;
rh
=
switch_core_media_bug_get_user_data
(
bug
);
switch_buffer_create_dynamic
(
&
rh
->
thread_buffer
,
1024
*
512
,
1024
*
64
,
0
);
rh
->
thread_ready
=
1
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论