Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
7c4a9eb6
提交
7c4a9eb6
authored
2月 29, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More work in RtpParameters
上级
67e8184c
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
158 行增加
和
26 行删除
+158
-26
test_RtpReceiver.js
test/test_RtpReceiver.js
+27
-8
test_scene_1.js
test/test_scene_1.js
+6
-6
RtpParameters.h
worker/include/RTC/RtpParameters.h
+17
-1
RtcpFeedback.cpp
worker/src/RTC/RtpParameters/RtcpFeedback.cpp
+54
-0
RtpCodecParameters.cpp
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
+52
-9
RtpEncodingParameters.cpp
worker/src/RTC/RtpParameters/RtpEncodingParameters.cpp
+2
-2
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
7c4a9eb6
...
@@ -25,16 +25,27 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -25,16 +25,27 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
[
[
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
111
payloadType
:
111
,
clockRate
:
null
,
numChannels
:
2
},
},
{
{
name
:
'PCMA'
,
name
:
'PCMA'
,
payloadType
:
8
,
payloadType
:
8
,
clockRate
:
9000
clockRate
:
4800
,
maxptime
:
20
},
},
{
{
name
:
'supercodec'
,
name
:
'VP8'
,
payloadType
:
103
payloadType
:
103
,
clockRate
:
9000
,
rtcpFeedback
:
[
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'nack'
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'google-remb'
}
]
}
}
],
],
encodings
:
encodings
:
...
@@ -55,17 +66,25 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -55,17 +66,25 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
111
,
payloadType
:
111
,
clockRate
:
null
numChannels
:
2
},
},
{
{
name
:
'PCMA'
,
name
:
'PCMA'
,
payloadType
:
8
,
payloadType
:
8
,
clockRate
:
9000
clockRate
:
4800
,
maxptime
:
20
},
},
{
{
name
:
'supercodec
'
,
name
:
'VP8
'
,
payloadType
:
103
,
payloadType
:
103
,
clockRate
:
null
clockRate
:
9000
,
rtcpFeedback
:
[
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'nack'
,
parameter
:
''
},
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'google-remb'
,
parameter
:
''
}
]
}
}
],
],
encodings
:
encodings
:
...
...
test/test_scene_1.js
浏览文件 @
7c4a9eb6
...
@@ -33,7 +33,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -33,7 +33,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
null
clockRate
:
9000
}
}
],
],
encodings
:
encodings
:
...
@@ -51,7 +51,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -51,7 +51,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
112
,
payloadType
:
112
,
clockRate
:
null
clockRate
:
9000
}
}
],
],
encodings
:
encodings
:
...
@@ -69,12 +69,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -69,12 +69,12 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
121
,
payloadType
:
121
,
clockRate
:
null
clockRate
:
9000
},
},
{
{
name
:
'vp8'
,
name
:
'vp8'
,
payloadType
:
122
,
payloadType
:
122
,
clockRate
:
null
clockRate
:
9000
}
}
],
],
encodings
:
encodings
:
...
@@ -92,7 +92,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -92,7 +92,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
131
,
payloadType
:
131
,
clockRate
:
null
clockRate
:
9000
}
}
],
],
encodings
:
encodings
:
...
@@ -110,7 +110,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
...
@@ -110,7 +110,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
132
,
payloadType
:
132
,
clockRate
:
null
clockRate
:
9000
}
}
],
],
encodings
:
encodings
:
...
...
worker/include/RTC/RtpParameters.h
浏览文件 @
7c4a9eb6
...
@@ -10,6 +10,7 @@ namespace RTC
...
@@ -10,6 +10,7 @@ namespace RTC
{
{
// Lazy declarations.
// Lazy declarations.
class
RtpCodecParameters
;
class
RtpCodecParameters
;
class
RtcpFeedback
;
class
RtpEncodingParameters
;
class
RtpEncodingParameters
;
class
RtpParameters
class
RtpParameters
...
@@ -23,7 +24,7 @@ namespace RTC
...
@@ -23,7 +24,7 @@ namespace RTC
public
:
public
:
// 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
;
std
::
vector
<
RtpEncodingParameters
>
encodings
;
std
::
vector
<
RtpEncodingParameters
>
encodings
;
};
};
...
@@ -42,6 +43,21 @@ namespace RTC
...
@@ -42,6 +43,21 @@ namespace RTC
uint32_t
clockRate
=
0
;
uint32_t
clockRate
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
numChannels
=
0
;
uint32_t
numChannels
=
0
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
// TODO: Dictionary parameters;
};
class
RtcpFeedback
{
public
:
RtcpFeedback
(
Json
::
Value
&
data
);
virtual
~
RtcpFeedback
();
Json
::
Value
toJson
();
public
:
std
::
string
type
;
std
::
string
parameter
;
};
};
class
RtpEncodingParameters
class
RtpEncodingParameters
...
...
worker/src/RTC/RtpParameters/RtcpFeedback.cpp
0 → 100644
浏览文件 @
7c4a9eb6
#define MS_CLASS "RTC::RtcpFeedback"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtcpFeedback
::
RtcpFeedback
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_type
(
"type"
);
static
const
Json
::
StaticString
k_parameter
(
"parameter"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtcpFeedback is not an object"
);
// `type` is mandatory.
if
(
!
data
[
k_type
].
isString
())
MS_THROW_ERROR
(
"missing `RtcpFeedback.type`"
);
this
->
type
=
data
[
k_type
].
asString
();
// `parameter` is optional.
if
(
data
[
k_parameter
].
isString
())
this
->
parameter
=
data
[
k_parameter
].
asString
();
}
RtcpFeedback
::~
RtcpFeedback
()
{
MS_TRACE
();
}
Json
::
Value
RtcpFeedback
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_type
(
"type"
);
static
const
Json
::
StaticString
k_parameter
(
"parameter"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `type`.
json
[
k_type
]
=
this
->
type
;
// Add `parameter`.
json
[
k_parameter
]
=
this
->
parameter
;
return
json
;
}
}
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
浏览文件 @
7c4a9eb6
...
@@ -15,27 +15,52 @@ namespace RTC
...
@@ -15,27 +15,52 @@ namespace RTC
static
const
Json
::
StaticString
k_name
(
"name"
);
static
const
Json
::
StaticString
k_name
(
"name"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_clockRate
(
"clockRate"
);
static
const
Json
::
StaticString
k_clockRate
(
"clockRate"
);
static
const
Json
::
StaticString
k_maxptime
(
"maxptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
data
is not an object"
);
MS_THROW_ERROR
(
"
RtpCodecParameters
is not an object"
);
// `name` is mandatory.
// `name` is mandatory.
if
(
!
data
[
k_name
].
isString
())
if
(
!
data
[
k_name
].
isString
())
MS_THROW_ERROR
(
"missing `
codec
.name`"
);
MS_THROW_ERROR
(
"missing `
RtpCodecParameters
.name`"
);
this
->
name
=
data
[
k_name
].
asString
();
this
->
name
=
data
[
k_name
].
asString
();
if
(
this
->
name
.
empty
())
if
(
this
->
name
.
empty
())
MS_THROW_ERROR
(
"empty `
codec
.name`"
);
MS_THROW_ERROR
(
"empty `
RtpCodecParameters
.name`"
);
// `payloadType` is mandatory.
// `payloadType` is mandatory.
if
(
!
data
[
k_payloadType
].
isUInt
())
if
(
!
data
[
k_payloadType
].
isUInt
())
MS_THROW_ERROR
(
"missing `
codec
.payloadType`"
);
MS_THROW_ERROR
(
"missing `
RtpCodecParameters
.payloadType`"
);
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
// `clockRate` is optional.
// `clockRate` is optional.
if
(
data
[
k_clockRate
].
isUInt
())
if
(
data
[
k_clockRate
].
isUInt
())
this
->
clockRate
=
(
uint32_t
)
data
[
k_clockRate
].
asUInt
();
this
->
clockRate
=
(
uint32_t
)
data
[
k_clockRate
].
asUInt
();
// `maxptime` is optional.
if
(
data
[
k_maxptime
].
isUInt
())
this
->
maxptime
=
(
uint32_t
)
data
[
k_maxptime
].
asUInt
();
// `numChannels` is optional.
if
(
data
[
k_numChannels
].
isUInt
())
this
->
numChannels
=
(
uint32_t
)
data
[
k_numChannels
].
asUInt
();
// `rtcpFeedback` is optional.
if
(
data
[
k_rtcpFeedback
].
isArray
())
{
auto
&
json_rtcpFeedback
=
data
[
k_rtcpFeedback
];
for
(
Json
::
UInt
i
=
0
;
i
<
json_rtcpFeedback
.
size
();
i
++
)
{
RtcpFeedback
rtcpFeedback
(
json_rtcpFeedback
[
i
]);
// Append to the rtcpFeedback vector.
this
->
rtcpFeedback
.
push_back
(
rtcpFeedback
);
}
}
}
}
RtpCodecParameters
::~
RtpCodecParameters
()
RtpCodecParameters
::~
RtpCodecParameters
()
...
@@ -48,11 +73,11 @@ namespace RTC
...
@@ -48,11 +73,11 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_name
(
"name"
);
static
const
Json
::
StaticString
k_name
(
"name"
);
static
const
Json
::
StaticString
v_both
(
""
);
static
const
Json
::
StaticString
v_audio
(
"audio"
);
static
const
Json
::
StaticString
v_video
(
"video"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_clockRate
(
"clockRate"
);
static
const
Json
::
StaticString
k_clockRate
(
"clockRate"
);
static
const
Json
::
StaticString
k_maxptime
(
"maxptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
...
@@ -65,8 +90,26 @@ namespace RTC
...
@@ -65,8 +90,26 @@ namespace RTC
// Add `clockRate`.
// Add `clockRate`.
if
(
this
->
clockRate
)
if
(
this
->
clockRate
)
json
[
k_clockRate
]
=
(
Json
::
UInt
)
this
->
clockRate
;
json
[
k_clockRate
]
=
(
Json
::
UInt
)
this
->
clockRate
;
else
json
[
k_clockRate
]
=
Json
::
nullValue
;
// Add `maxptime`.
if
(
this
->
maxptime
)
json
[
k_maxptime
]
=
(
Json
::
UInt
)
this
->
maxptime
;
// Add `numChannels`.
if
(
this
->
numChannels
)
json
[
k_numChannels
]
=
(
Json
::
UInt
)
this
->
numChannels
;
// Add `rtcpFeedback` (if any).
if
(
!
this
->
rtcpFeedback
.
empty
())
{
json
[
k_rtcpFeedback
]
=
Json
::
arrayValue
;
for
(
auto
it
=
this
->
rtcpFeedback
.
begin
();
it
!=
this
->
rtcpFeedback
.
end
();
++
it
)
{
RtcpFeedback
*
rtcpFeedback
=
std
::
addressof
(
*
it
);
json
[
k_rtcpFeedback
].
append
(
rtcpFeedback
->
toJson
());
}
}
return
json
;
return
json
;
}
}
...
...
worker/src/RTC/RtpParameters/RtpEncodingParameters.cpp
浏览文件 @
7c4a9eb6
...
@@ -15,11 +15,11 @@ namespace RTC
...
@@ -15,11 +15,11 @@ namespace RTC
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
data
is not an object"
);
MS_THROW_ERROR
(
"
RtpEncodingParameters
is not an object"
);
// `ssrc` is mandatory.
// `ssrc` is mandatory.
if
(
!
data
[
k_ssrc
].
isUInt
())
if
(
!
data
[
k_ssrc
].
isUInt
())
MS_THROW_ERROR
(
"missing `
encoding
.ssrc`"
);
MS_THROW_ERROR
(
"missing `
RtpEncodingParameters
.ssrc`"
);
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论