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/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/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 #include "content/renderer/android/email_detector.h" | 218 #include "content/renderer/android/email_detector.h" |
219 #include "content/renderer/android/phone_number_detector.h" | 219 #include "content/renderer/android/phone_number_detector.h" |
220 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 220 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
221 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | 221 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" |
222 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 222 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
223 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 223 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
224 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 224 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
225 #include "ui/gfx/rect_f.h" | 225 #include "ui/gfx/rect_f.h" |
226 #include "webkit/media/android/webmediaplayer_android.h" | 226 #include "webkit/media/android/webmediaplayer_android.h" |
227 #include "webkit/media/android/webmediaplayer_manager_android.h" | 227 #include "webkit/media/android/webmediaplayer_manager_android.h" |
| 228 |
| 229 #if defined(GOOGLE_TV) |
| 230 #include "content/renderer/media/rtc_video_decoder_bridge_tv.h" |
| 231 #endif |
| 232 |
228 #elif defined(OS_WIN) | 233 #elif defined(OS_WIN) |
229 // TODO(port): these files are currently Windows only because they concern: | 234 // TODO(port): these files are currently Windows only because they concern: |
230 // * theming | 235 // * theming |
231 #include "ui/native_theme/native_theme_win.h" | 236 #include "ui/native_theme/native_theme_win.h" |
232 #elif defined(USE_X11) | 237 #elif defined(USE_X11) |
233 #include "ui/native_theme/native_theme.h" | 238 #include "ui/native_theme/native_theme.h" |
234 #elif defined(OS_MACOSX) | 239 #elif defined(OS_MACOSX) |
235 #include "skia/ext/skia_utils_mac.h" | 240 #include "skia/ext/skia_utils_mac.h" |
236 #endif | 241 #endif |
237 | 242 |
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 routing_id_); | 2682 routing_id_); |
2678 } | 2683 } |
2679 } | 2684 } |
2680 | 2685 |
2681 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2686 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2682 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 2687 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
2683 FOR_EACH_OBSERVER( | 2688 FOR_EACH_OBSERVER( |
2684 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2689 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2685 | 2690 |
2686 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2691 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
2687 #if defined(ENABLE_WEBRTC) | 2692 #if defined(ENABLE_WEBRTC) && !defined(GOOGLE_TV) |
2688 if (MediaStreamImpl::CheckMediaStream(url)) { | 2693 if (MediaStreamImpl::CheckMediaStream(url)) { |
2689 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2694 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
2690 bool found_neon = | 2695 bool found_neon = |
2691 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 2696 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
2692 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | 2697 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
2693 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 2698 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
2694 EnsureMediaStreamImpl(); | 2699 EnsureMediaStreamImpl(); |
2695 return new webkit_media::WebMediaPlayerMS( | 2700 return new webkit_media::WebMediaPlayerMS( |
2696 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); | 2701 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); |
2697 } | 2702 } |
(...skipping 12 matching lines...) Expand all Loading... |
2710 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 2715 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
2711 if (!context_provider) { | 2716 if (!context_provider) { |
2712 LOG(ERROR) << "Failed to get context3d for media player"; | 2717 LOG(ERROR) << "Failed to get context3d for media player"; |
2713 return NULL; | 2718 return NULL; |
2714 } | 2719 } |
2715 | 2720 |
2716 if (!media_player_proxy_) { | 2721 if (!media_player_proxy_) { |
2717 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( | 2722 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( |
2718 this, media_player_manager_.get()); | 2723 this, media_player_manager_.get()); |
2719 } | 2724 } |
2720 return new webkit_media::WebMediaPlayerAndroid( | 2725 MediaStreamImpl* media_stream_impl = NULL; |
2721 frame, | 2726 media::Demuxer* demuxer = NULL; |
2722 client, | 2727 #if defined(ENABLE_WEBRTC) |
2723 media_player_manager_.get(), | 2728 if (MediaStreamImpl::CheckMediaStream(url)) { |
2724 media_player_proxy_, | 2729 EnsureMediaStreamImpl(); |
2725 new StreamTextureFactoryImpl( | 2730 demuxer = RTCVideoDecoderBridgeTv::Get()->CreateDemuxer( |
2726 context_provider->Context3d(), gpu_channel_host, routing_id_), | 2731 RenderThreadImpl::current()->GetMediaStreamDependencyFactory(), |
2727 new RenderMediaLog()); | 2732 base::MessageLoopProxy::current()); |
2728 #endif | 2733 if (demuxer) { |
| 2734 media_stream_impl = media_stream_impl_; |
| 2735 } else { |
| 2736 LOG(ERROR) << "Multiple MediaStream not supported yet."; |
| 2737 return NULL; |
| 2738 } |
| 2739 } |
| 2740 #endif // defined(ENABLE_WEBRTC) |
| 2741 webkit_media::WebMediaPlayerAndroid* web_media_player_android = |
| 2742 new webkit_media::WebMediaPlayerAndroid( |
| 2743 frame, |
| 2744 client, |
| 2745 media_player_manager_.get(), |
| 2746 media_player_proxy_, |
| 2747 new StreamTextureFactoryImpl( |
| 2748 context_provider->Context3d(), gpu_channel_host, routing_id_), |
| 2749 new RenderMediaLog(), |
| 2750 media_stream_impl, |
| 2751 demuxer); |
| 2752 #if defined(GOOGLE_TV) |
| 2753 if (media_stream_impl) { |
| 2754 // RTCVideoDecoderBridgeTv::Get() outlives web_media_player_android since |
| 2755 // it's a singleton, thus base::Unretained is safe here. |
| 2756 web_media_player_android->SetDestroyDemuxerCB( |
| 2757 base::Bind(&RTCVideoDecoderBridgeTv::DestroyDemuxer, |
| 2758 base::Unretained(RTCVideoDecoderBridgeTv::Get()))); |
| 2759 } |
| 2760 #endif // defined(GOOGLE_TV) |
| 2761 return web_media_player_android; |
| 2762 #endif // defined(OS_ANDROID) |
2729 | 2763 |
2730 scoped_refptr<media::AudioRendererSink> sink; | 2764 scoped_refptr<media::AudioRendererSink> sink; |
2731 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2765 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
2732 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 2766 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
2733 CreateInput(routing_id_); | 2767 CreateInput(routing_id_); |
2734 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; | 2768 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; |
2735 } | 2769 } |
2736 | 2770 |
2737 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; | 2771 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; |
2738 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; | 2772 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; |
(...skipping 3780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6519 WebURL url = icon_urls[i].iconURL(); | 6553 WebURL url = icon_urls[i].iconURL(); |
6520 if (!url.isEmpty()) | 6554 if (!url.isEmpty()) |
6521 urls.push_back(FaviconURL(url, | 6555 urls.push_back(FaviconURL(url, |
6522 ToFaviconType(icon_urls[i].iconType()))); | 6556 ToFaviconType(icon_urls[i].iconType()))); |
6523 } | 6557 } |
6524 SendUpdateFaviconURL(urls); | 6558 SendUpdateFaviconURL(urls); |
6525 } | 6559 } |
6526 | 6560 |
6527 | 6561 |
6528 } // namespace content | 6562 } // namespace content |
OLD | NEW |