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

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

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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_input_impl.h" 5 #include "content/renderer/pepper/pepper_platform_audio_input_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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int frames_per_buffer, 86 int frames_per_buffer,
87 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) { 87 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) {
88 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); 88 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
89 89
90 if (!plugin_delegate || !client) 90 if (!plugin_delegate || !client)
91 return false; 91 return false;
92 92
93 plugin_delegate_ = plugin_delegate; 93 plugin_delegate_ = plugin_delegate;
94 client_ = client; 94 client_ = client;
95 95
96 params_.Reset(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, 96 params_.Reset(media::AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
97 sample_rate, 16, frames_per_buffer); 97 sample_rate, 16, frames_per_buffer);
98 98
99 if (device_id.empty()) { 99 if (device_id.empty()) {
100 // Use the default device. 100 // Use the default device.
101 ChildProcess::current()->io_message_loop()->PostTask( 101 ChildProcess::current()->io_message_loop()->PostTask(
102 FROM_HERE, 102 FROM_HERE,
103 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread, 103 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread,
104 this, 0)); 104 this, 0));
105 } else { 105 } else {
106 // We need to open the device and obtain the label and session ID before 106 // We need to open the device and obtain the label and session ID before
(...skipping 13 matching lines...) Expand all
120 return; 120 return;
121 121
122 // Make sure we don't call init more than once. 122 // Make sure we don't call init more than once.
123 DCHECK_EQ(0, stream_id_); 123 DCHECK_EQ(0, stream_id_);
124 stream_id_ = filter_->AddDelegate(this); 124 stream_id_ = filter_->AddDelegate(this);
125 DCHECK_NE(0, stream_id_); 125 DCHECK_NE(0, stream_id_);
126 126
127 if (!session_id) { 127 if (!session_id) {
128 // We will be notified by OnStreamCreated(). 128 // We will be notified by OnStreamCreated().
129 filter_->Send(new AudioInputHostMsg_CreateStream( 129 filter_->Send(new AudioInputHostMsg_CreateStream(
130 stream_id_, params_, AudioManagerBase::kDefaultDeviceId, false)); 130 stream_id_, params_,
131 media::AudioManagerBase::kDefaultDeviceId, false));
131 } else { 132 } else {
132 // We will be notified by OnDeviceReady(). 133 // We will be notified by OnDeviceReady().
133 filter_->Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id)); 134 filter_->Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id));
134 } 135 }
135 } 136 }
136 137
137 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() { 138 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() {
138 DCHECK(ChildProcess::current()->io_message_loop_proxy()-> 139 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
139 BelongsToCurrentThread()); 140 BelongsToCurrentThread());
140 141
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 label_.clear(); 267 label_.clear();
267 } 268 }
268 } 269 }
269 270
270 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { 271 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() {
271 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); 272 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
272 273
273 if (client_) 274 if (client_)
274 client_->StreamCreationFailed(); 275 client_->StreamCreationFailed();
275 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698