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

Unified Diff: content/renderer/media/rtc_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: content/renderer/media/rtc_video_decoder.cc
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index aebe9f2846c8e5e72cd12c73af4ccacfe66cf01d..664e730fb457480246fb31f7886007cc5ddd4173 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -370,6 +370,11 @@ void RTCVideoDecoder::PictureReady(const media::Picture& picture) {
scoped_refptr<media::VideoFrame> frame =
CreateVideoFrame(picture, pb, timestamp, visible_rect);
+ if (!frame) {
+ LOG(ERROR) << "Couldn't create video frame";
+ NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
+ return;
+ }
bool inserted =
picture_buffers_at_display_.insert(std::make_pair(
picture.picture_buffer_id(),
@@ -405,15 +410,15 @@ scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame(
// as ARGB. This prevents the compositor from messing with it, since the
// underlying platform can handle the former format natively. Make sure the
// correct format is used and everyone down the line understands it.
- scoped_refptr<media::VideoFrame> frame(media::VideoFrame::WrapNativeTexture(
+ scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture(
media::PIXEL_FORMAT_ARGB,
gpu::MailboxHolder(pb.texture_mailbox(), gpu::SyncToken(),
decoder_texture_target_),
media::BindToCurrentLoop(base::Bind(
&RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
factories_, picture.picture_buffer_id(), pb.texture_id())),
- pb.size(), visible_rect, visible_rect.size(), timestamp_ms));
- if (picture.allow_overlay()) {
+ pb.size(), visible_rect, visible_rect.size(), timestamp_ms);
+ if (frame && picture.allow_overlay()) {
Pawel Osciak 2015/11/26 01:19:03 Could we perhaps have an error path here logging t
emircan 2015/12/04 04:20:09 Done. It returns a nullptr and l.374 logs it as we
frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY,
true);
}

Powered by Google App Engine
This is Rietveld 408576698