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

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

Issue 14247018: Implement WebRTC in Chrome for TV (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactored according to Ami's suggestion Created 7 years, 7 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
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/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 #include "content/renderer/media/rtc_video_decoder_factory_tv.h"
232 #endif
233
228 #elif defined(OS_WIN) 234 #elif defined(OS_WIN)
229 // TODO(port): these files are currently Windows only because they concern: 235 // TODO(port): these files are currently Windows only because they concern:
230 // * theming 236 // * theming
231 #include "ui/native_theme/native_theme_win.h" 237 #include "ui/native_theme/native_theme_win.h"
232 #elif defined(USE_X11) 238 #elif defined(USE_X11)
233 #include "ui/native_theme/native_theme.h" 239 #include "ui/native_theme/native_theme.h"
234 #elif defined(OS_MACOSX) 240 #elif defined(OS_MACOSX)
235 #include "skia/ext/skia_utils_mac.h" 241 #include "skia/ext/skia_utils_mac.h"
236 #endif 242 #endif
237 243
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 routing_id_); 2683 routing_id_);
2678 } 2684 }
2679 } 2685 }
2680 2686
2681 WebMediaPlayer* RenderViewImpl::createMediaPlayer( 2687 WebMediaPlayer* RenderViewImpl::createMediaPlayer(
2682 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { 2688 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) {
2683 FOR_EACH_OBSERVER( 2689 FOR_EACH_OBSERVER(
2684 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); 2690 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client));
2685 2691
2686 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 2692 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
2687 #if defined(ENABLE_WEBRTC) 2693 #if defined(ENABLE_WEBRTC) && !defined(GOOGLE_TV)
2688 if (MediaStreamImpl::CheckMediaStream(url)) { 2694 if (MediaStreamImpl::CheckMediaStream(url)) {
2689 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 2695 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
2690 bool found_neon = 2696 bool found_neon =
2691 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; 2697 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
2692 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); 2698 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon);
2693 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 2699 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
2694 EnsureMediaStreamImpl(); 2700 EnsureMediaStreamImpl();
2695 return new webkit_media::WebMediaPlayerMS( 2701 return new webkit_media::WebMediaPlayerMS(
2696 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); 2702 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog());
2697 } 2703 }
(...skipping 12 matching lines...) Expand all
2710 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); 2716 RenderThreadImpl::current()->OffscreenContextProviderForMainThread();
2711 if (!context_provider) { 2717 if (!context_provider) {
2712 LOG(ERROR) << "Failed to get context3d for media player"; 2718 LOG(ERROR) << "Failed to get context3d for media player";
2713 return NULL; 2719 return NULL;
2714 } 2720 }
2715 2721
2716 if (!media_player_proxy_) { 2722 if (!media_player_proxy_) {
2717 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( 2723 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid(
2718 this, media_player_manager_.get()); 2724 this, media_player_manager_.get());
2719 } 2725 }
2720 return new webkit_media::WebMediaPlayerAndroid( 2726 webkit_media::WebMediaPlayerAndroid* web_media_player_android =
2721 frame, 2727 new webkit_media::WebMediaPlayerAndroid(
2722 client, 2728 frame,
2723 media_player_manager_.get(), 2729 client,
2724 media_player_proxy_, 2730 media_player_manager_.get(),
2725 new StreamTextureFactoryImpl( 2731 media_player_proxy_,
2726 context_provider->Context3d(), gpu_channel_host, routing_id_), 2732 new StreamTextureFactoryImpl(
2727 new RenderMediaLog()); 2733 context_provider->Context3d(), gpu_channel_host, routing_id_),
2728 #endif 2734 new RenderMediaLog());
2735 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV)
2736 if (MediaStreamImpl::CheckMediaStream(url)) {
2737 EnsureMediaStreamImpl();
2738 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current()
2739 ->GetMediaStreamDependencyFactory()->decoder_factory_tv();
2740 // |media_stream_impl_| and |factory| outlives web_media_player_android.
2741 if (!factory->AcquireDemuxer() ||
2742 !web_media_player_android->InjectMediaStream(
2743 media_stream_impl_,
2744 factory,
2745 base::Bind(
2746 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer),
2747 base::Unretained(factory)))) {
2748 LOG(ERROR) << "Failed to inject media stream.";
2749 delete web_media_player_android;
2750 return NULL;
2751 }
2752 }
2753 #endif // defined(ENABLE_WEBRTC) && defined(GOOGLE_TV)
2754 return web_media_player_android;
2755 #endif // defined(OS_ANDROID)
2729 2756
2730 scoped_refptr<media::AudioRendererSink> sink; 2757 scoped_refptr<media::AudioRendererSink> sink;
2731 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { 2758 if (!cmd_line->HasSwitch(switches::kDisableAudio)) {
2732 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> 2759 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()->
2733 CreateInput(routing_id_); 2760 CreateInput(routing_id_);
2734 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; 2761 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink;
2735 } 2762 }
2736 2763
2737 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; 2764 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories;
2738 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; 2765 WebGraphicsContext3DCommandBufferImpl* context3d = NULL;
(...skipping 3780 matching lines...) Expand 10 before | Expand all | Expand 10 after
6519 WebURL url = icon_urls[i].iconURL(); 6546 WebURL url = icon_urls[i].iconURL();
6520 if (!url.isEmpty()) 6547 if (!url.isEmpty())
6521 urls.push_back(FaviconURL(url, 6548 urls.push_back(FaviconURL(url,
6522 ToFaviconType(icon_urls[i].iconType()))); 6549 ToFaviconType(icon_urls[i].iconType())));
6523 } 6550 }
6524 SendUpdateFaviconURL(urls); 6551 SendUpdateFaviconURL(urls);
6525 } 6552 }
6526 6553
6527 6554
6528 } // namespace content 6555 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698