| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 EXPECT_EQ(static_cast<size_t>(size) % sizeof(*audio_bus->channel(0)), 0U); | 249 EXPECT_EQ(static_cast<size_t>(size) % sizeof(*audio_bus->channel(0)), 0U); |
| 250 audio_bus->FromInterleaved( | 250 audio_bus->FromInterleaved( |
| 251 source, size / frame_size_, frame_size_ / channels_); | 251 source, size / frame_size_, frame_size_ / channels_); |
| 252 buffer_->Seek(size); | 252 buffer_->Seek(size); |
| 253 return size / frame_size_; | 253 return size / frame_size_; |
| 254 } | 254 } |
| 255 | 255 |
| 256 return 0; | 256 return 0; |
| 257 } | 257 } |
| 258 | 258 |
| 259 virtual int OnMoreIOData(AudioBus* source, |
| 260 AudioBus* dest, |
| 261 AudioBuffersState buffers_state) OVERRIDE { |
| 262 NOTREACHED(); |
| 263 return 0; |
| 264 } |
| 265 |
| 259 virtual void OnError(AudioOutputStream* stream, int code) OVERRIDE {} | 266 virtual void OnError(AudioOutputStream* stream, int code) OVERRIDE {} |
| 260 virtual void WaitTillDataReady() OVERRIDE {} | 267 virtual void WaitTillDataReady() OVERRIDE {} |
| 261 | 268 |
| 262 protected: | 269 protected: |
| 263 // Converts from bytes to milliseconds taking the sample rate and size | 270 // Converts from bytes to milliseconds taking the sample rate and size |
| 264 // of an audio frame into account. | 271 // of an audio frame into account. |
| 265 int BytesToMilliseconds(uint32 delay_bytes) const { | 272 int BytesToMilliseconds(uint32 delay_bytes) const { |
| 266 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); | 273 return static_cast<int>((delay_bytes / frame_size_) * frames_to_ms_ + 0.5); |
| 267 } | 274 } |
| 268 | 275 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 467 |
| 461 // All Close() operations that run on the mocked audio thread, | 468 // All Close() operations that run on the mocked audio thread, |
| 462 // should be synchronous and not post additional close tasks to | 469 // should be synchronous and not post additional close tasks to |
| 463 // mocked the audio thread. Hence, there is no need to call | 470 // mocked the audio thread. Hence, there is no need to call |
| 464 // message_loop()->RunAllPending() after the Close() methods. | 471 // message_loop()->RunAllPending() after the Close() methods. |
| 465 aos->Close(); | 472 aos->Close(); |
| 466 ais->Close(); | 473 ais->Close(); |
| 467 } | 474 } |
| 468 | 475 |
| 469 } // namespace media | 476 } // namespace media |
| OLD | NEW |