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

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2128273003: Use AudioDeviceFactory instead of GetAudioHardwareConfig to fetch audio output device parameters in… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« 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/renderer_blink_platform_impl.h" 5 #include "content/renderer/renderer_blink_platform_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/child/webmessageportchannel_impl.h" 42 #include "content/child/webmessageportchannel_impl.h"
43 #include "content/common/file_utilities_messages.h" 43 #include "content/common/file_utilities_messages.h"
44 #include "content/common/frame_messages.h" 44 #include "content/common/frame_messages.h"
45 #include "content/common/gpu/client/context_provider_command_buffer.h" 45 #include "content/common/gpu/client/context_provider_command_buffer.h"
46 #include "content/common/gpu_process_launch_causes.h" 46 #include "content/common/gpu_process_launch_causes.h"
47 #include "content/common/render_process_messages.h" 47 #include "content/common/render_process_messages.h"
48 #include "content/public/common/content_switches.h" 48 #include "content/public/common/content_switches.h"
49 #include "content/public/common/webplugininfo.h" 49 #include "content/public/common/webplugininfo.h"
50 #include "content/public/renderer/content_renderer_client.h" 50 #include "content/public/renderer/content_renderer_client.h"
51 #include "content/public/renderer/media_stream_utils.h" 51 #include "content/public/renderer/media_stream_utils.h"
52 #include "content/public/renderer/render_frame.h"
52 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" 53 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h"
53 #include "content/renderer/device_sensors/device_light_event_pump.h" 54 #include "content/renderer/device_sensors/device_light_event_pump.h"
54 #include "content/renderer/device_sensors/device_motion_event_pump.h" 55 #include "content/renderer/device_sensors/device_motion_event_pump.h"
55 #include "content/renderer/device_sensors/device_orientation_event_pump.h" 56 #include "content/renderer/device_sensors/device_orientation_event_pump.h"
56 #include "content/renderer/dom_storage/local_storage_cached_areas.h" 57 #include "content/renderer/dom_storage/local_storage_cached_areas.h"
57 #include "content/renderer/dom_storage/local_storage_namespace.h" 58 #include "content/renderer/dom_storage/local_storage_namespace.h"
58 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" 59 #include "content/renderer/dom_storage/webstoragenamespace_impl.h"
59 #include "content/renderer/gamepad_shared_memory_reader.h" 60 #include "content/renderer/gamepad_shared_memory_reader.h"
60 #include "content/renderer/media/audio_decoder.h" 61 #include "content/renderer/media/audio_decoder.h"
62 #include "content/renderer/media/audio_device_factory.h"
61 #include "content/renderer/media/canvas_capture_handler.h" 63 #include "content/renderer/media/canvas_capture_handler.h"
62 #include "content/renderer/media/html_audio_element_capturer_source.h" 64 #include "content/renderer/media/html_audio_element_capturer_source.h"
63 #include "content/renderer/media/html_video_element_capturer_source.h" 65 #include "content/renderer/media/html_video_element_capturer_source.h"
64 #include "content/renderer/media/image_capture_frame_grabber.h" 66 #include "content/renderer/media/image_capture_frame_grabber.h"
65 #include "content/renderer/media/media_recorder_handler.h" 67 #include "content/renderer/media/media_recorder_handler.h"
66 #include "content/renderer/media/renderer_webaudiodevice_impl.h" 68 #include "content/renderer/media/renderer_webaudiodevice_impl.h"
67 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" 69 #include "content/renderer/media/renderer_webmidiaccessor_impl.h"
68 #include "content/renderer/media/rtc_certificate_generator.h" 70 #include "content/renderer/media/rtc_certificate_generator.h"
69 #include "content/renderer/mojo/blink_service_registry_impl.h" 71 #include "content/renderer/mojo/blink_service_registry_impl.h"
70 #include "content/renderer/render_thread_impl.h" 72 #include "content/renderer/render_thread_impl.h"
71 #include "content/renderer/renderer_clipboard_delegate.h" 73 #include "content/renderer/renderer_clipboard_delegate.h"
72 #include "content/renderer/screen_orientation/screen_orientation_observer.h" 74 #include "content/renderer/screen_orientation/screen_orientation_observer.h"
73 #include "content/renderer/webclipboard_impl.h" 75 #include "content/renderer/webclipboard_impl.h"
74 #include "content/renderer/webgraphicscontext3d_provider_impl.h" 76 #include "content/renderer/webgraphicscontext3d_provider_impl.h"
75 #include "content/renderer/webpublicsuffixlist_impl.h" 77 #include "content/renderer/webpublicsuffixlist_impl.h"
76 #include "gpu/command_buffer/client/gles2_interface.h" 78 #include "gpu/command_buffer/client/gles2_interface.h"
77 #include "gpu/config/gpu_info.h" 79 #include "gpu/config/gpu_info.h"
78 #include "gpu/ipc/client/gpu_channel_host.h" 80 #include "gpu/ipc/client/gpu_channel_host.h"
79 #include "gpu/ipc/common/gpu_stream_constants.h" 81 #include "gpu/ipc/common/gpu_stream_constants.h"
80 #include "ipc/ipc_sync_message_filter.h" 82 #include "ipc/ipc_sync_message_filter.h"
81 #include "media/audio/audio_output_device.h" 83 #include "media/audio/audio_output_device.h"
82 #include "media/base/audio_hardware_config.h"
83 #include "media/base/mime_util.h" 84 #include "media/base/mime_util.h"
84 #include "media/blink/webcontentdecryptionmodule_impl.h" 85 #include "media/blink/webcontentdecryptionmodule_impl.h"
85 #include "media/filters/stream_parser_factory.h" 86 #include "media/filters/stream_parser_factory.h"
86 #include "mojo/common/common_type_converters.h" 87 #include "mojo/common/common_type_converters.h"
87 #include "storage/common/database/database_identifier.h" 88 #include "storage/common/database/database_identifier.h"
88 #include "storage/common/quota/quota_types.h" 89 #include "storage/common/quota/quota_types.h"
89 #include "third_party/WebKit/public/platform/BlameContext.h" 90 #include "third_party/WebKit/public/platform/BlameContext.h"
90 #include "third_party/WebKit/public/platform/FilePathConversion.h" 91 #include "third_party/WebKit/public/platform/FilePathConversion.h"
91 #include "third_party/WebKit/public/platform/URLConversion.h" 92 #include "third_party/WebKit/public/platform/URLConversion.h"
92 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" 93 #include "third_party/WebKit/public/platform/WebBlobRegistry.h"
93 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h" 94 #include "third_party/WebKit/public/platform/WebDeviceLightListener.h"
94 #include "third_party/WebKit/public/platform/WebFileInfo.h" 95 #include "third_party/WebKit/public/platform/WebFileInfo.h"
95 #include "third_party/WebKit/public/platform/WebGamepads.h" 96 #include "third_party/WebKit/public/platform/WebGamepads.h"
96 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 97 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
97 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" 98 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h"
98 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 99 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
99 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 100 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
100 #include "third_party/WebKit/public/platform/WebURL.h" 101 #include "third_party/WebKit/public/platform/WebURL.h"
101 #include "third_party/WebKit/public/platform/WebVector.h" 102 #include "third_party/WebKit/public/platform/WebVector.h"
102 #include "third_party/WebKit/public/platform/mime_registry.mojom.h" 103 #include "third_party/WebKit/public/platform/mime_registry.mojom.h"
103 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h" 104 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eMotionListener.h"
104 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h" 105 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic eOrientationListener.h"
106 #include "third_party/WebKit/public/web/WebLocalFrame.h"
105 #include "url/gurl.h" 107 #include "url/gurl.h"
106 108
107 #if defined(OS_MACOSX) 109 #if defined(OS_MACOSX)
108 #include "content/common/mac/font_descriptor.h" 110 #include "content/common/mac/font_descriptor.h"
109 #include "content/common/mac/font_loader.h" 111 #include "content/common/mac/font_loader.h"
110 #include "content/renderer/webscrollbarbehavior_impl_mac.h" 112 #include "content/renderer/webscrollbarbehavior_impl_mac.h"
111 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h" 113 #include "third_party/WebKit/public/platform/mac/WebSandboxSupport.h"
112 #endif 114 #endif
113 115
114 #if defined(OS_POSIX) 116 #if defined(OS_POSIX)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 173
172 namespace { 174 namespace {
173 175
174 bool g_sandbox_enabled = true; 176 bool g_sandbox_enabled = true;
175 double g_test_device_light_data = -1; 177 double g_test_device_light_data = -1;
176 base::LazyInstance<blink::WebDeviceMotionData>::Leaky 178 base::LazyInstance<blink::WebDeviceMotionData>::Leaky
177 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER; 179 g_test_device_motion_data = LAZY_INSTANCE_INITIALIZER;
178 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky 180 base::LazyInstance<blink::WebDeviceOrientationData>::Leaky
179 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER; 181 g_test_device_orientation_data = LAZY_INSTANCE_INITIALIZER;
180 182
183 media::AudioParameters GetAudioHardwareParams() {
184 blink::WebLocalFrame* const web_frame =
185 blink::WebLocalFrame::frameForCurrentContext();
186 RenderFrame* const render_frame = RenderFrame::FromWebFrame(web_frame);
187 return AudioDeviceFactory::GetOutputDeviceInfo(render_frame->GetRoutingID(),
188 0, std::string(),
189 web_frame->getSecurityOrigin())
190 .output_params();
191 }
192
181 } // namespace 193 } // namespace
182 194
183 //------------------------------------------------------------------------------ 195 //------------------------------------------------------------------------------
184 196
185 class RendererBlinkPlatformImpl::MimeRegistry 197 class RendererBlinkPlatformImpl::MimeRegistry
186 : public SimpleWebMimeRegistryImpl { 198 : public SimpleWebMimeRegistryImpl {
187 public: 199 public:
188 blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( 200 blink::WebMimeRegistry::SupportsType supportsMediaMIMEType(
189 const blink::WebString& mime_type, 201 const blink::WebString& mime_type,
190 const blink::WebString& codecs) override; 202 const blink::WebString& codecs) override;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 // thread can be NULL in tests. 690 // thread can be NULL in tests.
679 return thread && thread->compositor_task_runner().get(); 691 return thread && thread->compositor_task_runner().get();
680 } 692 }
681 693
682 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() { 694 bool RendererBlinkPlatformImpl::isThreadedAnimationEnabled() {
683 RenderThreadImpl* thread = RenderThreadImpl::current(); 695 RenderThreadImpl* thread = RenderThreadImpl::current();
684 return thread ? thread->IsThreadedAnimationEnabled() : true; 696 return thread ? thread->IsThreadedAnimationEnabled() : true;
685 } 697 }
686 698
687 double RendererBlinkPlatformImpl::audioHardwareSampleRate() { 699 double RendererBlinkPlatformImpl::audioHardwareSampleRate() {
688 RenderThreadImpl* thread = RenderThreadImpl::current(); 700 return GetAudioHardwareParams().sample_rate();
689 return thread->GetAudioHardwareConfig()->GetOutputSampleRate();
690 } 701 }
691 702
692 size_t RendererBlinkPlatformImpl::audioHardwareBufferSize() { 703 size_t RendererBlinkPlatformImpl::audioHardwareBufferSize() {
693 RenderThreadImpl* thread = RenderThreadImpl::current(); 704 return GetAudioHardwareParams().frames_per_buffer();
694 return thread->GetAudioHardwareConfig()->GetOutputBufferSize();
695 } 705 }
696 706
697 unsigned RendererBlinkPlatformImpl::audioHardwareOutputChannels() { 707 unsigned RendererBlinkPlatformImpl::audioHardwareOutputChannels() {
698 RenderThreadImpl* thread = RenderThreadImpl::current(); 708 return GetAudioHardwareParams().channels();
699 return thread->GetAudioHardwareConfig()->GetOutputChannels();
700 } 709 }
701 710
702 WebDatabaseObserver* RendererBlinkPlatformImpl::databaseObserver() { 711 WebDatabaseObserver* RendererBlinkPlatformImpl::databaseObserver() {
703 return web_database_observer_impl_.get(); 712 return web_database_observer_impl_.get();
704 } 713 }
705 714
706 WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice( 715 WebAudioDevice* RendererBlinkPlatformImpl::createAudioDevice(
707 size_t buffer_size, 716 size_t buffer_size,
708 unsigned input_channels, 717 unsigned input_channels,
709 unsigned channels, 718 unsigned channels,
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 return &trial_token_validator_; 1316 return &trial_token_validator_;
1308 } 1317 }
1309 1318
1310 void RendererBlinkPlatformImpl::workerContextCreated( 1319 void RendererBlinkPlatformImpl::workerContextCreated(
1311 const v8::Local<v8::Context>& worker) { 1320 const v8::Local<v8::Context>& worker) {
1312 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 1321 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
1313 worker); 1322 worker);
1314 } 1323 }
1315 1324
1316 } // namespace content 1325 } // 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