Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
b561dc41
提交
b561dc41
authored
4月 01, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update RtpParameters based on latest ORTC discussions
上级
71c1c220
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
277 行增加
和
219 行删除
+277
-219
test_RtpReceiver.js
test/test_RtpReceiver.js
+19
-32
test_scene_1.js
test/test_scene_1.js
+52
-35
RtpParameters.h
worker/include/RTC/RtpParameters.h
+43
-40
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+3
-3
Room.cpp
worker/src/RTC/Room.cpp
+17
-1
FecCodecParameters.cpp
worker/src/RTC/RtpParameters/FecCodecParameters.cpp
+16
-15
RtcpFeedback.cpp
worker/src/RTC/RtpParameters/RtcpFeedback.cpp
+1
-1
RtcpParameters.cpp
worker/src/RTC/RtpParameters/RtcpParameters.cpp
+1
-1
RtpCodecParameters.cpp
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
+42
-1
RtpEncodingParameters.cpp
worker/src/RTC/RtpParameters/RtpEncodingParameters.cpp
+28
-35
RtpFecParameters.cpp
worker/src/RTC/RtpParameters/RtpFecParameters.cpp
+0
-55
RtxCodecParameters.cpp
worker/src/RTC/RtpParameters/RtxCodecParameters.cpp
+55
-0
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
b561dc41
...
...
@@ -4,7 +4,6 @@ const tap = require('tap');
const
mediasoup
=
require
(
'../'
);
// TODO: waiting for proper parameters definition
tap
.
test
(
'rtpReceiver.receive() with valid `rtpParameters` must succeed'
,
{
timeout
:
1000
},
(
t
)
=>
{
let
server
=
mediasoup
.
Server
();
...
...
@@ -28,18 +27,15 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
name
:
'H264'
,
payloadType
:
100
,
numChannels
:
2
,
parameters
:
rtx
:
{
profileLevelId
:
2
,
packetizationMode
:
1
,
foo
:
'barœæ€'
,
isGood
:
true
}
},
{
name
:
'VP8'
,
payloadType
:
101
,
clockRate
:
90000
,
payloadType
:
96
,
rtxTime
:
1000
},
fec
:
[
{
mechanism
:
'foo'
,
payloadType
:
97
}
],
rtcpFeedback
:
[
{
type
:
'ccm'
,
parameter
:
'fir'
},
...
...
@@ -47,31 +43,21 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
{
type
:
'nack'
,
parameter
:
'pli'
},
{
type
:
'google-remb'
,
parameter
:
''
}
],
parameters
:
parameters
:
{
maxFr
:
20
profileLevelId
:
2
,
packetizationMode
:
1
,
foo
:
'barœæ€'
,
isGood
:
true
}
}
],
encodings
:
[
{
codecPayloadType
:
100
,
ssrc
:
111222330
,
fec
:
{
mechanism
:
'foo'
,
ssrc
:
222222222
},
rtx
:
{
payloadType
:
201
,
ssrc
:
333333333
}
},
{
codecPayloadType
:
101
,
ssrc
:
111222330
ssrc
:
100000021
,
rtxSsrc
:
100000022
,
fecSsrc
:
100000023
}
],
rtcp
:
...
...
@@ -95,8 +81,9 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
.
then
((
data
)
=>
{
t
.
pass
(
'transport.dump() succeeded'
);
t
.
same
(
Object
.
keys
(
data
.
rtpListener
.
ssrcTable
).
sort
(),
[
'111222330'
].
sort
(),
'transport.dump() must provide the given ssrc values'
);
t
.
same
(
Object
.
keys
(
data
.
rtpListener
.
ptTable
).
sort
(),
[
'100'
,
'101'
].
sort
(),
'transport.dump() must provide the given payload types'
);
// TODO: Enable when done
// t.same(Object.keys(data.rtpListener.ssrcTable).sort(), [ ... ].sort(), 'transport.dump() must provide the given ssrc values');
// t.same(Object.keys(data.rtpListener.ptTable).sort(), [ ... ].sort(), 'transport.dump() must provide the given payload types');
})
.
catch
((
error
)
=>
t
.
fail
(
`transport.dump() failed:
${
error
}
`
)),
...
...
test/test_scene_1.js
浏览文件 @
b561dc41
...
...
@@ -28,135 +28,152 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
let
aliceAudioParameters
=
{
kind
:
'audio'
,
muxId
:
'alice
muxid1
'
,
muxId
:
'alice
-audio
'
,
codecs
:
[
{
name
:
'opus'
,
payloadType
:
101
,
clockRate
:
90000
clockRate
:
90000
,
}
],
encodings
:
[
{
codecPayloadType
:
101
,
ssrc
:
100000001
ssrc
:
100000011
}
],
rtcp
:
{
cname
:
'ALICEAUDIO'
,
ssrc
:
5
000000
1
,
ssrc
:
5
100001
1
,
reducedSize
:
false
}
};
let
aliceVideoParameters
=
{
kind
:
'video'
,
muxId
:
'alice
muxid2
'
,
muxId
:
'alice
-video
'
,
codecs
:
[
{
name
:
'vp9'
,
payloadType
:
112
,
clockRate
:
90000
payloadType
:
102
,
clockRate
:
90000
,
rtx
:
{
payloadType
:
96
,
rtxTime
:
1000
},
fec
:
[
{
mechanism
:
'foo'
,
payloadType
:
97
}
]
}
],
encodings
:
[
{
codecPayloadType
:
112
,
ssrc
:
100000002
ssrc
:
100000021
,
rtxSsrc
:
100000022
,
fecSsrc
:
100000023
}
],
rtcp
:
{
cname
:
'ALICEVIDEO'
,
ssrc
:
5
0000002
,
ssrc
:
5
1000021
,
reducedSize
:
true
}
};
let
bobVideoParameters
=
{
kind
:
'video'
,
muxId
:
'bob
muxid2
'
,
muxId
:
'bob
-video
'
,
codecs
:
[
{
name
:
'vp9'
,
payloadType
:
1
21
,
clockRate
:
90000
},
{
name
:
'vp8'
,
payloadType
:
122
,
clockRate
:
90000
payloadType
:
1
03
,
clockRate
:
90000
,
rtx
:
{
payloadType
:
97
,
rtxTime
:
2000
}
}
],
encodings
:
[
{
codecPayloadType
:
1
21
,
ssrc
:
20000000
2
ssrc
:
2000000
21
,
rtxSsrc
:
20000002
2
}
],
rtcp
:
{
cname
:
'BOBVIDEO'
,
ssrc
:
5
0000003
,
ssrc
:
5
2000021
,
reducedSize
:
true
}
};
let
carolAudioParameters
=
{
kind
:
'audio'
,
muxId
:
'carol
muxid1
'
,
muxId
:
'carol
-audio
'
,
codecs
:
[
{
name
:
'opus'
,
payloadType
:
131
,
clockRate
:
90000
payloadType
:
103
,
clockRate
:
90000
,
fec
:
[
{
mechanism
:
'bar'
,
payloadType
:
98
}
]
}
],
encodings
:
[
{
codecPayloadType
:
13
1
,
ssrc
:
300000001
ssrc
:
30000001
1
,
fecSsrc
:
300000012
}
],
rtcp
:
{
cname
:
'CAROLAUDIO'
,
ssrc
:
5
0000004
,
reducedSize
:
fals
e
ssrc
:
5
3000011
,
reducedSize
:
tru
e
}
};
let
carolVideoParameters
=
{
kind
:
'video'
,
muxId
:
'carol
muxid2
'
,
muxId
:
'carol
-video
'
,
codecs
:
[
{
name
:
'vp9'
,
payloadType
:
132
,
clockRate
:
90000
payloadType
:
103
,
rtx
:
{
payloadType
:
97
,
rtxTime
:
1500
}
}
],
encodings
:
[
{
codecPayloadType
:
132
,
ssrc
:
30000000
2
ssrc
:
300000021
,
rtxSsrc
:
30000002
2
}
],
rtcp
:
{
cname
:
'CAROLVIDEO'
,
ssrc
:
5
0000005
,
ssrc
:
5
3000021
,
reducedSize
:
true
}
};
...
...
worker/include/RTC/RtpParameters.h
浏览文件 @
b561dc41
...
...
@@ -9,6 +9,36 @@
namespace
RTC
{
class
RtxCodecParameters
{
public
:
RtxCodecParameters
()
{};
RtxCodecParameters
(
Json
::
Value
&
data
);
virtual
~
RtxCodecParameters
();
Json
::
Value
toJson
();
public
:
uint8_t
payloadType
=
0
;
uint32_t
rtxTime
=
0
;
};
class
FecCodecParameters
{
public
:
FecCodecParameters
()
{};
FecCodecParameters
(
Json
::
Value
&
data
);
virtual
~
FecCodecParameters
();
Json
::
Value
toJson
();
public
:
std
::
string
mechanism
;
uint8_t
payloadType
=
0
;
// TODO: optional parameters
// https://github.com/openpeer/ortc/issues/444#issuecomment-203560671
};
class
RtcpFeedback
{
public
:
...
...
@@ -58,43 +88,18 @@ namespace RTC
Json
::
Value
toJson
();
public
:
std
::
string
name
;
uint8_t
payloadType
=
0
;
uint32_t
clockRate
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
numChannels
=
0
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
string
name
;
uint8_t
payloadType
=
0
;
uint32_t
clockRate
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
numChannels
=
0
;
bool
hasRtx
=
false
;
RtxCodecParameters
rtx
;
std
::
vector
<
FecCodecParameters
>
fec
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
unordered_map
<
std
::
string
,
ParameterValue
>
parameters
;
};
class
RtpFecParameters
{
public
:
RtpFecParameters
()
{};
RtpFecParameters
(
Json
::
Value
&
data
);
virtual
~
RtpFecParameters
();
Json
::
Value
toJson
();
public
:
std
::
string
mechanism
;
uint32_t
ssrc
=
0
;
};
class
RtpRtxParameters
{
public
:
RtpRtxParameters
()
{};
RtpRtxParameters
(
Json
::
Value
&
data
);
virtual
~
RtpRtxParameters
();
Json
::
Value
toJson
();
public
:
uint8_t
payloadType
=
0
;
uint32_t
ssrc
=
0
;
};
class
RtpEncodingParameters
{
public
:
...
...
@@ -104,12 +109,10 @@ namespace RTC
Json
::
Value
toJson
();
public
:
uint32_t
ssrc
=
0
;
uint8_t
codecPayloadType
=
0
;
bool
hasFec
=
false
;
RtpFecParameters
fec
;
bool
hasRtx
=
false
;
RtpRtxParameters
rtx
;
uint8_t
codecPayloadType
=
0
;
uint32_t
ssrc
=
0
;
uint32_t
rtxSsrc
=
0
;
uint32_t
fecSsrc
=
0
;
};
class
RtcpParameters
...
...
worker/mediasoup-worker.gyp
浏览文件 @
b561dc41
...
...
@@ -43,13 +43,14 @@
'src/RTC/Transport.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/RtpParameters/FecCodecParameters.cpp',
'src/RTC/RtpParameters/RtcpFeedback.cpp',
'src/RTC/RtpParameters/RtcpParameters.cpp',
'src/RTC/RtpParameters/RtpCodecParameters.cpp',
'src/RTC/RtpParameters/RtpEncodingParameters.cpp',
'src/RTC/RtpParameters/RtpFecParameters.cpp',
'src/RTC/RtpParameters/RtpParameters.cpp',
'src/RTC/RtpParameters/Rt
pRtx
Parameters.cpp',
'src/RTC/RtpParameters/Rt
xCodec
Parameters.cpp',
'src/Utils/Crypto.cpp',
'src/Utils/File.cpp',
'src/Utils/IP.cpp',
...
...
@@ -144,7 +145,6 @@
'ldflags': [ '-Wl,--export-dynamic' ]
}],
[ 'OS != "win"', {
'cflags': [ '-std=c++14', '-Wall', '-Wextra', '-Wno-unused-parameter' ]
}],
...
...
worker/src/RTC/Room.cpp
浏览文件 @
b561dc41
...
...
@@ -17,8 +17,16 @@ namespace RTC
{
MS_TRACE
();
static
const
Json
::
StaticString
k_audioCodec
(
"audioCodec"
);
static
const
Json
::
StaticString
k_videoCodec
(
"videoCodec"
);
static
const
Json
::
StaticString
k_forceUniquePayloadTypes
(
"forceUniquePayloadTypes"
);
// `audioCodec` is optional.
// if (data[k_audioCodec].isString())
// `videoCodec` is optional.
// if (data[k_videoCodec].isString())
// `forceUniquePayloadTypes` is optional.
if
(
data
[
k_forceUniquePayloadTypes
].
isBool
())
this
->
options
.
forceUniquePayloadTypes
=
data
[
k_forceUniquePayloadTypes
].
asBool
();
...
...
@@ -65,6 +73,8 @@ namespace RTC
static
const
Json
::
StaticString
k_roomId
(
"roomId"
);
static
const
Json
::
StaticString
k_options
(
"options"
);
static
const
Json
::
StaticString
k_audioCodec
(
"audioCodec"
);
static
const
Json
::
StaticString
k_videoCodec
(
"videoCodec"
);
static
const
Json
::
StaticString
k_forceUniquePayloadTypes
(
"forceUniquePayloadTypes"
);
static
const
Json
::
StaticString
k_peers
(
"peers"
);
static
const
Json
::
StaticString
k_mapRtpReceiverRtpSenders
(
"mapRtpReceiverRtpSenders"
);
...
...
@@ -77,7 +87,13 @@ namespace RTC
// Add `roomId`.
json
[
k_roomId
]
=
(
Json
::
UInt
)
this
->
roomId
;
// Add `options`.
// Add `options.audioCodec`.
// json_options[k_audioCodec] = // TODO
// Add `options.videoCodec`.
// json_options[k_videoCodec] = // TODO
// Add `options.forceUniquePayloadTypes`.
json_options
[
k_forceUniquePayloadTypes
]
=
this
->
options
.
forceUniquePayloadTypes
;
json
[
k_options
]
=
json_options
;
...
...
worker/src/RTC/RtpParameters/
RtpRtx
Parameters.cpp
→
worker/src/RTC/RtpParameters/
FecCodec
Parameters.cpp
浏览文件 @
b561dc41
#define MS_CLASS "RTC::
RtpRtx
Parameters"
#define MS_CLASS "RTC::
FecCodec
Parameters"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
...
...
@@ -8,47 +8,48 @@ namespace RTC
{
/* Instance methods. */
RtpRtxParameters
::
RtpRtx
Parameters
(
Json
::
Value
&
data
)
FecCodecParameters
::
FecCodec
Parameters
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtpRtxParameters is not an object"
);
MS_THROW_ERROR
(
"`FecCodecParameters` is not an object"
);
// `mechanism` is mandatory.
if
(
!
data
[
k_mechanism
].
isString
())
MS_THROW_ERROR
(
"missing `FecCodecParameters.mechanism`"
);
this
->
mechanism
=
data
[
k_mechanism
].
asString
();
// `payloadType` is optional.
if
(
data
[
k_payloadType
].
isUInt
())
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
// `ssrc` is optional.
if
(
data
[
k_ssrc
].
isUInt
())
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
}
RtpRtxParameters
::~
RtpRtx
Parameters
()
FecCodecParameters
::~
FecCodec
Parameters
()
{
MS_TRACE
();
}
Json
::
Value
RtpRtx
Parameters
::
toJson
()
Json
::
Value
FecCodec
Parameters
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `mechanism`.
json
[
k_mechanism
]
=
this
->
mechanism
;
// Add `payloadType`.
if
(
this
->
payloadType
)
json
[
k_payloadType
]
=
(
Json
::
UInt
)
this
->
payloadType
;
// Add `ssrc`.
if
(
this
->
ssrc
)
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
return
json
;
}
}
worker/src/RTC/RtpParameters/RtcpFeedback.cpp
浏览文件 @
b561dc41
...
...
@@ -16,7 +16,7 @@ namespace RTC
static
const
Json
::
StaticString
k_parameter
(
"parameter"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
RtcpFeedback
is not an object"
);
MS_THROW_ERROR
(
"
`RtcpFeedback`
is not an object"
);
// `type` is mandatory.
if
(
!
data
[
k_type
].
isString
())
...
...
worker/src/RTC/RtpParameters/RtcpParameters.cpp
浏览文件 @
b561dc41
...
...
@@ -17,7 +17,7 @@ namespace RTC
static
const
Json
::
StaticString
k_reducedSize
(
"reducedSize"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtcpPa
rameters
is not an object"
);
MS_THROW_ERROR
(
"RtcpPa
`rameters`
is not an object"
);
// `cname` is mandatory.
if
(
!
data
[
k_cname
].
isString
())
...
...
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
浏览文件 @
b561dc41
...
...
@@ -17,11 +17,13 @@ namespace RTC
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_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
RtpCodecParameters
is not an object"
);
MS_THROW_ERROR
(
"
`RtpCodecParameters`
is not an object"
);
// `name` is mandatory.
if
(
!
data
[
k_name
].
isString
())
...
...
@@ -49,6 +51,27 @@ namespace RTC
if
(
data
[
k_numChannels
].
isUInt
())
this
->
numChannels
=
(
uint32_t
)
data
[
k_numChannels
].
asUInt
();
// `rtx` is optional.
if
(
data
[
k_rtx
].
isObject
())
{
this
->
rtx
=
RtxCodecParameters
(
data
[
k_rtx
]);
this
->
hasRtx
=
true
;
}
// `fec` is optional.
if
(
data
[
k_fec
].
isArray
())
{
auto
&
json_fec
=
data
[
k_fec
];
for
(
Json
::
UInt
i
=
0
;
i
<
json_fec
.
size
();
i
++
)
{
FecCodecParameters
fec
(
json_fec
[
i
]);
// Append to the fec vector.
this
->
fec
.
push_back
(
fec
);
}
}
// `rtcpFeedback` is optional.
if
(
data
[
k_rtcpFeedback
].
isArray
())
{
...
...
@@ -124,6 +147,8 @@ namespace RTC
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_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
...
...
@@ -147,6 +172,22 @@ namespace RTC
if
(
this
->
numChannels
)
json
[
k_numChannels
]
=
(
Json
::
UInt
)
this
->
numChannels
;
// Add `rtx`
if
(
this
->
hasRtx
)
json
[
k_rtx
]
=
this
->
rtx
.
toJson
();
// Add `fec` (if any).
if
(
!
this
->
fec
.
empty
())
{
json
[
k_fec
]
=
Json
::
arrayValue
;
for
(
auto
it
=
this
->
fec
.
begin
();
it
!=
this
->
fec
.
end
();
++
it
)
{
FecCodecParameters
*
fec
=
std
::
addressof
(
*
it
);
json
[
k_fec
].
append
(
fec
->
toJson
());
}
}
// Add `rtcpFeedback` (if any).
if
(
!
this
->
rtcpFeedback
.
empty
())
{
...
...
worker/src/RTC/RtpParameters/RtpEncodingParameters.cpp
浏览文件 @
b561dc41
...
...
@@ -12,19 +12,13 @@ namespace RTC
{
MS_TRACE
();
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_rtxSsrc
(
"rtxSsrc"
);
static
const
Json
::
StaticString
k_fecSsrc
(
"fecSsrc"
);
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtpEncodingParameters is not an object"
);
// `codecPayloadType` is mandatory.
if
(
!
data
[
k_codecPayloadType
].
isUInt
())
MS_THROW_ERROR
(
"missing `RtpEncodingParameters.codecPayloadType`"
);
this
->
codecPayloadType
=
(
uint8_t
)
data
[
k_codecPayloadType
].
asUInt
();
MS_THROW_ERROR
(
"`RtpEncodingParameters is not an object"
);
// `ssrc` is mandatory.
if
(
!
data
[
k_ssrc
].
isUInt
())
...
...
@@ -32,19 +26,17 @@ namespace RTC
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
// `fec` is optional.
if
(
data
[
k_fec
].
isObject
())
{
this
->
fec
=
RtpFecParameters
(
data
[
k_fec
]);
this
->
hasFec
=
true
;
}
// `rtx` is optional.
if
(
data
[
k_rtx
].
isObject
())
{
this
->
rtx
=
RtpRtxParameters
(
data
[
k_rtx
]);
this
->
hasRtx
=
true
;
}
// `rtxSsrc` is optional.
if
(
data
[
k_rtxSsrc
].
isUInt
())
this
->
rtxSsrc
=
(
uint32_t
)
data
[
k_rtxSsrc
].
asUInt
();
// `fecSsrc` is optional.
if
(
data
[
k_fecSsrc
].
isUInt
())
this
->
fecSsrc
=
(
uint32_t
)
data
[
k_fecSsrc
].
asUInt
();
// `codecPayloadType` is optional.
if
(
data
[
k_codecPayloadType
].
isUInt
())
this
->
codecPayloadType
=
(
uint8_t
)
data
[
k_codecPayloadType
].
asUInt
();
}
RtpEncodingParameters
::~
RtpEncodingParameters
()
...
...
@@ -56,26 +48,27 @@ namespace RTC
{
MS_TRACE
();
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_rtxSsrc
(
"rtxSsrc"
);
static
const
Json
::
StaticString
k_fecSsrc
(
"fecSsrc"
);
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `codecPayloadType`.
json
[
k_codecPayloadType
]
=
(
Json
::
UInt
)
this
->
codecPayloadType
;
// Add `ssrc`.
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
// Add `fec`
if
(
this
->
hasFec
)
json
[
k_fec
]
=
this
->
fec
.
toJson
();
// Add `rtxSsrc`.
if
(
this
->
rtxSsrc
)
json
[
k_rtxSsrc
]
=
(
Json
::
UInt
)
this
->
rtxSsrc
;
// Add `fecSsrc`.
if
(
this
->
fecSsrc
)
json
[
k_fecSsrc
]
=
(
Json
::
UInt
)
this
->
fecSsrc
;
// Add `
rtx`
if
(
this
->
hasRtx
)
json
[
k_
rtx
]
=
this
->
rtx
.
toJson
()
;
// Add `
codecPayloadType`.
if
(
this
->
codecPayloadType
)
json
[
k_
codecPayloadType
]
=
(
Json
::
UInt
)
this
->
codecPayloadType
;
return
json
;
}
...
...
worker/src/RTC/RtpParameters/RtpFecParameters.cpp
deleted
100644 → 0
浏览文件 @
71c1c220
#define MS_CLASS "RTC::RtpFecParameters"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtpFecParameters
::
RtpFecParameters
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtpFecParameters is not an object"
);
// `mechanism` is mandatory.
if
(
!
data
[
k_mechanism
].
isString
())
MS_THROW_ERROR
(
"missing `RtpFecParameters.mechanism`"
);
this
->
mechanism
=
data
[
k_mechanism
].
asString
();
// `ssrc` is optional.
if
(
data
[
k_ssrc
].
isUInt
())
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
}
RtpFecParameters
::~
RtpFecParameters
()
{
MS_TRACE
();
}
Json
::
Value
RtpFecParameters
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `mechanism`.
json
[
k_mechanism
]
=
this
->
mechanism
;
// Add `ssrc`.
if
(
this
->
ssrc
)
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
return
json
;
}
}
worker/src/RTC/RtpParameters/RtxCodecParameters.cpp
0 → 100644
浏览文件 @
b561dc41
#define MS_CLASS "RTC::RtxCodecParameters"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtxCodecParameters
::
RtxCodecParameters
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_rtxTime
(
"rtxTime"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"`RtxCodecParameters is not an object"
);
// `payloadType` is mandatory.
if
(
!
data
[
k_payloadType
].
isUInt
())
MS_THROW_ERROR
(
"missing `RtpEncodingParameters.payloadType`"
);
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
// `rtxTime` is optional.
if
(
data
[
k_rtxTime
].
isUInt
())
this
->
rtxTime
=
(
uint32_t
)
data
[
k_rtxTime
].
asUInt
();
}
RtxCodecParameters
::~
RtxCodecParameters
()
{
MS_TRACE
();
}
Json
::
Value
RtxCodecParameters
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_rtxTime
(
"rtxTime"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `payloadType`.
json
[
k_payloadType
]
=
(
Json
::
UInt
)
this
->
payloadType
;
// Add `rtxTime`.
if
(
this
->
rtxTime
)
json
[
k_rtxTime
]
=
(
Json
::
UInt
)
this
->
rtxTime
;
return
json
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论