Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
240fe01e
提交
240fe01e
authored
6月 01, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve RtpParameters.
上级
1450d0eb
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
50 行增加
和
42 行删除
+50
-42
RtpParameters.h
worker/include/RTC/RtpParameters.h
+6
-1
RtpListener.cpp
worker/src/RTC/RtpListener.cpp
+4
-4
RtpParameters.cpp
worker/src/RTC/RtpParameters/RtpParameters.cpp
+40
-37
没有找到文件。
worker/include/RTC/RtpParameters.h
浏览文件 @
240fe01e
...
@@ -46,7 +46,12 @@ namespace RTC
...
@@ -46,7 +46,12 @@ namespace RTC
{
{
return
this
->
type
==
Type
::
DOUBLE
;
return
this
->
type
==
Type
::
DOUBLE
;
}
}
bool
IsString
(){
bool
IsPositiveDouble
()
{
return
this
->
type
==
Type
::
DOUBLE
&&
this
->
doubleValue
>=
0
;
}
bool
IsString
()
{
return
this
->
type
==
Type
::
STRING
;
return
this
->
type
==
Type
::
STRING
;
}
}
...
...
worker/src/RTC/RtpListener.cpp
浏览文件 @
240fe01e
...
@@ -70,7 +70,7 @@ namespace RTC
...
@@ -70,7 +70,7 @@ namespace RTC
for
(
auto
&
kv
:
this
->
ssrcTable
)
for
(
auto
&
kv
:
this
->
ssrcTable
)
{
{
auto
&
ssrc
=
kv
.
first
;
auto
ssrc
=
kv
.
first
;
auto
&
existingRtpReceiver
=
kv
.
second
;
auto
&
existingRtpReceiver
=
kv
.
second
;
if
(
existingRtpReceiver
==
rtpReceiver
)
if
(
existingRtpReceiver
==
rtpReceiver
)
...
@@ -91,7 +91,7 @@ namespace RTC
...
@@ -91,7 +91,7 @@ namespace RTC
for
(
auto
&
kv
:
this
->
ptTable
)
for
(
auto
&
kv
:
this
->
ptTable
)
{
{
auto
&
payloadType
=
kv
.
first
;
auto
payloadType
=
kv
.
first
;
auto
&
existingRtpReceiver
=
kv
.
second
;
auto
&
existingRtpReceiver
=
kv
.
second
;
if
(
existingRtpReceiver
==
rtpReceiver
)
if
(
existingRtpReceiver
==
rtpReceiver
)
...
@@ -313,7 +313,7 @@ namespace RTC
...
@@ -313,7 +313,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
for
(
auto
&
ssrc
:
previousSsrcs
)
for
(
auto
ssrc
:
previousSsrcs
)
{
{
this
->
ssrcTable
[
ssrc
]
=
rtpReceiver
;
this
->
ssrcTable
[
ssrc
]
=
rtpReceiver
;
}
}
...
@@ -321,7 +321,7 @@ namespace RTC
...
@@ -321,7 +321,7 @@ namespace RTC
if
(
!
previousMuxId
.
empty
())
if
(
!
previousMuxId
.
empty
())
this
->
muxIdTable
[
previousMuxId
]
=
rtpReceiver
;
this
->
muxIdTable
[
previousMuxId
]
=
rtpReceiver
;
for
(
auto
&
payloadType
:
previousPayloadTypes
)
for
(
auto
payloadType
:
previousPayloadTypes
)
{
{
this
->
ptTable
[
payloadType
]
=
rtpReceiver
;
this
->
ptTable
[
payloadType
]
=
rtpReceiver
;
}
}
...
...
worker/src/RTC/RtpParameters/RtpParameters.cpp
浏览文件 @
240fe01e
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "RTC/RtpParameters.h"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include "Logger.h"
#include <unordered_set>
namespace
RTC
namespace
RTC
{
{
...
@@ -238,10 +239,17 @@ namespace RTC
...
@@ -238,10 +239,17 @@ namespace RTC
if
(
this
->
codecs
.
size
()
==
0
)
if
(
this
->
codecs
.
size
()
==
0
)
MS_THROW_ERROR
(
"empty RtpParameters.codecs"
);
MS_THROW_ERROR
(
"empty RtpParameters.codecs"
);
// Validate each codec.
std
::
unordered_set
<
uint8_t
>
payloadTypes
;
// Validate each codec.
for
(
auto
&
codec
:
this
->
codecs
)
for
(
auto
&
codec
:
this
->
codecs
)
{
{
// Payload types must be unique.
if
(
payloadTypes
.
find
(
codec
.
payloadType
)
!=
payloadTypes
.
end
())
MS_THROW_ERROR
(
"duplicated codec.payloadType"
);
else
payloadTypes
.
insert
(
codec
.
payloadType
);
switch
(
codec
.
subtype
)
switch
(
codec
.
subtype
)
{
{
// A RTX codec must have 'apt' parameter pointing to a non RTX codec.
// A RTX codec must have 'apt' parameter pointing to a non RTX codec.
...
@@ -258,10 +266,14 @@ namespace RTC
...
@@ -258,10 +266,14 @@ namespace RTC
if
((
int32_t
)
codec
.
payloadType
==
apt
)
if
((
int32_t
)
codec
.
payloadType
==
apt
)
{
{
if
(
codec
.
subtype
!=
RtpCodecParameters
::
Subtype
::
RTX
)
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
RTX
)
break
;
MS_THROW_ERROR
(
"apt in RTX codec points to a RTX codec"
);
else
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
ULPFEC
)
MS_THROW_ERROR
(
"apt in RTX codec points to a ULPFEC codec"
);
else
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
FLEXFEC
)
MS_THROW_ERROR
(
"apt in RTX codec points to a FLEXFEC codec"
);
else
else
MS_THROW_ERROR
(
"apt in RTX codec points to RTX codec"
)
;
break
;
}
}
}
}
if
(
it2
==
this
->
codecs
.
end
())
if
(
it2
==
this
->
codecs
.
end
())
...
@@ -276,12 +288,10 @@ namespace RTC
...
@@ -276,12 +288,10 @@ namespace RTC
void
RtpParameters
::
ValidateEncodings
()
void
RtpParameters
::
ValidateEncodings
()
{
{
// If there are no encodings create one with `codecPayloadType` pointing to
uint8_t
firstMediaPayloadType
;
// the first media codec.
bool
hasFirstMediaPayloadType
=
false
;
if
(
this
->
encodings
.
size
()
==
0
)
{
RtpEncodingParameters
encoding
;
{
auto
it
=
this
->
codecs
.
begin
();
auto
it
=
this
->
codecs
.
begin
();
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
...
@@ -291,49 +301,41 @@ namespace RTC
...
@@ -291,49 +301,41 @@ namespace RTC
// Must be a media codec.
// Must be a media codec.
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
MEDIA
)
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
MEDIA
)
{
{
encoding
.
codec
PayloadType
=
codec
.
payloadType
;
firstMedia
PayloadType
=
codec
.
payloadType
;
encoding
.
hasCodec
PayloadType
=
true
;
hasFirstMedia
PayloadType
=
true
;
break
;
break
;
}
}
}
}
if
(
it
==
this
->
codecs
.
end
())
if
(
it
==
this
->
codecs
.
end
())
MS_THROW_ERROR
(
"no media codecs in RtpParameters.codecs"
);
MS_THROW_ERROR
(
"no media codecs found"
);
// Insert into the encodings vector.
this
->
encodings
.
push_back
(
encoding
);
}
}
// If there are one encoding and does not have `codecPayloadType` do the same
// as above.
else
if
(
this
->
encodings
.
size
()
==
1
&&
!
this
->
encodings
[
0
].
hasCodecPayloadType
)
{
auto
it
=
this
->
codecs
.
begin
();
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
// If there are no encodings create one with `codecPayloadType` pointing to
// the first media codec.
if
(
this
->
encodings
.
size
()
==
0
)
{
{
auto
codec
=
*
it
;
RtpEncodingParameters
encoding
;
auto
&
encoding
=
this
->
encodings
[
0
];
// Must be a media codec.
encoding
.
codecPayloadType
=
firstMediaPayloadType
;
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
MEDIA
)
{
encoding
.
codecPayloadType
=
codec
.
payloadType
;
encoding
.
hasCodecPayloadType
=
true
;
encoding
.
hasCodecPayloadType
=
true
;
break
;
// Insert into the encodings vector.
}
this
->
encodings
.
push_back
(
encoding
);
}
if
(
it
==
this
->
codecs
.
end
())
MS_THROW_ERROR
(
"no media codecs in RtpParameters.codecs"
);
}
}
// Otherwise all the encodings must point to a valid media codec.
// Otherwise iterate all the encodings, set the first payloadType in all of them
// with codecPayloadType unset, and check that others point to a media codec.
else
else
{
{
for
(
auto
&
encoding
:
this
->
encodings
)
for
(
auto
&
encoding
:
this
->
encodings
)
{
{
if
(
!
encoding
.
hasCodecPayloadType
)
if
(
!
encoding
.
hasCodecPayloadType
)
MS_THROW_ERROR
(
"missing RTpEncodingParameters.codecPayloadType"
);
{
encoding
.
codecPayloadType
=
firstMediaPayloadType
;
encoding
.
hasCodecPayloadType
=
true
;
}
else
{
auto
it
=
this
->
codecs
.
begin
();
auto
it
=
this
->
codecs
.
begin
();
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
...
@@ -346,11 +348,12 @@ namespace RTC
...
@@ -346,11 +348,12 @@ namespace RTC
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
MEDIA
)
if
(
codec
.
subtype
==
RtpCodecParameters
::
Subtype
::
MEDIA
)
break
;
break
;
else
else
MS_THROW_ERROR
(
"invalid RtpEncodingParameters
.codecPayloadType"
);
MS_THROW_ERROR
(
"invalid encoding
.codecPayloadType"
);
}
}
}
}
if
(
it
==
this
->
codecs
.
end
())
if
(
it
==
this
->
codecs
.
end
())
MS_THROW_ERROR
(
"unknown RtpEncodingParameters.codecPayloadType"
);
MS_THROW_ERROR
(
"unknown encoding.codecPayloadType"
);
}
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论