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}
This commit is contained in:
parent
1df1bf8551
commit
5f22365dd7
@ -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))));
|
||||
}
|
||||
|
||||
@ -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_|.
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -343,7 +343,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
|
||||
|
||||
RemoteBitrateEstimator* remote_bitrate_;
|
||||
|
||||
RtcpRttStats* rtt_stats_;
|
||||
RtcpRttStats* const rtt_stats_;
|
||||
|
||||
PacketLossStats send_loss_stats_;
|
||||
PacketLossStats receive_loss_stats_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user