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

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

Issue 1690063002: Fix mime type mappings when the unified media pipeline is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "content/renderer/stats_collection_controller.h" 125 #include "content/renderer/stats_collection_controller.h"
126 #include "content/renderer/usb/web_usb_client_impl.h" 126 #include "content/renderer/usb/web_usb_client_impl.h"
127 #include "content/renderer/wake_lock/wake_lock_dispatcher.h" 127 #include "content/renderer/wake_lock/wake_lock_dispatcher.h"
128 #include "content/renderer/web_frame_utils.h" 128 #include "content/renderer/web_frame_utils.h"
129 #include "content/renderer/web_ui_extension.h" 129 #include "content/renderer/web_ui_extension.h"
130 #include "content/renderer/websharedworker_proxy.h" 130 #include "content/renderer/websharedworker_proxy.h"
131 #include "crypto/sha2.h" 131 #include "crypto/sha2.h"
132 #include "gin/modules/module_registry.h" 132 #include "gin/modules/module_registry.h"
133 #include "media/audio/audio_output_device.h" 133 #include "media/audio/audio_output_device.h"
134 #include "media/base/audio_renderer_mixer_input.h" 134 #include "media/base/audio_renderer_mixer_input.h"
135 #include "media/base/media.h"
135 #include "media/base/media_log.h" 136 #include "media/base/media_log.h"
136 #include "media/base/media_switches.h" 137 #include "media/base/media_switches.h"
137 #include "media/blink/url_index.h" 138 #include "media/blink/url_index.h"
138 #include "media/blink/webencryptedmediaclient_impl.h" 139 #include "media/blink/webencryptedmediaclient_impl.h"
139 #include "media/blink/webmediaplayer_impl.h" 140 #include "media/blink/webmediaplayer_impl.h"
140 #include "media/renderers/gpu_video_accelerator_factories.h" 141 #include "media/renderers/gpu_video_accelerator_factories.h"
141 #include "mojo/common/url_type_converters.h" 142 #include "mojo/common/url_type_converters.h"
142 #include "mojo/edk/js/core.h" 143 #include "mojo/edk/js/core.h"
143 #include "mojo/edk/js/support.h" 144 #include "mojo/edk/js/support.h"
144 #include "net/base/data_url.h" 145 #include "net/base/data_url.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 main_resource_ssl_status.security_style != 737 main_resource_ssl_status.security_style !=
737 ssl_status.security_style || 738 ssl_status.security_style ||
738 main_resource_ssl_status.cert_id != ssl_status.cert_id || 739 main_resource_ssl_status.cert_id != ssl_status.cert_id ||
739 main_resource_ssl_status.cert_status != ssl_status.cert_status || 740 main_resource_ssl_status.cert_status != ssl_status.cert_status ||
740 main_resource_ssl_status.security_bits != ssl_status.security_bits || 741 main_resource_ssl_status.security_bits != ssl_status.security_bits ||
741 main_resource_ssl_status.connection_status != 742 main_resource_ssl_status.connection_status !=
742 ssl_status.connection_status); 743 ssl_status.connection_status);
743 } 744 }
744 745
745 #if defined(OS_ANDROID) 746 #if defined(OS_ANDROID)
746 // Returns true if WMPI must be used for playback because WMPA will not work. 747 // Returns true if WMPI should be used for playback, false otherwise.
747 bool MustUseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
748 const GURL& url) {
749 // WMPA can't play MSE if MediaCodec is unavailable. In this case WMPI may
750 // still work (via libvpx).
751 return (load_type == blink::WebMediaPlayer::LoadTypeMediaSource &&
752 !media::MediaCodecUtil::IsMediaCodecAvailable());
753 }
754
755 // Returns true if WMPI can be used for playback, false if it may not work.
756 // 748 //
757 // Note that HLS and WebM detection are pre-redirect and path-based. It is 749 // Note that HLS and MP4 detection are pre-redirect and path-based. It is
758 // possible to load such a URL and find different content. 750 // possible to load such a URL and find different content.
759 bool CanUseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type, 751 bool UseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
760 const GURL& url) { 752 const GURL& url) {
761 if (MustUseWebMediaPlayerImpl(load_type, url)) 753 if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource)
762 return true; 754 return media::IsUnifiedMediaPipelineEnabledForMse();
763 755
764 // WMPI does not support HLS. 756 // WMPI does not support HLS.
765 if (media::MediaCodecUtil::IsHLSPath(url)) 757 if (media::MediaCodecUtil::IsHLSPath(url))
766 return false; 758 return false;
767 759
768 // Otherwise --enable-unified-media-pipeline always enables WMPI. 760 // Don't use WMPI if the container likely contains a codec we can't decode in
769 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 761 // software and hardware decoders are not available.
770 switches::kEnableUnifiedMediaPipeline)) { 762 if (base::EndsWith(url.path(), ".mp4",
771 return true; 763 base::CompareCase::INSENSITIVE_ASCII) &&
764 !media::HasPlatformDecoderSupport()) {
765 return false;
772 } 766 }
773 767
774 // WMPI can always play WebM (via libvpx). 768 // Otherwise enable WMPI if indicated via experiment or command line.
775 if (base::EndsWith(url.path(), ".webm", base::CompareCase::INSENSITIVE_ASCII)) 769 return media::IsUnifiedMediaPipelineEnabled();
776 return true;
777
778 // Otherwise, WMPI can only be used if AVDA is working.
779 return (!base::CommandLine::ForCurrentProcess()->HasSwitch(
780 switches::kDisableAcceleratedVideoDecode) &&
781 media::MediaCodecUtil::IsMediaCodecAvailable());
782 } 770 }
783 #endif // defined(OS_ANDROID) 771 #endif // defined(OS_ANDROID)
784 772
785 } // namespace 773 } // namespace
786 774
787 // static 775 // static
788 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, 776 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
789 int32_t routing_id) { 777 int32_t routing_id) {
790 DCHECK(routing_id != MSG_ROUTING_NONE); 778 DCHECK(routing_id != MSG_ROUTING_NONE);
791 CreateParams params(render_view, routing_id); 779 CreateParams params(render_view, routing_id);
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 static_cast<RenderFrame*>(this), 2480 static_cast<RenderFrame*>(this),
2493 GetWebMediaPlayerDelegate()->has_played_media()), 2481 GetWebMediaPlayerDelegate()->has_played_media()),
2494 audio_renderer_sink, media_log, render_thread->GetMediaThreadTaskRunner(), 2482 audio_renderer_sink, media_log, render_thread->GetMediaThreadTaskRunner(),
2495 render_thread->GetWorkerTaskRunner(), 2483 render_thread->GetWorkerTaskRunner(),
2496 render_thread->compositor_task_runner(), context_3d_cb, 2484 render_thread->compositor_task_runner(), context_3d_cb,
2497 base::Bind(&v8::Isolate::AdjustAmountOfExternalAllocatedMemory, 2485 base::Bind(&v8::Isolate::AdjustAmountOfExternalAllocatedMemory,
2498 base::Unretained(blink::mainThreadIsolate())), 2486 base::Unretained(blink::mainThreadIsolate())),
2499 GetMediaPermission(), initial_cdm, media_surface_manager_); 2487 GetMediaPermission(), initial_cdm, media_surface_manager_);
2500 2488
2501 #if defined(OS_ANDROID) 2489 #if defined(OS_ANDROID)
2502 if (!CanUseWebMediaPlayerImpl(load_type, url)) { 2490 if (!UseWebMediaPlayerImpl(load_type, url))
2503 return CreateAndroidWebMediaPlayer(client, encrypted_client, params); 2491 return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
2504 } else if (!MustUseWebMediaPlayerImpl(load_type, url)) {
2505 // TODO(dalecurtis): This experiment is temporary and should be removed once
2506 // we have enough data to support the primacy of the unified media pipeline;
2507 // see http://crbug.com/533190 for details.
2508 //
2509 // Note: It's important to query the field trial state first, to ensure that
2510 // UMA reports the correct group.
2511 const std::string group_name =
2512 base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial");
2513 const bool enabled_via_cli =
2514 base::CommandLine::ForCurrentProcess()->HasSwitch(
2515 switches::kEnableUnifiedMediaPipeline);
2516 const bool enable_unified_media_pipeline =
2517 enabled_via_cli ||
2518 base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
2519
2520 if (!enable_unified_media_pipeline)
2521 return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
2522 }
2523 #endif // defined(OS_ANDROID) 2492 #endif // defined(OS_ANDROID)
2524 2493
2525 #if defined(ENABLE_MOJO_MEDIA) && !defined(OS_ANDROID) 2494 #if defined(ENABLE_MOJO_MEDIA) && !defined(OS_ANDROID)
2526 scoped_ptr<media::RendererFactory> media_renderer_factory( 2495 scoped_ptr<media::RendererFactory> media_renderer_factory(
2527 new media::MojoRendererFactory(GetMediaServiceFactory())); 2496 new media::MojoRendererFactory(GetMediaServiceFactory()));
2528 #else 2497 #else
2529 scoped_ptr<media::RendererFactory> media_renderer_factory = 2498 scoped_ptr<media::RendererFactory> media_renderer_factory =
2530 GetContentClient()->renderer()->CreateMediaRendererFactory( 2499 GetContentClient()->renderer()->CreateMediaRendererFactory(
2531 this, render_thread->GetGpuFactories(), media_log); 2500 this, render_thread->GetGpuFactories(), media_log);
2532 2501
(...skipping 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 int match_count, 6067 int match_count,
6099 int ordinal, 6068 int ordinal,
6100 const WebRect& selection_rect, 6069 const WebRect& selection_rect,
6101 bool final_status_update) { 6070 bool final_status_update) {
6102 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6071 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6103 selection_rect, ordinal, 6072 selection_rect, ordinal,
6104 final_status_update)); 6073 final_status_update));
6105 } 6074 }
6106 6075
6107 } // namespace content 6076 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698