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