diff options
author | Tommi <tommi@webrtc.org> | 2018-03-26 13:28:26 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-03-26 12:49:00 +0000 |
commit | 5f22365dd75482630b99857e04f75453496a13e8 (patch) | |
tree | b2af528997959c8b0d1df3243bfd525a6e059d3d /audio | |
parent | 1df1bf8551c8e01ee72e2ef336d27a3073060487 (diff) | |
download | webrtc-5f22365dd75482630b99857e04f75453496a13e8.tar.gz |
Remove unnecessary proxy+lock code around RtcpRttStats pointer
Change-Id: I9c7fdc695be1e424488fa46962d459c66cf4d1e7
Bug: webrtc:9068
Reviewed-on: https://webrtc-review.googlesource.com/64721
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22603}
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio_receive_stream.cc | 2 | ||||
-rw-r--r-- | audio/audio_send_stream.cc | 17 | ||||
-rw-r--r-- | audio/audio_send_stream_unittest.cc | 3 | ||||
-rw-r--r-- | audio/channel.cc | 40 | ||||
-rw-r--r-- | audio/channel.h | 7 | ||||
-rw-r--r-- | audio/channel_proxy.cc | 5 | ||||
-rw-r--r-- | audio/channel_proxy.h | 1 | ||||
-rw-r--r-- | audio/mock_voe_channel_proxy.h | 1 |
8 files changed, 17 insertions, 59 deletions
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc index 00b745bdd5..352261e248 100644 --- a/audio/audio_receive_stream.cc +++ b/audio/audio_receive_stream.cc @@ -73,7 +73,7 @@ std::unique_ptr<voe::ChannelProxy> CreateChannelAndProxy( return std::unique_ptr<voe::ChannelProxy>( new voe::ChannelProxy(std::unique_ptr<voe::Channel>(new voe::Channel( module_process_thread, internal_audio_state->audio_device_module(), - config.jitter_buffer_max_packets, + nullptr /* RtcpRttStats */, config.jitter_buffer_max_packets, config.jitter_buffer_fast_accelerate, config.decoder_factory, config.codec_pair_id)))); } diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index 71a4319fd6..9cf73459ea 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -46,15 +46,15 @@ void CallEncoder(const std::unique_ptr<voe::ChannelProxy>& channel_proxy, std::unique_ptr<voe::ChannelProxy> CreateChannelAndProxy( webrtc::AudioState* audio_state, rtc::TaskQueue* worker_queue, - ProcessThread* module_process_thread) { + ProcessThread* module_process_thread, + RtcpRttStats* rtcp_rtt_stats) { RTC_DCHECK(audio_state); internal::AudioState* internal_audio_state = static_cast<internal::AudioState*>(audio_state); - return std::unique_ptr<voe::ChannelProxy>(new voe::ChannelProxy( - std::unique_ptr<voe::Channel>(new voe::Channel( - worker_queue, - module_process_thread, - internal_audio_state->audio_device_module())))); + return std::unique_ptr<voe::ChannelProxy>( + new voe::ChannelProxy(std::unique_ptr<voe::Channel>(new voe::Channel( + worker_queue, module_process_thread, + internal_audio_state->audio_device_module(), rtcp_rtt_stats)))); } } // namespace @@ -103,7 +103,8 @@ AudioSendStream::AudioSendStream( overall_call_lifetime, CreateChannelAndProxy(audio_state.get(), worker_queue, - module_process_thread)) {} + module_process_thread, + rtcp_rtt_stats)) {} AudioSendStream::AudioSendStream( const webrtc::AudioSendStream::Config& config, @@ -138,7 +139,6 @@ AudioSendStream::AudioSendStream( RTC_DCHECK(overall_call_lifetime_); channel_proxy_->SetRtcEventLog(event_log_); - channel_proxy_->SetRtcpRttStats(rtcp_rtt_stats); channel_proxy_->SetRTCPStatus(true); RtpReceiver* rtpReceiver = nullptr; // Unused, but required for call. channel_proxy_->GetRtpRtcp(&rtp_rtcp_module_, &rtpReceiver); @@ -159,7 +159,6 @@ AudioSendStream::~AudioSendStream() { channel_proxy_->RegisterTransport(nullptr); channel_proxy_->ResetSenderCongestionControlObjects(); channel_proxy_->SetRtcEventLog(nullptr); - channel_proxy_->SetRtcpRttStats(nullptr); // Lifetime can only be updated after deregistering // |timed_send_transport_adapter_| in the underlying channel object to avoid // data races in |active_lifetime_|. diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc index 4d18c52030..8fb7e7e197 100644 --- a/audio/audio_send_stream_unittest.cc +++ b/audio/audio_send_stream_unittest.cc @@ -228,9 +228,6 @@ struct ConfigHelper { EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::NotNull())).Times(1); EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull())) .Times(1); // Destructor resets the event log - EXPECT_CALL(*channel_proxy_, SetRtcpRttStats(&rtcp_rtt_stats_)).Times(1); - EXPECT_CALL(*channel_proxy_, SetRtcpRttStats(testing::IsNull())) - .Times(1); // Destructor resets the rtt stats. } void SetupMockForSetupSendCodec(bool expect_set_encoder_call) { diff --git a/audio/channel.cc b/audio/channel.cc index fd2c281530..8dbe12ed04 100644 --- a/audio/channel.cc +++ b/audio/channel.cc @@ -94,34 +94,6 @@ class RtcEventLogProxy final : public webrtc::RtcEventLog { RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy); }; -class RtcpRttStatsProxy final : public RtcpRttStats { - public: - RtcpRttStatsProxy() : rtcp_rtt_stats_(nullptr) {} - - void OnRttUpdate(int64_t rtt) override { - rtc::CritScope lock(&crit_); - if (rtcp_rtt_stats_) - rtcp_rtt_stats_->OnRttUpdate(rtt); - } - - int64_t LastProcessedRtt() const override { - rtc::CritScope lock(&crit_); - if (!rtcp_rtt_stats_) - return 0; - return rtcp_rtt_stats_->LastProcessedRtt(); - } - - void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { - rtc::CritScope lock(&crit_); - rtcp_rtt_stats_ = rtcp_rtt_stats; - } - - private: - rtc::CriticalSection crit_; - RtcpRttStats* rtcp_rtt_stats_ RTC_GUARDED_BY(crit_); - RTC_DISALLOW_COPY_AND_ASSIGN(RtcpRttStatsProxy); -}; - class TransportFeedbackProxy : public TransportFeedbackObserver { public: TransportFeedbackProxy() : feedback_observer_(nullptr) { @@ -539,9 +511,11 @@ int Channel::PreferredSampleRate() const { Channel::Channel(rtc::TaskQueue* encoder_queue, ProcessThread* module_process_thread, - AudioDeviceModule* audio_device_module) + AudioDeviceModule* audio_device_module, + RtcpRttStats* rtcp_rtt_stats) : Channel(module_process_thread, audio_device_module, + rtcp_rtt_stats, 0, false, rtc::scoped_refptr<AudioDecoderFactory>(), @@ -552,12 +526,12 @@ Channel::Channel(rtc::TaskQueue* encoder_queue, Channel::Channel(ProcessThread* module_process_thread, AudioDeviceModule* audio_device_module, + RtcpRttStats* rtcp_rtt_stats, size_t jitter_buffer_max_packets, bool jitter_buffer_fast_playout, rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, rtc::Optional<AudioCodecPairId> codec_pair_id) : event_log_proxy_(new RtcEventLogProxy()), - rtcp_rtt_stats_proxy_(new RtcpRttStatsProxy()), rtp_payload_registry_(new RTPPayloadRegistry()), rtp_receive_statistics_( ReceiveStatistics::Create(Clock::GetRealTimeClock())), @@ -620,7 +594,7 @@ Channel::Channel(ProcessThread* module_process_thread, configuration.transport_feedback_callback = feedback_observer_proxy_.get(); } configuration.event_log = &(*event_log_proxy_); - configuration.rtt_stats = &(*rtcp_rtt_stats_proxy_); + configuration.rtt_stats = rtcp_rtt_stats; configuration.retransmission_rate_limiter = retransmission_rate_limiter_.get(); @@ -1313,10 +1287,6 @@ void Channel::SetRtcEventLog(RtcEventLog* event_log) { event_log_proxy_->SetEventLog(event_log); } -void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { - rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats); -} - void Channel::UpdateOverheadForEncoder() { size_t overhead_per_packet = transport_overhead_per_packet_ + rtp_overhead_per_packet_; diff --git a/audio/channel.h b/audio/channel.h index fa4539d83d..532ad156ed 100644 --- a/audio/channel.h +++ b/audio/channel.h @@ -90,7 +90,6 @@ struct ReportBlock { namespace voe { class RtcEventLogProxy; -class RtcpRttStatsProxy; class RtpPacketSenderProxy; class TransportFeedbackProxy; class TransportSequenceNumberProxy; @@ -151,10 +150,12 @@ class Channel // Used for send streams. Channel(rtc::TaskQueue* encoder_queue, ProcessThread* module_process_thread, - AudioDeviceModule* audio_device_module); + AudioDeviceModule* audio_device_module, + RtcpRttStats* rtcp_rtt_stats); // Used for receive streams. Channel(ProcessThread* module_process_thread, AudioDeviceModule* audio_device_module, + RtcpRttStats* rtcp_rtt_stats, size_t jitter_buffer_max_packets, bool jitter_buffer_fast_playout, rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, @@ -285,7 +286,6 @@ class Channel // Set a RtcEventLog logging object. void SetRtcEventLog(RtcEventLog* event_log); - void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats); void SetTransportOverhead(size_t transport_overhead_per_packet); // From OverheadObserver in the RTP/RTCP module @@ -341,7 +341,6 @@ class Channel ChannelState channel_state_; std::unique_ptr<voe::RtcEventLogProxy> event_log_proxy_; - std::unique_ptr<voe::RtcpRttStatsProxy> rtcp_rtt_stats_proxy_; std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_; std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; diff --git a/audio/channel_proxy.cc b/audio/channel_proxy.cc index 1a546f6a37..f2575159d7 100644 --- a/audio/channel_proxy.cc +++ b/audio/channel_proxy.cc @@ -283,11 +283,6 @@ void ChannelProxy::SetMinimumPlayoutDelay(int delay_ms) { } } -void ChannelProxy::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { - RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); - channel_->SetRtcpRttStats(rtcp_rtt_stats); -} - bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const { RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); return channel_->GetRecCodec(*codec_inst) == 0; diff --git a/audio/channel_proxy.h b/audio/channel_proxy.h index e11bd2d930..65f244d754 100644 --- a/audio/channel_proxy.h +++ b/audio/channel_proxy.h @@ -110,7 +110,6 @@ class ChannelProxy : public RtpPacketSinkInterface { RtpReceiver** rtp_receiver) const; virtual uint32_t GetPlayoutTimestamp() const; virtual void SetMinimumPlayoutDelay(int delay_ms); - virtual void SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats); virtual bool GetRecCodec(CodecInst* codec_inst) const; virtual void OnTwccBasedUplinkPacketLossRate(float packet_loss_rate); virtual void OnRecoverableUplinkPacketLossRate( diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h index 2f6754eea8..e12b0349c9 100644 --- a/audio/mock_voe_channel_proxy.h +++ b/audio/mock_voe_channel_proxy.h @@ -69,7 +69,6 @@ class MockVoEChannelProxy : public voe::ChannelProxy { MOCK_METHOD2(ReceivedRTCPPacket, bool(const uint8_t* packet, size_t length)); MOCK_METHOD1(SetChannelOutputVolumeScaling, void(float scaling)); MOCK_METHOD1(SetRtcEventLog, void(RtcEventLog* event_log)); - MOCK_METHOD1(SetRtcpRttStats, void(RtcpRttStats* rtcp_rtt_stats)); MOCK_METHOD2(GetAudioFrameWithInfo, AudioMixer::Source::AudioFrameInfo(int sample_rate_hz, AudioFrame* audio_frame)); |