Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
81a5cc67
提交
81a5cc67
authored
5月 16, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require full MIME "type/subtype" format for codec names.
上级
d687f935
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
89 行增加
和
19 行删除
+89
-19
test_RtpReceiver.js
test/test_RtpReceiver.js
+1
-1
test_scene_1.js
test/test_scene_1.js
+10
-10
RtpParameters.h
worker/include/RTC/RtpParameters.h
+27
-2
RtpCodecParameters.cpp
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
+31
-3
RtpParameters.cpp
worker/src/RTC/RtpParameters/RtpParameters.cpp
+19
-2
RtpReceiver.cpp
worker/src/RTC/RtpReceiver.cpp
+1
-1
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
81a5cc67
...
@@ -23,7 +23,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -23,7 +23,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
codecs
:
codecs
:
[
[
{
{
name
:
'H264'
,
name
:
'
video/
H264'
,
payloadType
:
100
,
payloadType
:
100
,
clockRate
:
90000
,
clockRate
:
90000
,
maxptime
:
80
,
maxptime
:
80
,
...
...
test/test_scene_1.js
浏览文件 @
81a5cc67
...
@@ -31,7 +31,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -31,7 +31,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
codecs
:
codecs
:
[
[
{
{
name
:
'opus'
,
name
:
'
audio/
opus'
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
clockRate
:
90000
}
}
...
@@ -60,12 +60,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -60,12 +60,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'v
ideo/v
p9'
,
payloadType
:
102
,
payloadType
:
102
,
clockRate
:
90000
clockRate
:
90000
},
},
{
{
name
:
'rtx'
,
name
:
'
video/
rtx'
,
payloadType
:
96
,
payloadType
:
96
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
{
apt
:
102
}
parameters
:
{
apt
:
102
}
...
@@ -99,12 +99,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -99,12 +99,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'v
ideo/v
p9'
,
payloadType
:
103
,
payloadType
:
103
,
clockRate
:
90000
clockRate
:
90000
},
},
{
{
name
:
'rtx'
,
name
:
'
video/
rtx'
,
payloadType
:
97
,
payloadType
:
97
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
{
apt
:
103
}
parameters
:
{
apt
:
103
}
...
@@ -138,7 +138,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -138,7 +138,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
codecs
:
codecs
:
[
[
{
{
name
:
'opus'
,
name
:
'
audio/
opus'
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
clockRate
:
90000
}
}
...
@@ -167,11 +167,11 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -167,11 +167,11 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'v
ideo/v
p9'
,
payloadType
:
103
payloadType
:
103
},
},
{
{
name
:
'rtx'
,
name
:
'
video/
rtx'
,
payloadType
:
97
,
payloadType
:
97
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
{
apt
:
103
}
parameters
:
{
apt
:
103
}
...
@@ -585,7 +585,7 @@ function createRtpReceiver(t, peer, kind, transport, rtpParameters)
...
@@ -585,7 +585,7 @@ function createRtpReceiver(t, peer, kind, transport, rtpParameters)
return
rtpReceiver
.
receive
(
rtpParameters
)
return
rtpReceiver
.
receive
(
rtpParameters
)
.
then
(()
=>
.
then
(()
=>
{
{
t
.
pass
(
`rtpReceiver.receive() succeeded for
${
peer
.
name
}
`
);
t
.
pass
(
`rtpReceiver.receive() succeeded for
${
peer
.
name
}
and kind "
${
kind
}
"
`
);
})
})
.
catch
((
error
)
=>
t
.
fail
(
`rtpReceiver.receive() failed for
${
peer
.
name
}
:
${
error
}
`
));
.
catch
((
error
)
=>
t
.
fail
(
`rtpReceiver.receive() failed for
${
peer
.
name
}
and kind "
${
kind
}
"
:
${
error
}
`
));
}
}
worker/include/RTC/RtpParameters.h
浏览文件 @
81a5cc67
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define MS_RTC_RTP_PARAMETERS_H
#define MS_RTC_RTP_PARAMETERS_H
#include "common.h"
#include "common.h"
#include "RTC/RtpKind.h"
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <unordered_map>
#include <unordered_map>
...
@@ -56,7 +57,19 @@ namespace RTC
...
@@ -56,7 +57,19 @@ namespace RTC
class
RtpCodecParameters
class
RtpCodecParameters
{
{
public
:
public
:
RtpCodecParameters
(
Json
::
Value
&
data
);
enum
class
Subtype
{
MEDIA
=
1
,
RTX
,
ULPFEC
,
FLEXFEC
,
RED
,
CN
,
DTMF
};
public
:
RtpCodecParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
);
virtual
~
RtpCodecParameters
();
virtual
~
RtpCodecParameters
();
Json
::
Value
toJson
();
Json
::
Value
toJson
();
...
@@ -70,6 +83,10 @@ namespace RTC
...
@@ -70,6 +83,10 @@ namespace RTC
uint32_t
numChannels
=
0
;
uint32_t
numChannels
=
0
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
CustomParameters
parameters
;
CustomParameters
parameters
;
public
:
RTC
::
RtpKind
type
;
Subtype
subtype
;
};
};
class
RtpFecParameters
class
RtpFecParameters
...
@@ -156,7 +173,12 @@ namespace RTC
...
@@ -156,7 +173,12 @@ namespace RTC
class
RtpParameters
class
RtpParameters
{
{
public
:
public
:
RtpParameters
(
Json
::
Value
&
data
);
static
RtpParameters
*
Factory
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
);
private
:
RtpParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
);
public
:
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
virtual
~
RtpParameters
();
virtual
~
RtpParameters
();
...
@@ -171,6 +193,9 @@ namespace RTC
...
@@ -171,6 +193,9 @@ namespace RTC
RtcpParameters
rtcp
;
RtcpParameters
rtcp
;
bool
hasRtcp
=
false
;
bool
hasRtcp
=
false
;
Json
::
Value
userParameters
;
Json
::
Value
userParameters
;
public
:
RTC
::
RtpKind
kind
;
};
};
}
}
...
...
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
浏览文件 @
81a5cc67
...
@@ -6,9 +6,23 @@
...
@@ -6,9 +6,23 @@
namespace
RTC
namespace
RTC
{
{
static
std
::
unordered_map
<
std
::
string
,
RtpCodecParameters
::
Subtype
>
string2Subtype
=
{
{
"rtx"
,
RtpCodecParameters
::
Subtype
::
RTX
},
{
"RTX"
,
RtpCodecParameters
::
Subtype
::
RTX
},
{
"ulpfec"
,
RtpCodecParameters
::
Subtype
::
ULPFEC
},
{
"flexfec"
,
RtpCodecParameters
::
Subtype
::
FLEXFEC
},
{
"red"
,
RtpCodecParameters
::
Subtype
::
RED
},
{
"RED"
,
RtpCodecParameters
::
Subtype
::
RED
},
{
"cn"
,
RtpCodecParameters
::
Subtype
::
CN
},
{
"CN"
,
RtpCodecParameters
::
Subtype
::
CN
},
{
"telephone-event"
,
RtpCodecParameters
::
Subtype
::
DTMF
},
{
"dtmf"
,
RtpCodecParameters
::
Subtype
::
DTMF
}
};
/* Instance methods. */
/* Instance methods. */
RtpCodecParameters
::
RtpCodecParameters
(
Json
::
Value
&
data
)
RtpCodecParameters
::
RtpCodecParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -29,8 +43,22 @@ namespace RTC
...
@@ -29,8 +43,22 @@ namespace RTC
MS_THROW_ERROR
(
"missing `RtpCodecParameters.name`"
);
MS_THROW_ERROR
(
"missing `RtpCodecParameters.name`"
);
this
->
name
=
data
[
k_name
].
asString
();
this
->
name
=
data
[
k_name
].
asString
();
if
(
this
->
name
.
empty
())
MS_THROW_ERROR
(
"empty `RtpCodecParameters.name`"
);
// Get and check name MIME type.
if
(
kind
==
RTC
::
RtpKind
::
AUDIO
&&
this
->
name
.
compare
(
0
,
6
,
"audio/"
)
==
0
)
this
->
type
=
RTC
::
RtpKind
::
AUDIO
;
else
if
(
kind
==
RTC
::
RtpKind
::
VIDEO
&&
this
->
name
.
compare
(
0
,
6
,
"video/"
)
==
0
)
this
->
type
=
RTC
::
RtpKind
::
VIDEO
;
else
MS_THROW_ERROR
(
"invalid `RtpCodecParameters.name` MIME type [name:%s"
,
this
->
name
.
c_str
());
// Get name MIME subtype.
std
::
string
subtype
=
this
->
name
.
substr
(
6
);
if
(
string2Subtype
.
find
(
subtype
)
==
string2Subtype
.
end
())
this
->
subtype
=
Subtype
::
MEDIA
;
else
this
->
subtype
=
string2Subtype
[
subtype
];
// `payloadType` is mandatory.
// `payloadType` is mandatory.
if
(
!
data
[
k_payloadType
].
isUInt
())
if
(
!
data
[
k_payloadType
].
isUInt
())
...
...
worker/src/RTC/RtpParameters/RtpParameters.cpp
浏览文件 @
81a5cc67
...
@@ -6,9 +6,24 @@
...
@@ -6,9 +6,24 @@
namespace
RTC
namespace
RTC
{
{
/* Class methods. */
RtpParameters
*
RtpParameters
::
Factory
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
)
{
MS_TRACE
();
// NOTE: This may throw,
auto
rtpParameters
=
new
RtpParameters
(
kind
,
data
);
// TODO: check parameters and, if wrong, free them and throw.
return
rtpParameters
;
}
/* Instance methods. */
/* Instance methods. */
RtpParameters
::
RtpParameters
(
Json
::
Value
&
data
)
RtpParameters
::
RtpParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
)
:
kind
(
kind
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -33,7 +48,7 @@ namespace RTC
...
@@ -33,7 +48,7 @@ namespace RTC
for
(
Json
::
UInt
i
=
0
;
i
<
json_codecs
.
size
();
i
++
)
for
(
Json
::
UInt
i
=
0
;
i
<
json_codecs
.
size
();
i
++
)
{
{
RtpCodecParameters
codec
(
json_codecs
[
i
]);
RtpCodecParameters
codec
(
this
->
kind
,
json_codecs
[
i
]);
// Append to the codecs vector.
// Append to the codecs vector.
this
->
codecs
.
push_back
(
codec
);
this
->
codecs
.
push_back
(
codec
);
...
@@ -97,6 +112,8 @@ namespace RTC
...
@@ -97,6 +112,8 @@ namespace RTC
this
->
rtcp
=
rtpParameters
->
rtcp
;
this
->
rtcp
=
rtpParameters
->
rtcp
;
this
->
hasRtcp
=
rtpParameters
->
hasRtcp
;
this
->
hasRtcp
=
rtpParameters
->
hasRtcp
;
this
->
userParameters
=
rtpParameters
->
userParameters
;
this
->
userParameters
=
rtpParameters
->
userParameters
;
this
->
kind
=
rtpParameters
->
kind
;
}
}
RtpParameters
::~
RtpParameters
()
RtpParameters
::~
RtpParameters
()
...
...
worker/src/RTC/RtpReceiver.cpp
浏览文件 @
81a5cc67
...
@@ -119,7 +119,7 @@ namespace RTC
...
@@ -119,7 +119,7 @@ namespace RTC
try
try
{
{
this
->
rtpParameters
=
new
RTC
::
RtpParameters
(
request
->
data
);
this
->
rtpParameters
=
RTC
::
RtpParameters
::
Factory
(
this
->
kind
,
request
->
data
);
}
}
catch
(
const
MediaSoupError
&
error
)
catch
(
const
MediaSoupError
&
error
)
{
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论