Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: webrtc/audio/audio_receive_stream_unittest.cc

Issue 2436033002: Replace AudioConferenceMixer with AudioMixer. (Closed)
Patch Set: Correct struct member names, less code duplication in tests, minor fixes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/audio/audio_receive_stream_unittest.cc
diff --git a/webrtc/audio/audio_receive_stream_unittest.cc b/webrtc/audio/audio_receive_stream_unittest.cc
index f263948fc4a8e09308fee1ff1b771f253c145686..e13682be3510f7e46c183c07068c7ba1dcd3885c 100644
--- a/webrtc/audio/audio_receive_stream_unittest.cc
+++ b/webrtc/audio/audio_receive_stream_unittest.cc
@@ -72,7 +72,8 @@ struct ConfigHelper {
congestion_controller_(&simulated_clock_,
&bitrate_observer_,
&remote_bitrate_observer_,
- &event_log_) {
+ &event_log_),
+ audio_mixer_(AudioMixerImpl::Create()) {
using testing::Invoke;
EXPECT_CALL(voice_engine_,
@@ -85,7 +86,7 @@ struct ConfigHelper {
AudioState::Config config;
config.voice_engine = &voice_engine_;
- config.audio_mixer = AudioMixerImpl::Create();
+ config.audio_mixer = audio_mixer_;
audio_state_ = AudioState::Create(config);
EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
@@ -122,7 +123,6 @@ struct ConfigHelper {
EXPECT_CALL(*channel_proxy_, DisassociateSendChannel()).Times(1);
return channel_proxy_;
}));
- EXPECT_CALL(voice_engine_, StopPlayout(kChannelId)).WillOnce(Return(0));
stream_config_.voe_channel_id = kChannelId;
stream_config_.rtp.local_ssrc = kLocalSsrc;
stream_config_.rtp.remote_ssrc = kRemoteSsrc;
@@ -143,6 +143,7 @@ struct ConfigHelper {
MockRtcEventLog* event_log() { return &event_log_; }
AudioReceiveStream::Config& config() { return stream_config_; }
rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
+ rtc::scoped_refptr<AudioMixerImpl> audio_mixer() { return audio_mixer_; }
MockVoiceEngine& voice_engine() { return voice_engine_; }
MockVoEChannelProxy* channel_proxy() { return channel_proxy_; }
@@ -185,6 +186,7 @@ struct ConfigHelper {
MockRtcEventLog event_log_;
testing::StrictMock<MockVoiceEngine> voice_engine_;
rtc::scoped_refptr<AudioState> audio_state_;
+ rtc::scoped_refptr<AudioMixerImpl> audio_mixer_;
AudioReceiveStream::Config stream_config_;
testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
};
@@ -368,5 +370,34 @@ TEST(AudioReceiveStreamTest, SetGain) {
SetChannelOutputVolumeScaling(FloatEq(0.765f)));
recv_stream.SetGain(0.765f);
}
+
+TEST(AudioReceiveStreamTest, StreamShouldNotBeAddedToMixerWhenVoEReturnsError) {
+ ConfigHelper helper;
+ internal::AudioReceiveStream recv_stream(
+ helper.congestion_controller(), helper.config(), helper.audio_state(),
+ helper.event_log());
+
+ EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(-1));
+
+ recv_stream.Start();
+
+ EXPECT_EQ(helper.audio_mixer()->GetSourcePresenceStatusForTest(&recv_stream),
ossu 2016/11/21 17:07:32 Eugh! I don't like that there's an extra method on
+ false);
+}
+
+TEST(AudioReceiveStreamTest, StreamShouldBeAddedToMixerOnStart) {
+ ConfigHelper helper;
+ internal::AudioReceiveStream recv_stream(
+ helper.congestion_controller(), helper.config(), helper.audio_state(),
+ helper.event_log());
+
+ EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0));
+ EXPECT_CALL(helper.voice_engine(), StopPlayout(_));
+
+ recv_stream.Start();
+
+ EXPECT_EQ(helper.audio_mixer()->GetSourcePresenceStatusForTest(&recv_stream),
+ true);
+}
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698