提交 820e9564 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix ortc.getConsumerRtpParameters()

上级 1369b9f5
......@@ -379,10 +379,8 @@ exports.getConsumableRtpParameters = function(params, caps, rtpMapping)
/**
* Generate RTP parameters for a specific Consumer.
*
* NOTE: All the codecs of the consumable RTP parameters are copied verbatim
* (all but RTX codecs in case the Peer does not support RTX). It's up to the
* remote Consumer to check the codecs and decide whether it can enable this
* Consumer or not.
* NOTE: It's up to theremote Consumer to check the codecs and decide whether it
* can enable this Consumer or not.
*
* @param {RTCRtpParameters} consumableRtpParameters - Consumable RTP parameters.
* @param {RTCRtpCapabilities} rtpCapabilities - Peer RTP capabilities.
......@@ -400,24 +398,25 @@ exports.getConsumerRtpParameters = function(consumableRtpParameters, rtpCapabili
rtcp : consumableRtpParameters.rtcp
};
const consumableCodecs = utils.cloneObject(consumableRtpParameters.codecs);
let rtxSupported = false;
consumerParams.codecs = consumableRtpParameters.codecs
.filter((codec) =>
{
if (codec.name.toLowerCase() !== 'rtx')
return true;
for (const codec of consumableCodecs)
{
const matchedCapCodec = rtpCapabilities.codecs
.find((capCodec) => capCodec.preferredPayloadType === codec.payloadType);
if (!matchedCapCodec)
continue;
const hasRtxCodec = rtpCapabilities.codecs
.some((capCodec) => capCodec.preferredPayloadType === codec.payloadType);
// Reduce RTCP feedbacks.
codec.rtcpFeedback = matchedCapCodec.rtcpFeedback;
if (hasRtxCodec)
{
rtxSupported = true;
consumerParams.codecs.push(codec);
return true;
}
});
if (!rtxSupported && codec.name.toLowerCase() === 'rtx')
rtxSupported = true;
}
consumerParams.headerExtensions = consumableRtpParameters.headerExtensions
.filter((ext) =>
......
......@@ -18,14 +18,8 @@ namespace RTC
/* Instance methods. */
Consumer::Consumer(
Channel::Notifier* notifier,
uint32_t consumerId,
RTC::Media::Kind kind,
uint32_t sourceProducerId)
: consumerId(consumerId),
kind(kind),
sourceProducerId(sourceProducerId),
notifier(notifier)
Channel::Notifier* notifier, uint32_t consumerId, RTC::Media::Kind kind, uint32_t sourceProducerId)
: consumerId(consumerId), kind(kind), sourceProducerId(sourceProducerId), notifier(notifier)
{
MS_TRACE();
......@@ -151,7 +145,7 @@ namespace RTC
if (IsEnabled())
Disable();
this->transport = transport;
this->transport = transport;
this->rtpParameters = rtpParameters;
FillSupportedCodecPayloadTypes();
......
......@@ -455,8 +455,7 @@ namespace RTC
return;
}
consumer = new RTC::Consumer(
this->notifier, consumerId, kind, producer->producerId);
consumer = new RTC::Consumer(this->notifier, consumerId, kind, producer->producerId);
// If the Producer is paused tell it to the new Consumer.
if (producer->IsPaused())
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论