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

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: Addressed Dongwon and Yuncheol's comments 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 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 routing_id_); 2687 routing_id_);
2682 } 2688 }
2683 } 2689 }
2684 2690
2685 WebMediaPlayer* RenderViewImpl::createMediaPlayer( 2691 WebMediaPlayer* RenderViewImpl::createMediaPlayer(
2686 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { 2692 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) {
2687 FOR_EACH_OBSERVER( 2693 FOR_EACH_OBSERVER(
2688 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); 2694 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client));
2689 2695
2690 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 2696 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
2691 #if defined(ENABLE_WEBRTC) 2697 #if defined(ENABLE_WEBRTC) && !defined(GOOGLE_TV)
2692 if (MediaStreamImpl::CheckMediaStream(url)) { 2698 if (MediaStreamImpl::CheckMediaStream(url)) {
2693 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 2699 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
2694 bool found_neon = 2700 bool found_neon =
2695 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; 2701 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
2696 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); 2702 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon);
2697 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 2703 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
2698 EnsureMediaStreamImpl(); 2704 EnsureMediaStreamImpl();
2699 return new webkit_media::WebMediaPlayerMS( 2705 return new webkit_media::WebMediaPlayerMS(
2700 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); 2706 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog());
2701 } 2707 }
(...skipping 12 matching lines...) Expand all
2714 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); 2720 RenderThreadImpl::current()->OffscreenContextProviderForMainThread();
2715 if (!context_provider) { 2721 if (!context_provider) {
2716 LOG(ERROR) << "Failed to get context3d for media player"; 2722 LOG(ERROR) << "Failed to get context3d for media player";
2717 return NULL; 2723 return NULL;
2718 } 2724 }
2719 2725
2720 if (!media_player_proxy_) { 2726 if (!media_player_proxy_) {
2721 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( 2727 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid(
2722 this, media_player_manager_.get()); 2728 this, media_player_manager_.get());
2723 } 2729 }
2724 return new webkit_media::WebMediaPlayerAndroid( 2730 webkit_media::WebMediaPlayerAndroid* web_media_player_android =
acolwell GONE FROM CHROMIUM 2013/05/14 18:17:47 nit: Use scoped_ptr<webkit_media::WebMediaPlayerAn
wonsik 2013/05/20 14:02:24 Done.
2725 frame, 2731 new webkit_media::WebMediaPlayerAndroid(
2726 client, 2732 frame,
2727 media_player_manager_.get(), 2733 client,
2728 media_player_proxy_, 2734 media_player_manager_.get(),
2729 new StreamTextureFactoryImpl( 2735 media_player_proxy_,
2730 context_provider->Context3d(), gpu_channel_host, routing_id_), 2736 new StreamTextureFactoryImpl(
2731 new RenderMediaLog()); 2737 context_provider->Context3d(), gpu_channel_host, routing_id_),
2732 #endif 2738 new RenderMediaLog());
2739 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV)
2740 if (MediaStreamImpl::CheckMediaStream(url)) {
2741 EnsureMediaStreamImpl();
2742 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current()
2743 ->GetMediaStreamDependencyFactory()->decoder_factory_tv();
2744 // |media_stream_impl_| and |factory| outlives web_media_player_android.
acolwell GONE FROM CHROMIUM 2013/05/14 18:17:47 nit: s/web_media_player_android/|web_media_player_
wonsik 2013/05/20 14:02:24 Done.
2745 if (!factory->AcquireDemuxer() ||
2746 !web_media_player_android->InjectMediaStream(
2747 media_stream_impl_,
2748 factory,
2749 base::Bind(
2750 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer),
2751 base::Unretained(factory)))) {
2752 LOG(ERROR) << "Failed to inject media stream.";
2753 delete web_media_player_android;
2754 return NULL;
2755 }
2756 }
2757 #endif // defined(ENABLE_WEBRTC) && defined(GOOGLE_TV)
2758 return web_media_player_android;
2759 #endif // defined(OS_ANDROID)
2733 2760
2734 scoped_refptr<media::AudioRendererSink> sink; 2761 scoped_refptr<media::AudioRendererSink> sink;
2735 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { 2762 if (!cmd_line->HasSwitch(switches::kDisableAudio)) {
2736 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> 2763 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()->
2737 CreateInput(routing_id_); 2764 CreateInput(routing_id_);
2738 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; 2765 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink;
2739 } 2766 }
2740 2767
2741 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories; 2768 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories;
2742 WebGraphicsContext3DCommandBufferImpl* context3d = NULL; 2769 WebGraphicsContext3DCommandBufferImpl* context3d = NULL;
(...skipping 3787 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 WebURL url = icon_urls[i].iconURL(); 6557 WebURL url = icon_urls[i].iconURL();
6531 if (!url.isEmpty()) 6558 if (!url.isEmpty())
6532 urls.push_back(FaviconURL(url, 6559 urls.push_back(FaviconURL(url,
6533 ToFaviconType(icon_urls[i].iconType()))); 6560 ToFaviconType(icon_urls[i].iconType())));
6534 } 6561 }
6535 SendUpdateFaviconURL(urls); 6562 SendUpdateFaviconURL(urls);
6536 } 6563 }
6537 6564
6538 6565
6539 } // namespace content 6566 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698