提交 1d24755c authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Changes in Consumer classes

上级 46bd7687
......@@ -66,7 +66,13 @@ namespace RTC
inline bool SimpleConsumer::IsActive() const
{
return (RTC::Consumer::IsActive() && this->producerRtpStream);
// clang-format off
return (
RTC::Consumer::IsActive() &&
this->producerRtpStream &&
this->producerRtpStream->GetScore() > 0u
);
// clang-format on
}
inline std::vector<RTC::RtpStreamSend*> SimpleConsumer::GetRtpStreams()
......
......@@ -77,7 +77,13 @@ namespace RTC
inline bool SvcConsumer::IsActive() const
{
return (RTC::Consumer::IsActive() && this->producerRtpStream);
// clang-format off
return (
RTC::Consumer::IsActive() &&
this->producerRtpStream &&
this->producerRtpStream->GetScore() > 0u
);
// clang-format on
}
inline std::vector<RTC::RtpStreamSend*> SvcConsumer::GetRtpStreams()
......
......@@ -140,19 +140,8 @@ namespace RTC
{
MS_TRACE();
// Audio SimpleConsumer does not play the BWE game.
if (this->kind != RTC::Media::Kind::VIDEO)
return 0u;
// TODO: Yes?
MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
if (!IsActive())
return 0u;
// TODO: Use app given priority.
return 1u;
// SimpleConsumer does not play the BWE game.
return 0u;
}
uint32_t SimpleConsumer::IncreaseLayer(uint32_t /*bitrate*/, bool /*considerLoss*/)
......
......@@ -530,7 +530,7 @@ namespace RTC
MS_TRACE();
MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
MS_ASSERT(RTC::Consumer::IsActive(), "should be active (Consumer::IsActive())");
MS_ASSERT(IsActive(), "should be active");
auto provisionalTargetSpatialLayer = this->provisionalTargetSpatialLayer;
auto provisionalTargetTemporalLayer = this->provisionalTargetTemporalLayer;
......@@ -574,7 +574,7 @@ namespace RTC
MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
if (!RTC::Consumer::IsActive())
if (!IsActive())
return 0u;
int16_t desiredSpatialLayer{ -1 };
......@@ -769,7 +769,7 @@ namespace RTC
if (this->keyFrameForTsOffsetRequested)
{
// Give up and use the theoretical offset.
tsExtraOffset = 1u;
tsExtraOffset = 0u;
}
else if (tsExtraOffset > maxTsExtraOffset)
{
......
......@@ -446,6 +446,7 @@ namespace RTC
MS_TRACE();
MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
MS_ASSERT(IsActive(), "should be active");
auto provisionalTargetSpatialLayer = this->provisionalTargetSpatialLayer;
auto provisionalTargetTemporalLayer = this->provisionalTargetTemporalLayer;
......@@ -454,7 +455,7 @@ namespace RTC
this->provisionalTargetSpatialLayer = -1;
this->provisionalTargetTemporalLayer = -1;
if (!RTC::Consumer::IsActive())
if (!IsActive())
return;
// clang-format off
......@@ -492,13 +493,7 @@ namespace RTC
MS_ASSERT(this->externallyManagedBitrate, "bitrate is not externally managed");
if (!RTC::Consumer::IsActive())
return 0u;
if (!this->producerRtpStream)
return 0u;
if (this->producerRtpStream->GetScore() == 0u)
if (!IsActive())
return 0u;
int16_t desiredSpatialLayer{ -1 };
......
......@@ -795,16 +795,13 @@ namespace RTC
RTC::BweType bweType;
// Use transport-cc if:
// - it's a simulcast or SVC Consumer, and
// - it's video, and
// - there is transport-wide-cc-01 RTP header extension, and
// - there is "transport-cc" in codecs RTCP feedback.
//
// clang-format off
if (
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.transportWideCc01 != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
......@@ -824,16 +821,13 @@ namespace RTC
bweType = RTC::BweType::TRANSPORT_CC;
}
// Use REMB if:
// - it's a simulcast or SVC Consumer, and
// - it's video, and
// - there is abs-send-time RTP header extension, and
// - there is "remb" in codecs RTCP feedback.
//
// clang-format off
else if (
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.absSendTime != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
......@@ -879,17 +873,14 @@ namespace RTC
#ifdef ENABLE_RTC_SENDER_BANDWIDTH_ESTIMATOR
// Create SenderBandwidthEstimator if:
// - not already created,
// - it's a simulcast or SVC Consumer, and
// - it's video, and
// - there is transport-wide-cc-01 RTP header extension, and
// - there is "transport-cc" in codecs RTCP feedback.
//
// clang-format off
if (
!this->senderBwe &&
(
consumer->GetType() == RTC::RtpParameters::Type::SIMULCAST ||
consumer->GetType() == RTC::RtpParameters::Type::SVC
) &&
consumer->GetKind() == RTC::Media::Kind::VIDEO &&
rtpHeaderExtensionIds.transportWideCc01 != 0u &&
std::any_of(
codecs.begin(), codecs.end(), [](const RTC::RtpCodecParameters& codec)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论