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

Side by Side Diff: media/video/ffmpeg_video_decode_engine.cc

Issue 7137002: Don't forget the ffmpeg input buffer padding when allocating a codec's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/video/ffmpeg_video_decode_engine.h" 5 #include "media/video/ffmpeg_video_decode_engine.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 codec_context_->codec_type = AVMEDIA_TYPE_VIDEO; 65 codec_context_->codec_type = AVMEDIA_TYPE_VIDEO;
66 codec_context_->codec_id = VideoCodecToCodecID(config.codec()); 66 codec_context_->codec_id = VideoCodecToCodecID(config.codec());
67 codec_context_->coded_width = config.width(); 67 codec_context_->coded_width = config.width();
68 codec_context_->coded_height = config.height(); 68 codec_context_->coded_height = config.height();
69 69
70 frame_rate_numerator_ = config.frame_rate_numerator(); 70 frame_rate_numerator_ = config.frame_rate_numerator();
71 frame_rate_denominator_ = config.frame_rate_denominator(); 71 frame_rate_denominator_ = config.frame_rate_denominator();
72 72
73 if (config.extra_data() != NULL) { 73 if (config.extra_data() != NULL) {
74 codec_context_->extradata_size = config.extra_data_size(); 74 codec_context_->extradata_size = config.extra_data_size();
75 codec_context_->extradata = 75 codec_context_->extradata = reinterpret_cast<uint8_t*>(
76 reinterpret_cast<uint8_t*>(av_malloc(config.extra_data_size())); 76 av_malloc(config.extra_data_size() + FF_INPUT_BUFFER_PADDING_SIZE));
77 memcpy(codec_context_->extradata, config.extra_data(), 77 memcpy(codec_context_->extradata, config.extra_data(),
78 config.extra_data_size()); 78 config.extra_data_size());
79 memset(codec_context_->extradata + config.extra_data_size(), '\0',
80 FF_INPUT_BUFFER_PADDING_SIZE);
79 } 81 }
80 82
81 // Enable motion vector search (potentially slow), strong deblocking filter 83 // Enable motion vector search (potentially slow), strong deblocking filter
82 // for damaged macroblocks, and set our error detection sensitivity. 84 // for damaged macroblocks, and set our error detection sensitivity.
83 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK; 85 codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
84 codec_context_->error_recognition = FF_ER_CAREFUL; 86 codec_context_->error_recognition = FF_ER_CAREFUL;
85 87
86 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); 88 AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
87 89
88 if (codec) { 90 if (codec) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 break; 384 break;
383 } 385 }
384 return VideoFrame::INVALID; 386 return VideoFrame::INVALID;
385 } 387 }
386 388
387 } // namespace media 389 } // namespace media
388 390
389 // Disable refcounting for this object because this object only lives 391 // Disable refcounting for this object because this object only lives
390 // on the video decoder thread and there's no need to refcount it. 392 // on the video decoder thread and there's no need to refcount it.
391 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine); 393 DISABLE_RUNNABLE_METHOD_REFCOUNT(media::FFmpegVideoDecodeEngine);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698