Remove SetOptions and other unused methods from channel interfaces Delete SetOptions from VoiceMediaSendChannelInterface, VoiceMediaReceiveChannelInterface, and VideoMediaSendChannelInterface, as they lack any external or polymorphic callers. * Remove unused implementations and associated internal logic from WebRtcVideoSendChannel, WebRtcVideoSendStream, and WebRtcVoiceReceiveChannel. * Retain WebRtcVoiceSendChannel::SetOptions as a private non-virtual helper function. * Mark internal tracking fields (default_send_options_ and options_) as const and drop their RTC_GUARDED_BY thread annotations, as they no longer undergo mutations or require explicit synchronization. * Remove an unused VideoOptions parameter from the constructor of WebRtcVideoReceiveChannel and its creation call site. * Drop now-obsolete virtual overrides and mock definitions across fake and mock implementations. Bug: none Change-Id: I508393646b4968c808d0c163fc036be969b807e9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/477040 Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47886}
diff --git a/media/base/fake_media_engine.cc b/media/base/fake_media_engine.cc index dff074e..7e9dcb2 100644 --- a/media/base/fake_media_engine.cc +++ b/media/base/fake_media_engine.cc
@@ -396,9 +396,6 @@ const std::vector<Codec>& FakeVideoMediaSendChannel::send_codecs() const { return send_codecs_; } -const std::vector<Codec>& FakeVideoMediaSendChannel::codecs() const { - return send_codecs(); -} const VideoOptions& FakeVideoMediaSendChannel::options() const { return options_; } @@ -476,13 +473,10 @@ const std::vector<std::string>& /* rids */) {} FakeVideoMediaReceiveChannel::FakeVideoMediaReceiveChannel( - const VideoOptions& options, TaskQueueBase* network_thread) : RtpReceiveChannelHelper<VideoMediaReceiveChannelInterface>( network_thread), - max_bps_(-1) { - SetOptions(options); -} + max_bps_(-1) {} FakeVideoMediaReceiveChannel::~FakeVideoMediaReceiveChannel() = default; const std::vector<Codec>& FakeVideoMediaReceiveChannel::recv_codecs() const { return recv_codecs_; @@ -490,9 +484,7 @@ bool FakeVideoMediaReceiveChannel::rendering() const { return playout(); } -const VideoOptions& FakeVideoMediaReceiveChannel::options() const { - return options_; -} + const std::map<uint32_t, VideoSinkInterface<VideoFrame>*>& FakeVideoMediaReceiveChannel::sinks() const { return sinks_; @@ -570,10 +562,6 @@ recv_codecs_ = codecs; return true; } -bool FakeVideoMediaReceiveChannel::SetOptions(const VideoOptions& options) { - options_ = options; - return true; -} bool FakeVideoMediaReceiveChannel::SetMaxSendBandwidth(int bps) { max_bps_ = bps; @@ -716,11 +704,9 @@ const Environment& /* env */, Call* call, const MediaConfig& /* config */, - const VideoOptions& options, const CryptoOptions& /* crypto_options */) { std::unique_ptr<FakeVideoMediaReceiveChannel> ch = - std::make_unique<FakeVideoMediaReceiveChannel>(options, - call->network_thread()); + std::make_unique<FakeVideoMediaReceiveChannel>(call->network_thread()); return ch; } std::vector<Codec> FakeVideoEngine::LegacySendCodecs(bool use_rtx) const {
diff --git a/media/base/fake_media_engine.h b/media/base/fake_media_engine.h index 6d35b3e..cc3c6d7 100644 --- a/media/base/fake_media_engine.h +++ b/media/base/fake_media_engine.h
@@ -357,9 +357,6 @@ void SetExtmapAllowMixed(bool extmap_allow_mixed) override { return MediaChannelUtil::SetExtmapAllowMixed(extmap_allow_mixed); } - bool ExtmapAllowMixed() const override { - return MediaChannelUtil::ExtmapAllowMixed(); - } RtpParameters GetRtpSendParameters(uint32_t ssrc) const override { auto parameters_iterator = rtp_send_parameters_.find(ssrc); @@ -566,7 +563,7 @@ void SetDefaultRawAudioSink( std::unique_ptr<AudioSinkInterface> sink) override; - webrtc::RtcpMode RtcpMode() const override { return recv_rtcp_mode_; } + webrtc::RtcpMode RtcpMode() const { return recv_rtcp_mode_; } void SetRtcpMode(webrtc::RtcpMode mode) override { recv_rtcp_mode_ = mode; } std::vector<RtpSource> GetSources(uint32_t ssrc) const override; void SetReceiveNackEnabled(bool /* enabled */) override {} @@ -593,7 +590,7 @@ bool SetRecvCodecs(const std::vector<Codec>& codecs); bool SetMaxSendBandwidth(int bps); - bool SetOptions(const AudioOptions& options) override; + bool SetOptions(const AudioOptions& options); std::vector<Codec> recv_codecs_; std::map<uint32_t, double> output_scalings_; @@ -642,13 +639,10 @@ bool CanInsertDtmf() override; bool InsertDtmf(uint32_t ssrc, int event_code, int duration) override; - bool SetOptions(const AudioOptions& options) override; + bool SetOptions(const AudioOptions& options); bool SenderNackEnabled() const override { return false; } bool SenderNonSenderRttEnabled() const override { return false; } - void SetReceiveNackEnabled(bool /* enabled */) {} - void SetReceiveNonSenderRttEnabled(bool /* enabled */) {} - bool SendCodecHasNack() const override { return false; } std::optional<Codec> GetSendCodec() const override; bool GetStats(VoiceMediaSendInfo* stats) override; @@ -696,8 +690,10 @@ class FakeVideoMediaReceiveChannel : public RtpReceiveChannelHelper<VideoMediaReceiveChannelInterface> { public: - FakeVideoMediaReceiveChannel(const VideoOptions& options, - TaskQueueBase* network_thread); + FakeVideoMediaReceiveChannel(const VideoOptions& /*options*/, + TaskQueueBase* network_thread) + : FakeVideoMediaReceiveChannel(network_thread) {} + explicit FakeVideoMediaReceiveChannel(TaskQueueBase* network_thread); ~FakeVideoMediaReceiveChannel() override; @@ -712,7 +708,7 @@ const std::vector<Codec>& recv_codecs() const; const std::vector<Codec>& send_codecs() const; bool rendering() const; - const VideoOptions& options() const; + const std::map<uint32_t, VideoSinkInterface<VideoFrame>*>& sinks() const; int max_bps() const; bool SetReceiverParameters(const VideoReceiverParameters& params) override; @@ -749,14 +745,14 @@ private: bool SetRecvCodecs(const std::vector<Codec>& codecs); bool SetSendCodecs(const std::vector<Codec>& codecs); - bool SetOptions(const VideoOptions& options); + bool SetMaxSendBandwidth(int bps); std::vector<Codec> recv_codecs_; std::map<uint32_t, VideoSinkInterface<VideoFrame>*> sinks_; std::map<uint32_t, VideoSourceInterface<VideoFrame>*> sources_; std::map<uint32_t, int> output_delays_; - VideoOptions options_; + int max_bps_; }; @@ -775,7 +771,6 @@ MediaType media_type() const override { return MediaType::VIDEO; } const std::vector<Codec>& send_codecs() const; - const std::vector<Codec>& codecs() const; const VideoOptions& options() const; const std::map<uint32_t, VideoSinkInterface<VideoFrame>*>& sinks() const; int max_bps() const; @@ -798,11 +793,10 @@ absl::AnyInvocable<void(const std::set<uint32_t>&)> /* callback */) override {} - bool SendCodecHasNack() const override { return false; } bool GetStats(VideoMediaSendInfo* info) override; absl::AnyInvocable<std::optional<VideoMediaSendInfo>()> GetStatsTask() override; - bool SetOptions(const VideoOptions& options) override; + bool SetOptions(const VideoOptions& options); private: bool SetSendCodecs(const std::vector<Codec>& codecs); @@ -962,7 +956,6 @@ const Environment& env, Call* call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options) override; FakeVideoMediaSendChannel* GetSendChannel(size_t index); FakeVideoMediaReceiveChannel* GetReceiveChannel(size_t index);
diff --git a/media/base/media_channel.h b/media/base/media_channel.h index ee9d19d..f7d8a31 100644 --- a/media/base/media_channel.h +++ b/media/base/media_channel.h
@@ -215,7 +215,6 @@ // in the same stream. The setter and getter must only be called from // worker_thread. virtual void SetExtmapAllowMixed(bool extmap_allow_mixed) = 0; - virtual bool ExtmapAllowMixed() const = 0; // Starts or stops transmission (and potentially capture) of local media. virtual bool SetSend(bool send) = 0; @@ -253,7 +252,6 @@ // thread state may be torn down asynchronously. virtual absl::AnyInvocable<RtpParameters(uint32_t)> GetRtpSendParametersCallback() const = 0; - virtual bool SendCodecHasNack() const = 0; // Called whenever the list of sending SSRCs changes. virtual void SetSsrcListChangedCallback( absl::AnyInvocable<void(const std::set<uint32_t>&)> callback) = 0; @@ -943,7 +941,6 @@ GetStatsTask() = 0; virtual bool SenderNackEnabled() const = 0; virtual bool SenderNonSenderRttEnabled() const = 0; - virtual bool SetOptions(const AudioOptions& options) = 0; }; class VoiceMediaReceiveChannelInterface : public MediaReceiveChannelInterface { @@ -972,11 +969,9 @@ // may be torn down asynchronously. virtual absl::AnyInvocable<std::optional<VoiceMediaReceiveInfo>()> GetStatsTask(bool reset_legacy) = 0; - virtual enum RtcpMode RtcpMode() const = 0; virtual void SetRtcpMode(enum RtcpMode mode) = 0; virtual void SetReceiveNackEnabled(bool enabled) = 0; virtual void SetReceiveNonSenderRttEnabled(bool enabled) = 0; - virtual bool SetOptions(const AudioOptions& options) = 0; }; struct VideoSenderParameters : SenderParameters { @@ -1009,7 +1004,6 @@ virtual bool SetVideoSend(uint32_t ssrc, const VideoOptions* options, VideoSourceInterface<VideoFrame>* source) = 0; - virtual bool SetOptions(const VideoOptions& options) = 0; // Cause generation of a keyframe for `ssrc` on a sending channel. virtual void GenerateSendKeyFrame(uint32_t ssrc, const std::vector<std::string>& rids) = 0;
diff --git a/media/base/media_engine.h b/media/base/media_engine.h index 38726cf..7b23c85 100644 --- a/media/base/media_engine.h +++ b/media/base/media_engine.h
@@ -143,7 +143,6 @@ CreateReceiveChannel(const Environment& env, Call* call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options) = 0; }; @@ -234,7 +233,6 @@ const Environment& env, Call* call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options) override = 0; // Legacy: Retrieve list of supported codecs.
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc index 393692b..c9f86bb 100644 --- a/media/engine/webrtc_video_engine.cc +++ b/media/engine/webrtc_video_engine.cc
@@ -827,10 +827,9 @@ WebRtcVideoEngine::CreateReceiveChannel(const Environment& env, Call* call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options) { return std::make_unique<WebRtcVideoReceiveChannel>( - env, call, config, options, crypto_options, decoder_factory_.get()); + env, call, config, crypto_options, decoder_factory_.get()); } std::vector<Codec> WebRtcVideoEngine::LegacySendCodecs(bool include_rtx) const { @@ -1420,31 +1419,6 @@ }; } -bool WebRtcVideoSendChannel::SetOptions(const VideoOptions& options) { - RTC_DCHECK_RUN_ON(worker_thread_); - default_send_options_ = options; - for (auto& kv : send_streams_) { - kv.second->SetOptions(options); - } - return true; -} - -void WebRtcVideoSendChannel::WebRtcVideoSendStream::SetOptions( - const VideoOptions& options) { - RTC_DCHECK_RUN_ON(&thread_checker_); - VideoOptions old_options = parameters_.options; - parameters_.options.SetAll(options); - if (parameters_.options.is_screencast.value_or(false) != - old_options.is_screencast.value_or(false) && - parameters_.codec_settings) { - SetCodec(*parameters_.codec_settings, parameters_.codec_settings_list); - old_options.is_screencast = options.is_screencast; - } - if (parameters_.options != old_options) { - ReconfigureEncoder(nullptr); - } -} - RTCError WebRtcVideoSendChannel::SetRtpSendParameters( uint32_t ssrc, const RtpParameters& parameters, @@ -2852,7 +2826,6 @@ const Environment& env, Call* absl_nonnull call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options, VideoDecoderFactory* absl_nullable decoder_factory) : MediaChannelUtil(call->network_thread(), config.enable_dscp),
diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h index 79fad08..5c9af49 100644 --- a/media/engine/webrtc_video_engine.h +++ b/media/engine/webrtc_video_engine.h
@@ -115,7 +115,6 @@ const Environment& env, Call* call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options) override; // TODO: https://issues.webrtc.org/360058654 - remove Legacy functions. @@ -200,9 +199,6 @@ void SetExtmapAllowMixed(bool extmap_allow_mixed) override { MediaChannelUtil::SetExtmapAllowMixed(extmap_allow_mixed); } - bool ExtmapAllowMixed() const override { - return MediaChannelUtil::ExtmapAllowMixed(); - } // Common functions between sender and receiver void SetInterface(MediaChannelNetworkInterface* iface) override; @@ -230,7 +226,6 @@ void OnReadyToSend(bool ready) override; void OnNetworkRouteChanged(absl::string_view transport_name, const NetworkRoute& network_route) override; - bool SetOptions(const VideoOptions& options) override; // Set a frame encryptor to a particular ssrc that will intercept all // outgoing video frames and attempt to encrypt them and forward the result @@ -277,15 +272,6 @@ void SetEncoderToPacketizerFrameTransformer( uint32_t ssrc, scoped_refptr<FrameTransformerInterface> frame_transformer) override; - // Information queries to support SetReceiverFeedbackParameters - bool SendCodecHasNack() const override { - RTC_DCHECK_RUN_ON(worker_thread_); - if (!send_codec()) { - return false; - } - return HasNack(send_codec()->codec); - } - private: struct ChangedSenderParameters { // These optionals are unset if not changed. @@ -346,8 +332,6 @@ scoped_refptr<VideoEncoderFactory::EncoderSelectorInterface> encoder_selector); - void SetOptions(const VideoOptions& options); - void SetSend(bool send); const std::vector<uint32_t>& GetSsrcs() const; @@ -458,7 +442,7 @@ bool sending_ RTC_GUARDED_BY(worker_thread_); Call* const call_; - const MediaConfig::Video video_config_ RTC_GUARDED_BY(worker_thread_); + const MediaConfig::Video video_config_; // Using primary-ssrc (first ssrc) as key. std::map<uint32_t, WebRtcVideoSendStream*> send_streams_ @@ -479,11 +463,11 @@ // comment in WebRtcVideoChannel::ChangedReceiverParameters. BitrateConstraints bitrate_config_ RTC_GUARDED_BY(worker_thread_); VideoSenderParameters send_params_ RTC_GUARDED_BY(worker_thread_); - VideoOptions default_send_options_ RTC_GUARDED_BY(worker_thread_); + const VideoOptions default_send_options_; int64_t last_send_stats_log_ms_ RTC_GUARDED_BY(worker_thread_); // Per peer connection crypto options that last for the lifetime of the peer // connection. - const CryptoOptions crypto_options_ RTC_GUARDED_BY(worker_thread_); + const CryptoOptions crypto_options_; // Callback invoked whenever the list of SSRCs changes. absl::AnyInvocable<void(const std::set<uint32_t>&)> @@ -504,7 +488,6 @@ WebRtcVideoReceiveChannel(const Environment& env, Call* absl_nonnull call, const MediaConfig& config, - const VideoOptions& options, const CryptoOptions& crypto_options, VideoDecoderFactory* absl_nullable decoder_factory); ~WebRtcVideoReceiveChannel() override; @@ -722,7 +705,7 @@ // Delay for unsignaled streams, which may be set before the stream exists. int default_recv_base_minimum_delay_ms_ RTC_GUARDED_BY(thread_checker_) = 0; - const MediaConfig::Video video_config_ RTC_GUARDED_BY(thread_checker_); + const MediaConfig::Video video_config_; // When the channel and demuxer get reconfigured, there is a window of time // where we have to be prepared for packets arriving based on the old demuxer @@ -753,7 +736,7 @@ // send_params/recv_params, rtp_extensions, options, etc. VideoReceiverParameters recv_params_ RTC_GUARDED_BY(thread_checker_); int64_t last_receive_stats_log_ms_ RTC_GUARDED_BY(thread_checker_); - const bool discard_unknown_ssrc_packets_ RTC_GUARDED_BY(thread_checker_); + const bool discard_unknown_ssrc_packets_; // This is a stream param that comes from the remote description, but wasn't // signaled with any a=ssrc lines. It holds information that was signaled // before the unsignaled receive stream is created when the first packet is @@ -761,7 +744,7 @@ StreamParams unsignaled_stream_params_ RTC_GUARDED_BY(thread_checker_); // Per peer connection crypto options that last for the lifetime of the peer // connection. - const CryptoOptions crypto_options_ RTC_GUARDED_BY(thread_checker_); + const CryptoOptions crypto_options_; // Optional frame transformer set on unsignaled streams. scoped_refptr<FrameTransformerInterface> unsignaled_frame_transformer_
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 4630a42..08d0abc 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -749,7 +749,7 @@ std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); EXPECT_TRUE(receive_channel->AddRecvStream(StreamParams::CreateLegacy(123))); VideoMediaReceiveInfo receive_info; receive_channel->GetStats(&receive_info); @@ -1024,7 +1024,7 @@ const std::vector<Codec>& codecs) { std::unique_ptr<VideoMediaReceiveChannelInterface> channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); VideoReceiverParameters parameters; parameters.codecs = codecs; EXPECT_TRUE(channel->SetReceiverParameters(parameters)); @@ -1061,7 +1061,7 @@ ChangeFieldTrials("WebRTC-ReceiveBufferSize", "size_bytes:10000"); std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); FakeNetworkInterface network(env_); receive_channel->SetInterface(&network); EXPECT_EQ(10000, network.recvbuf_size()); @@ -1074,7 +1074,7 @@ ChangeFieldTrials("WebRTC-ReceiveBufferSize", "size_bytes:10000001"); std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); FakeNetworkInterface network(env_); receive_channel->SetInterface(&network); EXPECT_EQ(kVideoRtpRecvBufferSize, network.recvbuf_size()); @@ -1086,7 +1086,7 @@ ChangeFieldTrials("WebRTC-ReceiveBufferSize", "size_bytes:9999"); std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); FakeNetworkInterface network(env_); receive_channel->SetInterface(&network); EXPECT_EQ(kVideoRtpRecvBufferSize, network.recvbuf_size()); @@ -1104,7 +1104,7 @@ std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine_->CreateReceiveChannel(env_, call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); VideoReceiverParameters parameters; parameters.codecs = supported_codecs; ASSERT_TRUE(receive_channel->SetReceiverParameters(parameters)); @@ -1581,7 +1581,7 @@ const int recv_ssrc = 321; std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel = engine.CreateReceiveChannel(env, call.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + CryptoOptions()); VideoReceiverParameters recv_parameters; recv_parameters.codecs.push_back(engine_codecs.at(0)); @@ -1701,7 +1701,7 @@ env_, call_.get(), MediaConfig(), VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_.CreateReceiveChannel( - env_, call_.get(), MediaConfig(), VideoOptions(), CryptoOptions()); + env_, call_.get(), MediaConfig(), CryptoOptions()); network_interface_.SetDestination(receive_channel_.get()); send_channel_->SetInterface(&network_interface_); @@ -1886,7 +1886,7 @@ env_, call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); receive_channel_->SetReceive(true); network_interface_.SetDestination(receive_channel_.get()); @@ -2792,9 +2792,8 @@ env_, fake_call_.get(), GetMediaConfig(), VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); - receive_channel_ = - engine_->CreateReceiveChannel(env_, fake_call_.get(), GetMediaConfig(), - VideoOptions(), CryptoOptions()); + receive_channel_ = engine_->CreateReceiveChannel( + env_, fake_call_.get(), GetMediaConfig(), CryptoOptions()); send_channel_->OnReadyToSend(true); receive_channel_->SetReceive(true); last_ssrc_ = 123; @@ -3621,7 +3620,7 @@ env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, fake_call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); send_channel_->SetSenderParameters(send_parameters_); @@ -3634,7 +3633,7 @@ env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, fake_call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); send_channel_->SetSenderParameters(send_parameters_); @@ -4250,7 +4249,7 @@ env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, fake_call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); ASSERT_TRUE(send_channel_->SetSenderParameters(parameters)); @@ -4304,7 +4303,7 @@ env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, fake_call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); EXPECT_TRUE(send_channel_->SetSenderParameters(parameters)); @@ -4340,7 +4339,7 @@ env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions(), video_bitrate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_->CreateReceiveChannel( - env_, fake_call_.get(), media_config, VideoOptions(), CryptoOptions()); + env_, fake_call_.get(), media_config, CryptoOptions()); send_channel_->OnReadyToSend(true); EXPECT_TRUE(send_channel_->SetSenderParameters(parameters)); @@ -9815,7 +9814,7 @@ env_, &fake_call_, GetMediaConfig(), VideoOptions(), CryptoOptions(), mock_rate_allocator_factory_.get(), nullptr, nullptr); receive_channel_ = engine_.CreateReceiveChannel( - env_, &fake_call_, GetMediaConfig(), VideoOptions(), CryptoOptions()); + env_, &fake_call_, GetMediaConfig(), CryptoOptions()); send_channel_->OnReadyToSend(true); receive_channel_->SetReceive(true); last_ssrc_ = 123;
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc index c296e8a..4222da1 100644 --- a/media/engine/webrtc_voice_engine.cc +++ b/media/engine/webrtc_voice_engine.cc
@@ -2267,42 +2267,6 @@ return rtp_params; } -bool WebRtcVoiceReceiveChannel::SetOptions(const AudioOptions& options) { - RTC_DCHECK_RUN_ON(worker_thread_); - RTC_LOG(LS_INFO) << "Setting voice channel options: " << options.ToString(); - - // We retain all of the existing options, and apply the given ones - // on top. This means there is no way to "clear" options such that - // they go back to the engine default. - options_.SetAll(options); - - // Check if any options changed that should apply to receive streams. - if (options.audio_jitter_buffer_max_packets && - std::max(20, *options.audio_jitter_buffer_max_packets) != - audio_config_.audio_jitter_buffer_max_packets) { - audio_config_.audio_jitter_buffer_max_packets = - std::max(20, *options.audio_jitter_buffer_max_packets); - for (auto& [unused, stream] : recv_streams_) { - stream->SetJitterBufferMaxPackets( - audio_config_.audio_jitter_buffer_max_packets); - } - } - if (options.audio_jitter_buffer_fast_accelerate && - *options.audio_jitter_buffer_fast_accelerate != - audio_config_.audio_jitter_buffer_fast_accelerate) { - audio_config_.audio_jitter_buffer_fast_accelerate = - *options.audio_jitter_buffer_fast_accelerate; - for (auto& [unused, stream] : recv_streams_) { - stream->SetJitterBufferFastAccelerate( - audio_config_.audio_jitter_buffer_fast_accelerate); - } - } - - RTC_LOG(LS_INFO) << "Set voice receive channel options. Current options: " - << options_.ToString(); - return true; -} - bool WebRtcVoiceReceiveChannel::SetRecvCodecs( const std::vector<Codec>& codecs_in) { RTC_DCHECK_RUN_ON(worker_thread_); @@ -2900,11 +2864,6 @@ std::move(frame_transformer)); } -RtcpMode WebRtcVoiceReceiveChannel::RtcpMode() const { - RTC_DCHECK_RUN_ON(worker_thread_); - return recv_rtcp_mode_; -} - bool WebRtcVoiceReceiveChannel::MaybeDeregisterUnsignaledRecvStream( uint32_t ssrc) { RTC_DCHECK_RUN_ON(worker_thread_);
diff --git a/media/engine/webrtc_voice_engine.h b/media/engine/webrtc_voice_engine.h index 1b77cc6..6458b34 100644 --- a/media/engine/webrtc_voice_engine.h +++ b/media/engine/webrtc_voice_engine.h
@@ -211,9 +211,6 @@ void SetExtmapAllowMixed(bool extmap_allow_mixed) override { MediaChannelUtil::SetExtmapAllowMixed(extmap_allow_mixed); } - bool ExtmapAllowMixed() const override { - return MediaChannelUtil::ExtmapAllowMixed(); - } const AudioOptions& options() const { return options_; } @@ -253,7 +250,6 @@ bool GetStats(VoiceMediaSendInfo* info) override; absl::AnyInvocable<std::optional<VoiceMediaSendInfo>()> GetStatsTask() override; - bool SetOptions(const AudioOptions& options) override; // Sets a frame transformer between encoder and packetizer, to transform // encoded frames before sending them out the network. @@ -263,9 +259,9 @@ bool SenderNackEnabled() const override; bool SenderNonSenderRttEnabled() const override; - bool SendCodecHasNack() const override { return SenderNackEnabled(); } private: + bool SetOptions(const AudioOptions& options); bool SetSendCodecs(const std::vector<Codec>& codecs, std::optional<Codec> preferred_codec); bool SetLocalSource(uint32_t ssrc, AudioSource* source); @@ -403,13 +399,11 @@ uint32_t ssrc, scoped_refptr<FrameTransformerInterface> frame_transformer) override; - enum RtcpMode RtcpMode() const override; void SetRtcpMode(enum RtcpMode mode) override; void SetReceiveNackEnabled(bool enabled) override; void SetReceiveNonSenderRttEnabled(bool enabled) override; private: - bool SetOptions(const AudioOptions& options) override; bool SetRecvCodecs(const std::vector<Codec>& codecs); bool SetLocalSource(uint32_t ssrc, AudioSource* source); bool MuteStream(uint32_t ssrc, bool mute); @@ -436,7 +430,7 @@ std::map<int, SdpAudioFormat> decoder_map_ RTC_GUARDED_BY(worker_thread_); - AudioOptions options_ RTC_GUARDED_BY(worker_thread_); + const AudioOptions options_; bool recv_nack_enabled_ RTC_GUARDED_BY(worker_thread_) = false; enum RtcpMode recv_rtcp_mode_ RTC_GUARDED_BY(worker_thread_) = RtcpMode::kCompound;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc index 43f13cb..33b4a52 100644 --- a/media/engine/webrtc_voice_engine_unittest.cc +++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -391,7 +391,7 @@ ? RtcpMode::kReducedSize : RtcpMode::kCompound); receive_channel_->SetReceiveNackEnabled( - send_channel_->SendCodecHasNack()); + send_channel_->SenderNackEnabled()); receive_channel_->SetReceiveNonSenderRttEnabled( send_channel_->SenderNonSenderRttEnabled()); }
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc index f5d57d2..15b4227 100644 --- a/pc/channel_unittest.cc +++ b/pc/channel_unittest.cc
@@ -810,7 +810,7 @@ EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kOffer).ok()); content.set_extmap_allow_mixed_level(answer_enum); EXPECT_TRUE(channel1_->SetLocalContent(&content, SdpType::kAnswer).ok()); - EXPECT_EQ(answer, channel1_->media_send_channel()->ExtmapAllowMixed()); + EXPECT_EQ(answer, media_send_channel1_impl()->ExtmapAllowMixed()); } // Test that SetLocalContent and SetRemoteContent properly deals
diff --git a/pc/rtp_sender_receiver_unittest.cc b/pc/rtp_sender_receiver_unittest.cc index 5c72c1a..3733e28 100644 --- a/pc/rtp_sender_receiver_unittest.cc +++ b/pc/rtp_sender_receiver_unittest.cc
@@ -140,7 +140,7 @@ voice_media_receive_channel_ = media_engine_->voice().CreateReceiveChannel( env_, &fake_call_, MediaConfig(), AudioOptions(), CryptoOptions()); video_media_receive_channel_ = media_engine_->video().CreateReceiveChannel( - env_, &fake_call_, MediaConfig(), VideoOptions(), CryptoOptions()); + env_, &fake_call_, MediaConfig(), CryptoOptions()); // Create streams for predefined SSRCs. Streams need to exist in order // for the senders and receievers to apply parameters to them.
diff --git a/pc/rtp_transceiver.cc b/pc/rtp_transceiver.cc index 5418dd5..feecd9c 100644 --- a/pc/rtp_transceiver.cc +++ b/pc/rtp_transceiver.cc
@@ -251,7 +251,7 @@ std::move(video_encoder_switch_request_callback), std::move(parameters_changed_callback)), video_factory->CreateReceiveChannel(env, call, media_config, - video_options, crypto_options)}; + crypto_options)}; } std::vector<absl::AnyInvocable<void() &&>> DetachAndGetStopTasksForSenders(
diff --git a/pc/test/mock_voice_media_receive_channel_interface.h b/pc/test/mock_voice_media_receive_channel_interface.h index 81a164d..a2af386 100644 --- a/pc/test/mock_voice_media_receive_channel_interface.h +++ b/pc/test/mock_voice_media_receive_channel_interface.h
@@ -17,7 +17,6 @@ #include <vector> #include "absl/functional/any_invocable.h" -#include "api/audio_options.h" #include "api/call/audio_sink.h" #include "api/crypto/frame_decryptor_interface.h" #include "api/frame_transformer_interface.h" @@ -79,11 +78,9 @@ GetStatsTask, (bool reset_legacy), (override)); - MOCK_METHOD(::webrtc::RtcpMode, RtcpMode, (), (const, override)); MOCK_METHOD(void, SetRtcpMode, (::webrtc::RtcpMode mode), (override)); MOCK_METHOD(void, SetReceiveNackEnabled, (bool enabled), (override)); MOCK_METHOD(void, SetReceiveNonSenderRttEnabled, (bool enabled), (override)); - MOCK_METHOD(bool, SetOptions, (const AudioOptions& options), (override)); // MediaReceiveChannelInterface MOCK_METHOD(VideoMediaReceiveChannelInterface*,