Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
15f1fb7d
提交
15f1fb7d
authored
3月 07, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpPArameters: add kind (audio/video)
上级
4a0ab1dd
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
44 行增加
和
59 行删除
+44
-59
test_RtpReceiver.js
test/test_RtpReceiver.js
+4
-59
test_scene_1.js
test/test_scene_1.js
+5
-0
RtpParameters.h
worker/include/RTC/RtpParameters.h
+8
-0
RtpParameters.cpp
worker/src/RTC/RtpParameters/RtpParameters.cpp
+27
-0
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
15f1fb7d
...
@@ -20,63 +20,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -20,63 +20,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
let
rtpReceiver
=
peer
.
RtpReceiver
(
transport
);
let
rtpReceiver
=
peer
.
RtpReceiver
(
transport
);
let
rtpParameters
=
let
rtpParameters
=
{
{
muxId
:
'abcd'
,
kind
:
'audio'
,
codecs
:
[
{
name
:
'opus'
,
payloadType
:
111
,
clockRate
:
null
,
numChannels
:
2
},
{
name
:
'PCMA'
,
payloadType
:
8
,
clockRate
:
4800
,
maxptime
:
20
},
{
name
:
'VP8'
,
payloadType
:
103
,
clockRate
:
90000
,
rtcpFeedback
:
[
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'google-remb'
}
]
}
],
encodings
:
[
{
ssrc
:
111222330
,
codecPayloadType
:
111
,
fec
:
{
mechanism
:
'foo'
,
ssrc
:
222222222
},
rtx
:
{
payloadType
:
201
,
ssrc
:
333333333
}
},
{
ssrc
:
111222331
}
],
rtcp
:
{
cname
:
'a7sdihkj3sdsdflqwkejl98ujk'
,
ssrc
:
88888888
,
reducedSize
:
true
}
};
let
expectedRtpParameters
=
{
muxId
:
'abcd'
,
muxId
:
'abcd'
,
codecs
:
codecs
:
[
[
...
@@ -121,7 +65,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -121,7 +65,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
}
}
},
},
{
{
ssrc
:
111222331
ssrc
:
111222331
,
codecPayloadType
:
8
}
}
],
],
rtcp
:
rtcp
:
...
@@ -154,7 +99,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -154,7 +99,7 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
t
.
pass
(
'rtpReceiver.dump() succeeded'
);
t
.
pass
(
'rtpReceiver.dump() succeeded'
);
t
.
same
(
data
.
rtpParameters
,
expectedR
tpParameters
,
'rtpReceiver.dump() must provide the expected `rtpParameters`'
);
t
.
same
(
data
.
rtpParameters
,
r
tpParameters
,
'rtpReceiver.dump() must provide the expected `rtpParameters`'
);
})
})
.
catch
((
error
)
=>
t
.
fail
(
`rtpReceiver.dump() failed:
${
error
}
`
))
.
catch
((
error
)
=>
t
.
fail
(
`rtpReceiver.dump() failed:
${
error
}
`
))
])
])
...
...
test/test_scene_1.js
浏览文件 @
15f1fb7d
...
@@ -27,6 +27,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -27,6 +27,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
let
aliceAudioParameters
=
let
aliceAudioParameters
=
{
{
kind
:
'audio'
,
muxId
:
'alicemuxid1'
,
muxId
:
'alicemuxid1'
,
codecs
:
codecs
:
[
[
...
@@ -51,6 +52,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -51,6 +52,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
};
};
let
aliceVideoParameters
=
let
aliceVideoParameters
=
{
{
kind
:
'video'
,
muxId
:
'alicemuxid2'
,
muxId
:
'alicemuxid2'
,
codecs
:
codecs
:
[
[
...
@@ -75,6 +77,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -75,6 +77,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
};
};
let
bobVideoParameters
=
let
bobVideoParameters
=
{
{
kind
:
'video'
,
muxId
:
'bobmuxid2'
,
muxId
:
'bobmuxid2'
,
codecs
:
codecs
:
[
[
...
@@ -104,6 +107,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -104,6 +107,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
};
};
let
carolAudioParameters
=
let
carolAudioParameters
=
{
{
kind
:
'audio'
,
muxId
:
'carolmuxid1'
,
muxId
:
'carolmuxid1'
,
codecs
:
codecs
:
[
[
...
@@ -128,6 +132,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -128,6 +132,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
};
};
let
carolVideoParameters
=
let
carolVideoParameters
=
{
{
kind
:
'video'
,
muxId
:
'carolmuxid2'
,
muxId
:
'carolmuxid2'
,
codecs
:
codecs
:
[
[
...
...
worker/include/RTC/RtpParameters.h
浏览文件 @
15f1fb7d
...
@@ -101,6 +101,13 @@ namespace RTC
...
@@ -101,6 +101,13 @@ namespace RTC
class
RtpParameters
class
RtpParameters
{
{
public
:
enum
class
Kind
{
AUDIO
=
1
,
VIDEO
=
2
};
public
:
public
:
RtpParameters
(
Json
::
Value
&
data
);
RtpParameters
(
Json
::
Value
&
data
);
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
...
@@ -109,6 +116,7 @@ namespace RTC
...
@@ -109,6 +116,7 @@ namespace RTC
Json
::
Value
toJson
();
Json
::
Value
toJson
();
public
:
public
:
Kind
kind
;
// TODO: not sure if 1 or 2 bytes or what.
// TODO: not sure if 1 or 2 bytes or what.
std
::
string
muxId
;
std
::
string
muxId
;
std
::
vector
<
RtpCodecParameters
>
codecs
;
std
::
vector
<
RtpCodecParameters
>
codecs
;
...
...
worker/src/RTC/RtpParameters.cpp
→
worker/src/RTC/RtpParameters
/RtpParameters
.cpp
浏览文件 @
15f1fb7d
...
@@ -12,11 +12,25 @@ namespace RTC
...
@@ -12,11 +12,25 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_kind
(
"kind"
);
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
static
const
Json
::
StaticString
k_rtcp
(
"rtcp"
);
static
const
Json
::
StaticString
k_rtcp
(
"rtcp"
);
// `kind` is mandatory.
if
(
!
data
[
k_kind
].
isString
())
MS_THROW_ERROR
(
"missing `kind`"
);
std
::
string
kind
=
data
[
k_kind
].
asString
();
if
(
kind
==
"audio"
)
this
->
kind
=
Kind
::
AUDIO
;
else
if
(
kind
==
"video"
)
this
->
kind
=
Kind
::
VIDEO
;
else
MS_THROW_ERROR
(
"unknown `kind`"
);
// `muxId` is optional.
// `muxId` is optional.
if
(
data
[
k_muxId
].
isString
())
if
(
data
[
k_muxId
].
isString
())
{
{
...
@@ -74,6 +88,7 @@ namespace RTC
...
@@ -74,6 +88,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
this
->
kind
=
rtpParameters
->
kind
;
this
->
muxId
=
rtpParameters
->
muxId
;
this
->
muxId
=
rtpParameters
->
muxId
;
this
->
codecs
=
rtpParameters
->
codecs
;
this
->
codecs
=
rtpParameters
->
codecs
;
this
->
encodings
=
rtpParameters
->
encodings
;
this
->
encodings
=
rtpParameters
->
encodings
;
...
@@ -89,6 +104,7 @@ namespace RTC
...
@@ -89,6 +104,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_kind
(
"kind"
);
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
...
@@ -96,6 +112,17 @@ namespace RTC
...
@@ -96,6 +112,17 @@ namespace RTC
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `kind`.
switch
(
this
->
kind
)
{
case
Kind
:
:
AUDIO
:
json
[
k_kind
]
=
"audio"
;
break
;
case
Kind
:
:
VIDEO
:
json
[
k_kind
]
=
"video"
;
break
;
}
// Add `muxId`.
// Add `muxId`.
json
[
k_muxId
]
=
this
->
muxId
;
json
[
k_muxId
]
=
this
->
muxId
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论