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

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 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.h ('k') | media/base/decoder_buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/decoder_buffer.cc
diff --git a/media/base/decoder_buffer.cc b/media/base/decoder_buffer.cc
index 527fb65ec945c550fc673aca5501aed16ec79fe3..3c298a4ff062809a5af26b5ffd8ba27bf9c03208 100644
--- a/media/base/decoder_buffer.cc
+++ b/media/base/decoder_buffer.cc
@@ -6,8 +6,9 @@
#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
namespace media {
@@ -34,7 +35,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 +44,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
« no previous file with comments | « media/base/decoder_buffer.h ('k') | media/base/decoder_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698