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.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_output.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/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "content/child/child_process.h" | 11 #include "content/child/child_process.h" |
12 #include "content/common/media/audio_messages.h" | 12 #include "content/common/media/audio_messages.h" |
13 #include "content/renderer/media/audio_message_filter.h" | 13 #include "content/renderer/media/audio_message_filter.h" |
14 #include "content/renderer/pepper/audio_helper.h" | 14 #include "content/renderer/pepper/audio_helper.h" |
15 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
16 #include "media/base/audio_hardware_config.h" | 16 #include "media/base/audio_hardware_config.h" |
| 17 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 // static | 21 // static |
21 PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create( | 22 PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create( |
22 int sample_rate, | 23 int sample_rate, |
23 int frames_per_buffer, | 24 int frames_per_buffer, |
24 int source_render_view_id, | 25 int source_render_view_id, |
25 AudioHelper* client) { | 26 AudioHelper* client) { |
26 scoped_refptr<PepperPlatformAudioOutput> audio_output( | 27 scoped_refptr<PepperPlatformAudioOutput> audio_output( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 DCHECK(client); | 120 DCHECK(client); |
120 client_ = client; | 121 client_ = client; |
121 | 122 |
122 RenderThreadImpl* const render_thread = RenderThreadImpl::current(); | 123 RenderThreadImpl* const render_thread = RenderThreadImpl::current(); |
123 ipc_ = render_thread->audio_message_filter()-> | 124 ipc_ = render_thread->audio_message_filter()-> |
124 CreateAudioOutputIPC(source_render_view_id); | 125 CreateAudioOutputIPC(source_render_view_id); |
125 CHECK(ipc_); | 126 CHECK(ipc_); |
126 | 127 |
127 media::AudioParameters params( | 128 media::AudioParameters params( |
128 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 129 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
129 media::CHANNEL_LAYOUT_STEREO, sample_rate, 16, frames_per_buffer); | 130 media::CHANNEL_LAYOUT_STEREO, sample_rate, |
| 131 ppapi::kBitsPerAudioOutputSample, frames_per_buffer); |
130 | 132 |
131 io_message_loop_proxy_->PostTask( | 133 io_message_loop_proxy_->PostTask( |
132 FROM_HERE, | 134 FROM_HERE, |
133 base::Bind(&PepperPlatformAudioOutput::InitializeOnIOThread, this, | 135 base::Bind(&PepperPlatformAudioOutput::InitializeOnIOThread, this, |
134 params)); | 136 params)); |
135 return true; | 137 return true; |
136 } | 138 } |
137 | 139 |
138 void PepperPlatformAudioOutput::InitializeOnIOThread( | 140 void PepperPlatformAudioOutput::InitializeOnIOThread( |
139 const media::AudioParameters& params) { | 141 const media::AudioParameters& params) { |
(...skipping 23 matching lines...) Expand all Loading... |
163 return; | 165 return; |
164 | 166 |
165 ipc_->CloseStream(); | 167 ipc_->CloseStream(); |
166 ipc_.reset(); | 168 ipc_.reset(); |
167 | 169 |
168 Release(); // Release for the delegate, balances out the reference taken in | 170 Release(); // Release for the delegate, balances out the reference taken in |
169 // PepperPlatformAudioOutput::Create. | 171 // PepperPlatformAudioOutput::Create. |
170 } | 172 } |
171 | 173 |
172 } // namespace content | 174 } // namespace content |
OLD | NEW |