Commit be789ec6 authored by Rasmus Brandt's avatar Rasmus Brandt Committed by Commit Bot

Fix rotation bug in WebMediaPlayerMSCompositor::SetCurrentFrame

Bug: 1025166
Change-Id: I482cedef1cb489384e896e5d8ff8b70f0ecd496e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913409Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Rasmus Brandt <brandtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715662}
parent 04a44287
......@@ -563,8 +563,11 @@ void WebMediaPlayerMSCompositor::SetCurrentFrame(
is_first_frame = false;
if (!current_frame_->metadata()->GetRotation(
media::VideoFrameMetadata::ROTATION, &current_video_rotation) ||
current_video_rotation == *new_rotation) {
media::VideoFrameMetadata::ROTATION, &current_video_rotation)) {
// Assume VIDEO_ROTATION_0 for current frame without video rotation.
current_video_rotation = media::VIDEO_ROTATION_0;
}
if (current_video_rotation == *new_rotation) {
new_rotation.reset();
}
......
......@@ -344,8 +344,12 @@ void MockMediaStreamVideoRenderer::QueueFrames(
frame_size, gfx::Rect(frame_size), frame_size,
base::TimeDelta::FromMilliseconds(token));
frame->metadata()->SetRotation(media::VideoFrameMetadata::ROTATION,
rotation);
// MediaStreamRemoteVideoSource does not explicitly set the rotation
// for unrotated frames, so that is not done here either.
if (rotation != media::VIDEO_ROTATION_0) {
frame->metadata()->SetRotation(media::VideoFrameMetadata::ROTATION,
rotation);
}
frame->metadata()->SetTimeTicks(
media::VideoFrameMetadata::Key::REFERENCE_TIME,
base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(token));
......@@ -1067,6 +1071,24 @@ TEST_P(WebMediaPlayerMSTest, RotationChange) {
EXPECT_EQ(kStandardHeight, natural_size.height);
EXPECT_EQ(kStandardWidth, natural_size.width);
// Change rotation again.
tokens[0] = 66;
timestamps = std::vector<int>(tokens, tokens + base::size(tokens));
provider->QueueFrames(timestamps, false, false, 17, media::VIDEO_ROTATION_90);
if (enable_surface_layer_for_video_) {
EXPECT_CALL(*submitter_ptr_, SetRotation(media::VIDEO_ROTATION_90));
} else {
EXPECT_CALL(*this, DoSetCcLayer(true));
EXPECT_CALL(*this, DoStopRendering());
EXPECT_CALL(*this, DoStartRendering());
}
message_loop_controller_.RunAndWaitForStatus(
media::PipelineStatus::PIPELINE_OK);
base::RunLoop().RunUntilIdle();
natural_size = player_->NaturalSize();
EXPECT_EQ(kStandardHeight, natural_size.width);
EXPECT_EQ(kStandardWidth, natural_size.height);
testing::Mock::VerifyAndClearExpectations(this);
EXPECT_CALL(*this, DoSetCcLayer(false));
......
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