diff options
Diffstat (limited to 'call')
-rw-r--r-- | call/BUILD.gn | 1 | ||||
-rw-r--r-- | call/audio_receive_stream.h | 6 | ||||
-rw-r--r-- | call/call.cc | 32 | ||||
-rw-r--r-- | call/call.h | 2 | ||||
-rw-r--r-- | call/degraded_call.cc | 4 | ||||
-rw-r--r-- | call/degraded_call.h | 2 | ||||
-rw-r--r-- | call/flexfec_receive_stream_impl.cc | 19 | ||||
-rw-r--r-- | call/flexfec_receive_stream_impl.h | 7 | ||||
-rw-r--r-- | call/receive_stream.h | 7 |
9 files changed, 39 insertions, 41 deletions
diff --git a/call/BUILD.gn b/call/BUILD.gn index fbf2fe379f..ba0da32bca 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -351,6 +351,7 @@ rtc_source_set("receive_stream_interface") { "../api:scoped_refptr", "../api/crypto:frame_decryptor_interface", "../api/transport/rtp:rtp_source", + "../modules/rtp_rtcp:rtp_rtcp_format", ] } diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h index 4846620342..45f2feb795 100644 --- a/call/audio_receive_stream.h +++ b/call/audio_receive_stream.h @@ -199,6 +199,12 @@ class AudioReceiveStream : public MediaReceiveStream { // post initialization. virtual uint32_t remote_ssrc() const = 0; + // Access the currently set rtp extensions. Must be called on the packet + // delivery thread. + // TODO(tommi): This is currently only called from + // `WebRtcAudioReceiveStream::GetRtpParameters()`. See if we can remove it. + virtual const std::vector<RtpExtension>& GetRtpExtensions() const = 0; + protected: virtual ~AudioReceiveStream() {} }; diff --git a/call/call.cc b/call/call.cc index a89aed37de..ed5ee1bc18 100644 --- a/call/call.cc +++ b/call/call.cc @@ -79,15 +79,14 @@ bool SendPeriodicFeedback(const std::vector<RtpExtension>& extensions) { return true; } +bool HasTransportSequenceNumber(const RtpHeaderExtensionMap& map) { + return map.IsRegistered(kRtpExtensionTransportSequenceNumber) || + map.IsRegistered(kRtpExtensionTransportSequenceNumber02); +} + bool UseSendSideBwe(const ReceiveStream* stream) { - if (!stream->transport_cc()) - return false; - for (const auto& extension : stream->GetRtpExtensions()) { - if (extension.uri == RtpExtension::kTransportSequenceNumberUri || - extension.uri == RtpExtension::kTransportSequenceNumberV2Uri) - return true; - } - return false; + return stream->transport_cc() && + HasTransportSequenceNumber(stream->GetRtpExtensionMap()); } const int* FindKeyByValue(const std::map<int, int>& m, int v) { @@ -237,7 +236,7 @@ class Call final : public webrtc::Call, webrtc::VideoReceiveStream* receive_stream) override; FlexfecReceiveStream* CreateFlexfecReceiveStream( - const FlexfecReceiveStream::Config& config) override; + const FlexfecReceiveStream::Config config) override; void DestroyFlexfecReceiveStream( FlexfecReceiveStream* receive_stream) override; @@ -1206,27 +1205,23 @@ void Call::DestroyVideoReceiveStream( } FlexfecReceiveStream* Call::CreateFlexfecReceiveStream( - const FlexfecReceiveStream::Config& config) { + const FlexfecReceiveStream::Config config) { TRACE_EVENT0("webrtc", "Call::CreateFlexfecReceiveStream"); RTC_DCHECK_RUN_ON(worker_thread_); - RecoveredPacketReceiver* recovered_packet_receiver = this; - - FlexfecReceiveStreamImpl* receive_stream; - // Unlike the video and audio receive streams, FlexfecReceiveStream implements // RtpPacketSinkInterface itself, and hence its constructor passes its `this` // pointer to video_receiver_controller_->CreateStream(). Calling the // constructor while on the worker thread ensures that we don't call // OnRtpPacket until the constructor is finished and the object is // in a valid state, since OnRtpPacket runs on the same thread. - receive_stream = new FlexfecReceiveStreamImpl( - clock_, config, recovered_packet_receiver, call_stats_->AsRtcpRttStats()); + FlexfecReceiveStreamImpl* receive_stream = new FlexfecReceiveStreamImpl( + clock_, std::move(config), this, call_stats_->AsRtcpRttStats()); // TODO(bugs.webrtc.org/11993): Set this up asynchronously on the network // thread. receive_stream->RegisterWithTransport(&video_receiver_controller_); - RegisterReceiveStream(config.rtp.remote_ssrc, receive_stream); + RegisterReceiveStream(receive_stream->remote_ssrc(), receive_stream); // TODO(brandtr): Store config in RtcEventLog here. @@ -1689,8 +1684,7 @@ bool Call::IdentifyReceivedPacket(RtpPacketReceived& packet, return false; } - packet.IdentifyExtensions( - RtpHeaderExtensionMap(it->second->GetRtpExtensions())); + packet.IdentifyExtensions(it->second->GetRtpExtensionMap()); if (use_send_side_bwe) { *use_send_side_bwe = UseSendSideBwe(it->second); diff --git a/call/call.h b/call/call.h index e4652d259a..9d6d4ee11a 100644 --- a/call/call.h +++ b/call/call.h @@ -127,7 +127,7 @@ class Call { // protected by a FlexfecReceiveStream, the latter should be created before // the former. virtual FlexfecReceiveStream* CreateFlexfecReceiveStream( - const FlexfecReceiveStream::Config& config) = 0; + const FlexfecReceiveStream::Config config) = 0; virtual void DestroyFlexfecReceiveStream( FlexfecReceiveStream* receive_stream) = 0; diff --git a/call/degraded_call.cc b/call/degraded_call.cc index ef53851d46..3790c78927 100644 --- a/call/degraded_call.cc +++ b/call/degraded_call.cc @@ -247,8 +247,8 @@ void DegradedCall::DestroyVideoReceiveStream( } FlexfecReceiveStream* DegradedCall::CreateFlexfecReceiveStream( - const FlexfecReceiveStream::Config& config) { - return call_->CreateFlexfecReceiveStream(config); + const FlexfecReceiveStream::Config config) { + return call_->CreateFlexfecReceiveStream(std::move(config)); } void DegradedCall::DestroyFlexfecReceiveStream( diff --git a/call/degraded_call.h b/call/degraded_call.h index dfd041a1c5..59f5236593 100644 --- a/call/degraded_call.h +++ b/call/degraded_call.h @@ -78,7 +78,7 @@ class DegradedCall : public Call, private PacketReceiver { void DestroyVideoReceiveStream(VideoReceiveStream* receive_stream) override; FlexfecReceiveStream* CreateFlexfecReceiveStream( - const FlexfecReceiveStream::Config& config) override; + const FlexfecReceiveStream::Config config) override; void DestroyFlexfecReceiveStream( FlexfecReceiveStream* receive_stream) override; diff --git a/call/flexfec_receive_stream_impl.cc b/call/flexfec_receive_stream_impl.cc index 24e2120ece..6f2b5dcad7 100644 --- a/call/flexfec_receive_stream_impl.cc +++ b/call/flexfec_receive_stream_impl.cc @@ -137,10 +137,11 @@ std::unique_ptr<ModuleRtpRtcpImpl2> CreateRtpRtcpModule( FlexfecReceiveStreamImpl::FlexfecReceiveStreamImpl( Clock* clock, - const Config& config, + Config config, RecoveredPacketReceiver* recovered_packet_receiver, RtcpRttStats* rtt_stats) - : config_(config), + : extension_map_(std::move(config.rtp.extensions)), + config_(std::move(config)), receiver_(MaybeCreateFlexfecReceiver(clock, config_, recovered_packet_receiver)), @@ -174,7 +175,7 @@ void FlexfecReceiveStreamImpl::RegisterWithTransport( // here at all, we'd then delete the OnRtpPacket method and instead register // `receiver_` as the RtpPacketSinkInterface for this stream. rtp_stream_receiver_ = - receiver_controller->CreateReceiver(config_.rtp.remote_ssrc, this); + receiver_controller->CreateReceiver(remote_ssrc(), this); } void FlexfecReceiveStreamImpl::UnregisterFromTransport() { @@ -190,7 +191,7 @@ void FlexfecReceiveStreamImpl::OnRtpPacket(const RtpPacketReceived& packet) { receiver_->OnRtpPacket(packet); // Do not report media packets in the RTCP RRs generated by `rtp_rtcp_`. - if (packet.Ssrc() == config_.rtp.remote_ssrc) { + if (packet.Ssrc() == remote_ssrc()) { rtp_receive_statistics_->OnRtpPacket(packet); } } @@ -204,16 +205,12 @@ FlexfecReceiveStreamImpl::Stats FlexfecReceiveStreamImpl::GetStats() const { void FlexfecReceiveStreamImpl::SetRtpExtensions( std::vector<RtpExtension> extensions) { RTC_DCHECK_RUN_ON(&packet_sequence_checker_); - // TODO(tommi): Remove this cast once header extensions are managed outside - // of the config struct. - const_cast<std::vector<RtpExtension>&>(config_.rtp.extensions) = - std::move(extensions); + extension_map_.Reset(extensions); } -const std::vector<RtpExtension>& FlexfecReceiveStreamImpl::GetRtpExtensions() - const { +RtpHeaderExtensionMap FlexfecReceiveStreamImpl::GetRtpExtensionMap() const { RTC_DCHECK_RUN_ON(&packet_sequence_checker_); - return config_.rtp.extensions; + return extension_map_; } } // namespace webrtc diff --git a/call/flexfec_receive_stream_impl.h b/call/flexfec_receive_stream_impl.h index 1858da7c6c..e25b7f09c2 100644 --- a/call/flexfec_receive_stream_impl.h +++ b/call/flexfec_receive_stream_impl.h @@ -34,7 +34,7 @@ class RtpStreamReceiverInterface; class FlexfecReceiveStreamImpl : public FlexfecReceiveStream { public: FlexfecReceiveStreamImpl(Clock* clock, - const Config& config, + Config config, RecoveredPacketReceiver* recovered_packet_receiver, RtcpRttStats* rtt_stats); // Destruction happens on the worker thread. Prior to destruction the caller @@ -60,7 +60,8 @@ class FlexfecReceiveStreamImpl : public FlexfecReceiveStream { // ReceiveStream impl. void SetRtpExtensions(std::vector<RtpExtension> extensions) override; - const std::vector<RtpExtension>& GetRtpExtensions() const override; + RtpHeaderExtensionMap GetRtpExtensionMap() const override; + uint32_t remote_ssrc() const { return config_.rtp.remote_ssrc; } bool transport_cc() const override { RTC_DCHECK_RUN_ON(&packet_sequence_checker_); @@ -70,6 +71,8 @@ class FlexfecReceiveStreamImpl : public FlexfecReceiveStream { private: RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_sequence_checker_; + RtpHeaderExtensionMap extension_map_; + // Config. Mostly const, header extensions may change, which is an exception // case that's specifically handled in `SetRtpExtensions`, which must be // called on the `packet_sequence_checker` thread. diff --git a/call/receive_stream.h b/call/receive_stream.h index 93ca03e8f5..0464a70a28 100644 --- a/call/receive_stream.h +++ b/call/receive_stream.h @@ -18,6 +18,7 @@ #include "api/media_types.h" #include "api/scoped_refptr.h" #include "api/transport/rtp/rtp_source.h" +#include "modules/rtp_rtcp/include/rtp_header_extension_map.h" namespace webrtc { @@ -56,11 +57,7 @@ class ReceiveStream { // Set/change the rtp header extensions. Must be called on the packet // delivery thread. virtual void SetRtpExtensions(std::vector<RtpExtension> extensions) = 0; - - // Access the currently set rtp extensions. Must be called on the packet - // delivery thread. - // TODO(tommi): Consider using `RtpHeaderExtensionMap` instead. - virtual const std::vector<RtpExtension>& GetRtpExtensions() const = 0; + virtual RtpHeaderExtensionMap GetRtpExtensionMap() const = 0; // Returns a bool for whether feedback for send side bandwidth estimation is // enabled. See |