[Spice-devel] [PATCH spice-gtk 1/3] channel-display-gst: Protect timer_id with queue_mutex

Snir Sheriber ssheribe at redhat.com
Mon Apr 16 12:27:21 UTC 2018


Hi


On 04/16/2018 01:43 PM, Frediano Ziglio wrote:
> timer_id is supposed to be protected by this mutex, make sure this
> is true in spice_gst_decoder_reschedule.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>   src/channel-display-gst.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> index 8b23036..201842e 100644
> --- a/src/channel-display-gst.c
> +++ b/src/channel-display-gst.c
> @@ -438,9 +438,14 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
>   static void spice_gst_decoder_reschedule(VideoDecoder *video_decoder)
>   {
>       SpiceGstDecoder *decoder = (SpiceGstDecoder*)video_decoder;
> -    if (decoder->timer_id != 0) {
> -        g_source_remove(decoder->timer_id);
> -        decoder->timer_id = 0;
> +
> +    g_mutex_lock(&decoder->queues_mutex);
> +    guint timer_id = decoder->timer_id;

I wonder if it shouldn't be declared at the beginning (style wise)?
Anyhow
Acked-by: Snir Sheriber <ssheribe at redhat.com>

> +    decoder->timer_id = 0;
> +    g_mutex_unlock(&decoder->queues_mutex);
> +
> +    if (timer_id != 0) {
> +        g_source_remove(timer_id);
>       }
>       schedule_frame(decoder);
>   }



More information about the Spice-devel mailing list