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

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

Issue 10828124: Always use non-low-latency (wave out) audio for Pepper plugins on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int sample_rate, 113 int sample_rate,
114 int frames_per_buffer, 114 int frames_per_buffer,
115 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) { 115 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client) {
116 DCHECK(client); 116 DCHECK(client);
117 // Make sure we don't call init more than once. 117 // Make sure we don't call init more than once.
118 DCHECK_EQ(0, stream_id_); 118 DCHECK_EQ(0, stream_id_);
119 119
120 client_ = client; 120 client_ = client;
121 121
122 media::AudioParameters::Format format; 122 media::AudioParameters::Format format;
123 #if defined(OS_WIN)
124 // For Chrome 21 on Windows, avoid the low-latency (WASAPI) path for the sake
125 // of Pepper Flash. Currently, the WASAPI path will fail silently for, e.g.,
126 // 5.1/7.1 sound. (Flash always requests 44.1 kHz anyways, so it's already
127 // using the non-low-latency (wave-out) path on any system that's configured
128 // for 48 kHz.)
129 format = media::AudioParameters::AUDIO_PCM_LINEAR;
130 #else
123 const int kMaxFramesForLowLatency = 2400; 131 const int kMaxFramesForLowLatency = 2400;
124 // Use the low latency back end if the client request is compatible, and 132 // Use the low latency back end if the client request is compatible, and
125 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. 133 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
126 if (sample_rate == audio_hardware::GetOutputSampleRate() && 134 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
127 frames_per_buffer <= kMaxFramesForLowLatency && 135 frames_per_buffer <= kMaxFramesForLowLatency &&
128 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 136 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
129 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
130 } else { 138 } else {
131 format = media::AudioParameters::AUDIO_PCM_LINEAR; 139 format = media::AudioParameters::AUDIO_PCM_LINEAR;
132 } 140 }
141 #endif
133 142
134 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16, 143 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16,
135 frames_per_buffer); 144 frames_per_buffer);
136 145
137 ChildProcess::current()->io_message_loop()->PostTask( 146 ChildProcess::current()->io_message_loop()->PostTask(
138 FROM_HERE, 147 FROM_HERE,
139 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, 148 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
140 this, params)); 149 this, params));
141 return true; 150 return true;
142 } 151 }
(...skipping 21 matching lines...) Expand all
164 173
165 ipc_->CloseStream(stream_id_); 174 ipc_->CloseStream(stream_id_);
166 ipc_->RemoveDelegate(stream_id_); 175 ipc_->RemoveDelegate(stream_id_);
167 stream_id_ = 0; 176 stream_id_ = 0;
168 177
169 Release(); // Release for the delegate, balances out the reference taken in 178 Release(); // Release for the delegate, balances out the reference taken in
170 // PepperPluginDelegateImpl::CreateAudio. 179 // PepperPluginDelegateImpl::CreateAudio.
171 } 180 }
172 181
173 } // namespace content 182 } // 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