[FFmpeg-devel] Understanding lavfi's permissions system (was: lavfi/audio: fix size of copied samples.)

Nicolas George nicolas.george at normalesup.org
Sat Jul 28 23:09:56 CEST 2012


(I am snipping a lot to try to recenter on what I think is the core of the
problem.)

Le decadi 10 thermidor, an CCXX, Michael Niedermayer a écrit :
> You seem to assume that split has the right to pass a 2
> read+write+preserve refs pointing to the same buffer to the 2 outputs
> thats not allowed, it would be a direct violation of the definition
> of the permissions, namely that Preserve on A implicates no other
> reference with write permission exists.

Forget about preserve: if split has READ+WRITE and give them to both
drawtext and X, then drawtext and X will write in the same buffer, which is
wrong. Even if X is read-only, if drawtext acts first, X will read the
modified buffer, which is wrong too.

split solves it by removing WRITE, and I think this is more or less the only
sane solution.

The point I am at now is: I do not see any situation where PRESERVE would
serve and removing WRITE would not be enough.

> I have just realized this is not completely correct.
> Consider a buffer that has a reference count of 1 (and "we" are the
> owner of that 1 reference) in that case we can get all permissions
> back that the underlaying storage space allows

You are totally right (and I thought of it too some time ago, before that
discussion, and I forgot about it). But I believe it is best to see that as
optimizing the copy and not as raising the permissions. It's exactly the
same thing, but stated that way it is not an exception to the rules.

Regards,

-- 
  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/20120728/dd523cb5/attachment.asc>


More information about the ffmpeg-devel mailing list