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

Nicolas George nicolas.george at normalesup.org
Fri Jun 15 16:18:39 CEST 2012

Le duodi 22 prairial, an CCXX, Stefano Sabatini a écrit :
> 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.

My reasoning for that is this: amerge keeps the reference for later, but has
already examined part of it, it would be catastrophic if someone else were
to alter it in the meantime.

In this particular case, the part that was already examined is the
audio->nb_samples field (the total number of samples in queue is kept for
each input), so I realize it probably can not be changed at all.

> 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.

There are several things that are a bit unclear to me about permissions:

- Does the permission apply to the buffer or to the reference?

- When calling avfilter_ref_buffer(), what does the pmask argument mean? My
  guess: the permissions we want to have on the resulting buffer/reference.

- Why are there a lot of filters finishing their work with:
  ff_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0));
  ? Can they not just give the reference to the next filter?

Ideally, the answers to these questions should go in doc/filter_design.txt,
along with a few word about the src_buf, cur_buf, out_buf fields of
AVFilterLink: who is responsible to set them, to clear them, who owns the
reference, who is allowed to access them.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120615/fd22bc64/attachment.asc>

More information about the ffmpeg-devel mailing list