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

Side by Side Diff: ppapi/shared_impl/ppb_audio_config_shared.cc

Issue 23672035: Classify ARM Chromebooks as high latency audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 "ppapi/shared_impl/ppb_audio_config_shared.h" 5 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
6 #include "ppapi/thunk/enter.h" 6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_instance_api.h" 7 #include "ppapi/thunk/ppb_instance_api.h"
8 8
9 namespace ppapi { 9 namespace ppapi {
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // output stream on the browser side, so we can use whatever sample count the 74 // output stream on the browser side, so we can use whatever sample count the
75 // client wants. 75 // client wants.
76 if (!hardware_sample_frame_count || !hardware_sample_rate) 76 if (!hardware_sample_frame_count || !hardware_sample_rate)
77 return sample_frame_count; 77 return sample_frame_count;
78 78
79 // Note: All the values below were determined through experimentation to 79 // Note: All the values below were determined through experimentation to
80 // minimize jitter and back-to-back callbacks from the browser. Please take 80 // minimize jitter and back-to-back callbacks from the browser. Please take
81 // care when modifying these values as they impact a large number of users. 81 // care when modifying these values as they impact a large number of users.
82 // TODO(dalecurtis): Land jitter test and add documentation for updating this. 82 // TODO(dalecurtis): Land jitter test and add documentation for updating this.
83 83
84 // Should track the value reported by XP and ALSA backends.
85 const uint32_t kHighLatencySampleFrameCount = 2048;
86
87 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
DaleCurtis 2013/09/12 18:12:53 might need #include build/build_config.h
ilja 2013/09/13 20:22:44 Done.
88 // TODO(ihf): Remove this once ARM Chromebooks support low latency audio. For
89 // now we classify them as high latency. See crbug.com/289770.
90 return CalculateMultipleOfSampleFrameCount(
91 sample_frame_count,
92 kHighLatencySampleFrameCount);
93 #endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
94
84 // If client is using same sample rate as audio hardware, then recommend a 95 // If client is using same sample rate as audio hardware, then recommend a
85 // multiple of the audio hardware's sample frame count. 96 // multiple of the audio hardware's sample frame count.
86 if (hardware_sample_rate == sample_rate) { 97 if (hardware_sample_rate == sample_rate) {
87 return CalculateMultipleOfSampleFrameCount( 98 return CalculateMultipleOfSampleFrameCount(
88 hardware_sample_frame_count, sample_frame_count); 99 hardware_sample_frame_count, sample_frame_count);
89 } 100 }
90 101
91 // Should track the value reported by XP and ALSA backends.
92 const uint32_t kHighLatencySampleFrameCount = 2048;
93
94 // If the hardware requires a high latency buffer or we're at a low sample 102 // If the hardware requires a high latency buffer or we're at a low sample
95 // rate w/ a buffer that's larger than 10ms, choose the nearest multiple of 103 // rate w/ a buffer that's larger than 10ms, choose the nearest multiple of
96 // the high latency sample frame count. An example of too low and too large 104 // the high latency sample frame count. An example of too low and too large
97 // is 16kHz and a sample frame count greater than 160 frames. 105 // is 16kHz and a sample frame count greater than 160 frames.
98 if (hardware_sample_frame_count >= kHighLatencySampleFrameCount || 106 if (hardware_sample_frame_count >= kHighLatencySampleFrameCount ||
99 (hardware_sample_rate < 44100 && 107 (hardware_sample_rate < 44100 &&
100 hardware_sample_frame_count > hardware_sample_rate / 100u)) { 108 hardware_sample_frame_count > hardware_sample_rate / 100u)) {
101 return CalculateMultipleOfSampleFrameCount( 109 return CalculateMultipleOfSampleFrameCount(
102 sample_frame_count, 110 sample_frame_count,
103 std::max(kHighLatencySampleFrameCount, hardware_sample_frame_count)); 111 std::max(kHighLatencySampleFrameCount, hardware_sample_frame_count));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || 169 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT ||
162 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) 170 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
163 return false; 171 return false;
164 172
165 sample_rate_ = sample_rate; 173 sample_rate_ = sample_rate;
166 sample_frame_count_ = sample_frame_count; 174 sample_frame_count_ = sample_frame_count;
167 return true; 175 return true;
168 } 176 }
169 177
170 } // namespace ppapi 178 } // namespace ppapi
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