The point is it can be re-used by renderer if you put it here. So you end up hitting the fence, vdpau start decode, then gui re-uses the buffer anyway with corrupt data.

So you need a separate mechanism to notify decoder that gui is done with the buffer. Look at DXVA it uses a refcounter on the buffer for this.