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

Side by Side Diff: src/content/renderer/pepper/pepper_platform_audio_output_impl.cc

Issue 10824135: On 1180 (M21): Always use non-low-latency (wave out) audio for Pepper plugins on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int sample_rate, 106 int sample_rate,
107 int frames_per_buffer, 107 int frames_per_buffer,
108 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) { 108 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) {
109 DCHECK(client); 109 DCHECK(client);
110 // Make sure we don't call init more than once. 110 // Make sure we don't call init more than once.
111 DCHECK_EQ(0, stream_id_); 111 DCHECK_EQ(0, stream_id_);
112 112
113 client_ = client; 113 client_ = client;
114 114
115 media::AudioParameters::Format format; 115 media::AudioParameters::Format format;
116 #if defined(OS_WIN)
117 // For Chrome 21 on Windows, avoid the low-latency (WASAPI) path for the sake
118 // of Pepper Flash. Currently, the WASAPI path will fail silently for, e.g.,
119 // 5.1/7.1 sound. (Flash always requests 44.1 kHz anyways, so it's already
120 // using the non-low-latency (wave-out) path on any system that's configured
121 // for 48 kHz.)
122 format = media::AudioParameters::AUDIO_PCM_LINEAR;
123 #else
116 const int kMaxFramesForLowLatency = 2048; 124 const int kMaxFramesForLowLatency = 2048;
117 // Use the low latency back end if the client request is compatible, and 125 // Use the low latency back end if the client request is compatible, and
118 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. 126 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
119 if (sample_rate == audio_hardware::GetOutputSampleRate() && 127 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
120 frames_per_buffer <= kMaxFramesForLowLatency && 128 frames_per_buffer <= kMaxFramesForLowLatency &&
121 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 129 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
122 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 130 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
123 } else { 131 } else {
124 format = media::AudioParameters::AUDIO_PCM_LINEAR; 132 format = media::AudioParameters::AUDIO_PCM_LINEAR;
125 } 133 }
134 #endif
126 135
127 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16, 136 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16,
128 frames_per_buffer); 137 frames_per_buffer);
129 138
130 ChildProcess::current()->io_message_loop()->PostTask( 139 ChildProcess::current()->io_message_loop()->PostTask(
131 FROM_HERE, 140 FROM_HERE,
132 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, 141 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
133 this, params)); 142 this, params));
134 return true; 143 return true;
135 } 144 }
(...skipping 21 matching lines...) Expand all
157 166
158 filter_->Send(new AudioHostMsg_CloseStream(stream_id_)); 167 filter_->Send(new AudioHostMsg_CloseStream(stream_id_));
159 filter_->RemoveDelegate(stream_id_); 168 filter_->RemoveDelegate(stream_id_);
160 stream_id_ = 0; 169 stream_id_ = 0;
161 170
162 Release(); // Release for the delegate, balances out the reference taken in 171 Release(); // Release for the delegate, balances out the reference taken in
163 // PepperPluginDelegateImpl::CreateAudio. 172 // PepperPluginDelegateImpl::CreateAudio.
164 } 173 }
165 174
166 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698