提交 45e3a45f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Minor changes

上级 4a794f71
...@@ -170,6 +170,16 @@ class RtpReceiver extends EventEmitter ...@@ -170,6 +170,16 @@ class RtpReceiver extends EventEmitter
}); });
} }
isRtpReceiver()
{
return true;
}
isRtpSender()
{
return false;
}
/** /**
* Start receiving media * Start receiving media
* @param {Object} rtpParameters * @param {Object} rtpParameters
......
...@@ -124,6 +124,16 @@ class RtpSender extends EventEmitter ...@@ -124,6 +124,16 @@ class RtpSender extends EventEmitter
}); });
} }
isRtpSender()
{
return true;
}
isRtpReceiver()
{
return false;
}
/** /**
* Assign Transport * Assign Transport
* @return {Promise} Resolves to this * @return {Promise} Resolves to this
......
...@@ -51,8 +51,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time ...@@ -51,8 +51,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
encodings : encodings :
[ [
{ {
ssrc : 111222330,
codecPayloadType : 111, codecPayloadType : 111,
ssrc : 111222330,
fec : fec :
{ {
mechanism : 'foo', mechanism : 'foo',
...@@ -65,8 +65,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time ...@@ -65,8 +65,8 @@ tap.test('rtpReceiver.receive() with valid `rtpParameters` must succeed', { time
} }
}, },
{ {
ssrc : 111222331, codecPayloadType : 8,
codecPayloadType : 8 ssrc : 111222331
} }
], ],
rtcp : rtcp :
......
...@@ -40,6 +40,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim ...@@ -40,6 +40,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
encodings : encodings :
[ [
{ {
codecPayloadType : 101,
ssrc : 100000001 ssrc : 100000001
} }
], ],
...@@ -65,6 +66,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim ...@@ -65,6 +66,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
encodings : encodings :
[ [
{ {
codecPayloadType : 112,
ssrc : 100000002 ssrc : 100000002
} }
], ],
...@@ -95,6 +97,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim ...@@ -95,6 +97,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
encodings : encodings :
[ [
{ {
codecPayloadType : 121,
ssrc : 200000002 ssrc : 200000002
} }
], ],
...@@ -120,6 +123,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim ...@@ -120,6 +123,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
encodings : encodings :
[ [
{ {
codecPayloadType : 131,
ssrc : 300000001 ssrc : 300000001
} }
], ],
...@@ -145,6 +149,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim ...@@ -145,6 +149,7 @@ tap.test('alice, bob and carol create RtpReceivers and expect RtpSenders', { tim
encodings : encodings :
[ [
{ {
codecPayloadType : 132,
ssrc : 300000002 ssrc : 300000002
} }
], ],
......
...@@ -12,24 +12,26 @@ namespace RTC ...@@ -12,24 +12,26 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
static const Json::StaticString k_ssrc("ssrc");
static const Json::StaticString k_codecPayloadType("codecPayloadType"); 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_fec("fec");
static const Json::StaticString k_rtx("rtx"); static const Json::StaticString k_rtx("rtx");
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())
MS_THROW_ERROR("missing `RtpEncodingParameters.ssrc`"); MS_THROW_ERROR("missing `RtpEncodingParameters.ssrc`");
this->ssrc = (uint32_t)data[k_ssrc].asUInt(); this->ssrc = (uint32_t)data[k_ssrc].asUInt();
// `codecPayloadType` is optional.
if (data[k_codecPayloadType].isUInt())
this->codecPayloadType = (uint8_t)data[k_codecPayloadType].asUInt();
// `fec` is optional. // `fec` is optional.
if (data[k_fec].isObject()) if (data[k_fec].isObject())
{ {
...@@ -54,20 +56,19 @@ namespace RTC ...@@ -54,20 +56,19 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
static const Json::StaticString k_ssrc("ssrc");
static const Json::StaticString k_codecPayloadType("codecPayloadType"); 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_fec("fec");
static const Json::StaticString k_rtx("rtx"); static const Json::StaticString k_rtx("rtx");
Json::Value json(Json::objectValue); Json::Value json(Json::objectValue);
// Add `ssrc`.
json[k_ssrc] = (Json::UInt)this->ssrc;
// Add `codecPayloadType`. // Add `codecPayloadType`.
if (this->codecPayloadType)
json[k_codecPayloadType] = (Json::UInt)this->codecPayloadType; json[k_codecPayloadType] = (Json::UInt)this->codecPayloadType;
// Add `ssrc`.
json[k_ssrc] = (Json::UInt)this->ssrc;
// Add `fec` // Add `fec`
if (this->hasFec) if (this->hasFec)
json[k_fec] = this->fec.toJson(); json[k_fec] = this->fec.toJson();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论