| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 FOR_EACH_OBSERVER( | 1927 FOR_EACH_OBSERVER( |
| 1928 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 1928 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 1929 | 1929 |
| 1930 media::MessageLoopFactory* message_loop_factory = | 1930 media::MessageLoopFactory* message_loop_factory = |
| 1931 new media::MessageLoopFactoryImpl(); | 1931 new media::MessageLoopFactoryImpl(); |
| 1932 media::FilterCollection* collection = new media::FilterCollection(); | 1932 media::FilterCollection* collection = new media::FilterCollection(); |
| 1933 RenderMediaLog* render_media_log = new RenderMediaLog(); | 1933 RenderMediaLog* render_media_log = new RenderMediaLog(); |
| 1934 | 1934 |
| 1935 // Add in any custom filter factories first. | 1935 // Add in any custom filter factories first. |
| 1936 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1936 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 1937 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | |
| 1938 // Add the chrome specific audio renderer. | |
| 1939 collection->AddAudioRenderer(new AudioRendererImpl()); | |
| 1940 } | |
| 1941 | 1937 |
| 1942 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 1938 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 1943 // Currently only cros/arm has any HW video decode support in | 1939 // Currently only cros/arm has any HW video decode support in |
| 1944 // GpuVideoDecodeAccelerator so we don't even try to use it on other | 1940 // GpuVideoDecodeAccelerator so we don't even try to use it on other |
| 1945 // platforms. This is a startup-time optimization. When new VDA | 1941 // platforms. This is a startup-time optimization. When new VDA |
| 1946 // implementations are added, relax the #if above. | 1942 // implementations are added, relax the #if above. |
| 1947 WebKit::WebGraphicsContext3D* wk_context3d = webview()->graphicsContext3D(); | 1943 WebKit::WebGraphicsContext3D* wk_context3d = webview()->graphicsContext3D(); |
| 1948 if (wk_context3d) { | 1944 if (wk_context3d) { |
| 1949 WebGraphicsContext3DCommandBufferImpl* context3d = | 1945 WebGraphicsContext3DCommandBufferImpl* context3d = |
| 1950 static_cast<WebGraphicsContext3DCommandBufferImpl*>(wk_context3d); | 1946 static_cast<WebGraphicsContext3DCommandBufferImpl*>(wk_context3d); |
| 1951 GpuChannelHost* gpu_channel_host = | 1947 GpuChannelHost* gpu_channel_host = |
| 1952 RenderThreadImpl::current()->EstablishGpuChannelSync( | 1948 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 1953 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 1949 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
| 1954 collection->AddVideoDecoder(new media::GpuVideoDecoder( | 1950 collection->AddVideoDecoder(new media::GpuVideoDecoder( |
| 1955 MessageLoop::current(), | 1951 MessageLoop::current(), |
| 1956 new RendererGpuVideoDecoderFactories( | 1952 new RendererGpuVideoDecoderFactories( |
| 1957 gpu_channel_host, context3d->context()->AsWeakPtr()))); | 1953 gpu_channel_host, context3d->context()->AsWeakPtr()))); |
| 1958 } | 1954 } |
| 1959 #endif | 1955 #endif |
| 1960 | 1956 |
| 1961 webkit_media::WebMediaPlayerImpl* result_ptr; | 1957 webkit_media::WebMediaPlayerImpl* result_ptr; |
| 1962 if (!content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( | 1958 if (!content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( |
| 1963 this, client, AsWeakPtr(), collection, message_loop_factory, | 1959 this, client, AsWeakPtr(), collection, message_loop_factory, |
| 1964 media_stream_impl_.get(), render_media_log, &result_ptr)) { | 1960 media_stream_impl_.get(), render_media_log, &result_ptr)) { |
| 1961 bool disable_audio = cmd_line->HasSwitch(switches::kDisableAudio); |
| 1965 result_ptr = new webkit_media::WebMediaPlayerImpl( | 1962 result_ptr = new webkit_media::WebMediaPlayerImpl( |
| 1966 client, AsWeakPtr(), collection, message_loop_factory, | 1963 client, AsWeakPtr(), collection, disable_audio, message_loop_factory, |
| 1967 media_stream_impl_.get(), render_media_log); | 1964 media_stream_impl_.get(), render_media_log); |
| 1968 } | 1965 } |
| 1969 | 1966 |
| 1970 DCHECK(result_ptr); | 1967 DCHECK(result_ptr); |
| 1971 scoped_ptr<webkit_media::WebMediaPlayerImpl> result; | 1968 scoped_ptr<webkit_media::WebMediaPlayerImpl> result; |
| 1972 result.reset(result_ptr); | 1969 result.reset(result_ptr); |
| 1973 | 1970 |
| 1974 if (!result->Initialize(frame, | 1971 if (!result->Initialize(frame, |
| 1975 cmd_line->HasSwitch(switches::kSimpleDataSource))) { | 1972 cmd_line->HasSwitch(switches::kSimpleDataSource))) { |
| 1976 return NULL; | 1973 return NULL; |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4794 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 4791 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 4795 return !!RenderThreadImpl::current()->compositor_thread(); | 4792 return !!RenderThreadImpl::current()->compositor_thread(); |
| 4796 } | 4793 } |
| 4797 | 4794 |
| 4798 void RenderViewImpl::OnJavaBridgeInit() { | 4795 void RenderViewImpl::OnJavaBridgeInit() { |
| 4799 DCHECK(!java_bridge_dispatcher_.get()); | 4796 DCHECK(!java_bridge_dispatcher_.get()); |
| 4800 #if defined(ENABLE_JAVA_BRIDGE) | 4797 #if defined(ENABLE_JAVA_BRIDGE) |
| 4801 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); | 4798 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); |
| 4802 #endif | 4799 #endif |
| 4803 } | 4800 } |
| OLD | NEW |