Delete class ChannelReceiveProxy.
Replaced by an interface ChannelReceiveInterface, implemented
by ChannelReceive and the corresponding mock class.
Moved thread checkers to ChannelReceive. That class is moved to the
anonymous namespace in the .cc file, and exposed only via a function
CreateChannelReceive.
Bug: webrtc:9801
Change-Id: Iecacbb1858885bf86da9484f2422e53323dbe87a
Reviewed-on: https://webrtc-review.googlesource.com/c/110610
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25665}
diff --git a/audio/audio_receive_stream_unittest.cc b/audio/audio_receive_stream_unittest.cc
index a5c7e20..7422810 100644
--- a/audio/audio_receive_stream_unittest.cc
+++ b/audio/audio_receive_stream_unittest.cc
@@ -83,16 +83,16 @@
new rtc::RefCountedObject<testing::NiceMock<MockAudioDeviceModule>>();
audio_state_ = AudioState::Create(config);
- channel_proxy_ = new testing::StrictMock<MockChannelReceiveProxy>();
- EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1);
- EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1);
- EXPECT_CALL(*channel_proxy_,
+ channel_receive_ = new testing::StrictMock<MockChannelReceive>();
+ EXPECT_CALL(*channel_receive_, SetLocalSSRC(kLocalSsrc)).Times(1);
+ EXPECT_CALL(*channel_receive_, SetNACKStatus(true, 15)).Times(1);
+ EXPECT_CALL(*channel_receive_,
RegisterReceiverCongestionControlObjects(&packet_router_))
.Times(1);
- EXPECT_CALL(*channel_proxy_, ResetReceiverCongestionControlObjects())
+ EXPECT_CALL(*channel_receive_, ResetReceiverCongestionControlObjects())
.Times(1);
- EXPECT_CALL(*channel_proxy_, DisassociateSendChannel()).Times(1);
- EXPECT_CALL(*channel_proxy_, SetReceiveCodecs(_))
+ EXPECT_CALL(*channel_receive_, SetAssociatedSendChannel(nullptr)).Times(1);
+ EXPECT_CALL(*channel_receive_, SetReceiveCodecs(_))
.WillRepeatedly(Invoke([](const std::map<int, SdpAudioFormat>& codecs) {
EXPECT_THAT(codecs, testing::IsEmpty());
}));
@@ -114,33 +114,33 @@
new internal::AudioReceiveStream(
&rtp_stream_receiver_controller_, &packet_router_, stream_config_,
audio_state_, &event_log_,
- std::unique_ptr<voe::ChannelReceiveProxy>(channel_proxy_)));
+ std::unique_ptr<voe::ChannelReceiveInterface>(channel_receive_)));
}
AudioReceiveStream::Config& config() { return stream_config_; }
rtc::scoped_refptr<MockAudioMixer> audio_mixer() { return audio_mixer_; }
- MockChannelReceiveProxy* channel_proxy() { return channel_proxy_; }
+ MockChannelReceive* channel_receive() { return channel_receive_; }
void SetupMockForGetStats() {
using testing::DoAll;
using testing::SetArgPointee;
- ASSERT_TRUE(channel_proxy_);
- EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
+ ASSERT_TRUE(channel_receive_);
+ EXPECT_CALL(*channel_receive_, GetRTCPStatistics())
.WillOnce(Return(kCallStats));
- EXPECT_CALL(*channel_proxy_, GetDelayEstimate())
+ EXPECT_CALL(*channel_receive_, GetDelayEstimate())
.WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay));
- EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange())
+ EXPECT_CALL(*channel_receive_, GetSpeechOutputLevelFullRange())
.WillOnce(Return(kSpeechOutputLevel));
- EXPECT_CALL(*channel_proxy_, GetTotalOutputEnergy())
+ EXPECT_CALL(*channel_receive_, GetTotalOutputEnergy())
.WillOnce(Return(kTotalOutputEnergy));
- EXPECT_CALL(*channel_proxy_, GetTotalOutputDuration())
+ EXPECT_CALL(*channel_receive_, GetTotalOutputDuration())
.WillOnce(Return(kTotalOutputDuration));
- EXPECT_CALL(*channel_proxy_, GetNetworkStatistics())
+ EXPECT_CALL(*channel_receive_, GetNetworkStatistics())
.WillOnce(Return(kNetworkStats));
- EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics())
+ EXPECT_CALL(*channel_receive_, GetDecodingCallStatistics())
.WillOnce(Return(kAudioDecodeStats));
- EXPECT_CALL(*channel_proxy_, GetRecCodec(_))
+ EXPECT_CALL(*channel_receive_, GetRecCodec(_))
.WillOnce(DoAll(SetArgPointee<0>(kCodecInst), Return(true)));
}
@@ -150,7 +150,7 @@
rtc::scoped_refptr<AudioState> audio_state_;
rtc::scoped_refptr<MockAudioMixer> audio_mixer_;
AudioReceiveStream::Config stream_config_;
- testing::StrictMock<MockChannelReceiveProxy>* channel_proxy_ = nullptr;
+ testing::StrictMock<MockChannelReceive>* channel_receive_ = nullptr;
RtpStreamReceiverController rtp_stream_receiver_controller_;
MockTransport rtcp_send_transport_;
};
@@ -239,7 +239,7 @@
ASSERT_TRUE(parsed_packet.Parse(&rtp_packet[0], rtp_packet.size()));
parsed_packet.set_arrival_time_ms((packet_time_us + 500) / 1000);
- EXPECT_CALL(*helper.channel_proxy(),
+ EXPECT_CALL(*helper.channel_receive(),
OnRtpPacket(testing::Ref(parsed_packet)));
recv_stream->OnRtpPacket(parsed_packet);
@@ -250,7 +250,7 @@
helper.config().rtp.transport_cc = true;
auto recv_stream = helper.CreateAudioReceiveStream();
std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport();
- EXPECT_CALL(*helper.channel_proxy(),
+ EXPECT_CALL(*helper.channel_receive(),
ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size()))
.WillOnce(Return(true));
EXPECT_TRUE(recv_stream->DeliverRtcp(&rtcp_packet[0], rtcp_packet.size()));
@@ -312,7 +312,7 @@
TEST(AudioReceiveStreamTest, SetGain) {
ConfigHelper helper;
auto recv_stream = helper.CreateAudioReceiveStream();
- EXPECT_CALL(*helper.channel_proxy(),
+ EXPECT_CALL(*helper.channel_receive(),
SetChannelOutputVolumeScaling(FloatEq(0.765f)));
recv_stream->SetGain(0.765f);
}
@@ -323,10 +323,10 @@
auto recv_stream1 = helper1.CreateAudioReceiveStream();
auto recv_stream2 = helper2.CreateAudioReceiveStream();
- EXPECT_CALL(*helper1.channel_proxy(), StartPlayout()).Times(1);
- EXPECT_CALL(*helper2.channel_proxy(), StartPlayout()).Times(1);
- EXPECT_CALL(*helper1.channel_proxy(), StopPlayout()).Times(1);
- EXPECT_CALL(*helper2.channel_proxy(), StopPlayout()).Times(1);
+ EXPECT_CALL(*helper1.channel_receive(), StartPlayout()).Times(1);
+ EXPECT_CALL(*helper2.channel_receive(), StartPlayout()).Times(1);
+ EXPECT_CALL(*helper1.channel_receive(), StopPlayout()).Times(1);
+ EXPECT_CALL(*helper2.channel_receive(), StopPlayout()).Times(1);
EXPECT_CALL(*helper1.audio_mixer(), AddSource(recv_stream1.get()))
.WillOnce(Return(true));
EXPECT_CALL(*helper1.audio_mixer(), AddSource(recv_stream2.get()))
@@ -367,10 +367,10 @@
kTransportSequenceNumberId + 1));
new_config.decoder_map.emplace(1, SdpAudioFormat("foo", 8000, 1));
- MockChannelReceiveProxy& channel_proxy = *helper.channel_proxy();
- EXPECT_CALL(channel_proxy, SetLocalSSRC(kLocalSsrc + 1)).Times(1);
- EXPECT_CALL(channel_proxy, SetNACKStatus(true, 15 + 1)).Times(1);
- EXPECT_CALL(channel_proxy, SetReceiveCodecs(new_config.decoder_map));
+ MockChannelReceive& channel_receive = *helper.channel_receive();
+ EXPECT_CALL(channel_receive, SetLocalSSRC(kLocalSsrc + 1)).Times(1);
+ EXPECT_CALL(channel_receive, SetNACKStatus(true, 15 + 1)).Times(1);
+ EXPECT_CALL(channel_receive, SetReceiveCodecs(new_config.decoder_map));
recv_stream->Reconfigure(new_config);
}