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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 12937017: In some rare cases it has been found that Windows returns a sample-rate of 0, even though it's capa… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/renderer_webkitplatformsupport_impl.cc
===================================================================
--- content/renderer/renderer_webkitplatformsupport_impl.cc (revision 190462)
+++ content/renderer/renderer_webkitplatformsupport_impl.cc (working copy)
@@ -633,7 +633,23 @@
double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() {
RenderThreadImpl* thread = RenderThreadImpl::current();
- return thread->GetAudioHardwareConfig()->GetOutputSampleRate();
+ int sample_rate = thread->GetAudioHardwareConfig()->GetOutputSampleRate();
+
+ // In some rare cases it has been found that Windows returns
+ // a sample-rate of 0.
+ // Let's make sure to return a sane fallback sample-rate.
+ // http://crbug.com/222718
+ static const int kMinSampleRate = 22050;
DaleCurtis 2013/03/25 21:29:39 How about calling GetAudioHardwareConfig()->GetOut
Chris Rogers 2013/03/25 22:46:45 The sample-rate limits of Web Audio aren't necessa
+ static const int kMaxSampleRate = 192000;
+#if defined(OS_MACOSX)
+ static const int kFallbackSampleRate = 44100;
+#else
+ static const int kFallbackSampleRate = 48000;
+#endif
+ if (sample_rate < kMinSampleRate || sample_rate > kMaxSampleRate)
+ sample_rate = kFallbackSampleRate;
+
+ return sample_rate;
}
size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() {
« 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