From cc5083cfe00e6872d0b52b6be917b80582c64e52 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 12 Nov 2013 22:26:59 +0100 Subject: mp_audio: use av_malloc (cargo cult for libav*) libav* is generally freaking horrible, and might do bad things if the data pointer passed to it are not aligned. One way to be sure that the alignment is correct is allocating all pointers using av_malloc(). It's possible that this is not needed at all, though. For now it might be better to keep this, since the mp_audio code is intended to replace another buffer in dec_audio.c, which is currently av_malloc() allocated. The original reason why this uses av_malloc() is apparently because libavcodec used to directly encode into mplayer buffers, which is not the case anymore, and thus (probably) doesn't make sense anymore. (The commit subject uses the word "cargo cult", after all.) --- audio/audio.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'audio/audio.h') diff --git a/audio/audio.h b/audio/audio.h index b5cae0c83c..54ac2d5aac 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -36,6 +36,9 @@ struct mp_audio { int spf; // sub-samples per sample on each plane int num_planes; // number of planes int bps; // size of sub-samples (af_fmt2bits(format) / 8) + + // private + int allocated[MP_NUM_CHANNELS]; // use mp_audio_get_allocated_size() }; void mp_audio_set_format(struct mp_audio *mpa, int format); -- cgit v1.2.3