| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 class TestAudioSource : public SineWaveAudioSource { | 60 class TestAudioSource : public SineWaveAudioSource { |
| 61 public: | 61 public: |
| 62 TestAudioSource() | 62 TestAudioSource() |
| 63 : SineWaveAudioSource( | 63 : SineWaveAudioSource( |
| 64 kParams.channel_layout(), 200.0, kParams.sample_rate()), | 64 kParams.channel_layout(), 200.0, kParams.sample_rate()), |
| 65 data_pulled_(false, false) {} | 65 data_pulled_(false, false) {} |
| 66 | 66 |
| 67 virtual ~TestAudioSource() {} | 67 virtual ~TestAudioSource() {} |
| 68 | 68 |
| 69 virtual int OnMoreData(AudioBus* audio_bus, | 69 virtual int OnMoreData(AudioBus* audio_bus, |
| 70 uint32 total_bytes_delay) OVERRIDE { | 70 uint32 total_bytes_delay) override { |
| 71 const int ret = SineWaveAudioSource::OnMoreData(audio_bus, | 71 const int ret = SineWaveAudioSource::OnMoreData(audio_bus, |
| 72 total_bytes_delay); | 72 total_bytes_delay); |
| 73 data_pulled_.Signal(); | 73 data_pulled_.Signal(); |
| 74 return ret; | 74 return ret; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WaitForDataPulls() { | 77 void WaitForDataPulls() { |
| 78 for (int i = 0; i < 3; ++i) { | 78 for (int i = 0; i < 3; ++i) { |
| 79 data_pulled_.Wait(); | 79 data_pulled_.Wait(); |
| 80 } | 80 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 338 } |
| 339 RUN_ON_AUDIO_THREAD(Close); | 339 RUN_ON_AUDIO_THREAD(Close); |
| 340 WaitUntilClosed(); | 340 WaitUntilClosed(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, | 343 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, |
| 344 VirtualAudioInputStreamTest, | 344 VirtualAudioInputStreamTest, |
| 345 ::testing::Values(false, true)); | 345 ::testing::Values(false, true)); |
| 346 | 346 |
| 347 } // namespace media | 347 } // namespace media |
| OLD | NEW |