diff options
-rw-r--r-- | chromecast/media/cma/filters/hole_frame_factory.cc | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/chromecast/media/cma/filters/hole_frame_factory.cc b/chromecast/media/cma/filters/hole_frame_factory.cc index 54923cc..5cca26a 100644 --- a/chromecast/media/cma/filters/hole_frame_factory.cc +++ b/chromecast/media/cma/filters/hole_frame_factory.cc @@ -25,7 +25,7 @@ HoleFrameFactory::HoleFrameFactory( use_legacy_hole_punching_( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableLegacyHolePunching)) { - if (!use_legacy_hole_punching_) { + if (gpu_factories_ && !use_legacy_hole_punching_) { gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface(); CHECK(gl); @@ -43,7 +43,7 @@ HoleFrameFactory::HoleFrameFactory( } HoleFrameFactory::~HoleFrameFactory() { - if (texture_ != 0) { + if (texture_) { gpu::gles2::GLES2Interface* gl = gpu_factories_->GetGLES2Interface(); gl->BindTexture(GL_TEXTURE_2D, texture_); gl->ReleaseTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id_); @@ -61,18 +61,23 @@ scoped_refptr<::media::VideoFrame> HoleFrameFactory::CreateHoleFrame( NOTREACHED(); } - scoped_refptr<::media::VideoFrame> frame = - ::media::VideoFrame::WrapNativeTexture( - ::media::PIXEL_FORMAT_XRGB, - gpu::MailboxHolder(mailbox_, GL_TEXTURE_2D, sync_point_), - ::media::VideoFrame::ReleaseMailboxCB(), - size, // coded_size - gfx::Rect(size), // visible rect - size, // natural size - base::TimeDelta()); // timestamp - frame->metadata()->SetBoolean(::media::VideoFrameMetadata::ALLOW_OVERLAY, - true); - return frame; + if (texture_) { + scoped_refptr<::media::VideoFrame> frame = + ::media::VideoFrame::WrapNativeTexture( + ::media::PIXEL_FORMAT_XRGB, + gpu::MailboxHolder(mailbox_, GL_TEXTURE_2D, sync_point_), + ::media::VideoFrame::ReleaseMailboxCB(), + size, // coded_size + gfx::Rect(size), // visible rect + size, // natural size + base::TimeDelta()); // timestamp + frame->metadata()->SetBoolean(::media::VideoFrameMetadata::ALLOW_OVERLAY, + true); + return frame; + } else { + // This case is needed for audio-only devices. + return ::media::VideoFrame::CreateBlackFrame(gfx::Size(1, 1)); + } } } // namespace media |