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

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

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary #include Created 8 years, 5 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"
11 #include "content/common/child_process.h" 11 #include "content/common/child_process.h"
12 #include "content/common/media/audio_messages.h" 12 #include "content/common/media/audio_messages.h"
13 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" 13 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "media/audio/audio_manager_base.h" 15 #include "media/audio/audio_manager_base.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 // static 19 // static
20 PepperPlatformAudioInputImpl* PepperPlatformAudioInputImpl::Create( 20 PepperPlatformAudioInputImpl* PepperPlatformAudioInputImpl::Create(
21 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, 21 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate,
22 const std::string& device_id, 22 const std::string& device_id,
23 int sample_rate, 23 int sample_rate,
24 int frames_per_buffer, 24 int frames_per_buffer,
25 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) { 25 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) {
26 scoped_refptr<PepperPlatformAudioInputImpl> audio_input( 26 scoped_refptr<PepperPlatformAudioInputImpl> audio_input(
27 new PepperPlatformAudioInputImpl); 27 new PepperPlatformAudioInputImpl());
28 if (audio_input->Initialize(plugin_delegate, device_id, sample_rate, 28 if (audio_input->Initialize(plugin_delegate, device_id, sample_rate,
29 frames_per_buffer, client)) { 29 frames_per_buffer, client)) {
30 // Balanced by Release invoked in 30 // Balanced by Release invoked in
31 // PepperPlatformAudioInputImpl::ShutDownOnIOThread(). 31 // PepperPlatformAudioInputImpl::ShutDownOnIOThread().
32 return audio_input.release(); 32 return audio_input.release();
33 } 33 }
34 return NULL; 34 return NULL;
35 } 35 }
36 36
37 void PepperPlatformAudioInputImpl::StartCapture() { 37 void PepperPlatformAudioInputImpl::StartCapture() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 90 } else {
91 // Clean up the handles. 91 // Clean up the handles.
92 base::SyncSocket temp_socket(socket_handle); 92 base::SyncSocket temp_socket(socket_handle);
93 base::SharedMemory temp_shared_memory(handle, false); 93 base::SharedMemory temp_shared_memory(handle, false);
94 } 94 }
95 } 95 }
96 } 96 }
97 97
98 void PepperPlatformAudioInputImpl::OnVolume(double volume) {} 98 void PepperPlatformAudioInputImpl::OnVolume(double volume) {}
99 99
100 void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) {} 100 void PepperPlatformAudioInputImpl::OnStateChanged(
101 media::AudioStreamState state) {
102 }
101 103
102 void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) { 104 void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string& device_id) {
103 DCHECK(ChildProcess::current()->io_message_loop_proxy()-> 105 DCHECK(ChildProcess::current()->io_message_loop_proxy()->
104 BelongsToCurrentThread()); 106 BelongsToCurrentThread());
105 107
106 if (shutdown_called_) 108 if (shutdown_called_)
107 return; 109 return;
108 110
109 if (device_id.empty()) { 111 if (device_id.empty()) {
110 main_message_loop_proxy_->PostTask( 112 main_message_loop_proxy_->PostTask(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 271 }
270 272
271 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { 273 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() {
272 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); 274 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
273 275
274 if (client_) 276 if (client_)
275 client_->StreamCreationFailed(); 277 client_->StreamCreationFailed();
276 } 278 }
277 279
278 } // namespace content 280 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698