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

Unified Diff: media/base/decoder_buffer.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 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
Index: media/base/decoder_buffer.cc
diff --git a/media/base/decoder_buffer.cc b/media/base/decoder_buffer.cc
index 527fb65ec945c550fc673aca5501aed16ec79fe3..9e9cf04ba4fff467f20e4220bac9102dcacd5296 100644
--- a/media/base/decoder_buffer.cc
+++ b/media/base/decoder_buffer.cc
@@ -5,10 +5,10 @@
#include "media/base/decoder_buffer.h"
#include "base/logging.h"
-#include "media/base/decrypt_config.h"
#if !defined(OS_ANDROID)
-#include "media/ffmpeg/ffmpeg_common.h"
+#include "base/memory/aligned_memory.h"
#endif
+#include "media/base/decrypt_config.h"
namespace media {
@@ -34,7 +34,7 @@ DecoderBuffer::DecoderBuffer(const uint8* data, int buffer_size)
DecoderBuffer::~DecoderBuffer() {
#if !defined(OS_ANDROID)
- av_free(data_);
+ base::AlignedFree(data_);
#else
delete[] data_;
#endif
@@ -43,12 +43,9 @@ DecoderBuffer::~DecoderBuffer() {
void DecoderBuffer::Initialize() {
DCHECK_GE(buffer_size_, 0);
#if !defined(OS_ANDROID)
- // Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
- // padded. Using av_malloc with padding ensures FFmpeg only recieves data
- // padded and aligned to its specifications.
data_ = reinterpret_cast<uint8*>(
- av_malloc(buffer_size_ + FF_INPUT_BUFFER_PADDING_SIZE));
- memset(data_ + buffer_size_, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ base::AlignedAlloc(buffer_size_ + kPaddingSize, kAlignmentSize));
+ memset(data_ + buffer_size_, 0, kPaddingSize);
#else
data_ = new uint8[buffer_size_];
#endif

Powered by Google App Engine
This is Rietveld 408576698