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

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: LOG in video_Frame and CHECK/return outside. Created 5 years 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..c853d01161cd37195f070bb75f8399357858dbc3 100644
--- a/media/filters/vpx_video_decoder.cc
+++ b/media/filters/vpx_video_decoder.cc
@@ -576,8 +576,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());
@@ -594,18 +595,19 @@ void VpxVideoDecoder::CopyVpxImageToVideoFrame(
*video_frame = frame_pool_.CreateFrame(
codec_format, visible_size, gfx::Rect(visible_size),
config_.natural_size(), kNoTimestamp());
-
- libyuv::I420Copy(
- vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y],
- vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U],
- vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V],
- (*video_frame)->visible_data(VideoFrame::kYPlane),
- (*video_frame)->stride(VideoFrame::kYPlane),
- (*video_frame)->visible_data(VideoFrame::kUPlane),
- (*video_frame)->stride(VideoFrame::kUPlane),
- (*video_frame)->visible_data(VideoFrame::kVPlane),
- (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(),
- coded_size.height());
+ if (*video_frame) {
+ libyuv::I420Copy(
+ vpx_image->planes[VPX_PLANE_Y], vpx_image->stride[VPX_PLANE_Y],
+ vpx_image->planes[VPX_PLANE_U], vpx_image->stride[VPX_PLANE_U],
+ vpx_image->planes[VPX_PLANE_V], vpx_image->stride[VPX_PLANE_V],
+ (*video_frame)->visible_data(VideoFrame::kYPlane),
+ (*video_frame)->stride(VideoFrame::kYPlane),
+ (*video_frame)->visible_data(VideoFrame::kUPlane),
+ (*video_frame)->stride(VideoFrame::kUPlane),
+ (*video_frame)->visible_data(VideoFrame::kVPlane),
+ (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(),
+ coded_size.height());
+ }
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698