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

Unified Diff: media/cast/test/fake_media_source.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/cast/test/fake_media_source.cc
diff --git a/media/cast/test/fake_media_source.cc b/media/cast/test/fake_media_source.cc
index 24327d030e83f40fa63cdbfc4e3a49fac4c6b16f..7d87121c7b3fd18bbe466410e98c32f297911551 100644
--- a/media/cast/test/fake_media_source.cc
+++ b/media/cast/test/fake_media_source.cc
@@ -546,10 +546,14 @@ void FakeMediaSource::DecodeVideo(ScopedAVPacket packet) {
video_first_pts_ = avframe->pkt_pts - adjustment_pts;
}
- video_frame_queue_.push(VideoFrame::WrapExternalYuvData(
- media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size,
- avframe->linesize[0], avframe->linesize[1], avframe->linesize[2],
- avframe->data[0], avframe->data[1], avframe->data[2], timestamp));
+ scoped_refptr<media::VideoFrame> video_frame =
+ VideoFrame::WrapExternalYuvData(
+ media::PIXEL_FORMAT_YV12, size, gfx::Rect(size), size,
+ avframe->linesize[0], avframe->linesize[1], avframe->linesize[2],
+ avframe->data[0], avframe->data[1], avframe->data[2], timestamp);
+ if (!video_frame)
+ return;
+ video_frame_queue_.push(video_frame);
video_frame_queue_.back()->AddDestructionObserver(
base::Bind(&AVFreeFrame, avframe));
last_video_frame_timestamp_ = timestamp;

Powered by Google App Engine
This is Rietveld 408576698