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

Unified Diff: media/ffmpeg/ffmpeg_common.h

Issue 10949029: Replace av_malloc with AlignedAlloc for memory allocation in DecoderBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« media/base/decoder_buffer.cc ('K') | « media/base/decoder_buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common.h
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index 01393698af30c3ca01b2d5fb64f9842a8e6faf3c..d5a05f373b9fe4d3a324e346d85e7151e44fdac0 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -8,10 +8,12 @@
// Used for FFmpeg error codes.
#include <cerrno>
+#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/time.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/channel_layout.h"
+#include "media/base/decoder_buffer.h"
acolwell GONE FROM CHROMIUM 2012/09/20 00:16:21 move this into cc file too.
xhwang 2012/09/20 01:43:03 Done.
#include "media/base/media_export.h"
#include "media/base/video_frame.h"
#include "media/base/video_decoder_config.h"
@@ -37,6 +39,15 @@ namespace media {
class AudioDecoderConfig;
class VideoDecoderConfig;
+// Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
+// padded. Using av_malloc with padding ensures FFmpeg only receives data
acolwell GONE FROM CHROMIUM 2012/09/20 00:16:21 Comment should be updated. We don't use av_malloc
xhwang 2012/09/20 01:43:03 Done.
+// padded and aligned to its specifications.
+COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE,
ddorwin 2012/09/19 23:59:18 Shouldn't the new constants be multiples (1 or gre
DaleCurtis 2012/09/20 00:00:04 Do this in the cc file instead.
xhwang 2012/09/20 01:43:03 This should be okay. (+dale to be sure.)
xhwang 2012/09/20 01:43:03 Done.
+ decoder_buffer_padding_size_does_not_fit_ffmpeg_requirement);
+// Why 32? This is the alignment size required by FFmpeg for input buffers.
+COMPILE_ASSERT(DecoderBuffer::kAlignmentSize == 32,
DaleCurtis 2012/09/20 00:00:04 >= 32?
xhwang 2012/09/20 01:43:03 The alignment should be positive multiple of 32. E
+ decoder_buffer_alignment_size_does_not_fit_ffmpeg_requirement);
+
// Wraps FFmpeg's av_free() in a class that can be passed as a template argument
// to scoped_ptr_malloc.
class ScopedPtrAVFree {
« media/base/decoder_buffer.cc ('K') | « media/base/decoder_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698