Commit 4f95a06f authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

VideoSurfaceLayer: enable feature 100% on trunk.

Bug: 746182
Change-Id: Iaa0a2e5f7c3950f6fe2d1e1a1e14dd2d501311cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1541584Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646571}
parent 3570bf6b
......@@ -301,7 +301,7 @@ const base::Feature kUnifiedAutoplay{"UnifiedAutoplay",
// If enabled, use SurfaceLayer instead of VideoLayer for all playbacks that
// aren't MediaStream.
const base::Feature kUseSurfaceLayerForVideo{"UseSurfaceLayerForVideo",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
// Enable VA-API hardware encode acceleration for VP8.
const base::Feature kVaapiVP8Encoder{"VaapiVP8Encoder",
......
......@@ -861,6 +861,8 @@ TEST_F(WebMediaPlayerImplTest, LazyLoadPreloadMetadataSuspend) {
const int64_t data_source_size = GetDataSourceMemoryUsage();
EXPECT_GT(data_source_size, 0);
EXPECT_EQ(reported_memory_ - data_source_size, 0);
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
// Verify that preload=metadata suspend video w/ poster uses zero video memory.
......@@ -892,6 +894,8 @@ TEST_F(WebMediaPlayerImplTest, LoadPreloadMetadataSuspendNoVideoMemoryUsage) {
const int64_t data_source_size = GetDataSourceMemoryUsage();
EXPECT_GT(data_source_size, 0);
EXPECT_EQ(reported_memory_ - data_source_size, 0);
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
// Verify that preload=metadata suspend is aborted if we know the element will
......@@ -1323,6 +1327,24 @@ TEST_F(WebMediaPlayerImplTest, Encrypted) {
TEST_F(WebMediaPlayerImplTest, Waiting_NoDecryptionKey) {
InitializeWebMediaPlayerImpl();
scoped_refptr<cc::Layer> layer = cc::Layer::Create();
EXPECT_CALL(*surface_layer_bridge_ptr_, GetCcLayer())
.WillRepeatedly(Return(layer.get()));
if (base::FeatureList::IsEnabled(kUseSurfaceLayerForVideo)) {
EXPECT_CALL(*surface_layer_bridge_ptr_, CreateSurfaceLayer());
EXPECT_CALL(client_, SetCcLayer(_)).Times(0);
EXPECT_CALL(*surface_layer_bridge_ptr_, GetSurfaceId())
.WillOnce(ReturnRef(surface_id_));
EXPECT_CALL(*surface_layer_bridge_ptr_, GetLocalSurfaceIdAllocationTime())
.WillOnce(Return(base::TimeTicks()));
EXPECT_CALL(*compositor_, EnableSubmission(_, _, _, _));
EXPECT_CALL(*surface_layer_bridge_ptr_, SetContentsOpaque(true)).Times(1);
EXPECT_CALL(*surface_layer_bridge_ptr_, SetContentsOpaque(false)).Times(1);
} else {
EXPECT_CALL(client_, SetCcLayer(NotNull()));
}
// Use non-encrypted file here since we don't have a CDM. Otherwise pipeline
// initialization will stall waiting for a CDM to be set.
LoadAndWaitForMetadata(kVideoOnlyTestFile);
......@@ -1331,6 +1353,8 @@ TEST_F(WebMediaPlayerImplTest, Waiting_NoDecryptionKey) {
EXPECT_CALL(encrypted_client_, DidResumePlaybackBlockedForKey());
OnWaiting(WaitingReason::kNoDecryptionKey);
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, VideoConfigChange) {
......@@ -1385,6 +1409,8 @@ TEST_F(WebMediaPlayerImplTest, VideoConfigChange) {
OnVideoConfigChange(new_color_config);
ASSERT_EQ(last_reporter, GetVideoStatsReporter());
ASSERT_EQ(VP8PROFILE_MIN, GetVideoStatsReporterCodecProfile());
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, NaturalSizeChange) {
......@@ -1425,6 +1451,8 @@ TEST_F(WebMediaPlayerImplTest, NaturalSizeChange) {
ASSERT_NE(orig_stats_reporter, GetVideoStatsReporter());
ASSERT_TRUE(GetVideoStatsReporter()->MatchesBucketedNaturalSize(
gfx::Size(1920, 1080)));
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) {
......@@ -1466,6 +1494,8 @@ TEST_F(WebMediaPlayerImplTest, NaturalSizeChange_Rotated) {
ASSERT_NE(orig_stats_reporter, GetVideoStatsReporter());
ASSERT_TRUE(GetVideoStatsReporter()->MatchesBucketedNaturalSize(
gfx::Size(1080, 1920)));
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, VideoLockedWhenPausedWhenHidden) {
......@@ -1522,6 +1552,8 @@ TEST_F(WebMediaPlayerImplTest, VideoLockedWhenPausedWhenHidden) {
// Foregrounding the player unsets the lock.
ForegroundPlayer();
EXPECT_FALSE(IsVideoLockedWhenPausedWhenHidden());
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, BackgroundIdlePauseTimerDependsOnAudio) {
......@@ -1581,6 +1613,8 @@ TEST_F(WebMediaPlayerImplTest, InfiniteDuration) {
wmpi_->Pause();
EXPECT_EQ(0, wmpi_->CurrentTime());
EXPECT_EQ(base::TimeDelta(), GetCurrentTimeInternal());
EXPECT_CALL(*surface_layer_bridge_ptr_, ClearObserver());
}
TEST_F(WebMediaPlayerImplTest, SetContentsLayerGetsWebLayerFromBridge) {
......
......@@ -10,11 +10,7 @@
}
function load() {
var canplayCount = 0;
function oncanplay() {
if (++canplayCount < 2) {
return;
}
// Make sure we render the first frame.
requestAnimationFrame(function() {
video.play();
......@@ -24,12 +20,12 @@
// Get the first video to stay on frame zero for comparison purposes.
var video = document.getElementsByTagName("video")[0];
video.src = "../media/resources/frame_size_change.webm";
video.addEventListener('canplay', oncanplay);
video.addEventListener('canplay', oncanplay, {once: true});
// Get the second video to play through the clip with changing dimensions.
video = document.getElementsByTagName("video")[1];
video.src = "../media/resources/frame_size_change.webm";
video.addEventListener('canplay', oncanplay);
video.addEventListener('canplay', oncanplay, {once: true});
video.addEventListener('playing', function() {
// Make sure the video plays for a bit.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment