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_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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 bool PepperPlatformAudioInputImpl::Initialize( | 68 bool PepperPlatformAudioInputImpl::Initialize( |
69 int sample_rate, | 69 int sample_rate, |
70 int frames_per_buffer, | 70 int frames_per_buffer, |
71 webkit::ppapi::PluginDelegate::PlatformAudioCommonClient* client) { | 71 webkit::ppapi::PluginDelegate::PlatformAudioCommonClient* client) { |
72 DCHECK(client); | 72 DCHECK(client); |
73 // Make sure we don't call init more than once. | 73 // Make sure we don't call init more than once. |
74 DCHECK_EQ(0, stream_id_); | 74 DCHECK_EQ(0, stream_id_); |
75 | 75 |
76 client_ = client; | 76 client_ = client; |
77 | 77 |
78 AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, | 78 media::AudioParameters params( |
79 CHANNEL_LAYOUT_MONO, | 79 media::AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, |
80 sample_rate, 16, frames_per_buffer); | 80 sample_rate, 16, frames_per_buffer); |
81 | 81 |
82 ChildProcess::current()->io_message_loop()->PostTask( | 82 ChildProcess::current()->io_message_loop()->PostTask( |
83 FROM_HERE, | 83 FROM_HERE, |
84 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread, | 84 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread, |
85 this, params)); | 85 this, params)); |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void PepperPlatformAudioInputImpl::InitializeOnIOThread( | 89 void PepperPlatformAudioInputImpl::InitializeOnIOThread( |
90 const AudioParameters& params) { | 90 const media::AudioParameters& params) { |
91 stream_id_ = filter_->AddDelegate(this); | 91 stream_id_ = filter_->AddDelegate(this); |
92 filter_->Send(new AudioInputHostMsg_CreateStream( | 92 filter_->Send(new AudioInputHostMsg_CreateStream( |
93 stream_id_, params, AudioManagerBase::kDefaultDeviceId)); | 93 stream_id_, params, media::AudioManagerBase::kDefaultDeviceId)); |
94 } | 94 } |
95 | 95 |
96 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() { | 96 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() { |
97 if (stream_id_) | 97 if (stream_id_) |
98 filter_->Send(new AudioInputHostMsg_RecordStream(stream_id_)); | 98 filter_->Send(new AudioInputHostMsg_RecordStream(stream_id_)); |
99 } | 99 } |
100 | 100 |
101 void PepperPlatformAudioInputImpl::StopCaptureOnIOThread() { | 101 void PepperPlatformAudioInputImpl::StopCaptureOnIOThread() { |
102 if (stream_id_) | 102 if (stream_id_) |
103 filter_->Send(new AudioInputHostMsg_CloseStream(stream_id_)); | 103 filter_->Send(new AudioInputHostMsg_CloseStream(stream_id_)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 void PepperPlatformAudioInputImpl::OnVolume(double volume) { | 145 void PepperPlatformAudioInputImpl::OnVolume(double volume) { |
146 } | 146 } |
147 | 147 |
148 void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) { | 148 void PepperPlatformAudioInputImpl::OnStateChanged(AudioStreamState state) { |
149 } | 149 } |
150 | 150 |
151 void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string&) { | 151 void PepperPlatformAudioInputImpl::OnDeviceReady(const std::string&) { |
152 } | 152 } |
OLD | NEW |