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

Unified Diff: media/filters/ffmpeg_video_decoder.cc

Issue 1227383003: Remove memset from VideoFrame and mark buffer as unpoisoned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dalecurtis@ comments. Created 5 years, 5 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/ffmpeg_video_decoder.cc
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index fdf8dc5841a8085c4831026dd693b6fe3e994acf..c42e13199a29e6b3cbd1d3f4e5666414f26284d8 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -125,14 +125,17 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
return AVERROR(EINVAL);
}
+ // FFmpeg expects the initialize allocation to be zero-initialized. Failure
+ // to do so can lead to unitialized value usage. See http://crbug.com/390941
scoped_refptr<VideoFrame> video_frame = frame_pool_.CreateFrame(
- format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp());
+ format, coded_size, gfx::Rect(size), natural_size, kNoTimestamp(), true);
+
if (codec_context->colorspace == AVCOL_SPC_BT709) {
video_frame->metadata()->SetInteger(VideoFrameMetadata::COLOR_SPACE,
VideoFrame::COLOR_SPACE_HD_REC709);
}
- for (int i = 0; i < 3; i++) {
+ for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) {
frame->data[i] = video_frame->data(i);
frame->linesize[i] = video_frame->stride(i);
}
@@ -148,7 +151,7 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
video_frame.swap(reinterpret_cast<VideoFrame**>(&opaque));
frame->buf[0] =
av_buffer_create(frame->data[0],
- VideoFrame::AllocationSize(format, coded_size),
+ VideoFrame::AlignedAllocationSize(video_frame),
ReleaseVideoBufferImpl,
opaque,
0);

Powered by Google App Engine
This is Rietveld 408576698