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
3a9408bc
Unverified
Commit
3a9408bc
authored
Jun 11, 2022
by
sha-long-ba-si
Committed by
GitHub
Jun 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webrtc answer m-lines次序错误 (#1695)
Co-authored-by: james <mrjamesli@126.com>
parent
483a7528
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
17 行删除
+23
-17
webrtc/Sdp.cpp
+19
-13
webrtc/Sdp.h
+4
-4
没有找到文件。
webrtc/Sdp.cpp
查看文件 @
3a9408bc
...
...
@@ -1521,15 +1521,17 @@ void RtcConfigure::enableREMB(bool enable, TrackType type){
}
}
shared_ptr
<
RtcSession
>
RtcConfigure
::
createAnswer
(
const
RtcSession
&
offer
){
shared_ptr
<
RtcSession
>
RtcConfigure
::
createAnswer
(
const
RtcSession
&
offer
)
const
{
shared_ptr
<
RtcSession
>
ret
=
std
::
make_shared
<
RtcSession
>
();
ret
->
version
=
offer
.
version
;
ret
->
origin
=
offer
.
origin
;
ret
->
session_name
=
offer
.
session_name
;
ret
->
msid_semantic
=
offer
.
msid_semantic
;
matchMedia
(
ret
,
TrackAudio
,
offer
.
media
,
audio
);
matchMedia
(
ret
,
TrackVideo
,
offer
.
media
,
video
);
matchMedia
(
ret
,
TrackApplication
,
offer
.
media
,
application
);
for
(
auto
&
m
:
offer
.
media
)
{
matchMedia
(
ret
,
m
);
}
//设置音视频端口复用
if
(
!
offer
.
group
.
mids
.
empty
())
{
for
(
auto
&
m
:
ret
->
media
)
{
...
...
@@ -1573,17 +1575,22 @@ static DtlsRole mathDtlsRole(DtlsRole role){
}
}
void
RtcConfigure
::
matchMedia
(
const
s
hared_ptr
<
RtcSession
>
&
ret
,
TrackType
type
,
const
vector
<
RtcMedia
>
&
medias
,
const
RtcTrackConfigure
&
configure
)
{
void
RtcConfigure
::
matchMedia
(
const
s
td
::
shared_ptr
<
RtcSession
>
&
ret
,
const
RtcMedia
&
offer_media
)
const
{
bool
check_profile
=
true
;
bool
check_codec
=
true
;
const
RtcTrackConfigure
*
cfg_ptr
=
nullptr
;
switch
(
offer_media
.
type
)
{
case
TrackAudio
:
cfg_ptr
=
&
audio
;
break
;
case
TrackVideo
:
cfg_ptr
=
&
video
;
break
;
case
TrackApplication
:
cfg_ptr
=
&
application
;
break
;
default
:
return
;
}
auto
&
configure
=
*
cfg_ptr
;
RETRY
:
for
(
auto
&
offer_media
:
medias
)
{
if
(
offer_media
.
type
!=
type
)
{
continue
;
}
if
(
type
==
TrackApplication
)
{
if
(
offer_media
.
type
==
TrackApplication
)
{
RtcMedia
answer_media
=
offer_media
;
answer_media
.
role
=
mathDtlsRole
(
offer_media
.
role
);
#ifdef ENABLE_SCTP
...
...
@@ -1720,7 +1727,6 @@ RETRY:
ret
->
media
.
emplace_back
(
answer_media
);
return
;
}
}
if
(
check_profile
)
{
//如果是由于检查profile导致匹配失败,那么重试一次,且不检查profile
...
...
@@ -1765,7 +1771,7 @@ void RtcConfigure::setPlayRtspInfo(const string &sdp){
static
const
string
kProfile
{
"profile-level-id"
};
static
const
string
kMode
{
"packetization-mode"
};
bool
RtcConfigure
::
onCheckCodecProfile
(
const
RtcCodecPlan
&
plan
,
CodecId
codec
){
bool
RtcConfigure
::
onCheckCodecProfile
(
const
RtcCodecPlan
&
plan
,
CodecId
codec
)
const
{
if
(
_rtsp_audio_plan
&&
codec
==
getCodecId
(
_rtsp_audio_plan
->
codec
))
{
if
(
plan
.
sample_rate
!=
_rtsp_audio_plan
->
sample_rate
||
plan
.
channel
!=
_rtsp_audio_plan
->
channel
)
{
//音频采样率和通道数必须相同
...
...
@@ -1785,7 +1791,7 @@ bool RtcConfigure::onCheckCodecProfile(const RtcCodecPlan &plan, CodecId codec){
return
true
;
}
void
RtcConfigure
::
onSelectPlan
(
RtcCodecPlan
&
plan
,
CodecId
codec
){
void
RtcConfigure
::
onSelectPlan
(
RtcCodecPlan
&
plan
,
CodecId
codec
)
const
{
if
(
_rtsp_video_plan
&&
codec
==
CodecH264
&&
getCodecId
(
_rtsp_video_plan
->
codec
)
==
CodecH264
)
{
//h264时,设置packetization-mod为一致
auto
mode
=
_rtsp_video_plan
->
fmtp
[
kMode
];
...
...
webrtc/Sdp.h
查看文件 @
3a9408bc
...
...
@@ -720,7 +720,7 @@ public:
void
setDefaultSetting
(
std
::
string
ice_ufrag
,
std
::
string
ice_pwd
,
RtpDirection
direction
,
const
SdpAttrFingerprint
&
fingerprint
);
void
addCandidate
(
const
SdpAttrCandidate
&
candidate
,
mediakit
::
TrackType
type
=
mediakit
::
TrackInvalid
);
std
::
shared_ptr
<
RtcSession
>
createAnswer
(
const
RtcSession
&
offer
);
std
::
shared_ptr
<
RtcSession
>
createAnswer
(
const
RtcSession
&
offer
)
const
;
void
setPlayRtspInfo
(
const
std
::
string
&
sdp
);
...
...
@@ -728,9 +728,9 @@ public:
void
enableREMB
(
bool
enable
=
true
,
mediakit
::
TrackType
type
=
mediakit
::
TrackInvalid
);
private
:
void
matchMedia
(
const
std
::
shared_ptr
<
RtcSession
>
&
ret
,
mediakit
::
TrackType
type
,
const
std
::
vector
<
RtcMedia
>
&
medias
,
const
RtcTrackConfigure
&
configure
)
;
bool
onCheckCodecProfile
(
const
RtcCodecPlan
&
plan
,
mediakit
::
CodecId
codec
);
void
onSelectPlan
(
RtcCodecPlan
&
plan
,
mediakit
::
CodecId
codec
);
void
matchMedia
(
const
std
::
shared_ptr
<
RtcSession
>
&
ret
,
const
RtcMedia
&
media
)
const
;
bool
onCheckCodecProfile
(
const
RtcCodecPlan
&
plan
,
mediakit
::
CodecId
codec
)
const
;
void
onSelectPlan
(
RtcCodecPlan
&
plan
,
mediakit
::
CodecId
codec
)
const
;
private
:
RtcCodecPlan
::
Ptr
_rtsp_video_plan
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论