Chromium Code Reviews| Index: content/renderer/render_view_impl.cc |
| diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
| index db2fd0ecb12416a42d6bb52f066b3bd69b81520f..1ab404f50b1bb58e4d204f680e68d498e8142f76 100644 |
| --- a/content/renderer/render_view_impl.cc |
| +++ b/content/renderer/render_view_impl.cc |
| @@ -3068,23 +3068,26 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
| FOR_EACH_OBSERVER( |
| RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| - |
| const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| #if defined(ENABLE_WEBRTC) |
| - if (!InitializeMediaStreamClient()) |
| - return NULL; |
| - |
| + bool webrtc_enabled = !cmd_line->HasSwitch(switches::kDisableWebRTC); |
| + if (webrtc_enabled) { |
|
jamesr
2013/10/30 22:45:20
early return would be better
if (cmd_line->HasSwi
michaelbai
2013/10/30 22:48:35
We can't return and still want to create WebMediaP
jamesr
2013/10/30 22:50:11
This function's way too complicated. Break it up i
michaelbai
2013/10/30 23:13:30
Agreed, I had another CL https://codereview.chromi
|
| + if (!InitializeMediaStreamClient()) { |
| + LOG(ERROR) << "Failed to initialize MediaStreamClient"; |
| + return NULL; |
| + } |
| #if !defined(GOOGLE_TV) |
| - if (media_stream_client_->IsMediaStream(url)) { |
| + if (media_stream_client_->IsMediaStream(url)) { |
| #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| - bool found_neon = |
| - (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| - UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
| + bool found_neon = |
| + (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| + UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
| #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| - return new WebMediaPlayerMS( |
| - frame, client, AsWeakPtr(), media_stream_client_, new RenderMediaLog()); |
| - } |
| + return new WebMediaPlayerMS(frame, client, AsWeakPtr(), |
| + media_stream_client_, new RenderMediaLog()); |
| + } |
| #endif // !defined(GOOGLE_TV) |
| + } |
| #endif // defined(ENABLE_WEBRTC) |
| #if defined(OS_ANDROID) |
| @@ -3130,7 +3133,7 @@ WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
| new RenderMediaLog())); |
| #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) |
| - if (media_stream_client_->IsMediaStream(url)) { |
| + if (webrtc_enabled && media_stream_client_->IsMediaStream(url)) { |
| RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current() |
| ->GetMediaStreamDependencyFactory()->decoder_factory_tv(); |
| // |media_stream_client| and |factory| outlives |web_media_player_android|. |