Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8e5cbb0e
提交
8e5cbb0e
authored
8月 04, 2014
作者:
Seven Du
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7514: follow the last core_video refactor
上级
f3ad6995
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
20 行删除
+18
-20
mod_vlc.c
src/mod/formats/mod_vlc/mod_vlc.c
+18
-20
没有找到文件。
src/mod/formats/mod_vlc/mod_vlc.c
浏览文件 @
8e5cbb0e
...
...
@@ -107,6 +107,7 @@ struct vlc_video_context {
uint8_t
video_packet
[
1500
+
12
];
void
*
raw_yuyv_data
;
void
*
raw_i420_data
;
switch_image_t
*
img
;
switch_time_t
last_video_ts
;
switch_payload_t
pt
;
uint32_t
seq
;
...
...
@@ -266,24 +267,22 @@ static void vlc_video_unlock_callback(void *data, void *id, void *const *p_pixel
{
vlc_video_context_t
*
context
=
(
vlc_video_context_t
*
)
data
;
switch_frame_t
*
frame
=
context
->
vid_frame
;
uint32_t
decoded_data_len
;
uint32_t
flag
=
0
;
uint32_t
encoded_data_len
=
1500
;
uint32_t
encoded_rate
=
0
;
switch_time_t
now
=
(
switch_time_t
)(
switch_micro_time_now
()
/
1000
);
switch_codec_t
*
codec
=
switch_core_session_get_video_write_codec
(
context
->
session
);
int
delta
;
long
delta
;
switch_assert
(
id
==
NULL
);
/* picture identifier, not needed here */
switch_assert
(
codec
);
if
(
now
-
context
->
last_video_ts
<
60
)
goto
end
;
yuyv_to_i420
(
*
p_pixels
,
context
->
raw_i420_data
,
context
->
width
,
context
->
height
);
if
(
!
context
->
img
)
context
->
img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
context
->
width
,
context
->
height
,
0
);
if
(
!
context
->
img
)
goto
end
;
yuyv_to_i420
(
*
p_pixels
,
context
->
img
->
img_data
,
context
->
width
,
context
->
height
);
codec
->
enc_picture
.
width
=
context
->
width
;
codec
->
enc_picture
.
height
=
context
->
height
;
decoded_data_len
=
context
->
width
*
context
->
height
*
3
/
2
;
delta
=
now
-
context
->
last_video_ts
;
if
(
delta
>
0
)
{
...
...
@@ -291,10 +290,10 @@ static void vlc_video_unlock_callback(void *data, void *id, void *const *p_pixel
context
->
last_video_ts
=
now
;
}
switch_core_codec_encode
(
codec
,
NULL
,
context
->
raw_i420_data
,
decoded_data_len
,
0
,
frame
->
data
,
&
encoded_data_len
,
&
encoded_rate
,
&
flag
);
switch_core_codec_encode
_video
(
codec
,
context
->
img
,
frame
->
data
,
&
encoded_data_len
,
&
flag
);
while
(
encoded_data_len
)
{
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "encoded: %s [%d] flag=%d ts=%
u
\n", codec->implementation->iananame, encoded_data_len, flag, context->last_video_ts);
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "encoded: %s [%d] flag=%d ts=%
lld
\n", codec->implementation->iananame, encoded_data_len, flag, context->last_video_ts);
frame
->
datalen
=
encoded_data_len
;
frame
->
packetlen
=
frame
->
datalen
+
12
;
...
...
@@ -314,12 +313,12 @@ static void vlc_video_unlock_callback(void *data, void *id, void *const *p_pixel
}
switch_set_flag
(
frame
,
SFF_RAW_RTP
);
switch_set_flag
(
frame
,
SFF_PROXY_PACKET
);
//
switch_set_flag(frame, SFF_PROXY_PACKET);
switch_core_session_write_video_frame
(
context
->
session
,
frame
,
SWITCH_IO_FLAG_NONE
,
0
);
encoded_data_len
=
1500
;
switch_core_codec_encode
(
codec
,
NULL
,
NULL
,
0
,
0
,
frame
->
data
,
&
encoded_data_len
,
&
encoded_rate
,
&
flag
);
switch_core_codec_encode
_video
(
codec
,
NULL
,
frame
->
data
,
&
encoded_data_len
,
&
flag
);
}
end:
...
...
@@ -346,24 +345,22 @@ static void do_buffer_frame(vlc_video_context_t *context)
static
void
vlc_video_channel_unlock_callback
(
void
*
data
,
void
*
id
,
void
*
const
*
p_pixels
)
{
vlc_video_context_t
*
context
=
(
vlc_video_context_t
*
)
data
;
uint32_t
decoded_data_len
;
uint32_t
flag
=
0
;
uint32_t
encoded_data_len
=
1500
;
uint32_t
encoded_rate
=
0
;
switch_codec_t
*
codec
=
switch_core_session_get_video_write_codec
(
context
->
session
);
switch_frame_t
*
frame
=
context
->
vid_frame
;
switch_time_t
now
=
(
switch_time_t
)(
switch_micro_time_now
()
/
1000
);
int
delta
;
long
delta
;
switch_assert
(
id
==
NULL
);
/* picture identifier, not needed here */
switch_assert
(
codec
);
yuyv_to_i420
(
*
p_pixels
,
context
->
raw_i420_data
,
context
->
width
,
context
->
height
);
if
(
!
context
->
img
)
context
->
img
=
switch_img_alloc
(
NULL
,
SWITCH_IMG_FMT_I420
,
context
->
width
,
context
->
height
,
0
);
if
(
!
context
->
img
)
goto
end
;
yuyv_to_i420
(
*
p_pixels
,
context
->
img
->
img_data
,
context
->
width
,
context
->
height
);
codec
->
enc_picture
.
width
=
context
->
width
;
codec
->
enc_picture
.
height
=
context
->
height
;
encoded_data_len
=
1500
;
decoded_data_len
=
context
->
width
*
context
->
height
*
3
/
2
;
frame
->
packet
=
context
->
video_packet
;
frame
->
data
=
context
->
video_packet
+
12
;
...
...
@@ -374,7 +371,7 @@ static void vlc_video_channel_unlock_callback(void *data, void *id, void *const
context
->
last_video_ts
=
now
;
}
switch_core_codec_encode
(
codec
,
NULL
,
context
->
raw_i420_data
,
decoded_data_len
,
0
,
frame
->
data
,
&
encoded_data_len
,
&
encoded_rate
,
&
flag
);
switch_core_codec_encode
_video
(
codec
,
context
->
img
,
frame
->
data
,
&
encoded_data_len
,
&
flag
);
while
(
encoded_data_len
)
{
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "encoded: %s [%d] flag=%d ts=%u\n", codec->implementation->iananame, encoded_data_len, flag, context->ts);
...
...
@@ -402,9 +399,10 @@ static void vlc_video_channel_unlock_callback(void *data, void *id, void *const
do_buffer_frame
(
context
);
encoded_data_len
=
1500
;
switch_core_codec_encode
(
codec
,
NULL
,
NULL
,
0
,
0
,
frame
->
data
,
&
encoded_data_len
,
&
encoded_rate
,
&
flag
);
switch_core_codec_encode
_video
(
codec
,
NULL
,
frame
->
data
,
&
encoded_data_len
,
&
flag
);
}
end:
switch_mutex_unlock
(
context
->
video_mutex
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论