| 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 state.output_delay_ms); | 180 state.output_delay_ms); |
| 181 ++elements_written; | 181 ++elements_written; |
| 182 } | 182 } |
| 183 | 183 |
| 184 file_util::CloseFile(text_file); | 184 file_util::CloseFile(text_file); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // AudioInputStream::AudioInputCallback. | 187 // AudioInputStream::AudioInputCallback. |
| 188 virtual void OnData(AudioInputStream* stream, | 188 virtual void OnData(AudioInputStream* stream, |
| 189 const uint8* src, uint32 size, | 189 const uint8* src, uint32 size, |
| 190 uint32 hardware_delay_bytes) OVERRIDE { | 190 uint32 hardware_delay_bytes, |
| 191 double volume) OVERRIDE { |
| 191 base::AutoLock lock(lock_); | 192 base::AutoLock lock(lock_); |
| 192 | 193 |
| 193 // Update three components in the AudioDelayState for this recorded | 194 // Update three components in the AudioDelayState for this recorded |
| 194 // audio packet. | 195 // audio packet. |
| 195 base::Time now_time = base::Time::Now(); | 196 base::Time now_time = base::Time::Now(); |
| 196 int diff = (now_time - previous_write_time_).InMilliseconds(); | 197 int diff = (now_time - previous_write_time_).InMilliseconds(); |
| 197 previous_write_time_ = now_time; | 198 previous_write_time_ = now_time; |
| 198 if (input_elements_to_write_ < kMaxDelayMeasurements) { | 199 if (input_elements_to_write_ < kMaxDelayMeasurements) { |
| 199 delay_states_[input_elements_to_write_].delta_time_ms = diff; | 200 delay_states_[input_elements_to_write_].delta_time_ms = diff; |
| 200 delay_states_[input_elements_to_write_].buffer_delay_ms = | 201 delay_states_[input_elements_to_write_].buffer_delay_ms = |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 aos->Stop(); | 450 aos->Stop(); |
| 450 ais->Stop(); | 451 ais->Stop(); |
| 451 | 452 |
| 452 // All Close() operations that run on the mocked audio thread, | 453 // All Close() operations that run on the mocked audio thread, |
| 453 // should be synchronous and not post additional close tasks to | 454 // should be synchronous and not post additional close tasks to |
| 454 // mocked the audio thread. Hence, there is no need to call | 455 // mocked the audio thread. Hence, there is no need to call |
| 455 // message_loop()->RunAllPending() after the Close() methods. | 456 // message_loop()->RunAllPending() after the Close() methods. |
| 456 aos->Close(); | 457 aos->Close(); |
| 457 ais->Close(); | 458 ais->Close(); |
| 458 } | 459 } |
| OLD | NEW |