Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
cd2a53b5
提交
cd2a53b5
authored
7月 16, 2019
作者:
Andrey Volk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-10882 [Core] VPX: Use 4 byte header VP8 with Picture ID
上级
b4311188
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
61 行增加
和
3 行删除
+61
-3
switch_vpx.c
src/switch_vpx.c
+61
-3
没有找到文件。
src/switch_vpx.c
浏览文件 @
cd2a53b5
...
...
@@ -164,6 +164,17 @@ typedef struct {
unsigned
start
:
1
;
unsigned
reserved2
:
1
;
unsigned
pid
:
3
;
unsigned
I
:
1
;
unsigned
L
:
1
;
unsigned
T
:
1
;
unsigned
K
:
1
;
unsigned
RSV
:
4
;
unsigned
M
:
1
;
unsigned
PID
:
15
;
unsigned
TL0PICIDX
:
8
;
unsigned
TID
:
2
;
unsigned
Y
:
1
;
unsigned
KEYIDX
:
5
;
}
vp8_payload_descriptor_t
;
typedef
struct
{
...
...
@@ -207,6 +218,17 @@ typedef struct {
unsigned
non_referenced
:
1
;
unsigned
reserved1
:
1
;
unsigned
extended
:
1
;
unsigned
RSV
:
4
;
unsigned
K
:
1
;
unsigned
T
:
1
;
unsigned
L
:
1
;
unsigned
I
:
1
;
unsigned
PID
:
15
;
unsigned
M
:
1
;
unsigned
TL0PICIDX
:
8
;
unsigned
KEYIDX
:
5
;
unsigned
Y
:
1
;
unsigned
TID
:
2
;
}
vp8_payload_descriptor_t
;
typedef
struct
{
...
...
@@ -373,6 +395,7 @@ struct vpx_context {
switch_buffer_t
*
pbuffer
;
switch_time_t
start_time
;
switch_image_t
*
patch_img
;
int16_t
picture_id
;
};
typedef
struct
vpx_context
vpx_context_t
;
...
...
@@ -606,13 +629,15 @@ static switch_status_t switch_vpx_init(switch_codec_t *codec, switch_codec_flag_
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
codec
->
session
),
SWITCH_LOG_DEBUG
,
"VPX VER:%s VPX_IMAGE_ABI_VERSION:%d VPX_CODEC_ABI_VERSION:%d
\n
"
,
vpx_codec_version_str
(),
VPX_IMAGE_ABI_VERSION
,
VPX_CODEC_ABI_VERSION
);
context
->
picture_id
=
13
;
// picture Id may start from random value and must be incremented on each frame
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
consume_partition
(
vpx_context_t
*
context
,
switch_frame_t
*
frame
)
{
vpx_payload_descriptor_t
*
payload_descriptor
;
uint8_t
*
body
;
uint8_t
*
body
,
*
c
=
NULL
;
uint32_t
hdrlen
=
0
,
payload_size
=
0
,
packet_size
=
0
,
start
=
0
,
key
=
0
;
switch_size_t
remaining_bytes
=
0
;
switch_status_t
status
;
...
...
@@ -650,9 +675,15 @@ static switch_status_t consume_partition(vpx_context_t *context, switch_frame_t
/* reset header */
*
(
uint8_t
*
)
frame
->
data
=
0
;
payload_descriptor
=
(
vpx_payload_descriptor_t
*
)
frame
->
data
;
memset
(
payload_descriptor
,
0
,
sizeof
(
*
payload_descriptor
));
if
(
context
->
is_vp9
)
{
hdrlen
=
1
;
/* Send VP9 with 1 byte REQUIRED header. */
}
else
{
hdrlen
=
4
;
/* Send VP8 with 4 byte extended header, includes 1 byte REQUIRED header, 1 byte X header and 2 bytes of I header with picture_id. */
}
// if !extended
hdrlen
=
1
;
body
=
((
uint8_t
*
)
frame
->
data
)
+
hdrlen
;
packet_size
=
vpx_globals
.
rtp_slice_size
;
payload_size
=
packet_size
-
hdrlen
;
...
...
@@ -731,11 +762,38 @@ static switch_status_t consume_partition(vpx_context_t *context, switch_frame_t
payload_descriptor
->
vp8
.
start
=
start
;
}
if
(
!
context
->
is_vp9
)
{
payload_descriptor
->
vp8
.
extended
=
1
;
/* REQUIRED header. */
payload_descriptor
->
vp8
.
I
=
1
;
/* X header. */
payload_descriptor
->
vp8
.
M
=
1
;
/* I header. */
c
=
((
uint8_t
*
)
frame
->
data
)
+
2
;
*
c
++
=
(
context
->
picture_id
>>
8
)
|
0x80
;
*
c
=
context
->
picture_id
&
0xff
;
payload_descriptor
->
vp8
.
L
=
0
;
payload_descriptor
->
vp8
.
TL0PICIDX
=
0
;
payload_descriptor
->
vp8
.
T
=
0
;
payload_descriptor
->
vp8
.
TID
=
0
;
payload_descriptor
->
vp8
.
Y
=
0
;
payload_descriptor
->
vp8
.
K
=
0
;
payload_descriptor
->
vp8
.
KEYIDX
=
0
;
}
if
(
remaining_bytes
<=
payload_size
)
{
switch_buffer_read
(
context
->
pbuffer
,
body
,
remaining_bytes
);
context
->
pkt
=
NULL
;
frame
->
datalen
+=
remaining_bytes
;
frame
->
m
=
1
;
if
(
!
context
->
is_vp9
)
{
context
->
picture_id
++
;
if
(
context
->
picture_id
>
0x7fff
)
{
context
->
picture_id
=
0
;
}
}
status
=
SWITCH_STATUS_SUCCESS
;
}
else
{
switch_buffer_read
(
context
->
pbuffer
,
body
,
payload_size
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论