[Spice-devel] [spice v10 10/27] server: Make the RedDrawable refcount thread-safe

Christophe Fergeau cfergeau at redhat.com
Wed Mar 23 11:20:20 UTC 2016


On Mon, Mar 21, 2016 at 07:43:20PM +0100, Francois Gouget wrote:
> A completely different approach to solving this would be to handle it 
> all in the GStreamer encoder code:
>  - Only ref the RedDrawable once but wrap it in a struct with its own 
>    refcount. It's that struct which will track the actual refcounting by 
>    the GstMemory objects.
>  - When that struct's refcount drops to zero, put the RedDrawable into a 
>    GAsyncQueue.
>  - encode_frame() is always called from a safe thread, so unref all the 
>    RedDrawables in the async queue whenever we enter / leave 
>    encode_frame() or destroy the GStreamer encoder.
> 
> The drawback is that we could get up to a 1 frame delay before a 
> RedDrawable is freed.

I forgot to mention that this approach is fine for me if fighting with
glib mainloop stuff is not going well.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160323/bc7b2627/attachment.sig>


More information about the Spice-devel mailing list