diff options
author | wm4 <wm4@nowhere> | 2019-11-10 15:30:29 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-10 15:30:29 +0100 |
commit | 20c9538e3236779fabe21c6fbdb7e6e039bd32b1 (patch) | |
tree | bbb57c907c8f4691999f5b263bead60a234384dd /audio | |
parent | 4667b3a18263b46846ed37dabc70d27732ec6f7a (diff) | |
download | mpv-20c9538e3236779fabe21c6fbdb7e6e039bd32b1.tar.bz2 mpv-20c9538e3236779fabe21c6fbdb7e6e039bd32b1.tar.xz |
audio: more alignment nonsense
It's hard to see what FFmpeg does or what its API requires. It looks
like the alignment in our own allocation code might be slightly too
lenient, but who knows. Even if this is not needed, upping the alignment
only wastes memory and doesn't do anything bad.
(Note that the only reason why we have our own code is because FFmpeg
doesn't even provide it as API. API users are forced to recreate this,
even if they have no need for custom allocation!)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/aframe.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/audio/aframe.c b/audio/aframe.c index 118962f35b..655a4a38c3 100644 --- a/audio/aframe.c +++ b/audio/aframe.c @@ -598,7 +598,11 @@ int mp_aframe_pool_allocate(struct mp_aframe_pool *pool, struct mp_aframe *frame { int planes = mp_aframe_get_planes(frame); size_t sstride = mp_aframe_get_sstride(frame); - int plane_size = MP_ALIGN_UP(sstride * MPMAX(samples, 1), 32); + // FFmpeg hardcodes similar hidden possibly-requirements in a number of + // places: av_frame_get_buffer(), libavcodec's get_buffer(), mem.c, + // probably more. + int align_samples = MP_ALIGN_UP(MPMAX(samples, 1), 32); + int plane_size = MP_ALIGN_UP(sstride * align_samples, 64); int size = plane_size * planes; if (size <= 0 || mp_aframe_is_allocated(frame)) |