diff options
22 files changed, 62 insertions, 48 deletions
diff --git a/android_webview/android_webview_tests.gypi b/android_webview/android_webview_tests.gypi index ab92ffc..c87b792 100644 --- a/android_webview/android_webview_tests.gypi +++ b/android_webview/android_webview_tests.gypi @@ -34,7 +34,7 @@ '<(asset_location)/full_screen_video_test.html', '<(asset_location)/full_screen_video_inside_div_test.html', '<(asset_location)/multiple_videos_test.html', - '<(asset_location)/video.mp4', + '<(asset_location)/video.webm', '<(asset_location)/visual_state_during_fullscreen_test.html', '<(asset_location)/visual_state_waits_for_js_test.html', '<(asset_location)/visual_state_waits_for_js_detached_test.html', @@ -62,7 +62,7 @@ '<(java_in_dir)/assets/full_screen_video_test.html', '<(java_in_dir)/assets/full_screen_video_inside_div_test.html', '<(java_in_dir)/assets/multiple_videos_test.html', - '<(java_in_dir)/assets/video.mp4', + '<(java_in_dir)/assets/video.webm', '<(java_in_dir)/assets/visual_state_during_fullscreen_test.html', '<(java_in_dir)/assets/visual_state_waits_for_js_test.html', '<(java_in_dir)/assets/visual_state_waits_for_js_detached_test.html', diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java index 32ee9aa..ff9e489 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java @@ -4,6 +4,7 @@ package org.chromium.android_webview.test; +import android.os.Build; import android.test.suitebuilder.annotation.SmallTest; import org.chromium.android_webview.AwContents; @@ -66,12 +67,16 @@ public class KeySystemTest extends AwTestBase { + " navigator.requestMediaKeySystemAccess(keySystem, [{}]).then(" + " success, failure);" + "}" + + "function areProprietaryCodecsSupported() {" + + " var video = document.createElement('video');" + + " return video.canPlayType('video/mp4; codecs=\"avc1\"');" + + "}" + "</script> </html>"; } private String isKeySystemSupported(String keySystem) throws Exception { - executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, - "isKeySystemSupported('" + keySystem + "')"); + executeJavaScriptAndWaitForResult( + mAwContents, mContentsClient, "isKeySystemSupported('" + keySystem + "')"); poll(new Callable<Boolean>() { @Override @@ -83,6 +88,12 @@ public class KeySystemTest extends AwTestBase { return getResultFromJS(); } + private boolean areProprietaryCodecsSupported() throws Exception { + String result = executeJavaScriptAndWaitForResult( + mAwContents, mContentsClient, "areProprietaryCodecsSupported()"); + return !result.isEmpty(); + } + private String getResultFromJS() { String result = "null"; try { @@ -94,6 +105,18 @@ public class KeySystemTest extends AwTestBase { return result; } + private String getPlatformKeySystemExpectations() throws Exception { + // Android key systems only support non-proprietary codecs on Lollipop+. + // When neither is true isKeySystemSupported() will return an error for + // all key systems except ClearKey (which is handled by Chrome itself). + if (!areProprietaryCodecsSupported() + && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { + return "\"NotSupportedError\""; + } + + return "\"supported\""; + } + @Feature({"AndroidWebView"}) @SmallTest public void testSupportClearKeySystem() throws Throwable { @@ -103,7 +126,8 @@ public class KeySystemTest extends AwTestBase { @Feature({"AndroidWebView"}) @SmallTest public void testSupportWidevineKeySystem() throws Throwable { - assertEquals("\"supported\"", isKeySystemSupported("com.widevine.alpha")); + assertEquals( + getPlatformKeySystemExpectations(), isKeySystemSupported("com.widevine.alpha")); } @Feature({"AndroidWebView"}) @@ -115,7 +139,8 @@ public class KeySystemTest extends AwTestBase { @Feature({"AndroidWebView"}) @SmallTest public void testSupportPlatformKeySystem() throws Throwable { - assertEquals("\"supported\"", isKeySystemSupported("x-com.oem.test-keysystem")); + assertEquals(getPlatformKeySystemExpectations(), + isKeySystemSupported("x-com.oem.test-keysystem")); } @Feature({"AndroidWebView"}) diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index 92b46fa..68b71d4 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn @@ -65,7 +65,7 @@ android_assets("android_webview_apk_assets") { "shell/assets/full_screen_video_inside_div_test.html", "shell/assets/full_screen_video_test.html", "shell/assets/multiple_videos_test.html", - "shell/assets/video.mp4", + "shell/assets/video.webm", "shell/assets/visual_state_during_fullscreen_test.html", "shell/assets/visual_state_on_page_commit_visible_test.html", "shell/assets/visual_state_waits_for_js_detached_test.html", diff --git a/android_webview/test/shell/assets/full_screen_video_inside_div_test.html b/android_webview/test/shell/assets/full_screen_video_inside_div_test.html index 7a8f4f2..f76d981 100644 --- a/android_webview/test/shell/assets/full_screen_video_inside_div_test.html +++ b/android_webview/test/shell/assets/full_screen_video_inside_div_test.html @@ -9,7 +9,7 @@ <div id='div'> <button id="playControl" style='padding:10px 10px;' onclick="playVideo(); return false">Play</button> <video style = 'width: 300px; height: 300px;' id='video'> - <source src="video.mp4" type="video/mp4"> + <source src="video.webm" type="video/webm"> </video> </div> </body> diff --git a/android_webview/test/shell/assets/full_screen_video_test.html b/android_webview/test/shell/assets/full_screen_video_test.html index c046e70..6d1979d 100644 --- a/android_webview/test/shell/assets/full_screen_video_test.html +++ b/android_webview/test/shell/assets/full_screen_video_test.html @@ -9,7 +9,7 @@ <button id="fullscreenControl" autofocus style ='padding:10px 10px;' onclick="goFullscreen('video'); return false">Go fullscreen</button> <button id="playControl" style='padding:10px 10px;' onclick="playVideo(); return false">Play</button> <video style = 'width: 10px; height: 10px;' id='video' controls> - <source src="video.mp4" type="video/mp4"> + <source src="video.webm" type="video/webm"> </video> </body> </html> diff --git a/android_webview/test/shell/assets/multiple_videos_test.html b/android_webview/test/shell/assets/multiple_videos_test.html index 12ded88..70c3945 100644 --- a/android_webview/test/shell/assets/multiple_videos_test.html +++ b/android_webview/test/shell/assets/multiple_videos_test.html @@ -18,11 +18,11 @@ function playSecondVideo() { <button id="playSecondButton" style='padding:10px 10px;' onclick="playSecondVideo(); return false">Play second</button> <video style='width: 10px; height: 10px;' id='firstVideo' controls> - <source src="video.mp4" type="video/mp4"> + <source src="video.webm" type="video/webm"> </video> <video style='width: 10px; height: 10px;' id='secondVideo' controls> - <source src="video.mp4" type="video/mp4"> + <source src="video.webm" type="video/webm"> </video> </body> diff --git a/android_webview/test/shell/assets/video.mp4 b/android_webview/test/shell/assets/video.mp4 Binary files differdeleted file mode 100644 index 3763b59..0000000 --- a/android_webview/test/shell/assets/video.mp4 +++ /dev/null diff --git a/android_webview/test/shell/assets/video.webm b/android_webview/test/shell/assets/video.webm Binary files differnew file mode 100644 index 0000000..7bfc552 --- /dev/null +++ b/android_webview/test/shell/assets/video.webm diff --git a/build/common.gypi b/build/common.gypi index b1b14d1..885e325 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -833,10 +833,9 @@ 'use_browser_spellchecker%': 1, }], - # Android OS includes support for proprietary codecs regardless of - # building Chromium or Google Chrome. We also ship Google Chrome and - # Chromecast with proprietary codecs. - ['OS=="android" or branding=="Chrome" or chromecast==1', { + # Enables proprietary codecs and demuxers; e.g. H264, AAC, MP3, and MP4. + # We always build Google Chrome and Chromecast with proprietary codecs. + ['branding=="Chrome" or chromecast==1', { 'proprietary_codecs%': 1, }, { 'proprietary_codecs%': 0, diff --git a/build/config/features.gni b/build/config/features.gni index 8efa7cf..c965844 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -46,11 +46,9 @@ declare_args() { # Enables the Media Router. enable_media_router = !is_ios - # Enables proprietary codecs and demuxers; e.g. H264, MOV, AAC, and MP3. - # Android OS includes support for proprietary codecs regardless of building - # Chromium or Google Chrome. We also ship Google Chrome and Chromecast with - # proprietary codecs. - proprietary_codecs = is_android || is_chrome_branded || is_chromecast + # Enables proprietary codecs and demuxers; e.g. H264, AAC, MP3, and MP4. + # We always build Google Chrome and Chromecast with proprietary codecs. + proprietary_codecs = is_chrome_branded || is_chromecast enable_configuration_policy = !is_ios diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java index 8d69889..73aa40e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java @@ -236,7 +236,7 @@ public class ContextMenuTest extends DownloadTestBase { throws InterruptedException, TimeoutException, SecurityException, IOException { // Click the video to enable playback DOMUtils.clickNode(this, getActivity().getCurrentContentViewCore(), "videoDOMElement"); - saveMediaFromContextMenu("videoDOMElement", R.id.contextmenu_save_video, "test.mp4"); + saveMediaFromContextMenu("videoDOMElement", R.id.contextmenu_save_video, "test.webm"); } /** diff --git a/chrome/test/data/android/contextmenu/context_menu_test.html b/chrome/test/data/android/contextmenu/context_menu_test.html index 3c88f46..ab9418d 100644 --- a/chrome/test/data/android/contextmenu/context_menu_test.html +++ b/chrome/test/data/android/contextmenu/context_menu_test.html @@ -31,7 +31,7 @@ V0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNg width="16" height="14" alt="embedded folder icon" id="dataUrlIcon"><br /> <video id="videoDOMElement" controls> - <source src="../media/test.mp4" type="video/mp4"> + <source src="../media/test.webm" type="video/webm"> </video><br /> </body> diff --git a/chrome/test/data/android/media/test.webm b/chrome/test/data/android/media/test.webm Binary files differnew file mode 100644 index 0000000..f1a92fc --- /dev/null +++ b/chrome/test/data/android/media/test.webm diff --git a/components/cdm/browser/widevine_drm_delegate_android.cc b/components/cdm/browser/widevine_drm_delegate_android.cc index ba09143..d4133ee 100644 --- a/components/cdm/browser/widevine_drm_delegate_android.cc +++ b/components/cdm/browser/widevine_drm_delegate_android.cc @@ -36,9 +36,13 @@ bool WidevineDrmDelegateAndroid::OnCreateSession( if (init_data_type != media::EmeInitDataType::CENC) return true; +#if defined(PROPRIETARY_CODECS) // Widevine MediaDrm plugin only accepts the "data" part of the PSSH box as // the init data when using MP4 container. return media::GetPsshData(init_data, GetUUID(), init_data_out); +#else + return false; +#endif } } // namespace cdm diff --git a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc index 78ba075..bc52b01 100644 --- a/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc +++ b/components/dom_distiller/content/browser/distiller_page_web_contents_browsertest.cc @@ -250,7 +250,7 @@ IN_PROC_BROWSER_TEST_F(DistillerPageWebContentsTest, HandlesRelativeVideos) { // A relative source/track should've been updated. EXPECT_THAT(distiller_result_->distilled_content().html(), - ContainsRegex("src=\"http://127.0.0.1:.*/relative_video.mp4\"")); + ContainsRegex("src=\"http://127.0.0.1:.*/relative_video.webm\"")); EXPECT_THAT( distiller_result_->distilled_content().html(), ContainsRegex("src=\"http://127.0.0.1:.*/relative_track_en.vtt\"")); diff --git a/components/test/data/dom_distiller/video_article.html b/components/test/data/dom_distiller/video_article.html index 7fac7ae..1ca2ce9 100644 --- a/components/test/data/dom_distiller/video_article.html +++ b/components/test/data/dom_distiller/video_article.html @@ -7,7 +7,7 @@ <p>Lorem ipsum dolor sit amet, at alia aliquip vel. Quas inani labore an vel. Sed an nemore minimum accusata. Sint inermis tacimates est ex, ad movet iracundia mei, delicata iracundia laboramus ei eos. Illud principes complectitur te nec, ius alienum insolens ea, cu quo oratio omnesque. <video width="500" height="400" controls> - <source src="relative_video.mp4" type="video/mp4"> + <source src="relative_video.webm" type="video/webm"> <source src="http://www.google.com/absolute_video.ogg" type="video/ogg"> <track src="relative_track_en.vtt" kind="chapters" srclang="en" label="English"> <track src="http://www.google.com/absolute_track_fr.vtt" kind="chapters" srclang="fr" label="French"> diff --git a/content/browser/media/media_canplaytype_browsertest.cc b/content/browser/media/media_canplaytype_browsertest.cc index 0b70f41..1a3af5a 100644 --- a/content/browser/media/media_canplaytype_browsertest.cc +++ b/content/browser/media/media_canplaytype_browsertest.cc @@ -42,8 +42,8 @@ const char* kOggVideoMaybe = kNot; const char* kTheoraProbably = kNot; const char* kOggOpusProbably = kNot; const char* kMpeg2AacProbably = kNot; // https://crbug.com/544268. -const char* kHlsProbably = kProbably; -const char* kHlsMaybe = kMaybe; +const char* kHlsProbably = kPropProbably; +const char* kHlsMaybe = kPropMaybe; #endif // !OS_ANDROID #if BUILDFLAG(ENABLE_HEVC_DEMUXING) diff --git a/media/BUILD.gn b/media/BUILD.gn index 34f6759..b0750196 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -642,19 +642,15 @@ test("media_unittests") { sources += [ "ffmpeg/ffmpeg_common_unittest.cc", "filters/audio_decoder_unittest.cc", + "filters/audio_file_reader_unittest.cc", "filters/blocking_url_protocol_unittest.cc", + "filters/ffmpeg_demuxer_unittest.cc", "filters/ffmpeg_glue_unittest.cc", "filters/in_memory_url_protocol_unittest.cc", ] if (!is_android) { sources += [ - # These tests are confused by Android always having proprietary - # codecs enabled, but ffmpeg_branding=Chromium. These should be - # fixed, http://crbug.com/570762. - "filters/audio_file_reader_unittest.cc", - "filters/ffmpeg_demuxer_unittest.cc", - # FFmpeg on Android does not include video decoders. "filters/ffmpeg_video_decoder_unittest.cc", ] diff --git a/media/base/android/BUILD.gn b/media/base/android/BUILD.gn index 7ac7d97..b9db10a 100644 --- a/media/base/android/BUILD.gn +++ b/media/base/android/BUILD.gn @@ -83,7 +83,6 @@ source_set("unittests") { sources = [ "access_unit_queue_unittest.cc", "media_codec_decoder_unittest.cc", - "media_codec_player_unittest.cc", "media_drm_bridge_unittest.cc", "media_player_bridge_unittest.cc", "media_source_player_unittest.cc", @@ -92,6 +91,11 @@ source_set("unittests") { "test_data_factory.h", "test_statistics.h", ] + + if (proprietary_codecs) { + sources += [ "media_codec_player_unittest.cc" ] + } + deps = [ ":android", "//media/base:test_support", diff --git a/media/base/mime_util_unittest.cc b/media/base/mime_util_unittest.cc index da9877d..0690f85 100644 --- a/media/base/mime_util_unittest.cc +++ b/media/base/mime_util_unittest.cc @@ -131,7 +131,7 @@ TEST(MimeUtilTest, CommonMediaMimeType) { EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg")); #endif // OS_ANDROID -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) && defined(USE_PROPRIETARY_CODECS) // HLS is supported on Android API level 14 and higher and Chrome supports // API levels 15 and higher, so these are expected to be supported. bool kHlsSupported = true; diff --git a/media/filters/audio_decoder_unittest.cc b/media/filters/audio_decoder_unittest.cc index c4f727b..d29a68d 100644 --- a/media/filters/audio_decoder_unittest.cc +++ b/media/filters/audio_decoder_unittest.cc @@ -503,7 +503,6 @@ INSTANTIATE_TEST_CASE_P(OpusAudioDecoderBehavioralTest, testing::ValuesIn(kOpusBehavioralTest)); #if defined(OS_ANDROID) - const DecoderTestData kMediaCodecTests[] = { {MEDIA_CODEC, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, CHANNEL_LAYOUT_STEREO}, @@ -512,10 +511,7 @@ const DecoderTestData kMediaCodecTests[] = { INSTANTIATE_TEST_CASE_P(MediaCodecAudioDecoderTest, AudioDecoderTest, testing::ValuesIn(kMediaCodecTests)); - -#else // !defined(OS_ANDROID) - -// Disable all FFmpeg decoder tests on Android. http://crbug.com/570762. +#endif // defined(OS_ANDROID) #if defined(USE_PROPRIETARY_CODECS) const DecodedBufferExpectations kSfxMp3Expectations[] = { @@ -598,6 +594,4 @@ INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, FFmpegAudioDecoderBehavioralTest, testing::ValuesIn(kFFmpegBehavioralTest)); -#endif // !defined(OS_ANDROID) - } // namespace media diff --git a/media/media.gyp b/media/media.gyp index f254b8f..1616b19 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -1160,7 +1160,6 @@ '<@(capture_unittests_sources)', 'base/android/access_unit_queue_unittest.cc', 'base/android/media_codec_decoder_unittest.cc', - 'base/android/media_codec_player_unittest.cc', 'base/android/media_drm_bridge_unittest.cc', 'base/android/media_player_bridge_unittest.cc', 'base/android/media_source_player_unittest.cc', @@ -1331,12 +1330,6 @@ 'filters/ffmpeg_video_decoder_unittest.cc', 'test/pipeline_integration_test.cc', 'test/pipeline_integration_test_base.cc', - - # These tests are confused by Android always having proprietary - # codecs enabled, but ffmpeg_branding=Chromium. These should be - # fixed, see http://crbug.com/570762. - 'filters/audio_file_reader_unittest.cc', - 'filters/ffmpeg_demuxer_unittest.cc', ], }], ['OS=="android"', { @@ -1370,6 +1363,7 @@ }], ['proprietary_codecs==1', { 'sources': [ + 'base/android/media_codec_player_unittest.cc', 'cdm/cenc_utils_unittest.cc', 'filters/ffmpeg_aac_bitstream_converter_unittest.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc', |