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

Unified Diff: content/renderer/media/webrtc_audio_device_unittest.cc

Issue 15979027: start/stop the source of the capturer when 1st audiotrack/last audiotrack is added/removed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed Henrik's comments. Created 7 years, 6 months 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: content/renderer/media/webrtc_audio_device_unittest.cc
diff --git a/content/renderer/media/webrtc_audio_device_unittest.cc b/content/renderer/media/webrtc_audio_device_unittest.cc
index 37d5401c558b9e1aadfed78d7aadc2ddf2e87135..4dac1f8f2831f2e19f34a502e7fad0391e09b903 100644
--- a/content/renderer/media/webrtc_audio_device_unittest.cc
+++ b/content/renderer/media/webrtc_audio_device_unittest.cc
@@ -11,6 +11,7 @@
#include "content/renderer/media/webrtc_audio_capturer.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "content/renderer/media/webrtc_audio_renderer.h"
+#include "content/renderer/media/webrtc_local_audio_track.h"
#include "content/renderer/render_thread_impl.h"
#include "content/test/webrtc_audio_device_test.h"
#include "media/audio/audio_manager_base.h"
@@ -582,7 +583,14 @@ TEST_F(WebRTCAudioDeviceTest, MAYBE_StartRecording) {
ASSERT_EQ(0, err);
EXPECT_TRUE(InitializeCapturer(webrtc_audio_device.get()));
- webrtc_audio_device->capturer()->Start();
+
+ // Create and start a local audio track. Starting the audio track will connect
+ // the audio track to the capturer and also start the source of the capturer.
+ scoped_refptr<WebRtcLocalAudioTrack> local_audio_track(
+ WebRtcLocalAudioTrack::Create(std::string(),
+ webrtc_audio_device->capturer(),
+ NULL));
+ local_audio_track->Start();
int ch = base->CreateChannel();
EXPECT_NE(-1, ch);
@@ -619,7 +627,7 @@ TEST_F(WebRTCAudioDeviceTest, MAYBE_StartRecording) {
ch, webrtc::kRecordingPerChannel));
EXPECT_EQ(0, base->StopSend(ch));
- webrtc_audio_device->capturer()->Stop();
+ local_audio_track->Stop();
EXPECT_EQ(0, base->DeleteChannel(ch));
EXPECT_EQ(0, base->Terminate());
}
@@ -745,7 +753,13 @@ TEST_F(WebRTCAudioDeviceTest, MAYBE_FullDuplexAudioWithAGC) {
ASSERT_EQ(0, err);
EXPECT_TRUE(InitializeCapturer(webrtc_audio_device.get()));
- webrtc_audio_device->capturer()->Start();
+ // Create and start a local audio track. Starting the audio track will connect
+ // the audio track to the capturer and also start the source of the capturer.
+ scoped_refptr<WebRtcLocalAudioTrack> local_audio_track(
+ WebRtcLocalAudioTrack::Create(std::string(),
+ webrtc_audio_device->capturer(),
+ NULL));
+ local_audio_track->Start();
ScopedWebRTCPtr<webrtc::VoEAudioProcessing> audio_processing(engine.get());
ASSERT_TRUE(audio_processing.valid());
@@ -781,7 +795,7 @@ TEST_F(WebRTCAudioDeviceTest, MAYBE_FullDuplexAudioWithAGC) {
base::TimeDelta::FromSeconds(2));
message_loop_.Run();
- webrtc_audio_device->capturer()->Stop();
+ local_audio_track->Stop();
renderer->Stop();
EXPECT_EQ(0, base->StopSend(ch));
EXPECT_EQ(0, base->StopPlayout(ch));
@@ -815,7 +829,13 @@ TEST_F(WebRTCAudioDeviceTest, WebRtcRecordingSetupTime) {
ASSERT_EQ(0, err);
EXPECT_TRUE(InitializeCapturer(webrtc_audio_device.get()));
- webrtc_audio_device->capturer()->Start();
+ // Create and start a local audio track. Starting the audio track will connect
+ // the audio track to the capturer and also start the source of the capturer.
+ scoped_refptr<WebRtcLocalAudioTrack> local_audio_track(
+ WebRtcLocalAudioTrack::Create(std::string(),
+ webrtc_audio_device->capturer(),
+ NULL));
+ local_audio_track->Start();
base::WaitableEvent event(false, false);
scoped_ptr<MockWebRtcAudioCapturerSink> capturer_sink(
@@ -834,7 +854,7 @@ TEST_F(WebRTCAudioDeviceTest, WebRtcRecordingSetupTime) {
PrintPerfResultMs("webrtc_recording_setup_c", "t", delay);
capturer->RemoveSink(capturer_sink.get());
- webrtc_audio_device->capturer()->Stop();
+ local_audio_track->Stop();
EXPECT_EQ(0, base->StopSend(ch));
EXPECT_EQ(0, base->DeleteChannel(ch));
EXPECT_EQ(0, base->Terminate());
« no previous file with comments | « content/renderer/media/webrtc_audio_device_impl.cc ('k') | content/renderer/media/webrtc_local_audio_track.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698