diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc index f45f608a2a..77031cd120 100644 --- a/audio/audio_receive_stream.cc +++ b/audio/audio_receive_stream.cc @@ -211,6 +211,11 @@ void AudioReceiveStream::Stop() { audio_state()->RemoveReceivingStream(this); } +bool AudioReceiveStream::transport_cc() const { + RTC_DCHECK_RUN_ON(&packet_sequence_checker_); + return config_.rtp.transport_cc; +} + bool AudioReceiveStream::IsRunning() const { RTC_DCHECK_RUN_ON(&worker_thread_checker_); return playing_; diff --git a/audio/audio_receive_stream.h b/audio/audio_receive_stream.h index 6a4c0222c3..0d18dc9516 100644 --- a/audio/audio_receive_stream.h +++ b/audio/audio_receive_stream.h @@ -83,7 +83,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream, // webrtc::AudioReceiveStream implementation. void Start() override; void Stop() override; - const RtpConfig& rtp_config() const override { return config_.rtp; } + bool transport_cc() const override; bool IsRunning() const override; void SetDepacketizerToDecoderFrameTransformer( rtc::scoped_refptr frame_transformer) diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h index b18e076530..4846620342 100644 --- a/call/audio_receive_stream.h +++ b/call/audio_receive_stream.h @@ -108,7 +108,7 @@ class AudioReceiveStream : public MediaReceiveStream { std::string ToString() const; // Receive-stream specific RTP settings. - struct Rtp : public RtpConfig { + struct Rtp : public ReceiveStreamRtpConfig { Rtp(); ~Rtp(); diff --git a/call/call.cc b/call/call.cc index ae6c767a39..4c7bebc4b3 100644 --- a/call/call.cc +++ b/call/call.cc @@ -80,7 +80,7 @@ bool SendPeriodicFeedback(const std::vector& extensions) { } bool UseSendSideBwe(const ReceiveStream* stream) { - if (!stream->rtp_config().transport_cc) + if (!stream->transport_cc()) return false; for (const auto& extension : stream->GetRtpExtensions()) { if (extension.uri == RtpExtension::kTransportSequenceNumberUri || diff --git a/call/flexfec_receive_stream.h b/call/flexfec_receive_stream.h index 72e544e7ec..118eb0bce5 100644 --- a/call/flexfec_receive_stream.h +++ b/call/flexfec_receive_stream.h @@ -50,7 +50,7 @@ class FlexfecReceiveStream : public RtpPacketSinkInterface, // Payload type for FlexFEC. int payload_type = -1; - RtpConfig rtp; + ReceiveStreamRtpConfig rtp; // Vector containing a single element, corresponding to the SSRC of the // media stream being protected by this FlexFEC stream. The vector MUST have diff --git a/call/flexfec_receive_stream_impl.h b/call/flexfec_receive_stream_impl.h index 0bc9faaf3d..1858da7c6c 100644 --- a/call/flexfec_receive_stream_impl.h +++ b/call/flexfec_receive_stream_impl.h @@ -61,8 +61,11 @@ class FlexfecReceiveStreamImpl : public FlexfecReceiveStream { // ReceiveStream impl. void SetRtpExtensions(std::vector extensions) override; const std::vector& GetRtpExtensions() const override; - const RtpConfig& rtp_config() const override { return config_.rtp; } uint32_t remote_ssrc() const { return config_.rtp.remote_ssrc; } + bool transport_cc() const override { + RTC_DCHECK_RUN_ON(&packet_sequence_checker_); + return config_.rtp.transport_cc; + } private: RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_; diff --git a/call/receive_stream.h b/call/receive_stream.h index 5413387a3b..93ca03e8f5 100644 --- a/call/receive_stream.h +++ b/call/receive_stream.h @@ -26,7 +26,9 @@ namespace webrtc { class ReceiveStream { public: // Receive-stream specific RTP settings. - struct RtpConfig { + // TODO(tommi): This struct isn't needed at this level anymore. Move it closer + // to where it's used. + struct ReceiveStreamRtpConfig { // Synchronization source (stream identifier) to be received. // This member will not change mid-stream and can be assumed to be const // post initialization. @@ -60,11 +62,13 @@ class ReceiveStream { // TODO(tommi): Consider using `RtpHeaderExtensionMap` instead. virtual const std::vector& GetRtpExtensions() const = 0; - // Called on the packet delivery thread since some members of the config may - // change mid-stream (e.g. the local ssrc). All mutation must also happen on - // the packet delivery thread. Return value can be assumed to - // only be used in the calling context (on the stack basically). - virtual const RtpConfig& rtp_config() const = 0; + // Returns a bool for whether feedback for send side bandwidth estimation is + // enabled. See + // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions + // for details. + // This value may change mid-stream and must be done on the same thread + // that the value is read on (i.e. packet delivery). + virtual bool transport_cc() const = 0; protected: virtual ~ReceiveStream() {} diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h index 7c66a4e275..357b4e58a9 100644 --- a/call/video_receive_stream.h +++ b/call/video_receive_stream.h @@ -174,7 +174,7 @@ class VideoReceiveStream : public MediaReceiveStream { VideoDecoderFactory* decoder_factory = nullptr; // Receive-stream specific RTP settings. - struct Rtp : public RtpConfig { + struct Rtp : public ReceiveStreamRtpConfig { Rtp(); Rtp(const Rtp&); ~Rtp(); diff --git a/media/engine/fake_webrtc_call.h b/media/engine/fake_webrtc_call.h index 47d7b183c7..64b9c0db66 100644 --- a/media/engine/fake_webrtc_call.h +++ b/media/engine/fake_webrtc_call.h @@ -110,9 +110,7 @@ class FakeAudioReceiveStream final : public webrtc::AudioReceiveStream { } private: - const webrtc::ReceiveStream::RtpConfig& rtp_config() const override { - return config_.rtp; - } + bool transport_cc() const override { return config_.rtp.transport_cc; } uint32_t remote_ssrc() const override { return config_.rtp.remote_ssrc; } void Start() override { started_ = true; } void Stop() override { started_ = false; } @@ -268,10 +266,7 @@ class FakeVideoReceiveStream final : public webrtc::VideoReceiveStream { // webrtc::VideoReceiveStream implementation. void SetRtpExtensions(std::vector extensions) override; const std::vector& GetRtpExtensions() const override; - - const webrtc::ReceiveStream::RtpConfig& rtp_config() const override { - return config_.rtp; - } + bool transport_cc() const override { return config_.rtp.transport_cc; } void Start() override; void Stop() override; @@ -301,10 +296,7 @@ class FakeFlexfecReceiveStream final : public webrtc::FlexfecReceiveStream { void SetRtpExtensions(std::vector extensions) override; const std::vector& GetRtpExtensions() const override; - - const webrtc::ReceiveStream::RtpConfig& rtp_config() const override { - return config_.rtp; - } + bool transport_cc() const override { return config_.rtp.transport_cc; } const webrtc::FlexfecReceiveStream::Config& GetConfig() const; diff --git a/video/video_receive_stream2.h b/video/video_receive_stream2.h index e5acf307e2..9513626d5d 100644 --- a/video/video_receive_stream2.h +++ b/video/video_receive_stream2.h @@ -136,8 +136,7 @@ class VideoReceiveStream2 void SetRtpExtensions(std::vector extensions) override; const std::vector& GetRtpExtensions() const override; - - const RtpConfig& rtp_config() const override { return rtp(); } + bool transport_cc() const override { return rtp().transport_cc; } webrtc::VideoReceiveStream::Stats GetStats() const override;