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

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

Issue 11830004: Refactor content::RenderAudioSourceProvider as webkit_media::WebAudioSourceProviderImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
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/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "content/renderer/external_popup_menu.h" 76 #include "content/renderer/external_popup_menu.h"
77 #include "content/renderer/favicon_helper.h" 77 #include "content/renderer/favicon_helper.h"
78 #include "content/renderer/geolocation_dispatcher.h" 78 #include "content/renderer/geolocation_dispatcher.h"
79 #include "content/renderer/gpu/compositor_thread.h" 79 #include "content/renderer/gpu/compositor_thread.h"
80 #include "content/renderer/gpu/compositor_output_surface.h" 80 #include "content/renderer/gpu/compositor_output_surface.h"
81 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" 81 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h"
82 #include "content/renderer/idle_user_detector.h" 82 #include "content/renderer/idle_user_detector.h"
83 #include "content/renderer/input_tag_speech_dispatcher.h" 83 #include "content/renderer/input_tag_speech_dispatcher.h"
84 #include "content/renderer/java/java_bridge_dispatcher.h" 84 #include "content/renderer/java/java_bridge_dispatcher.h"
85 #include "content/renderer/load_progress_tracker.h" 85 #include "content/renderer/load_progress_tracker.h"
86 #include "content/renderer/media/audio_device_factory.h"
87 #include "content/renderer/media/audio_renderer_mixer_manager.h"
86 #include "content/renderer/media/media_stream_dependency_factory.h" 88 #include "content/renderer/media/media_stream_dependency_factory.h"
87 #include "content/renderer/media/media_stream_dispatcher.h" 89 #include "content/renderer/media/media_stream_dispatcher.h"
88 #include "content/renderer/media/media_stream_impl.h" 90 #include "content/renderer/media/media_stream_impl.h"
89 #include "content/renderer/media/render_audiosourceprovider.h"
90 #include "content/renderer/media/render_media_log.h" 91 #include "content/renderer/media/render_media_log.h"
92 #include "content/renderer/media/renderer_audio_output_device.h"
91 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" 93 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h"
92 #include "content/renderer/media/rtc_peer_connection_handler.h" 94 #include "content/renderer/media/rtc_peer_connection_handler.h"
93 #include "content/renderer/mhtml_generator.h" 95 #include "content/renderer/mhtml_generator.h"
94 #include "content/renderer/notification_provider.h" 96 #include "content/renderer/notification_provider.h"
95 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" 97 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
96 #include "content/renderer/plugin_channel_host.h" 98 #include "content/renderer/plugin_channel_host.h"
97 #include "content/renderer/render_process.h" 99 #include "content/renderer/render_process.h"
98 #include "content/renderer/render_thread_impl.h" 100 #include "content/renderer/render_thread_impl.h"
99 #include "content/renderer/render_view_impl_params.h" 101 #include "content/renderer/render_view_impl_params.h"
100 #include "content/renderer/render_view_mouse_lock_dispatcher.h" 102 #include "content/renderer/render_view_mouse_lock_dispatcher.h"
101 #include "content/renderer/render_widget_fullscreen_pepper.h" 103 #include "content/renderer/render_widget_fullscreen_pepper.h"
102 #include "content/renderer/renderer_accessibility.h" 104 #include "content/renderer/renderer_accessibility.h"
103 #include "content/renderer/renderer_accessibility_complete.h" 105 #include "content/renderer/renderer_accessibility_complete.h"
104 #include "content/renderer/renderer_accessibility_focus_only.h" 106 #include "content/renderer/renderer_accessibility_focus_only.h"
105 #include "content/renderer/renderer_date_time_picker.h" 107 #include "content/renderer/renderer_date_time_picker.h"
106 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 108 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
107 #include "content/renderer/renderer_webcolorchooser_impl.h" 109 #include "content/renderer/renderer_webcolorchooser_impl.h"
108 #include "content/renderer/speech_recognition_dispatcher.h" 110 #include "content/renderer/speech_recognition_dispatcher.h"
109 #include "content/renderer/text_input_client_observer.h" 111 #include "content/renderer/text_input_client_observer.h"
110 #include "content/renderer/v8_value_converter_impl.h" 112 #include "content/renderer/v8_value_converter_impl.h"
111 #include "content/renderer/web_intents_host.h" 113 #include "content/renderer/web_intents_host.h"
112 #include "content/renderer/web_ui_extension.h" 114 #include "content/renderer/web_ui_extension.h"
113 #include "content/renderer/web_ui_extension_data.h" 115 #include "content/renderer/web_ui_extension_data.h"
114 #include "content/renderer/webplugin_delegate_proxy.h" 116 #include "content/renderer/webplugin_delegate_proxy.h"
115 #include "content/renderer/websharedworker_proxy.h" 117 #include "content/renderer/websharedworker_proxy.h"
118 #include "media/base/audio_renderer_mixer_input.h"
116 #include "media/base/filter_collection.h" 119 #include "media/base/filter_collection.h"
117 #include "media/base/media_switches.h" 120 #include "media/base/media_switches.h"
118 #include "media/filters/audio_renderer_impl.h" 121 #include "media/filters/audio_renderer_impl.h"
119 #include "media/filters/gpu_video_decoder.h" 122 #include "media/filters/gpu_video_decoder.h"
120 #include "net/base/data_url.h" 123 #include "net/base/data_url.h"
121 #include "net/base/escape.h" 124 #include "net/base/escape.h"
122 #include "net/base/net_errors.h" 125 #include "net/base/net_errors.h"
123 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 126 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
124 #include "net/http/http_util.h" 127 #include "net/http/http_util.h"
125 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h" 128 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObjec t.h"
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 } 2612 }
2610 return new webkit_media::WebMediaPlayerImplAndroid( 2613 return new webkit_media::WebMediaPlayerImplAndroid(
2611 frame, 2614 frame,
2612 client, 2615 client,
2613 media_player_manager_.get(), 2616 media_player_manager_.get(),
2614 media_player_proxy_, 2617 media_player_proxy_,
2615 new StreamTextureFactoryImpl( 2618 new StreamTextureFactoryImpl(
2616 resource_context, gpu_channel_host, routing_id_)); 2619 resource_context, gpu_channel_host, routing_id_));
2617 #endif 2620 #endif
2618 2621
2619 RenderMediaLog* render_media_log = new RenderMediaLog(); 2622 scoped_refptr<media::AudioRendererSink> sink;
2620
2621 RenderAudioSourceProvider* audio_source_provider = NULL;
2622
2623 // |audio_source_provider| "provides" audio to WebKit and is a sink from the
2624 // perspective of the audio renderer.
2625 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { 2623 if (!cmd_line->HasSwitch(switches::kDisableAudio)) {
2626 audio_source_provider = new RenderAudioSourceProvider(routing_id_); 2624 #if defined(OS_WIN) || defined(OS_MACOSX)
2625 const bool use_mixing =
2626 !cmd_line->HasSwitch(switches::kDisableRendererSideMixing);
2627 #else
2628 const bool use_mixing =
2629 cmd_line->HasSwitch(switches::kEnableRendererSideMixing);
2630 #endif
2631 if (use_mixing) {
2632 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()->
2633 CreateInput(routing_id_);
2634 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink;
2635 } else {
2636 scoped_refptr<RendererAudioOutputDevice> device =
2637 AudioDeviceFactory::NewOutputDevice();
2638 // The RenderView creating AudioRendererSink will be the source of
2639 // the audio (WebMediaPlayer is always associated with a document in a
2640 // frame at the time RenderAudioSourceProvider is instantiated).
2641 device->SetSourceRenderView(routing_id_);
2642 sink = device;
2643 DVLOG(1) << "Using AudioDeviceFactory-provided sink: " << sink;
2644 }
2627 } 2645 }
2628 2646
2629 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; 2647 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories;
2630 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; 2648 WebGraphicsContext3DCommandBufferImpl* context3d = NULL;
2631 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) 2649 if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
2632 context3d = RenderThreadImpl::current()->GetGpuVDAContext3D(); 2650 context3d = RenderThreadImpl::current()->GetGpuVDAContext3D();
2633 if (context3d) { 2651 if (context3d) {
2634 scoped_refptr<base::MessageLoopProxy> factories_loop = 2652 scoped_refptr<base::MessageLoopProxy> factories_loop =
2635 RenderThreadImpl::current()->compositor_thread() ? 2653 RenderThreadImpl::current()->compositor_thread() ?
2636 RenderThreadImpl::current()->compositor_thread()->GetWebThread() 2654 RenderThreadImpl::current()->compositor_thread()->GetWebThread()
2637 ->message_loop()->message_loop_proxy() : 2655 ->message_loop()->message_loop_proxy() :
2638 base::MessageLoopProxy::current(); 2656 base::MessageLoopProxy::current();
2639 GpuChannelHost* gpu_channel_host = 2657 GpuChannelHost* gpu_channel_host =
2640 RenderThreadImpl::current()->EstablishGpuChannelSync( 2658 RenderThreadImpl::current()->EstablishGpuChannelSync(
2641 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); 2659 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE);
2642 gpu_factories = new RendererGpuVideoDecoderFactories( 2660 gpu_factories = new RendererGpuVideoDecoderFactories(
2643 gpu_channel_host, factories_loop, context3d); 2661 gpu_channel_host, factories_loop, context3d);
2644 } 2662 }
2645 2663
2646 webkit_media::WebMediaPlayerParams params( 2664 webkit_media::WebMediaPlayerParams params(
2647 audio_source_provider, audio_source_provider, gpu_factories, 2665 sink, gpu_factories, media_stream_impl_, new RenderMediaLog());
2648 media_stream_impl_, render_media_log);
2649 WebMediaPlayer* media_player = 2666 WebMediaPlayer* media_player =
2650 GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( 2667 GetContentClient()->renderer()->OverrideCreateWebMediaPlayer(
2651 this, frame, client, AsWeakPtr(), params); 2668 this, frame, client, AsWeakPtr(), params);
2652 if (!media_player) { 2669 if (!media_player) {
2653 media_player = new webkit_media::WebMediaPlayerImpl( 2670 media_player = new webkit_media::WebMediaPlayerImpl(
2654 frame, client, AsWeakPtr(), params); 2671 frame, client, AsWeakPtr(), params);
2655 } 2672 }
2656 return media_player; 2673 return media_player;
2657 } 2674 }
2658 2675
(...skipping 3847 matching lines...) Expand 10 before | Expand all | Expand 10 after
6506 } 6523 }
6507 #endif 6524 #endif
6508 6525
6509 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( 6526 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6510 TransportDIB::Handle dib_handle) { 6527 TransportDIB::Handle dib_handle) {
6511 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); 6528 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6512 RenderProcess::current()->ReleaseTransportDIB(dib); 6529 RenderProcess::current()->ReleaseTransportDIB(dib);
6513 } 6530 }
6514 6531
6515 } // namespace content 6532 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698