| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // Double the buffer capacity to ensure that we have a buffer large | 209 // Double the buffer capacity to ensure that we have a buffer large |
| 210 // enough to handle the current sample test scenario. | 210 // enough to handle the current sample test scenario. |
| 211 // buffer_->set_forward_capacity(2 * buffer_->forward_capacity()); | 211 // buffer_->set_forward_capacity(2 * buffer_->forward_capacity()); |
| 212 // buffer_->Clear(); | 212 // buffer_->Clear(); |
| 213 // } | 213 // } |
| 214 } | 214 } |
| 215 | 215 |
| 216 void OnError(AudioInputStream* stream) override {} | 216 void OnError(AudioInputStream* stream) override {} |
| 217 | 217 |
| 218 // AudioOutputStream::AudioSourceCallback. | 218 // AudioOutputStream::AudioSourceCallback. |
| 219 int OnMoreData(AudioBus* audio_bus, | 219 int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override { |
| 220 uint32_t total_bytes_delay, | |
| 221 uint32_t frames_skipped) override { | |
| 222 base::AutoLock lock(lock_); | 220 base::AutoLock lock(lock_); |
| 223 | 221 |
| 224 // Update one component in the AudioDelayState for the packet | 222 // Update one component in the AudioDelayState for the packet |
| 225 // which is about to be played out. | 223 // which is about to be played out. |
| 226 if (output_elements_to_write_ < kMaxDelayMeasurements) { | 224 if (output_elements_to_write_ < kMaxDelayMeasurements) { |
| 227 delay_states_[output_elements_to_write_].output_delay_ms = | 225 delay_states_[output_elements_to_write_].output_delay_ms = |
| 228 BytesToMilliseconds(total_bytes_delay); | 226 BytesToMilliseconds(total_bytes_delay); |
| 229 ++output_elements_to_write_; | 227 ++output_elements_to_write_; |
| 230 } | 228 } |
| 231 | 229 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 428 |
| 431 // All Close() operations that run on the mocked audio thread, | 429 // All Close() operations that run on the mocked audio thread, |
| 432 // should be synchronous and not post additional close tasks to | 430 // should be synchronous and not post additional close tasks to |
| 433 // mocked the audio thread. Hence, there is no need to call | 431 // mocked the audio thread. Hence, there is no need to call |
| 434 // message_loop()->RunUntilIdle() after the Close() methods. | 432 // message_loop()->RunUntilIdle() after the Close() methods. |
| 435 aos->Close(); | 433 aos->Close(); |
| 436 ais->Close(); | 434 ais->Close(); |
| 437 } | 435 } |
| 438 | 436 |
| 439 } // namespace media | 437 } // namespace media |
| OLD | NEW |