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

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

Issue 10805031: Increase buffer threshold for switch between PCM_LINEAR and PCM_LOW_LATENCY (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 const int kMaxFramesForLowLatency = 2048; 116 const int kMaxFramesForLowLatency = 2400;
117 // Use the low latency back end if the client request is compatible, and 117 // 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. 118 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
119 if (sample_rate == audio_hardware::GetOutputSampleRate() && 119 if (sample_rate == audio_hardware::GetOutputSampleRate() &&
120 frames_per_buffer <= kMaxFramesForLowLatency && 120 frames_per_buffer <= kMaxFramesForLowLatency &&
121 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 121 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
122 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 122 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
123 } else { 123 } else {
124 format = media::AudioParameters::AUDIO_PCM_LINEAR; 124 format = media::AudioParameters::AUDIO_PCM_LINEAR;
125 } 125 }
126 126
(...skipping 30 matching lines...) Expand all
157 157
158 filter_->Send(new AudioHostMsg_CloseStream(stream_id_)); 158 filter_->Send(new AudioHostMsg_CloseStream(stream_id_));
159 filter_->RemoveDelegate(stream_id_); 159 filter_->RemoveDelegate(stream_id_);
160 stream_id_ = 0; 160 stream_id_ = 0;
161 161
162 Release(); // Release for the delegate, balances out the reference taken in 162 Release(); // Release for the delegate, balances out the reference taken in
163 // PepperPluginDelegateImpl::CreateAudio. 163 // PepperPluginDelegateImpl::CreateAudio.
164 } 164 }
165 165
166 } // namespace content 166 } // 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