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

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: mcasas@ comments. Created 4 years, 11 months 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 40814bb273ad5a3f5cc18e96ea9172f9fd4e929b..4a6381be6a6797143ae597c1505edfb814190105 100644
--- a/media/filters/vpx_video_decoder.cc
+++ b/media/filters/vpx_video_decoder.cc
@@ -592,8 +592,10 @@ bool 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) {
Pawel Osciak 2016/01/13 07:53:25 Should this be if (*video_frame)?
emircan 2016/01/14 23:13:54 I changed it after mcasas@ suggestion. But looking
+ video_frame->get()->AddDestructionObserver(
+ memory_pool_->CreateFrameCallback(vpx_image->fb_priv));
+ }
UMA_HISTOGRAM_COUNTS("Media.Vpx.VideoDecoderBuffersInUseByDecoder",
memory_pool_->NumberOfFrameBuffersInUseByDecoder());
@@ -610,6 +612,8 @@ bool VpxVideoDecoder::CopyVpxImageToVideoFrame(
*video_frame = frame_pool_.CreateFrame(
codec_format, visible_size, gfx::Rect(visible_size),
config_.natural_size(), kNoTimestamp());
+ if (!video_frame)
Pawel Osciak 2016/01/13 07:53:25 Also if (*video_frame) I believe.
emircan 2016/01/14 23:13:53 Done.
+ return false;
libyuv::I420Copy(
vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y],

Powered by Google App Engine
This is Rietveld 408576698