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_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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } else if (sample_rate == audio_hardware::GetOutputSampleRate() && | 132 } else if (sample_rate == audio_hardware::GetOutputSampleRate() && |
133 frames_per_buffer <= kMaxFramesForLowLatency && | 133 frames_per_buffer <= kMaxFramesForLowLatency && |
134 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { | 134 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { |
135 // Use the low latency back end if the client request is compatible, and | 135 // Use the low latency back end if the client request is compatible, and |
136 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. | 136 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. |
137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; | 137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; |
138 } else { | 138 } else { |
139 format = media::AudioParameters::AUDIO_PCM_LINEAR; | 139 format = media::AudioParameters::AUDIO_PCM_LINEAR; |
140 } | 140 } |
141 | 141 |
142 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16, | 142 media::AudioParameters params(format, media::CHANNEL_LAYOUT_STEREO, |
143 frames_per_buffer); | 143 sample_rate, 16, frames_per_buffer); |
144 | 144 |
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) { |
(...skipping 18 matching lines...) Expand all Loading... |
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 |
OLD | NEW |