| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 virtual ~TestAudioSource() {} | 66 virtual ~TestAudioSource() {} |
| 67 | 67 |
| 68 virtual int OnMoreData(AudioBus* audio_bus, | 68 virtual int OnMoreData(AudioBus* audio_bus, |
| 69 AudioBuffersState audio_buffers) OVERRIDE { | 69 AudioBuffersState audio_buffers) OVERRIDE { |
| 70 const int ret = SineWaveAudioSource::OnMoreData(audio_bus, audio_buffers); | 70 const int ret = SineWaveAudioSource::OnMoreData(audio_bus, audio_buffers); |
| 71 data_pulled_.Signal(); | 71 data_pulled_.Signal(); |
| 72 return ret; | 72 return ret; |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual int OnMoreIOData(AudioBus* source, | |
| 76 AudioBus* dest, | |
| 77 AudioBuffersState audio_buffers) OVERRIDE { | |
| 78 const int ret = | |
| 79 SineWaveAudioSource::OnMoreIOData(source, dest, audio_buffers); | |
| 80 data_pulled_.Signal(); | |
| 81 return ret; | |
| 82 } | |
| 83 | |
| 84 void WaitForDataPulls() { | 75 void WaitForDataPulls() { |
| 85 for (int i = 0; i < 3; ++i) { | 76 for (int i = 0; i < 3; ++i) { |
| 86 data_pulled_.Wait(); | 77 data_pulled_.Wait(); |
| 87 } | 78 } |
| 88 } | 79 } |
| 89 | 80 |
| 90 private: | 81 private: |
| 91 base::WaitableEvent data_pulled_; | 82 base::WaitableEvent data_pulled_; |
| 92 | 83 |
| 93 DISALLOW_COPY_AND_ASSIGN(TestAudioSource); | 84 DISALLOW_COPY_AND_ASSIGN(TestAudioSource); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 337 } |
| 347 RUN_ON_AUDIO_THREAD(Close); | 338 RUN_ON_AUDIO_THREAD(Close); |
| 348 WaitUntilClosed(); | 339 WaitUntilClosed(); |
| 349 } | 340 } |
| 350 | 341 |
| 351 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, | 342 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, |
| 352 VirtualAudioInputStreamTest, | 343 VirtualAudioInputStreamTest, |
| 353 ::testing::Values(false, true)); | 344 ::testing::Values(false, true)); |
| 354 | 345 |
| 355 } // namespace media | 346 } // namespace media |
| OLD | NEW |