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/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 EXPECT_EQ(static_cast<size_t>(size) % sizeof(*audio_bus->channel(0)), 0U); | 247 EXPECT_EQ(static_cast<size_t>(size) % sizeof(*audio_bus->channel(0)), 0U); |
248 audio_bus->FromInterleaved( | 248 audio_bus->FromInterleaved( |
249 source, size / frame_size_, frame_size_ / channels_); | 249 source, size / frame_size_, frame_size_ / channels_); |
250 buffer_->Seek(size); | 250 buffer_->Seek(size); |
251 return size / frame_size_; | 251 return size / frame_size_; |
252 } | 252 } |
253 | 253 |
254 return 0; | 254 return 0; |
255 } | 255 } |
256 | 256 |
257 virtual int OnMoreIOData(AudioBus* source, | |
258 AudioBus* dest, | |
259 AudioBuffersState buffers_state) OVERRIDE { | |
260 NOTREACHED(); | |
261 return 0; | |
262 } | |
263 | |
264 virtual void OnError(AudioOutputStream* stream) OVERRIDE {} | 257 virtual void OnError(AudioOutputStream* stream) OVERRIDE {} |
265 | 258 |
266 protected: | 259 protected: |
267 // Converts from bytes to milliseconds taking the sample rate and size | 260 // Converts from bytes to milliseconds taking the sample rate and size |
268 // of an audio frame into account. | 261 // of an audio frame into account. |
269 int BytesToMilliseconds(uint32 delay_bytes) const { | 262 int BytesToMilliseconds(uint32 delay_bytes) const { |
270 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); | 263 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); |
271 } | 264 } |
272 | 265 |
273 private: | 266 private: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 437 |
445 // All Close() operations that run on the mocked audio thread, | 438 // All Close() operations that run on the mocked audio thread, |
446 // should be synchronous and not post additional close tasks to | 439 // should be synchronous and not post additional close tasks to |
447 // mocked the audio thread. Hence, there is no need to call | 440 // mocked the audio thread. Hence, there is no need to call |
448 // message_loop()->RunUntilIdle() after the Close() methods. | 441 // message_loop()->RunUntilIdle() after the Close() methods. |
449 aos->Close(); | 442 aos->Close(); |
450 ais->Close(); | 443 ais->Close(); |
451 } | 444 } |
452 | 445 |
453 } // namespace media | 446 } // namespace media |
OLD | NEW |