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 个修改的文件
包含
266 行增加
和
208 行删除
+266
-208
test_RtpReceiver.js
test/test_RtpReceiver.js
+17
-30
test_scene_1.js
test/test_scene_1.js
+51
-34
RtpParameters.h
worker/include/RTC/RtpParameters.h
+36
-33
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
+27
-34
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');
...
@@ -4,7 +4,6 @@ const tap = require('tap');
const
mediasoup
=
require
(
'../'
);
const
mediasoup
=
require
(
'../'
);
// TODO: waiting for proper parameters definition
tap
.
test
(
'rtpReceiver.receive() with valid `rtpParameters` must succeed'
,
{
timeout
:
1000
},
(
t
)
=>
tap
.
test
(
'rtpReceiver.receive() with valid `rtpParameters` must succeed'
,
{
timeout
:
1000
},
(
t
)
=>
{
{
let
server
=
mediasoup
.
Server
();
let
server
=
mediasoup
.
Server
();
...
@@ -28,18 +27,15 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -28,18 +27,15 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
name
:
'H264'
,
name
:
'H264'
,
payloadType
:
100
,
payloadType
:
100
,
numChannels
:
2
,
numChannels
:
2
,
parameters
:
rtx
:
{
{
profileLevelId
:
2
,
payloadType
:
96
,
packetizationMode
:
1
,
rtxTime
:
1000
foo
:
'barœæ€'
,
isGood
:
true
}
},
},
{
fec
:
name
:
'VP8'
,
[
payloadType
:
101
,
{
mechanism
:
'foo'
,
payloadType
:
97
}
clockRate
:
90000
,
]
,
rtcpFeedback
:
rtcpFeedback
:
[
[
{
type
:
'ccm'
,
parameter
:
'fir'
},
{
type
:
'ccm'
,
parameter
:
'fir'
},
...
@@ -49,29 +45,19 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -49,29 +45,19 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
],
],
parameters
:
parameters
:
{
{
maxFr
:
20
profileLevelId
:
2
,
packetizationMode
:
1
,
foo
:
'barœæ€'
,
isGood
:
true
}
}
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
100
,
ssrc
:
100000021
,
ssrc
:
111222330
,
rtxSsrc
:
100000022
,
fec
:
fecSsrc
:
100000023
{
mechanism
:
'foo'
,
ssrc
:
222222222
},
rtx
:
{
payloadType
:
201
,
ssrc
:
333333333
}
},
{
codecPayloadType
:
101
,
ssrc
:
111222330
}
}
],
],
rtcp
:
rtcp
:
...
@@ -95,8 +81,9 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
...
@@ -95,8 +81,9 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
t
.
pass
(
'transport.dump() succeeded'
);
t
.
pass
(
'transport.dump() succeeded'
);
t
.
same
(
Object
.
keys
(
data
.
rtpListener
.
ssrcTable
).
sort
(),
[
'111222330'
].
sort
(),
'transport.dump() must provide the given ssrc values'
);
// TODO: Enable when done
t
.
same
(
Object
.
keys
(
data
.
rtpListener
.
ptTable
).
sort
(),
[
'100'
,
'101'
].
sort
(),
'transport.dump() must provide the given payload types'
);
// 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
}
`
)),
.
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
...
@@ -28,135 +28,152 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
let
aliceAudioParameters
=
let
aliceAudioParameters
=
{
{
kind
:
'audio'
,
kind
:
'audio'
,
muxId
:
'alice
muxid1
'
,
muxId
:
'alice
-audio
'
,
codecs
:
codecs
:
[
[
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
101
,
payloadType
:
101
,
clockRate
:
90000
clockRate
:
90000
,
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
101
,
ssrc
:
100000011
ssrc
:
100000001
}
}
],
],
rtcp
:
rtcp
:
{
{
cname
:
'ALICEAUDIO'
,
cname
:
'ALICEAUDIO'
,
ssrc
:
5
000000
1
,
ssrc
:
5
100001
1
,
reducedSize
:
false
reducedSize
:
false
}
}
};
};
let
aliceVideoParameters
=
let
aliceVideoParameters
=
{
{
kind
:
'video'
,
kind
:
'video'
,
muxId
:
'alice
muxid2
'
,
muxId
:
'alice
-video
'
,
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
112
,
payloadType
:
102
,
clockRate
:
90000
clockRate
:
90000
,
rtx
:
{
payloadType
:
96
,
rtxTime
:
1000
},
fec
:
[
{
mechanism
:
'foo'
,
payloadType
:
97
}
]
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
112
,
ssrc
:
100000021
,
ssrc
:
100000002
rtxSsrc
:
100000022
,
fecSsrc
:
100000023
}
}
],
],
rtcp
:
rtcp
:
{
{
cname
:
'ALICEVIDEO'
,
cname
:
'ALICEVIDEO'
,
ssrc
:
5
0000002
,
ssrc
:
5
1000021
,
reducedSize
:
true
reducedSize
:
true
}
}
};
};
let
bobVideoParameters
=
let
bobVideoParameters
=
{
{
kind
:
'video'
,
kind
:
'video'
,
muxId
:
'bob
muxid2
'
,
muxId
:
'bob
-video
'
,
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
1
21
,
payloadType
:
1
03
,
clockRate
:
90000
clockRate
:
90000
,
},
rtx
:
{
{
name
:
'vp8'
,
payloadType
:
97
,
payloadType
:
122
,
rtxTime
:
2000
clockRate
:
90000
}
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
1
21
,
ssrc
:
2000000
21
,
ssrc
:
20000000
2
rtxSsrc
:
20000002
2
}
}
],
],
rtcp
:
rtcp
:
{
{
cname
:
'BOBVIDEO'
,
cname
:
'BOBVIDEO'
,
ssrc
:
5
0000003
,
ssrc
:
5
2000021
,
reducedSize
:
true
reducedSize
:
true
}
}
};
};
let
carolAudioParameters
=
let
carolAudioParameters
=
{
{
kind
:
'audio'
,
kind
:
'audio'
,
muxId
:
'carol
muxid1
'
,
muxId
:
'carol
-audio
'
,
codecs
:
codecs
:
[
[
{
{
name
:
'opus'
,
name
:
'opus'
,
payloadType
:
131
,
payloadType
:
103
,
clockRate
:
90000
clockRate
:
90000
,
fec
:
[
{
mechanism
:
'bar'
,
payloadType
:
98
}
]
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
13
1
,
ssrc
:
30000001
1
,
ssrc
:
300000001
fecSsrc
:
300000012
}
}
],
],
rtcp
:
rtcp
:
{
{
cname
:
'CAROLAUDIO'
,
cname
:
'CAROLAUDIO'
,
ssrc
:
5
0000004
,
ssrc
:
5
3000011
,
reducedSize
:
fals
e
reducedSize
:
tru
e
}
}
};
};
let
carolVideoParameters
=
let
carolVideoParameters
=
{
{
kind
:
'video'
,
kind
:
'video'
,
muxId
:
'carol
muxid2
'
,
muxId
:
'carol
-video
'
,
codecs
:
codecs
:
[
[
{
{
name
:
'vp9'
,
name
:
'vp9'
,
payloadType
:
132
,
payloadType
:
103
,
clockRate
:
90000
rtx
:
{
payloadType
:
97
,
rtxTime
:
1500
}
}
}
],
],
encodings
:
encodings
:
[
[
{
{
codecPayloadType
:
132
,
ssrc
:
300000021
,
ssrc
:
30000000
2
rtxSsrc
:
30000002
2
}
}
],
],
rtcp
:
rtcp
:
{
{
cname
:
'CAROLVIDEO'
,
cname
:
'CAROLVIDEO'
,
ssrc
:
5
0000005
,
ssrc
:
5
3000021
,
reducedSize
:
true
reducedSize
:
true
}
}
};
};
...
...
worker/include/RTC/RtpParameters.h
浏览文件 @
b561dc41
...
@@ -9,6 +9,36 @@
...
@@ -9,6 +9,36 @@
namespace
RTC
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
class
RtcpFeedback
{
{
public
:
public
:
...
@@ -63,38 +93,13 @@ namespace RTC
...
@@ -63,38 +93,13 @@ 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
;
bool
hasRtx
=
false
;
RtxCodecParameters
rtx
;
std
::
vector
<
FecCodecParameters
>
fec
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
unordered_map
<
std
::
string
,
ParameterValue
>
parameters
;
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
class
RtpEncodingParameters
{
{
public
:
public
:
...
@@ -104,12 +109,10 @@ namespace RTC
...
@@ -104,12 +109,10 @@ namespace RTC
Json
::
Value
toJson
();
Json
::
Value
toJson
();
public
:
public
:
uint32_t
ssrc
=
0
;
uint8_t
codecPayloadType
=
0
;
uint8_t
codecPayloadType
=
0
;
bool
hasFec
=
false
;
uint32_t
ssrc
=
0
;
RtpFecParameters
fec
;
uint32_t
rtxSsrc
=
0
;
bool
hasRtx
=
false
;
uint32_t
fecSsrc
=
0
;
RtpRtxParameters
rtx
;
};
};
class
RtcpParameters
class
RtcpParameters
...
...
worker/mediasoup-worker.gyp
浏览文件 @
b561dc41
...
@@ -43,13 +43,14 @@
...
@@ -43,13 +43,14 @@
'src/RTC/Transport.cpp',
'src/RTC/Transport.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/RtpParameters/FecCodecParameters.cpp',
'src/RTC/RtpParameters/RtcpFeedback.cpp',
'src/RTC/RtpParameters/RtcpFeedback.cpp',
'src/RTC/RtpParameters/RtcpParameters.cpp',
'src/RTC/RtpParameters/RtcpParameters.cpp',
'src/RTC/RtpParameters/RtpCodecParameters.cpp',
'src/RTC/RtpParameters/RtpCodecParameters.cpp',
'src/RTC/RtpParameters/RtpEncodingParameters.cpp',
'src/RTC/RtpParameters/RtpEncodingParameters.cpp',
'src/RTC/RtpParameters/RtpFecParameters.cpp',
'src/RTC/RtpParameters/RtpParameters.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/Crypto.cpp',
'src/Utils/File.cpp',
'src/Utils/File.cpp',
'src/Utils/IP.cpp',
'src/Utils/IP.cpp',
...
@@ -144,7 +145,6 @@
...
@@ -144,7 +145,6 @@
'ldflags': [ '-Wl,--export-dynamic' ]
'ldflags': [ '-Wl,--export-dynamic' ]
}],
}],
[ 'OS != "win"', {
[ 'OS != "win"', {
'cflags': [ '-std=c++14', '-Wall', '-Wextra', '-Wno-unused-parameter' ]
'cflags': [ '-std=c++14', '-Wall', '-Wextra', '-Wno-unused-parameter' ]
}],
}],
...
...
worker/src/RTC/Room.cpp
浏览文件 @
b561dc41
...
@@ -17,8 +17,16 @@ namespace RTC
...
@@ -17,8 +17,16 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
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_forceUniquePayloadTypes
(
"forceUniquePayloadTypes"
);
// `audioCodec` is optional.
// if (data[k_audioCodec].isString())
// `videoCodec` is optional.
// if (data[k_videoCodec].isString())
// `forceUniquePayloadTypes` is optional.
// `forceUniquePayloadTypes` is optional.
if
(
data
[
k_forceUniquePayloadTypes
].
isBool
())
if
(
data
[
k_forceUniquePayloadTypes
].
isBool
())
this
->
options
.
forceUniquePayloadTypes
=
data
[
k_forceUniquePayloadTypes
].
asBool
();
this
->
options
.
forceUniquePayloadTypes
=
data
[
k_forceUniquePayloadTypes
].
asBool
();
...
@@ -65,6 +73,8 @@ namespace RTC
...
@@ -65,6 +73,8 @@ namespace RTC
static
const
Json
::
StaticString
k_roomId
(
"roomId"
);
static
const
Json
::
StaticString
k_roomId
(
"roomId"
);
static
const
Json
::
StaticString
k_options
(
"options"
);
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_forceUniquePayloadTypes
(
"forceUniquePayloadTypes"
);
static
const
Json
::
StaticString
k_peers
(
"peers"
);
static
const
Json
::
StaticString
k_peers
(
"peers"
);
static
const
Json
::
StaticString
k_mapRtpReceiverRtpSenders
(
"mapRtpReceiverRtpSenders"
);
static
const
Json
::
StaticString
k_mapRtpReceiverRtpSenders
(
"mapRtpReceiverRtpSenders"
);
...
@@ -77,7 +87,13 @@ namespace RTC
...
@@ -77,7 +87,13 @@ namespace RTC
// Add `roomId`.
// Add `roomId`.
json
[
k_roomId
]
=
(
Json
::
UInt
)
this
->
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_options
[
k_forceUniquePayloadTypes
]
=
this
->
options
.
forceUniquePayloadTypes
;
json
[
k_options
]
=
json_options
;
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 "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "MediaSoupError.h"
...
@@ -8,47 +8,48 @@ namespace RTC
...
@@ -8,47 +8,48 @@ namespace RTC
{
{
/* Instance methods. */
/* Instance methods. */
RtpRtxParameters
::
RtpRtx
Parameters
(
Json
::
Value
&
data
)
FecCodecParameters
::
FecCodec
Parameters
(
Json
::
Value
&
data
)
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
if
(
!
data
.
isObject
())
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.
// `payloadType` is optional.
if
(
data
[
k_payloadType
].
isUInt
())
if
(
data
[
k_payloadType
].
isUInt
())
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
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
();
MS_TRACE
();
}
}
Json
::
Value
RtpRtx
Parameters
::
toJson
()
Json
::
Value
FecCodec
Parameters
::
toJson
()
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_mechanism
(
"mechanism"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `mechanism`.
json
[
k_mechanism
]
=
this
->
mechanism
;
// Add `payloadType`.
// Add `payloadType`.
if
(
this
->
payloadType
)
if
(
this
->
payloadType
)
json
[
k_payloadType
]
=
(
Json
::
UInt
)
this
->
payloadType
;
json
[
k_payloadType
]
=
(
Json
::
UInt
)
this
->
payloadType
;
// Add `ssrc`.
if
(
this
->
ssrc
)
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
return
json
;
return
json
;
}
}
}
}
worker/src/RTC/RtpParameters/RtcpFeedback.cpp
浏览文件 @
b561dc41
...
@@ -16,7 +16,7 @@ namespace RTC
...
@@ -16,7 +16,7 @@ namespace RTC
static
const
Json
::
StaticString
k_parameter
(
"parameter"
);
static
const
Json
::
StaticString
k_parameter
(
"parameter"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
RtcpFeedback
is not an object"
);
MS_THROW_ERROR
(
"
`RtcpFeedback`
is not an object"
);
// `type` is mandatory.
// `type` is mandatory.
if
(
!
data
[
k_type
].
isString
())
if
(
!
data
[
k_type
].
isString
())
...
...
worker/src/RTC/RtpParameters/RtcpParameters.cpp
浏览文件 @
b561dc41
...
@@ -17,7 +17,7 @@ namespace RTC
...
@@ -17,7 +17,7 @@ namespace RTC
static
const
Json
::
StaticString
k_reducedSize
(
"reducedSize"
);
static
const
Json
::
StaticString
k_reducedSize
(
"reducedSize"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtcpPa
rameters
is not an object"
);
MS_THROW_ERROR
(
"RtcpPa
`rameters`
is not an object"
);
// `cname` is mandatory.
// `cname` is mandatory.
if
(
!
data
[
k_cname
].
isString
())
if
(
!
data
[
k_cname
].
isString
())
...
...
worker/src/RTC/RtpParameters/RtpCodecParameters.cpp
浏览文件 @
b561dc41
...
@@ -17,11 +17,13 @@ namespace RTC
...
@@ -17,11 +17,13 @@ namespace RTC
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_maxptime
(
"maxptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
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_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"
RtpCodecParameters
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
())
...
@@ -49,6 +51,27 @@ namespace RTC
...
@@ -49,6 +51,27 @@ namespace RTC
if
(
data
[
k_numChannels
].
isUInt
())
if
(
data
[
k_numChannels
].
isUInt
())
this
->
numChannels
=
(
uint32_t
)
data
[
k_numChannels
].
asUInt
();
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.
// `rtcpFeedback` is optional.
if
(
data
[
k_rtcpFeedback
].
isArray
())
if
(
data
[
k_rtcpFeedback
].
isArray
())
{
{
...
@@ -124,6 +147,8 @@ namespace RTC
...
@@ -124,6 +147,8 @@ namespace RTC
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_maxptime
(
"maxptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
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_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
...
@@ -147,6 +172,22 @@ namespace RTC
...
@@ -147,6 +172,22 @@ namespace RTC
if
(
this
->
numChannels
)
if
(
this
->
numChannels
)
json
[
k_numChannels
]
=
(
Json
::
UInt
)
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).
// Add `rtcpFeedback` (if any).
if
(
!
this
->
rtcpFeedback
.
empty
())
if
(
!
this
->
rtcpFeedback
.
empty
())
{
{
...
...
worker/src/RTC/RtpParameters/RtpEncodingParameters.cpp
浏览文件 @
b561dc41
...
@@ -12,19 +12,13 @@ namespace RTC
...
@@ -12,19 +12,13 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtxSsrc
(
"rtxSsrc"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_fecSsrc
(
"fecSsrc"
);
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RtpEncodingParameters is not an object"
);
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
();
// `ssrc` is mandatory.
// `ssrc` is mandatory.
if
(
!
data
[
k_ssrc
].
isUInt
())
if
(
!
data
[
k_ssrc
].
isUInt
())
...
@@ -32,19 +26,17 @@ namespace RTC
...
@@ -32,19 +26,17 @@ namespace RTC
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
this
->
ssrc
=
(
uint32_t
)
data
[
k_ssrc
].
asUInt
();
// `fec` is optional.
// `rtxSsrc` is optional.
if
(
data
[
k_fec
].
isObject
())
if
(
data
[
k_rtxSsrc
].
isUInt
())
{
this
->
rtxSsrc
=
(
uint32_t
)
data
[
k_rtxSsrc
].
asUInt
();
this
->
fec
=
RtpFecParameters
(
data
[
k_fec
]);
this
->
hasFec
=
true
;
}
// `rtx` is optional.
// `fecSsrc` is optional.
if
(
data
[
k_rtx
].
isObject
())
if
(
data
[
k_fecSsrc
].
isUInt
())
{
this
->
fecSsrc
=
(
uint32_t
)
data
[
k_fecSsrc
].
asUInt
();
this
->
rtx
=
RtpRtxParameters
(
data
[
k_rtx
]);
this
->
hasRtx
=
true
;
// `codecPayloadType` is optional.
}
if
(
data
[
k_codecPayloadType
].
isUInt
())
this
->
codecPayloadType
=
(
uint8_t
)
data
[
k_codecPayloadType
].
asUInt
();
}
}
RtpEncodingParameters
::~
RtpEncodingParameters
()
RtpEncodingParameters
::~
RtpEncodingParameters
()
...
@@ -56,26 +48,27 @@ namespace RTC
...
@@ -56,26 +48,27 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_ssrc
(
"ssrc"
);
static
const
Json
::
StaticString
k_fec
(
"fec"
);
static
const
Json
::
StaticString
k_rtxSsrc
(
"rtxSsrc"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_fecSsrc
(
"fecSsrc"
);
static
const
Json
::
StaticString
k_codecPayloadType
(
"codecPayloadType"
);
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `codecPayloadType`.
json
[
k_codecPayloadType
]
=
(
Json
::
UInt
)
this
->
codecPayloadType
;
// Add `ssrc`.
// Add `ssrc`.
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
json
[
k_ssrc
]
=
(
Json
::
UInt
)
this
->
ssrc
;
// Add `fec`
// Add `rtxSsrc`.
if
(
this
->
hasFec
)
if
(
this
->
rtxSsrc
)
json
[
k_fec
]
=
this
->
fec
.
toJson
();
json
[
k_rtxSsrc
]
=
(
Json
::
UInt
)
this
->
rtxSsrc
;
// Add `fecSsrc`.
if
(
this
->
fecSsrc
)
json
[
k_fecSsrc
]
=
(
Json
::
UInt
)
this
->
fecSsrc
;
// Add `
rtx`
// Add `
codecPayloadType`.
if
(
this
->
hasRtx
)
if
(
this
->
codecPayloadType
)
json
[
k_
rtx
]
=
this
->
rtx
.
toJson
()
;
json
[
k_
codecPayloadType
]
=
(
Json
::
UInt
)
this
->
codecPayloadType
;
return
json
;
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论