[FFmpeg-devel] [PATCH] lavfi/audio: fix size of copied samples.

Stefano Sabatini stefasab at gmail.com
Sat Jun 9 13:01:07 CEST 2012


On date Thursday 2012-06-07 17:20:21 +0200, Nicolas George encoded:
> Le nonidi 19 prairial, an CCXX, Michael Niedermayer a écrit :
> > LGTM
> 
> Thanks, pushed.
> 
> By the way, Stefano, I would appreciate if you could explain me is someone
> is doing something wrong here:
> 
> aresample requests a buffer with permission AV_PERM_WRITE.
> 

> amerge does not implement get_audio_buffer, so the buffer is mallocated.
> 
> aresamples fills the buffer and then gives it, the only reference, to
> amerge.
> 
> amerge asks for AV_PERM_READ | AV_PERM_PRESERVE on its inputs.
> 
> Since the buffer does not have AV_PERM_PRESERVE, ff_filter_samples decides
> to make a copy (thus triggering the bug this commit fixes).
> 
> As far as I can see, there is no need to make a copy, so something must be
> wrong somewhere.

The question is, why AV_PERM_PRESERVE is needed on the amerge input
min_perms? Note that I don't know (I asked when the patch was reviewed
IIRC but can't remember any reply), but looks just wrong to me.

I believe AV_PERM_PRESERVE should stay in rej_perms, meaning that it
won't accept a buffer which must be preserved, while the filter will
write over it, asking for a buffer *which can't be modified* doesn't
make much sense to me.
-- 
FFmpeg = Fundamental Foolish Magnificient Pure EniGma


More information about the ffmpeg-devel mailing list