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

Changes in Consumer classes

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