Commit 3dfc51cb authored by liberato@chromium.org's avatar liberato@chromium.org Committed by Commit Bot

Don't submit zero-sized VideoFrames to the frame sink.

Zero-sized renderpasses aren't allowed, but VideoFrameSubmitter
sometimes submits them anyway.  It's unclear where they come from,
since the media pipeline doesn't allow them either except in some
special cases (e.g., EOS frames).

This CL makes VideoFrameSubmitter ignore frames that are zero-sized.

Bug: 979564
Change-Id: Ib2f51c856587c66b5116a799fa983f83de6e0eb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929832
Auto-Submit: Frank Liberato <liberato@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Frank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718028}
parent e79e6a34
...@@ -422,6 +422,15 @@ bool VideoFrameSubmitter::SubmitFrame( ...@@ -422,6 +422,15 @@ bool VideoFrameSubmitter::SubmitFrame(
rotation_ == media::VIDEO_ROTATION_270) { rotation_ == media::VIDEO_ROTATION_270) {
frame_size = gfx::Size(frame_size.height(), frame_size.width()); frame_size = gfx::Size(frame_size.height(), frame_size.width());
} }
if (frame_size.IsEmpty()) {
// We're not supposed to get 0x0 frames. For now, just ignore it until we
// track down where they're coming from. Creating a CompositorFrame with an
// empty output rectangle isn't allowed.
// crbug.com/979564
return false;
}
if (frame_size_ != frame_size) { if (frame_size_ != frame_size) {
if (!frame_size_.IsEmpty()) if (!frame_size_.IsEmpty())
GenerateNewSurfaceId(); GenerateNewSurfaceId();
......
...@@ -918,4 +918,14 @@ TEST_F(VideoFrameSubmitterTest, NoDuplicateFramesDidReceiveFrame) { ...@@ -918,4 +918,14 @@ TEST_F(VideoFrameSubmitterTest, NoDuplicateFramesDidReceiveFrame) {
task_environment_.RunUntilIdle(); task_environment_.RunUntilIdle();
} }
TEST_F(VideoFrameSubmitterTest, ZeroSizedFramesAreNotSubmitted) {
auto vf = media::VideoFrame::CreateEOSFrame();
ASSERT_TRUE(vf->natural_size().IsEmpty());
EXPECT_CALL(*video_frame_provider_, GetCurrentFrame()).WillOnce(Return(vf));
EXPECT_CALL(*sink_, DoSubmitCompositorFrame(_, _)).Times(0);
submitter_->DidReceiveFrame();
task_environment_.RunUntilIdle();
}
} // namespace blink } // namespace blink
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