Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
04b4d5cc
提交
04b4d5cc
authored
3月 31, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpParameters.cpp: add scalabilityMode
上级
96839199
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
125 行增加
和
11 行删除
+125
-11
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+4
-2
Media.cpp
worker/src/RTC/RtpDictionaries/Media.cpp
+1
-1
RtpEncodingParameters.cpp
worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp
+111
-0
RtpParameters.cpp
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
+9
-8
没有找到文件。
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
04b4d5cc
...
@@ -26,7 +26,7 @@ namespace RTC
...
@@ -26,7 +26,7 @@ namespace RTC
public
:
public
:
static
Kind
GetKind
(
std
::
string
&
str
);
static
Kind
GetKind
(
std
::
string
&
str
);
static
Kind
GetKind
(
std
::
string
&&
str
);
static
Kind
GetKind
(
std
::
string
&&
str
);
static
std
::
string
&
GetString
(
Kind
kind
);
static
const
std
::
string
&
GetString
(
Kind
kind
);
private
:
private
:
static
std
::
unordered_map
<
std
::
string
,
Kind
>
string2Kind
;
static
std
::
unordered_map
<
std
::
string
,
Kind
>
string2Kind
;
...
@@ -205,6 +205,9 @@ namespace RTC
...
@@ -205,6 +205,9 @@ namespace RTC
uint32_t
maxBitrate
{
0
};
uint32_t
maxBitrate
{
0
};
double
maxFramerate
{
0
};
double
maxFramerate
{
0
};
bool
dtx
{
false
};
bool
dtx
{
false
};
std
::
string
scalabilityMode
;
uint8_t
spatialLayers
{
1
};
uint8_t
temporalLayers
{
1
};
};
};
class
RtpHeaderExtensionParameters
class
RtpHeaderExtensionParameters
...
@@ -261,7 +264,6 @@ namespace RTC
...
@@ -261,7 +264,6 @@ namespace RTC
public
:
public
:
RtpParameters
(){};
RtpParameters
(){};
explicit
RtpParameters
(
json
&
data
);
explicit
RtpParameters
(
json
&
data
);
explicit
RtpParameters
(
const
RtpParameters
*
rtpParameters
);
void
FillJson
(
json
&
jsonObject
)
const
;
void
FillJson
(
json
&
jsonObject
)
const
;
const
RTC
::
RtpCodecParameters
*
GetCodecForEncoding
(
RtpEncodingParameters
&
encoding
)
const
;
const
RTC
::
RtpCodecParameters
*
GetCodecForEncoding
(
RtpEncodingParameters
&
encoding
)
const
;
...
...
worker/src/RTC/RtpDictionaries/Media.cpp
浏览文件 @
04b4d5cc
...
@@ -57,7 +57,7 @@ namespace RTC
...
@@ -57,7 +57,7 @@ namespace RTC
return
it
->
second
;
return
it
->
second
;
}
}
std
::
string
&
Media
::
GetString
(
Media
::
Kind
kind
)
const
std
::
string
&
Media
::
GetString
(
Media
::
Kind
kind
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp
浏览文件 @
04b4d5cc
...
@@ -23,6 +23,7 @@ namespace RTC
...
@@ -23,6 +23,7 @@ namespace RTC
auto
jsonMaxBitrateIt
=
data
.
find
(
"maxBitrate"
);
auto
jsonMaxBitrateIt
=
data
.
find
(
"maxBitrate"
);
auto
jsonMaxFramerateIt
=
data
.
find
(
"maxFramerate"
);
auto
jsonMaxFramerateIt
=
data
.
find
(
"maxFramerate"
);
auto
jsonDtxIt
=
data
.
find
(
"dtx"
);
auto
jsonDtxIt
=
data
.
find
(
"dtx"
);
auto
jsonScalabilityModeIt
=
data
.
find
(
"scalabilityMode"
);
// ssrc is optional.
// ssrc is optional.
if
(
jsonSsrcIt
!=
data
.
end
()
&&
jsonSsrcIt
->
is_number_unsigned
())
if
(
jsonSsrcIt
!=
data
.
end
()
&&
jsonSsrcIt
->
is_number_unsigned
())
...
@@ -58,6 +59,108 @@ namespace RTC
...
@@ -58,6 +59,108 @@ namespace RTC
// dtx is optional.
// dtx is optional.
if
(
jsonDtxIt
!=
data
.
end
()
&&
jsonDtxIt
->
is_boolean
())
if
(
jsonDtxIt
!=
data
.
end
()
&&
jsonDtxIt
->
is_boolean
())
this
->
dtx
=
jsonDtxIt
->
get
<
bool
>
();
this
->
dtx
=
jsonDtxIt
->
get
<
bool
>
();
// scalabilityMode is optional.
if
(
jsonScalabilityModeIt
!=
data
.
end
()
&&
jsonScalabilityModeIt
->
is_string
())
{
this
->
scalabilityMode
=
jsonScalabilityModeIt
->
get
<
std
::
string
>
();
if
(
this
->
scalabilityMode
==
"L1T2"
)
{
this
->
spatialLayers
=
1
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L1T3"
)
{
this
->
spatialLayers
=
1
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L2T1"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
1
;
}
else
if
(
this
->
scalabilityMode
==
"L2T2"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L2T3"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L3T1"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
1
;
}
else
if
(
this
->
scalabilityMode
==
"L3T2"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L3T3"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L2T1h"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
1
;
}
else
if
(
this
->
scalabilityMode
==
"L2T2h"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L2T3h"
)
{
this
->
spatialLayers
=
2
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L3T2_KEY"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L3T3_KEY"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L4T5_KEY"
)
{
this
->
spatialLayers
=
4
;
this
->
temporalLayers
=
5
;
}
else
if
(
this
->
scalabilityMode
==
"L4T7_KEY"
)
{
this
->
spatialLayers
=
4
;
this
->
temporalLayers
=
7
;
}
else
if
(
this
->
scalabilityMode
==
"L3T2_KEY_SHIFT"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
2
;
}
else
if
(
this
->
scalabilityMode
==
"L3T3_KEY_SHIFT"
)
{
this
->
spatialLayers
=
3
;
this
->
temporalLayers
=
3
;
}
else
if
(
this
->
scalabilityMode
==
"L4T5_KEY_SHIFT"
)
{
this
->
spatialLayers
=
4
;
this
->
temporalLayers
=
5
;
}
else
if
(
this
->
scalabilityMode
==
"L4T7_KEY_SHIFT"
)
{
this
->
spatialLayers
=
4
;
this
->
temporalLayers
=
7
;
}
}
}
}
void
RtpEncodingParameters
::
FillJson
(
json
&
jsonObject
)
const
void
RtpEncodingParameters
::
FillJson
(
json
&
jsonObject
)
const
...
@@ -94,5 +197,13 @@ namespace RTC
...
@@ -94,5 +197,13 @@ namespace RTC
// Add dtx.
// Add dtx.
if
(
this
->
dtx
)
if
(
this
->
dtx
)
jsonObject
[
"dtx"
]
=
this
->
dtx
;
jsonObject
[
"dtx"
]
=
this
->
dtx
;
// Add scalabilityMode.
if
(
!
this
->
scalabilityMode
.
empty
())
{
jsonObject
[
"scalabilityMode"
]
=
this
->
scalabilityMode
;
jsonObject
[
"spatialLayers"
]
=
this
->
spatialLayers
;
jsonObject
[
"temporalLayers"
]
=
this
->
temporalLayers
;
}
}
}
}
// namespace RTC
}
// namespace RTC
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
浏览文件 @
04b4d5cc
...
@@ -155,14 +155,6 @@ namespace RTC
...
@@ -155,14 +155,6 @@ namespace RTC
ValidateEncodings
();
ValidateEncodings
();
}
}
RtpParameters
::
RtpParameters
(
const
RtpParameters
*
rtpParameters
)
:
mid
(
rtpParameters
->
mid
),
codecs
(
rtpParameters
->
codecs
),
encodings
(
rtpParameters
->
encodings
),
headerExtensions
(
rtpParameters
->
headerExtensions
),
rtcp
(
rtpParameters
->
rtcp
),
hasRtcp
(
rtpParameters
->
hasRtcp
)
{
MS_TRACE
();
}
void
RtpParameters
::
FillJson
(
json
&
jsonObject
)
const
void
RtpParameters
::
FillJson
(
json
&
jsonObject
)
const
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -339,8 +331,17 @@ namespace RTC
...
@@ -339,8 +331,17 @@ namespace RTC
// Iterate all the encodings, set the first payloadType in all of them with
// Iterate all the encodings, set the first payloadType in all of them with
// codecPayloadType unset, and check that others point to a media codec.
// codecPayloadType unset, and check that others point to a media codec.
//
// Also, don't allow multiple SVC spatial layers into an encoding if there
// are more than one encoding (simulcast).
for
(
auto
&
encoding
:
this
->
encodings
)
for
(
auto
&
encoding
:
this
->
encodings
)
{
{
if
(
encoding
.
spatialLayers
>
1
&&
this
->
encodings
.
size
()
>
1
)
{
MS_THROW_TYPE_ERROR
(
"cannot use both simulcast and encodings with multiple SVC spatial layers"
);
}
if
(
!
encoding
.
hasCodecPayloadType
)
if
(
!
encoding
.
hasCodecPayloadType
)
{
{
encoding
.
codecPayloadType
=
firstMediaPayloadType
;
encoding
.
codecPayloadType
=
firstMediaPayloadType
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论