提交 5af3da9b authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Producer: allow unset encodings

上级 7a7b9bbb
......@@ -285,6 +285,10 @@ class Transport extends EnhancedEventEmitter
else if (appData && typeof appData !== 'object')
throw new TypeError('if given, appData must be an object');
// If missing encodings, add one.
if (!rtpParameters.encodings || !Array.isArray(rtpParameters.encodings))
rtpParameters.encodings = [ {} ];
// Don't do this in PipeTransports since there we must keep CNAME value in
// each Producer.
if (this.constructor.name !== 'PipeTransport')
......
......@@ -99,9 +99,8 @@ test('webRtcTransport.produce() succeeds', async () =>
id : 12
}
],
// Single encoding without ssrc and rid on purpose.
encodings : [ { dtx: true } ],
rtcp :
// Missing encodings on purpose.
rtcp :
{
cname : 'audio-1'
}
......@@ -483,7 +482,7 @@ test('transport.produce() with no MID and with single encoding without RID or SS
channels : 2
}
],
encodings : [ { dtx: true } ],
encodings : [ {} ],
rtcp :
{
cname : 'audio-2'
......@@ -539,7 +538,7 @@ test('producer.dump() succeeds', async () =>
expect(data.rtpParameters.encodings.length).toBe(1);
expect(data.rtpParameters.encodings).toEqual(
[
{ codecPayloadType: 111, dtx: true }
{ codecPayloadType: 111 }
]);
expect(data.type).toBe('simple');
......
......@@ -656,7 +656,7 @@ namespace RTC
auto* rtpStream = it->second;
// Ensure no RTX SSRC was previously detected.
// Ensure no RTX ssrc was previously detected.
if (rtpStream->HasRtx())
{
MS_DEBUG_2TAGS(rtp, rtx, "ignoring RTX packet with new ssrc (ssrc lookup)");
......@@ -667,7 +667,7 @@ namespace RTC
// Update the stream RTX data.
rtpStream->SetRtx(payloadType, ssrc);
// Insert the new RTX SSRC into the map.
// Insert the new RTX ssrc into the map.
this->mapRtxSsrcRtpStream[ssrc] = rtpStream;
return rtpStream;
......@@ -720,7 +720,7 @@ namespace RTC
if (rtpStream->GetRid() == rid)
{
// Ensure no RTX SSRC was previously detected.
// Ensure no RTX ssrc was previously detected.
if (rtpStream->HasRtx())
{
MS_DEBUG_2TAGS(rtp, rtx, "ignoring RTX packet with new SSRC (RID lookup)");
......@@ -731,7 +731,7 @@ namespace RTC
// Update the stream RTX data.
rtpStream->SetRtx(payloadType, ssrc);
// Insert the new RTX SSRC into the map.
// Insert the new RTX ssrc into the map.
this->mapRtxSsrcRtpStream[ssrc] = rtpStream;
return rtpStream;
......@@ -749,13 +749,14 @@ namespace RTC
return nullptr;
}
// If not found, and there is a single encoding, this may be a media or RTX
// stream and the single encoding does not signal nor SSRC nor RID.
// If not found, and there is a single encoding without ssrc and RID, this
// may be the media or RTX stream.
//
// clang-format off
if (
this->rtpParameters.encodings.size() == 1 &&
this->mapSsrcRtpStream.size() <= 1
!this->rtpParameters.encodings[0].ssrc &&
this->rtpParameters.encodings[0].rid.empty()
)
// clang-format on
{
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论