Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output_impl.cc

Issue 10830268: Allow audio system to handle synchronized low-latency audio I/O (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_webaudiodevice_impl.cc ('k') | media/audio/audio_device_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698