| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/synchronization/waitable_event.h" | 5 #include "base/synchronization/waitable_event.h" |
| 6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
| 7 #include "content/renderer/media/media_stream_audio_source.h" | 7 #include "content/renderer/media/media_stream_audio_source.h" |
| 8 #include "content/renderer/media/mock_media_constraint_factory.h" | 8 #include "content/renderer/media/mock_media_constraint_factory.h" |
| 9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 10 #include "content/renderer/media/webrtc_audio_capturer.h" | 10 #include "content/renderer/media/webrtc_audio_capturer.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 public: | 38 public: |
| 39 FakeAudioThread(WebRtcAudioCapturer* capturer, | 39 FakeAudioThread(WebRtcAudioCapturer* capturer, |
| 40 const media::AudioParameters& params) | 40 const media::AudioParameters& params) |
| 41 : capturer_(capturer), | 41 : capturer_(capturer), |
| 42 thread_(), | 42 thread_(), |
| 43 closure_(false, false) { | 43 closure_(false, false) { |
| 44 DCHECK(capturer); | 44 DCHECK(capturer); |
| 45 audio_bus_ = media::AudioBus::Create(params); | 45 audio_bus_ = media::AudioBus::Create(params); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual ~FakeAudioThread() { DCHECK(thread_.is_null()); } | 48 ~FakeAudioThread() override { DCHECK(thread_.is_null()); } |
| 49 | 49 |
| 50 // base::PlatformThread::Delegate: | 50 // base::PlatformThread::Delegate: |
| 51 virtual void ThreadMain() override { | 51 void ThreadMain() override { |
| 52 while (true) { | 52 while (true) { |
| 53 if (closure_.IsSignaled()) | 53 if (closure_.IsSignaled()) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 media::AudioCapturerSource::CaptureCallback* callback = | 56 media::AudioCapturerSource::CaptureCallback* callback = |
| 57 static_cast<media::AudioCapturerSource::CaptureCallback*>( | 57 static_cast<media::AudioCapturerSource::CaptureCallback*>( |
| 58 capturer_); | 58 capturer_); |
| 59 audio_bus_->Zero(); | 59 audio_bus_->Zero(); |
| 60 callback->Capture(audio_bus_.get(), 0, 0, false); | 60 callback->Capture(audio_bus_.get(), 0, 0, false); |
| 61 | 61 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // Stopping the new source will stop the second track. | 534 // Stopping the new source will stop the second track. |
| 535 EXPECT_CALL(*source.get(), OnStop()).Times(1); | 535 EXPECT_CALL(*source.get(), OnStop()).Times(1); |
| 536 capturer->Stop(); | 536 capturer->Stop(); |
| 537 | 537 |
| 538 // Even though this test don't use |capturer_source_| it will be stopped | 538 // Even though this test don't use |capturer_source_| it will be stopped |
| 539 // during teardown of the test harness. | 539 // during teardown of the test harness. |
| 540 EXPECT_CALL(*capturer_source_.get(), OnStop()); | 540 EXPECT_CALL(*capturer_source_.get(), OnStop()); |
| 541 } | 541 } |
| 542 | 542 |
| 543 } // namespace content | 543 } // namespace content |
| OLD | NEW |