Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2188)

Unified Diff: media/filters/vpx_video_decoder.cc

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/filters/vpx_video_decoder.cc
diff --git a/media/filters/vpx_video_decoder.cc b/media/filters/vpx_video_decoder.cc
index d9721b0c9474e6aa83867d395d8dbad900473aaf..8a44c16ec1f1f20cfadff460bf25f6376e0d4677 100644
--- a/media/filters/vpx_video_decoder.cc
+++ b/media/filters/vpx_video_decoder.cc
@@ -464,6 +464,10 @@ bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer,
}
CopyVpxImageToVideoFrame(vpx_image, video_frame);
+ if (!video_frame->get()) {
+ DLOG(ERROR) << "Couldn't create video frame";
+ return false;
+ }
(*video_frame)->set_timestamp(base::TimeDelta::FromMicroseconds(timestamp));
// Default to the color space from the config, but if the bistream specifies
@@ -576,8 +580,9 @@ void VpxVideoDecoder::CopyVpxImageToVideoFrame(
vpx_image->planes[VPX_PLANE_U],
vpx_image->planes[VPX_PLANE_V],
kNoTimestamp());
- video_frame->get()->AddDestructionObserver(
- memory_pool_->CreateFrameCallback(vpx_image->fb_priv));
+ if (video_frame->get())
+ video_frame->get()->AddDestructionObserver(
+ memory_pool_->CreateFrameCallback(vpx_image->fb_priv));
UMA_HISTOGRAM_COUNTS("Media.Vpx.VideoDecoderBuffersInUseByDecoder",
memory_pool_->NumberOfFrameBuffersInUseByDecoder());

Powered by Google App Engine
This is Rietveld 408576698