Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
a9dd2429
提交
a9dd2429
authored
3月 01, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add RtcpParameters.
上级
890bcb7b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
151 行增加
和
7 行删除
+151
-7
test_RtpReceiver.js
test/test_RtpReceiver.js
+14
-2
test_scene_1.js
test/test_scene_1.js
+35
-5
RtpParameters.h
worker/include/RTC/RtpParameters.h
+20
-0
RtpParameters.cpp
worker/src/RTC/RtpParameters.cpp
+16
-0
RtcpParameters.cpp
worker/src/RTC/RtpParameters/RtcpParameters.cpp
+66
-0
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
a9dd2429
...
...
@@ -67,7 +67,13 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
{
ssrc
:
111222331
}
]
],
rtcp
:
{
cname
:
'a7sdihkj3sdsdflqwkejl98ujk'
,
ssrc
:
88888888
,
reducedSize
:
true
}
};
let
expectedRtpParameters
=
{
...
...
@@ -117,7 +123,13 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
{
ssrc
:
111222331
}
]
],
rtcp
:
{
cname
:
'a7sdihkj3sdsdflqwkejl98ujk'
,
ssrc
:
88888888
,
reducedSize
:
true
}
};
t
.
equal
(
rtpReceiver
.
transport
,
transport
,
'rtpReceiver.transport must retrieve the given `transport`'
);
...
...
test/test_scene_1.js
浏览文件 @
a9dd2429
...
...
@@ -41,7 +41,13 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
ssrc
:
100000001
}
]
],
rtcp
:
{
cname
:
'ALICEAUDIO'
,
ssrc
:
50000001
,
reducedSize
:
false
}
};
let
aliceVideoParameters
=
{
...
...
@@ -59,7 +65,13 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
ssrc
:
100000002
}
]
],
rtcp
:
{
cname
:
'ALICEVIDEO'
,
ssrc
:
50000002
,
reducedSize
:
true
}
};
let
bobVideoParameters
=
{
...
...
@@ -82,7 +94,13 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
ssrc
:
200000002
}
]
],
rtcp
:
{
cname
:
'BOBVIDEO'
,
ssrc
:
50000003
,
reducedSize
:
true
}
};
let
carolAudioParameters
=
{
...
...
@@ -100,7 +118,13 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
ssrc
:
300000001
}
]
],
rtcp
:
{
cname
:
'CAROLAUDIO'
,
ssrc
:
50000004
,
reducedSize
:
false
}
};
let
carolVideoParameters
=
{
...
...
@@ -118,7 +142,13 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
ssrc
:
300000002
}
]
],
rtcp
:
{
cname
:
'CAROLVIDEO'
,
ssrc
:
50000005
,
reducedSize
:
true
}
};
Promise
.
all
(
...
...
worker/include/RTC/RtpParameters.h
浏览文件 @
a9dd2429
...
...
@@ -84,6 +84,21 @@ namespace RTC
RtpRtxParameters
rtx
;
};
class
RtcpParameters
{
public
:
RtcpParameters
()
{};
RtcpParameters
(
Json
::
Value
&
data
);
virtual
~
RtcpParameters
();
Json
::
Value
toJson
();
public
:
std
::
string
cname
;
uint32_t
ssrc
=
0
;
bool
reducedSize
=
false
;
};
class
RtpParameters
{
public
:
...
...
@@ -97,7 +112,12 @@ namespace RTC
// TODO: not sure if 1 or 2 bytes or what.
std
::
string
muxId
;
std
::
vector
<
RtpCodecParameters
>
codecs
;
// TODO:
// std::vector<RtpHeaderExtensionParameters> headerExtensions;
std
::
vector
<
RtpEncodingParameters
>
encodings
;
RtcpParameters
rtcp
;
// TODO:
// DegradationPreference degradationPreference = "balanced";
};
}
...
...
worker/src/RTC/RtpParameters.cpp
浏览文件 @
a9dd2429
...
...
@@ -15,6 +15,7 @@ namespace RTC
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
static
const
Json
::
StaticString
k_rtcp
(
"rtcp"
);
// `muxId` is optional.
if
(
data
[
k_muxId
].
isString
())
...
...
@@ -57,6 +58,16 @@ namespace RTC
{
MS_THROW_ERROR
(
"missing `encodings`"
);
}
// `rtcp` is mandatory.
if
(
data
[
k_rtcp
].
isObject
())
{
this
->
rtcp
=
RtcpParameters
(
data
[
k_rtcp
]);
}
else
{
MS_THROW_ERROR
(
"missing `rtcp`"
);
}
}
RtpParameters
::
RtpParameters
(
const
RtpParameters
*
rtpParameters
)
...
...
@@ -66,6 +77,7 @@ namespace RTC
this
->
muxId
=
rtpParameters
->
muxId
;
this
->
codecs
=
rtpParameters
->
codecs
;
this
->
encodings
=
rtpParameters
->
encodings
;
this
->
rtcp
=
rtpParameters
->
rtcp
;
}
RtpParameters
::~
RtpParameters
()
...
...
@@ -80,6 +92,7 @@ namespace RTC
static
const
Json
::
StaticString
k_muxId
(
"muxId"
);
static
const
Json
::
StaticString
k_codecs
(
"codecs"
);
static
const
Json
::
StaticString
k_encodings
(
"encodings"
);
static
const
Json
::
StaticString
k_rtcp
(
"rtcp"
);
Json
::
Value
json
(
Json
::
objectValue
);
...
...
@@ -104,6 +117,9 @@ namespace RTC
json
[
k_encodings
].
append
(
encoding
->
toJson
());
}
// Add `rtcp`.
json
[
k_rtcp
]
=
this
->
rtcp
.
toJson
();
return
json
;
}
}
worker/src/RTC/RtpParameters/RtcpParameters.cpp
0 → 100644
浏览文件 @
a9dd2429
#define MS_CLASS "RTC::RtcpParameters"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtcpParameters
::
RtcpParameters
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_cname
(
"cname"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_reducedSize
(
"reducedSize"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtcpParameters is not an object"
);
// `cname` is mandatory.
if
(
!
data
[
k_cname
].
isString
())
MS_THROW_ERROR
(
"missing `RtcpParameters.cname`"
);
this
->
cname
=
data
[
k_cname
].
asString
();
if
(
this
->
cname
.
empty
())
MS_THROW_ERROR
(
"empty `RtcpParameters.cname`"
);
// `ssrc` is optional.
if
(
data
[
k_ssrc
].
isUInt
())
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
// `reducedSize` is optional.
if
(
data
[
k_reducedSize
].
isBool
())
this
->
reducedSize
=
data
[
k_reducedSize
].
asBool
();
}
RtcpParameters
::~
RtcpParameters
()
{
MS_TRACE
();
}
Json
::
Value
RtcpParameters
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_cname
(
"cname"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_reducedSize
(
"reducedSize"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `cname`.
json
[
k_cname
]
=
this
->
cname
;
// Add `ssrc`.
if
(
this
->
ssrc
)
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
// Add `reducedSize`.
json
[
k_reducedSize
]
=
this
->
reducedSize
;
return
json
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论