| 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 "content/renderer/pepper/pepper_platform_audio_output_impl.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ChildProcess::current()->io_message_loop()->PostTask( | 137 ChildProcess::current()->io_message_loop()->PostTask( |
| 138 FROM_HERE, | 138 FROM_HERE, |
| 139 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, | 139 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, |
| 140 this, params)); | 140 this, params)); |
| 141 return true; | 141 return true; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void PepperPlatformAudioOutputImpl::InitializeOnIOThread( | 144 void PepperPlatformAudioOutputImpl::InitializeOnIOThread( |
| 145 const media::AudioParameters& params) { | 145 const media::AudioParameters& params) { |
| 146 stream_id_ = ipc_->AddDelegate(this); | 146 stream_id_ = ipc_->AddDelegate(this); |
| 147 ipc_->CreateStream(stream_id_, params); | 147 ipc_->CreateStream(stream_id_, params, 0); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread() { | 150 void PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread() { |
| 151 if (stream_id_) | 151 if (stream_id_) |
| 152 ipc_->PlayStream(stream_id_); | 152 ipc_->PlayStream(stream_id_); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread() { | 155 void PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread() { |
| 156 if (stream_id_) | 156 if (stream_id_) |
| 157 ipc_->PauseStream(stream_id_); | 157 ipc_->PauseStream(stream_id_); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() { | 160 void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() { |
| 161 // Make sure we don't call shutdown more than once. | 161 // Make sure we don't call shutdown more than once. |
| 162 if (!stream_id_) | 162 if (!stream_id_) |
| 163 return; | 163 return; |
| 164 | 164 |
| 165 ipc_->CloseStream(stream_id_); | 165 ipc_->CloseStream(stream_id_); |
| 166 ipc_->RemoveDelegate(stream_id_); | 166 ipc_->RemoveDelegate(stream_id_); |
| 167 stream_id_ = 0; | 167 stream_id_ = 0; |
| 168 | 168 |
| 169 Release(); // Release for the delegate, balances out the reference taken in | 169 Release(); // Release for the delegate, balances out the reference taken in |
| 170 // PepperPluginDelegateImpl::CreateAudio. | 170 // PepperPluginDelegateImpl::CreateAudio. |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace content | 173 } // namespace content |
| OLD | NEW |