OLD | NEW |
---|---|
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/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 | 626 |
627 return true; | 627 return true; |
628 } | 628 } |
629 | 629 |
630 bool RendererWebKitPlatformSupportImpl::isThreadedCompositingEnabled() { | 630 bool RendererWebKitPlatformSupportImpl::isThreadedCompositingEnabled() { |
631 return !!RenderThreadImpl::current()->compositor_message_loop_proxy(); | 631 return !!RenderThreadImpl::current()->compositor_message_loop_proxy(); |
632 } | 632 } |
633 | 633 |
634 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { | 634 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { |
635 RenderThreadImpl* thread = RenderThreadImpl::current(); | 635 RenderThreadImpl* thread = RenderThreadImpl::current(); |
636 return thread->GetAudioHardwareConfig()->GetOutputSampleRate(); | 636 int sample_rate = thread->GetAudioHardwareConfig()->GetOutputSampleRate(); |
637 | |
638 // In some rare cases it has been found that Windows returns | |
639 // a sample-rate of 0. | |
640 // Let's make sure to return a sane fallback sample-rate. | |
641 // http://crbug.com/222718 | |
642 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
| |
643 static const int kMaxSampleRate = 192000; | |
644 #if defined(OS_MACOSX) | |
645 static const int kFallbackSampleRate = 44100; | |
646 #else | |
647 static const int kFallbackSampleRate = 48000; | |
648 #endif | |
649 if (sample_rate < kMinSampleRate || sample_rate > kMaxSampleRate) | |
650 sample_rate = kFallbackSampleRate; | |
651 | |
652 return sample_rate; | |
637 } | 653 } |
638 | 654 |
639 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 655 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
640 RenderThreadImpl* thread = RenderThreadImpl::current(); | 656 RenderThreadImpl* thread = RenderThreadImpl::current(); |
641 return thread->GetAudioHardwareConfig()->GetOutputBufferSize(); | 657 return thread->GetAudioHardwareConfig()->GetOutputBufferSize(); |
642 } | 658 } |
643 | 659 |
644 unsigned RendererWebKitPlatformSupportImpl::audioHardwareOutputChannels() { | 660 unsigned RendererWebKitPlatformSupportImpl::audioHardwareOutputChannels() { |
645 RenderThreadImpl* thread = RenderThreadImpl::current(); | 661 RenderThreadImpl* thread = RenderThreadImpl::current(); |
646 return thread->GetAudioHardwareConfig()->GetOutputChannels(); | 662 return thread->GetAudioHardwareConfig()->GetOutputChannels(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 //------------------------------------------------------------------------------ | 907 //------------------------------------------------------------------------------ |
892 | 908 |
893 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() { | 909 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() { |
894 if (!shared_offscreen_context_) | 910 if (!shared_offscreen_context_) |
895 return NULL; | 911 return NULL; |
896 return shared_offscreen_context_->GrContext(); | 912 return shared_offscreen_context_->GrContext(); |
897 } | 913 } |
898 | 914 |
899 | 915 |
900 } // namespace content | 916 } // namespace content |
OLD | NEW |