| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 public: | 66 public: |
| 67 TestAudioSource() | 67 TestAudioSource() |
| 68 : SineWaveAudioSource(kParams.channel_layout(), | 68 : SineWaveAudioSource(kParams.channel_layout(), |
| 69 200.0, | 69 200.0, |
| 70 kParams.sample_rate()), | 70 kParams.sample_rate()), |
| 71 data_pulled_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 71 data_pulled_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 72 base::WaitableEvent::InitialState::NOT_SIGNALED) {} | 72 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 73 | 73 |
| 74 ~TestAudioSource() override {} | 74 ~TestAudioSource() override {} |
| 75 | 75 |
| 76 int OnMoreData(AudioBus* audio_bus, | 76 int OnMoreData(base::TimeDelta delay, |
| 77 uint32_t total_bytes_delay, | 77 base::TimeTicks delay_timestamp, |
| 78 uint32_t frames_skipped) override { | 78 int prior_frames_skipped, |
| 79 const int ret = SineWaveAudioSource::OnMoreData( | 79 AudioBus* dest) override { |
| 80 audio_bus, total_bytes_delay, frames_skipped); | 80 const int ret = SineWaveAudioSource::OnMoreData(delay, delay_timestamp, |
| 81 prior_frames_skipped, dest); |
| 81 data_pulled_.Signal(); | 82 data_pulled_.Signal(); |
| 82 return ret; | 83 return ret; |
| 83 } | 84 } |
| 84 | 85 |
| 85 void WaitForDataPulls() { | 86 void WaitForDataPulls() { |
| 86 for (int i = 0; i < 3; ++i) { | 87 for (int i = 0; i < 3; ++i) { |
| 87 data_pulled_.Wait(); | 88 data_pulled_.Wait(); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 | 91 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 349 } |
| 349 RUN_ON_AUDIO_THREAD(Close); | 350 RUN_ON_AUDIO_THREAD(Close); |
| 350 WaitUntilClosed(); | 351 WaitUntilClosed(); |
| 351 } | 352 } |
| 352 | 353 |
| 353 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, | 354 INSTANTIATE_TEST_CASE_P(SingleVersusMultithreaded, |
| 354 VirtualAudioInputStreamTest, | 355 VirtualAudioInputStreamTest, |
| 355 ::testing::Values(false, true)); | 356 ::testing::Values(false, true)); |
| 356 | 357 |
| 357 } // namespace media | 358 } // namespace media |
| OLD | NEW |