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