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

Unified Diff: media/base/video_frame.cc

Issue 11308310: Replace av_malloc with AlignedAlloc for memory allocation in VideoFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/video_frame.h ('K') | « media/base/video_frame.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 28b4f9efe02d102812229d36345c024562d2731a..409eeed079f764de6cf8a371a406290672565d07 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -12,8 +12,9 @@
#include "base/string_piece.h"
#include "media/base/limits.h"
#include "media/base/video_util.h"
+
#if !defined(OS_ANDROID)
-#include "media/ffmpeg/ffmpeg_common.h"
+#include "base/memory/aligned_memory.h"
#endif
namespace media {
@@ -153,7 +154,7 @@ static void ReleaseData(uint8* data) {
DCHECK(data);
if (data) {
#if !defined(OS_ANDROID)
- av_free(data);
+ base::AlignedFree(data);
#else
delete[] data;
#endif
@@ -171,7 +172,8 @@ void VideoFrame::AllocateRGB(size_t bytes_per_pixel) {
// TODO(dalecurtis): use DataAligned or so, so this #ifdef hackery
// doesn't need to be repeated in every single user of aligned data.
data_[VideoFrame::kRGBPlane] = reinterpret_cast<uint8*>(
- av_malloc(bytes_per_row * aligned_height + kFramePadBytes));
+ base::AlignedAlloc(bytes_per_row * aligned_height + kFramePadBytes,
+ kAlignmentSize));
#else
data_[VideoFrame::kRGBPlane] = new uint8_t[bytes_per_row * aligned_height];
#endif
@@ -211,7 +213,8 @@ void VideoFrame::AllocateYUV() {
// avcodec_align_dimensions2() and libavcodec/x86/h264_chromamc.asm:
// put_h264_chroma_mc4_ssse3().
uint8* data = reinterpret_cast<uint8*>(
- av_malloc(y_bytes + (uv_bytes * 2 + uv_stride) + kFramePadBytes));
+ base::AlignedAlloc(y_bytes + (uv_bytes * 2 + uv_stride) + kFramePadBytes,
+ kAlignmentSize));
#else
uint8* data = new uint8_t[y_bytes + (uv_bytes * 2)];
#endif
« media/base/video_frame.h ('K') | « media/base/video_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698