Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
c9950dda
Commit
c9950dda
authored
Nov 02, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复sdp解析的bug
parent
6e03e5a8
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
5 行删除
+11
-5
src/Extension/Factory.cpp
+11
-5
没有找到文件。
src/Extension/Factory.cpp
查看文件 @
c9950dda
...
@@ -82,7 +82,7 @@ Sdp::Ptr Factory::getSdpByTrack(const Track::Ptr &track) {
...
@@ -82,7 +82,7 @@ Sdp::Ptr Factory::getSdpByTrack(const Track::Ptr &track) {
Track
::
Ptr
Factory
::
getTrackBySdp
(
const
SdpTrack
::
Ptr
&
track
)
{
Track
::
Ptr
Factory
::
getTrackBySdp
(
const
SdpTrack
::
Ptr
&
track
)
{
if
(
strcasestr
(
track
->
_codec
.
data
(),
"mpeg4-generic"
)
!=
nullptr
)
{
if
(
strcasestr
(
track
->
_codec
.
data
(),
"mpeg4-generic"
)
!=
nullptr
)
{
string
aac_cfg_str
=
FindField
(
track
->
_fmtp
.
c_str
(),
"config="
,
"
\r\n
"
);
string
aac_cfg_str
=
FindField
(
track
->
_fmtp
.
c_str
(),
"config="
,
nullptr
);
if
(
aac_cfg_str
.
size
()
!=
4
)
{
if
(
aac_cfg_str
.
size
()
!=
4
)
{
aac_cfg_str
=
FindField
(
track
->
_fmtp
.
c_str
(),
"config="
,
";"
);
aac_cfg_str
=
FindField
(
track
->
_fmtp
.
c_str
(),
"config="
,
";"
);
}
}
...
@@ -106,7 +106,7 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) {
...
@@ -106,7 +106,7 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) {
}
}
if
(
strcasestr
(
track
->
_codec
.
data
(),
"h264"
)
!=
nullptr
)
{
if
(
strcasestr
(
track
->
_codec
.
data
(),
"h264"
)
!=
nullptr
)
{
string
sps_pps
=
FindField
(
track
->
_fmtp
.
c_str
(),
"sprop-parameter-sets="
,
"
\r\n
"
);
string
sps_pps
=
FindField
(
track
->
_fmtp
.
c_str
(),
"sprop-parameter-sets="
,
nullptr
);
if
(
sps_pps
.
empty
()){
if
(
sps_pps
.
empty
()){
return
std
::
make_shared
<
H264Track
>
();
return
std
::
make_shared
<
H264Track
>
();
}
}
...
@@ -124,14 +124,20 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) {
...
@@ -124,14 +124,20 @@ Track::Ptr Factory::getTrackBySdp(const SdpTrack::Ptr &track) {
if
(
strcasestr
(
track
->
_codec
.
data
(),
"h265"
)
!=
nullptr
)
{
if
(
strcasestr
(
track
->
_codec
.
data
(),
"h265"
)
!=
nullptr
)
{
//a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBdoAKAgC0WNrkky/AIAAADAAgAAAMBlQg=; sprop-pps=RAHA8vA8kAA=
//a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwBdoAKAgC0WNrkky/AIAAADAAgAAAMBlQg=; sprop-pps=RAHA8vA8kAA=
int
pt
;
int
pt
;
char
sprop_sps
[
128
]
=
{
0
},
sprop_pps
[
128
]
=
{
0
};
char
sprop_vps
[
128
]
=
{
0
},
sprop_sps
[
128
]
=
{
0
},
sprop_pps
[
128
]
=
{
0
};
if
(
3
!=
sscanf
(
track
->
_fmtp
.
c_str
(),
"%d sprop-sps=%127[^;]; sprop-pps=%127[^;]"
,
&
pt
,
sprop_sps
,
sprop_pps
))
{
if
(
4
==
sscanf
(
track
->
_fmtp
.
c_str
(),
"%d sprop-vps=%127[^;]; sprop-sps=%127[^;]; sprop-pps=%127[^;]"
,
&
pt
,
sprop_vps
,
sprop_sps
,
sprop_pps
))
{
return
std
::
make_shared
<
H265Track
>
();
auto
vps
=
decodeBase64
(
sprop_vps
);
auto
sps
=
decodeBase64
(
sprop_sps
);
auto
pps
=
decodeBase64
(
sprop_pps
);
return
std
::
make_shared
<
H265Track
>
(
vps
,
sps
,
pps
,
0
,
0
,
0
);
}
}
if
(
3
==
sscanf
(
track
->
_fmtp
.
c_str
(),
"%d sprop-sps=%127[^;]; sprop-pps=%127[^;]"
,
&
pt
,
sprop_sps
,
sprop_pps
))
{
auto
sps
=
decodeBase64
(
sprop_sps
);
auto
sps
=
decodeBase64
(
sprop_sps
);
auto
pps
=
decodeBase64
(
sprop_pps
);
auto
pps
=
decodeBase64
(
sprop_pps
);
return
std
::
make_shared
<
H265Track
>
(
""
,
sps
,
pps
,
0
,
0
,
0
);
return
std
::
make_shared
<
H265Track
>
(
""
,
sps
,
pps
,
0
,
0
,
0
);
}
}
return
std
::
make_shared
<
H265Track
>
();
}
WarnL
<<
"暂不支持该sdp:"
<<
track
->
_codec
<<
" "
<<
track
->
_fmtp
;
WarnL
<<
"暂不支持该sdp:"
<<
track
->
_codec
<<
" "
<<
track
->
_fmtp
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论