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

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

Issue 10823148: Revert 149508 - 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
131 const int kMaxFramesForLowLatency = 2400; 123 const int kMaxFramesForLowLatency = 2400;
132 // Use the low latency back end if the client request is compatible, and 124 // Use the low latency back end if the client request is compatible, and
133 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. 125 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
134 if (sample_rate == audio_hardware::GetOutputSampleRate() && 126 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
135 frames_per_buffer <= kMaxFramesForLowLatency && 127 frames_per_buffer <= kMaxFramesForLowLatency &&
136 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 128 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 129 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
138 } else { 130 } else {
139 format = media::AudioParameters::AUDIO_PCM_LINEAR; 131 format = media::AudioParameters::AUDIO_PCM_LINEAR;
140 } 132 }
141 #endif
142 133
143 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16, 134 media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16,
144 frames_per_buffer); 135 frames_per_buffer);
145 136
146 ChildProcess::current()->io_message_loop()->PostTask( 137 ChildProcess::current()->io_message_loop()->PostTask(
147 FROM_HERE, 138 FROM_HERE,
148 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread, 139 base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
149 this, params)); 140 this, params));
150 return true; 141 return true;
151 } 142 }
(...skipping 21 matching lines...) Expand all
173 164
174 ipc_->CloseStream(stream_id_); 165 ipc_->CloseStream(stream_id_);
175 ipc_->RemoveDelegate(stream_id_); 166 ipc_->RemoveDelegate(stream_id_);
176 stream_id_ = 0; 167 stream_id_ = 0;
177 168
178 Release(); // Release for the delegate, balances out the reference taken in 169 Release(); // Release for the delegate, balances out the reference taken in
179 // PepperPluginDelegateImpl::CreateAudio. 170 // PepperPluginDelegateImpl::CreateAudio.
180 } 171 }
181 172
182 } // namespace content 173 } // 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