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

Unified Diff: webrtc/audio/audio_receive_stream_unittest.cc

Issue 2436033002: Replace AudioConferenceMixer with AudioMixer. (Closed)
Patch Set: Added mock mixer, merged audio state tests. 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
« no previous file with comments | « webrtc/audio/audio_receive_stream.cc ('k') | webrtc/audio/audio_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bc071970e14454acb3aaa76c7d7b472dd547c05e 100644
--- a/webrtc/audio/audio_receive_stream_unittest.cc
+++ b/webrtc/audio/audio_receive_stream_unittest.cc
@@ -11,11 +11,11 @@
#include <string>
#include <vector>
+#include "webrtc/api/test/mock_audio_mixer.h"
#include "webrtc/audio/audio_receive_stream.h"
#include "webrtc/audio/conversion.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
-#include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
#include "webrtc/modules/pacing/packet_router.h"
@@ -72,7 +72,8 @@ struct ConfigHelper {
congestion_controller_(&simulated_clock_,
&bitrate_observer_,
&remote_bitrate_observer_,
- &event_log_) {
+ &event_log_),
+ audio_mixer_(new rtc::RefCountedObject<MockAudioMixer>()) {
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<MockAudioMixer> 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<MockAudioMixer> audio_mixer_;
AudioReceiveStream::Config stream_config_;
testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
};
@@ -368,5 +370,31 @@ 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));
+ EXPECT_CALL(*helper.audio_mixer(), AddSource(_)).Times(0);
+
+ recv_stream.Start();
+}
+
+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(_));
+ EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream))
+ .WillOnce(Return(true));
+
+ recv_stream.Start();
+}
} // namespace test
} // namespace webrtc
« no previous file with comments | « webrtc/audio/audio_receive_stream.cc ('k') | webrtc/audio/audio_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698