| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/base/fake_audio_renderer_sink.h" | 5 #include "media/base/fake_audio_renderer_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 bool FakeAudioRendererSink::SetVolume(double volume) { | 60 bool FakeAudioRendererSink::SetVolume(double volume) { |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 OutputDeviceInfo FakeAudioRendererSink::GetOutputDeviceInfo() { | 64 OutputDeviceInfo FakeAudioRendererSink::GetOutputDeviceInfo() { |
| 65 return output_device_info_; | 65 return output_device_info_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool FakeAudioRendererSink::Render(AudioBus* dest, | 68 bool FakeAudioRendererSink::Render(AudioBus* dest, |
| 69 uint32_t audio_delay_milliseconds, | 69 uint32_t frames_delayed, |
| 70 int* frames_written) { | 70 int* frames_written) { |
| 71 if (state_ != kPlaying) | 71 if (state_ != kPlaying) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 *frames_written = callback_->Render(dest, audio_delay_milliseconds, 0); | 74 *frames_written = callback_->Render(dest, frames_delayed, 0); |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void FakeAudioRendererSink::OnRenderError() { | 78 void FakeAudioRendererSink::OnRenderError() { |
| 79 DCHECK_NE(state_, kUninitialized); | 79 DCHECK_NE(state_, kUninitialized); |
| 80 DCHECK_NE(state_, kStopped); | 80 DCHECK_NE(state_, kStopped); |
| 81 | 81 |
| 82 callback_->OnRenderError(); | 82 callback_->OnRenderError(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void FakeAudioRendererSink::ChangeState(State new_state) { | 85 void FakeAudioRendererSink::ChangeState(State new_state) { |
| 86 static const char* kStateNames[] = { | 86 static const char* kStateNames[] = { |
| 87 "kUninitialized", | 87 "kUninitialized", |
| 88 "kInitialized", | 88 "kInitialized", |
| 89 "kStarted", | 89 "kStarted", |
| 90 "kPaused", | 90 "kPaused", |
| 91 "kPlaying", | 91 "kPlaying", |
| 92 "kStopped" | 92 "kStopped" |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 DVLOG(1) << __FUNCTION__ << " : " | 95 DVLOG(1) << __FUNCTION__ << " : " |
| 96 << kStateNames[state_] << " -> " << kStateNames[new_state]; | 96 << kStateNames[state_] << " -> " << kStateNames[new_state]; |
| 97 state_ = new_state; | 97 state_ = new_state; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace media | 100 } // namespace media |
| OLD | NEW |