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

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 10949029: Replace av_malloc with AlignedAlloc for memory allocation in DecoderBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve Dale's comments. 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
« no previous file with comments | « media/base/decoder_buffer_unittest.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.cc
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index b6690cb5f74d103e11e9c86f9eae50327ea1f2aa..00d91f552bb7fd62689ce61ec91a048697130821 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -4,11 +4,32 @@
#include "media/ffmpeg/ffmpeg_common.h"
+#include "base/basictypes.h"
#include "base/logging.h"
+#include "media/base/decoder_buffer.h"
#include "media/base/video_util.h"
namespace media {
+// Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
+// padded. Check here to ensure FFmpeg only receives data padded to its
+// specifications.
+COMPILE_ASSERT(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE,
+ decoder_buffer_padding_size_does_not_fit_ffmpeg_requirement);
+
+// Alignment requirement by FFmpeg for input buffers. This need to be updated
+// to match FFmpeg when it changes.
+#if defined(ARCH_CPU_ARM_FAMILY)
+static const int kFFmpegInputBufferAlignmentSize = 16;
+#else
+static const int kFFmpegInputBufferAlignmentSize = 32;
+#endif
+// Check here to ensure FFmpeg only receives data aligned to its specifications.
+COMPILE_ASSERT(
+ DecoderBuffer::kAlignmentSize >= kFFmpegInputBufferAlignmentSize &&
+ DecoderBuffer::kAlignmentSize % kFFmpegInputBufferAlignmentSize == 0,
+ decoder_buffer_alignment_size_does_not_fit_ffmpeg_requirement);
+
static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond };
base::TimeDelta ConvertFromTimeBase(const AVRational& time_base,
« no previous file with comments | « media/base/decoder_buffer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698