Skip to content

Commit

Permalink
[Chromecast] Avoid DCHECK for 0-area video frames
Browse files Browse the repository at this point in the history
If video resolution is reported as width or height 0, the
overlay codepath leads to a DCHECK in TextureMailbox.  Since
these video frames can't actually be visible onscreen, we can
just take the backup path, which creates a black software frame
instead.

BUG=internal b/26736950
TEST=Ran the failing test mentioned in bug, verified that black
     frame path is taken and no DCHECK hit.

Review URL: https://codereview.chromium.org/1623763002

Cr-Commit-Position: refs/heads/master@{#371273}
  • Loading branch information
halliwell authored and Commit bot committed Jan 25, 2016
1 parent 47c832a commit fb2e77c
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions chromecast/renderer/media/hole_frame_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,25 @@ HoleFrameFactory::~HoleFrameFactory() {

scoped_refptr<::media::VideoFrame> HoleFrameFactory::CreateHoleFrame(
const gfx::Size& size) {
if (texture_) {
scoped_refptr<::media::VideoFrame> frame =
::media::VideoFrame::WrapNativeTexture(
::media::PIXEL_FORMAT_XRGB,
gpu::MailboxHolder(mailbox_, sync_token_, GL_TEXTURE_2D),
::media::VideoFrame::ReleaseMailboxCB(),
size, // coded_size
gfx::Rect(size), // visible rect
size, // natural size
base::TimeDelta()); // timestamp
CHECK(frame);
frame->metadata()->SetBoolean(::media::VideoFrameMetadata::ALLOW_OVERLAY,
true);
return frame;
} else {
// This case is needed for audio-only devices.
// No texture => audio device. size empty => video has one dimension = 0.
// Dimension 0 case triggers a DCHECK later on in TextureMailbox if we push
// through the overlay path.
if (!texture_ || size.IsEmpty())
return ::media::VideoFrame::CreateBlackFrame(gfx::Size(1, 1));
}

scoped_refptr<::media::VideoFrame> frame =
::media::VideoFrame::WrapNativeTexture(
::media::PIXEL_FORMAT_XRGB,
gpu::MailboxHolder(mailbox_, sync_token_, GL_TEXTURE_2D),
::media::VideoFrame::ReleaseMailboxCB(),
size, // coded_size
gfx::Rect(size), // visible rect
size, // natural size
base::TimeDelta()); // timestamp
CHECK(frame);
frame->metadata()->SetBoolean(::media::VideoFrameMetadata::ALLOW_OVERLAY,
true);
return frame;
}

} // namespace media
Expand Down

0 comments on commit fb2e77c

Please sign in to comment.