aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorNiels Möller <nisse@webrtc.org>2018-08-14 09:43:34 +0200
committerCommit Bot <commit-bot@chromium.org>2018-08-15 09:59:15 +0000
commitfa4e185684de7185db9001299c1958caafb32fc7 (patch)
treee3818a70144d40f789d3c40f11d1ade4ad26c3d8 /audio
parent7d2df3f848bd7e3f931b6ee664d683f9da4e3fd6 (diff)
downloadwebrtc-fa4e185684de7185db9001299c1958caafb32fc7.tar.gz
Delete class voe::RtcEventLogProxy
Bug: None Change-Id: Ic0c380e2f7f844a0e06c8c2a3d8bcb42ecee1eba Reviewed-on: https://webrtc-review.googlesource.com/94040 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Oskar Sundbom <ossu@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24287}
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_receive_stream.cc19
-rw-r--r--audio/audio_receive_stream_unittest.cc5
-rw-r--r--audio/audio_send_stream.cc17
-rw-r--r--audio/audio_send_stream_unittest.cc3
-rw-r--r--audio/channel.cc49
-rw-r--r--audio/channel.h10
-rw-r--r--audio/channel_proxy.cc5
-rw-r--r--audio/channel_proxy.h1
-rw-r--r--audio/mock_voe_channel_proxy.h1
9 files changed, 31 insertions, 79 deletions
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 165bfaffdd..3be50fdfc5 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -66,16 +66,16 @@ namespace {
std::unique_ptr<voe::ChannelProxy> CreateChannelAndProxy(
webrtc::AudioState* audio_state,
ProcessThread* module_process_thread,
- const webrtc::AudioReceiveStream::Config& config) {
+ const webrtc::AudioReceiveStream::Config& config,
+ RtcEventLog* event_log) {
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(
- module_process_thread, internal_audio_state->audio_device_module(),
- nullptr /* RtcpRttStats */, config.jitter_buffer_max_packets,
- config.jitter_buffer_fast_accelerate, config.decoder_factory,
- config.codec_pair_id))));
+ return absl::make_unique<voe::ChannelProxy>(absl::make_unique<voe::Channel>(
+ module_process_thread, internal_audio_state->audio_device_module(),
+ nullptr /* RtcpRttStats */, event_log, config.jitter_buffer_max_packets,
+ config.jitter_buffer_fast_accelerate, config.decoder_factory,
+ config.codec_pair_id));
}
} // namespace
@@ -93,7 +93,8 @@ AudioReceiveStream::AudioReceiveStream(
event_log,
CreateChannelAndProxy(audio_state.get(),
module_process_thread,
- config)) {}
+ config,
+ event_log)) {}
AudioReceiveStream::AudioReceiveStream(
RtpStreamReceiverControllerInterface* receiver_controller,
@@ -112,7 +113,6 @@ AudioReceiveStream::AudioReceiveStream(
module_process_thread_checker_.DetachFromThread();
- channel_proxy_->SetRtcEventLog(event_log);
channel_proxy_->RegisterTransport(config.rtcp_send_transport);
// Configure bandwidth estimation.
@@ -132,7 +132,6 @@ AudioReceiveStream::~AudioReceiveStream() {
channel_proxy_->DisassociateSendChannel();
channel_proxy_->RegisterTransport(nullptr);
channel_proxy_->ResetReceiverCongestionControlObjects();
- channel_proxy_->SetRtcEventLog(nullptr);
}
void AudioReceiveStream::Reconfigure(
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index 94271a30dc..0c3189d275 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -91,11 +91,6 @@ struct ConfigHelper {
EXPECT_CALL(*channel_proxy_, ResetReceiverCongestionControlObjects())
.Times(1);
EXPECT_CALL(*channel_proxy_, RegisterTransport(nullptr)).Times(2);
- testing::Expectation expect_set =
- EXPECT_CALL(*channel_proxy_, SetRtcEventLog(&event_log_)).Times(1);
- EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull()))
- .Times(1)
- .After(expect_set);
EXPECT_CALL(*channel_proxy_, DisassociateSendChannel()).Times(1);
EXPECT_CALL(*channel_proxy_, SetReceiveCodecs(_))
.WillRepeatedly(Invoke([](const std::map<int, SdpAudioFormat>& codecs) {
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 6df653add7..0f725c4da1 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -14,6 +14,8 @@
#include <utility>
#include <vector>
+#include "absl/memory/memory.h"
+
#include "audio/audio_state.h"
#include "audio/channel_proxy.h"
#include "audio/conversion.h"
@@ -48,14 +50,14 @@ std::unique_ptr<voe::ChannelProxy> CreateChannelAndProxy(
webrtc::AudioState* audio_state,
rtc::TaskQueue* worker_queue,
ProcessThread* module_process_thread,
- RtcpRttStats* rtcp_rtt_stats) {
+ RtcpRttStats* rtcp_rtt_stats,
+ RtcEventLog* event_log) {
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(), rtcp_rtt_stats))));
+ return absl::make_unique<voe::ChannelProxy>(absl::make_unique<voe::Channel>(
+ worker_queue, module_process_thread,
+ internal_audio_state->audio_device_module(), rtcp_rtt_stats, event_log));
}
} // namespace
@@ -105,7 +107,8 @@ AudioSendStream::AudioSendStream(
CreateChannelAndProxy(audio_state.get(),
worker_queue,
module_process_thread,
- rtcp_rtt_stats)) {}
+ rtcp_rtt_stats,
+ event_log)) {}
AudioSendStream::AudioSendStream(
const webrtc::AudioSendStream::Config& config,
@@ -139,7 +142,6 @@ AudioSendStream::AudioSendStream(
RTC_DCHECK(transport);
RTC_DCHECK(overall_call_lifetime_);
- channel_proxy_->SetRtcEventLog(event_log_);
channel_proxy_->SetRTCPStatus(true);
rtp_rtcp_module_ = channel_proxy_->GetRtpRtcp();
RTC_DCHECK(rtp_rtcp_module_);
@@ -158,7 +160,6 @@ AudioSendStream::~AudioSendStream() {
transport_->DeRegisterPacketFeedbackObserver(this);
channel_proxy_->RegisterTransport(nullptr);
channel_proxy_->ResetSenderCongestionControlObjects();
- channel_proxy_->SetRtcEventLog(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 dba1f5c230..1e777f1480 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -221,9 +221,6 @@ struct ConfigHelper {
EXPECT_CALL(*channel_proxy_, RegisterTransport(_)).Times(1);
EXPECT_CALL(*channel_proxy_, RegisterTransport(nullptr)).Times(1);
}
- EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::NotNull())).Times(1);
- EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull()))
- .Times(1); // Destructor resets the event log
}
void SetupMockForSetupSendCodec(bool expect_set_encoder_call) {
diff --git a/audio/channel.cc b/audio/channel.cc
index e0cb7c4277..c96184d6d8 100644
--- a/audio/channel.cc
+++ b/audio/channel.cc
@@ -63,36 +63,6 @@ constexpr int kVoiceEngineMaxMinPlayoutDelayMs = 10000;
const int kTelephoneEventAttenuationdB = 10;
-class RtcEventLogProxy final : public webrtc::RtcEventLog {
- public:
- RtcEventLogProxy() : event_log_(nullptr) {}
-
- bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
- int64_t output_period_ms) override {
- RTC_NOTREACHED();
- return false;
- }
-
- void StopLogging() override { RTC_NOTREACHED(); }
-
- void Log(std::unique_ptr<RtcEvent> event) override {
- rtc::CritScope lock(&crit_);
- if (event_log_) {
- event_log_->Log(std::move(event));
- }
- }
-
- void SetEventLog(RtcEventLog* event_log) {
- rtc::CritScope lock(&crit_);
- event_log_ = event_log;
- }
-
- private:
- rtc::CriticalSection crit_;
- RtcEventLog* event_log_ RTC_GUARDED_BY(crit_);
- RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogProxy);
-};
-
class TransportFeedbackProxy : public TransportFeedbackObserver {
public:
TransportFeedbackProxy() : feedback_observer_(nullptr) {
@@ -393,7 +363,7 @@ AudioMixer::Source::AudioFrameInfo Channel::GetAudioFrameWithInfo(
unsigned int ssrc;
RTC_CHECK_EQ(GetRemoteSSRC(ssrc), 0);
- event_log_proxy_->Log(absl::make_unique<RtcEventAudioPlayout>(ssrc));
+ event_log_->Log(absl::make_unique<RtcEventAudioPlayout>(ssrc));
// Get 10ms raw PCM data from the ACM (mixer limits output frequency)
bool muted;
if (audio_coding_->PlayoutData10Ms(audio_frame->sample_rate_hz_, audio_frame,
@@ -502,10 +472,12 @@ int Channel::PreferredSampleRate() const {
Channel::Channel(rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- RtcpRttStats* rtcp_rtt_stats)
+ RtcpRttStats* rtcp_rtt_stats,
+ RtcEventLog* rtc_event_log)
: Channel(module_process_thread,
audio_device_module,
rtcp_rtt_stats,
+ rtc_event_log,
0,
false,
rtc::scoped_refptr<AudioDecoderFactory>(),
@@ -517,11 +489,12 @@ Channel::Channel(rtc::TaskQueue* encoder_queue,
Channel::Channel(ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
RtcpRttStats* rtcp_rtt_stats,
+ RtcEventLog* rtc_event_log,
size_t jitter_buffer_max_packets,
bool jitter_buffer_fast_playout,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
absl::optional<AudioCodecPairId> codec_pair_id)
- : event_log_proxy_(new RtcEventLogProxy()),
+ : event_log_(rtc_event_log),
rtp_payload_registry_(new RTPPayloadRegistry()),
rtp_receive_statistics_(
ReceiveStatistics::Create(Clock::GetRealTimeClock())),
@@ -581,7 +554,7 @@ Channel::Channel(ProcessThread* module_process_thread,
seq_num_allocator_proxy_.get();
configuration.transport_feedback_callback = feedback_observer_proxy_.get();
}
- configuration.event_log = &(*event_log_proxy_);
+ configuration.event_log = event_log_;
configuration.rtt_stats = rtcp_rtt_stats;
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
@@ -831,8 +804,8 @@ bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string) {
bool success = false;
audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
if (*encoder) {
- success = (*encoder)->EnableAudioNetworkAdaptor(config_string,
- event_log_proxy_.get());
+ success =
+ (*encoder)->EnableAudioNetworkAdaptor(config_string, event_log_);
}
});
return success;
@@ -1270,10 +1243,6 @@ void Channel::SetAssociatedSendChannel(Channel* channel) {
associated_send_channel_ = channel;
}
-void Channel::SetRtcEventLog(RtcEventLog* event_log) {
- event_log_proxy_->SetEventLog(event_log);
-}
-
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 5ffd6b1153..8d78665838 100644
--- a/audio/channel.h
+++ b/audio/channel.h
@@ -89,7 +89,6 @@ struct ReportBlock {
namespace voe {
-class RtcEventLogProxy;
class RtpPacketSenderProxy;
class TransportFeedbackProxy;
class TransportSequenceNumberProxy;
@@ -150,11 +149,13 @@ class Channel
Channel(rtc::TaskQueue* encoder_queue,
ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
- RtcpRttStats* rtcp_rtt_stats);
+ RtcpRttStats* rtcp_rtt_stats,
+ RtcEventLog* rtc_event_log);
// Used for receive streams.
Channel(ProcessThread* module_process_thread,
AudioDeviceModule* audio_device_module,
RtcpRttStats* rtcp_rtt_stats,
+ RtcEventLog* rtc_event_log,
size_t jitter_buffer_max_packets,
bool jitter_buffer_fast_playout,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
@@ -285,9 +286,6 @@ class Channel
// Used for obtaining RTT for a receive-only channel.
void SetAssociatedSendChannel(Channel* channel);
- // Set a RtcEventLog logging object.
- void SetRtcEventLog(RtcEventLog* event_log);
-
void SetTransportOverhead(size_t transport_overhead_per_packet);
// From OverheadObserver in the RTP/RTCP module
@@ -341,7 +339,7 @@ class Channel
ChannelState channel_state_;
- std::unique_ptr<voe::RtcEventLogProxy> event_log_proxy_;
+ RtcEventLog* const event_log_;
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 f034f07116..78cc2fcc7a 100644
--- a/audio/channel_proxy.cc
+++ b/audio/channel_proxy.cc
@@ -226,11 +226,6 @@ void ChannelProxy::SetChannelOutputVolumeScaling(float scaling) {
channel_->SetChannelOutputVolumeScaling(scaling);
}
-void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- channel_->SetRtcEventLog(event_log);
-}
-
AudioMixer::Source::AudioFrameInfo ChannelProxy::GetAudioFrameWithInfo(
int sample_rate_hz,
AudioFrame* audio_frame) {
diff --git a/audio/channel_proxy.h b/audio/channel_proxy.h
index 6175d6cc31..253a196e5e 100644
--- a/audio/channel_proxy.h
+++ b/audio/channel_proxy.h
@@ -99,7 +99,6 @@ class ChannelProxy : public RtpPacketSinkInterface {
void OnRtpPacket(const RtpPacketReceived& packet) override;
virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length);
virtual void SetChannelOutputVolumeScaling(float scaling);
- virtual void SetRtcEventLog(RtcEventLog* event_log);
virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo(
int sample_rate_hz,
AudioFrame* audio_frame);
diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h
index e09373bf84..ee16195cb1 100644
--- a/audio/mock_voe_channel_proxy.h
+++ b/audio/mock_voe_channel_proxy.h
@@ -68,7 +68,6 @@ class MockVoEChannelProxy : public voe::ChannelProxy {
MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived& packet));
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_METHOD2(GetAudioFrameWithInfo,
AudioMixer::Source::AudioFrameInfo(int sample_rate_hz,
AudioFrame* audio_frame));