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

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

Issue 1824143004: Allow WebView to force MediaPlayer for unsupported containers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test. Created 4 years, 8 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
« no previous file with comments | « android_webview/test/shell/assets/video.3gp ('k') | media/base/media_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/alias.h" 14 #include "base/debug/alias.h"
15 #include "base/debug/asan_invalid_access.h" 15 #include "base/debug/asan_invalid_access.h"
16 #include "base/debug/crash_logging.h" 16 #include "base/debug/crash_logging.h"
17 #include "base/debug/dump_without_crashing.h" 17 #include "base/debug/dump_without_crashing.h"
18 #include "base/files/file.h" 18 #include "base/files/file.h"
19 #include "base/i18n/char_iterator.h" 19 #include "base/i18n/char_iterator.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/macros.h" 21 #include "base/macros.h"
22 #include "base/memory/shared_memory.h" 22 #include "base/memory/shared_memory.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/metrics/field_trial.h" 24 #include "base/metrics/field_trial.h"
25 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
26 #include "base/process/process.h" 26 #include "base/process/process.h"
27 #include "base/stl_util.h" 27 #include "base/stl_util.h"
28 #include "base/strings/string16.h" 28 #include "base/strings/string16.h"
29 #include "base/strings/string_split.h"
29 #include "base/strings/utf_string_conversions.h" 30 #include "base/strings/utf_string_conversions.h"
30 #include "base/thread_task_runner_handle.h" 31 #include "base/thread_task_runner_handle.h"
31 #include "base/time/time.h" 32 #include "base/time/time.h"
32 #include "build/build_config.h" 33 #include "build/build_config.h"
33 #include "cc/base/switches.h" 34 #include "cc/base/switches.h"
34 #include "components/scheduler/renderer/renderer_scheduler.h" 35 #include "components/scheduler/renderer/renderer_scheduler.h"
35 #include "content/child/appcache/appcache_dispatcher.h" 36 #include "content/child/appcache/appcache_dispatcher.h"
36 #include "content/child/permissions/permission_dispatcher.h" 37 #include "content/child/permissions/permission_dispatcher.h"
37 #include "content/child/plugin_messages.h" 38 #include "content/child/plugin_messages.h"
38 #include "content/child/quota_dispatcher.h" 39 #include "content/child/quota_dispatcher.h"
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 return false; 762 return false;
762 763
763 // Don't use WMPI if the container likely contains a codec we can't decode in 764 // Don't use WMPI if the container likely contains a codec we can't decode in
764 // software and platform decoders are not available. 765 // software and platform decoders are not available.
765 if (base::EndsWith(url.path(), ".mp4", 766 if (base::EndsWith(url.path(), ".mp4",
766 base::CompareCase::INSENSITIVE_ASCII) && 767 base::CompareCase::INSENSITIVE_ASCII) &&
767 !media::HasPlatformDecoderSupport()) { 768 !media::HasPlatformDecoderSupport()) {
768 return false; 769 return false;
769 } 770 }
770 771
772 // Android WebView may allow codecs and containers that Chrome does not.
ncarter (slow) 2016/03/28 22:30:03 A command line switch seems like an awkward way to
ncarter (slow) 2016/03/28 22:50:07 Also, I checked with Charlie, who thinks it's a go
ddorwin 2016/03/28 22:50:51 See, for example ShouldUseVideoOverlayForEmbeddedE
DaleCurtis 2016/03/29 00:28:19 Done. Thanks for the suggestion, it's much cleaner
773 const std::string media_player_extension_csv =
774 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
775 switches::kUseMediaPlayerForExtensions);
776 if (!media_player_extension_csv.empty()) {
777 std::vector<std::string> media_player_extensions =
778 base::SplitString(media_player_extension_csv, ",",
779 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
780 for (const auto& extension : media_player_extensions) {
781 if (base::EndsWith(url.path(), extension,
782 base::CompareCase::INSENSITIVE_ASCII)) {
783 return false;
784 }
785 }
786 }
787
771 // Otherwise enable WMPI if indicated via experiment or command line. 788 // Otherwise enable WMPI if indicated via experiment or command line.
772 return media::IsUnifiedMediaPipelineEnabled(); 789 return media::IsUnifiedMediaPipelineEnabled();
773 } 790 }
774 #endif // defined(OS_ANDROID) 791 #endif // defined(OS_ANDROID)
775 792
776 #if defined(ENABLE_MOJO_CDM) 793 #if defined(ENABLE_MOJO_CDM)
777 // Returns whether mojo CDM should be used at runtime. Note that even when mojo 794 // Returns whether mojo CDM should be used at runtime. Note that even when mojo
778 // CDM is enabled at compile time (ENABLE_MOJO_CDM is defined), there are cases 795 // CDM is enabled at compile time (ENABLE_MOJO_CDM is defined), there are cases
779 // where we want to choose other CDM types. For example, on Android when we use 796 // where we want to choose other CDM types. For example, on Android when we use
780 // WebMediaPlayerAndroid, we still want to use ProxyMediaKeys. In the future, 797 // WebMediaPlayerAndroid, we still want to use ProxyMediaKeys. In the future,
(...skipping 5230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6011 int match_count, 6028 int match_count,
6012 int ordinal, 6029 int ordinal,
6013 const WebRect& selection_rect, 6030 const WebRect& selection_rect,
6014 bool final_status_update) { 6031 bool final_status_update) {
6015 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6032 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6016 selection_rect, ordinal, 6033 selection_rect, ordinal,
6017 final_status_update)); 6034 final_status_update));
6018 } 6035 }
6019 6036
6020 } // namespace content 6037 } // namespace content
OLDNEW
« no previous file with comments | « android_webview/test/shell/assets/video.3gp ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698