[Spice-devel] [spice-gtk PATCH 2/2] gst_decoder_queue_frame: free frame when returning false

Frediano Ziglio fziglio at redhat.com
Tue Apr 17 12:13:21 UTC 2018


> 
> The decoder_queue_frame now owns frame.
> 

The queue is named decoding_queue and actually the reason you have to free frame
is that is not owned by decoding_queue in this path of code.

Note that the same issue happens some lines below in the

#if GST_CHECK_VERSION(1,9,0)
    if (decoder->appsrc == NULL) {
        spice_warning("Error: Playbin has not yet initialized the Appsrc element");
        stream_dropped_frame_on_playback(decoder->base.stream);
        return TRUE;
    }
#endif

does not matter if the function returns TRUE or FALSE, the caller never free frame
so either we free or we retain it.

> Signed-off-by: Uri Lublin <uril at redhat.com>
> ---
>  src/channel-display-gst.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> index 0d7aabb..ae59292 100644
> --- a/src/channel-display-gst.c
> +++ b/src/channel-display-gst.c
> @@ -544,6 +544,7 @@ static gboolean
> spice_gst_decoder_queue_frame(VideoDecoder *video_decoder,
>      if (decoder->pipeline == NULL) {
>          /* An error occurred, causing the GStreamer pipeline to be freed */
>          spice_warning("An error occurred, stopping the video stream");
> +        frame->free(frame);
>          return FALSE;
>      }
>  

Frediano


More information about the Spice-devel mailing list