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

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: halliwell@ 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
« no previous file with comments | « content/renderer/media/media_stream_video_track.cc ('k') | content/renderer/media/video_capture_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 de91b6e32395c4a3d8aa203efb5b77dfbcaa5f03..423b14344272afe3f441a99e87439077347eaecd 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -372,6 +372,10 @@ void RTCVideoDecoder::PictureReady(const media::Picture& picture) {
scoped_refptr<media::VideoFrame> frame =
CreateVideoFrame(picture, pb, timestamp, visible_rect);
+ if (!frame) {
+ NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
+ return;
+ }
bool inserted =
picture_buffers_at_display_.insert(std::make_pair(
picture.picture_buffer_id(),
@@ -407,15 +411,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()) {
frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY,
true);
}
« no previous file with comments | « content/renderer/media/media_stream_video_track.cc ('k') | content/renderer/media/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698