Re: [PATCH] streaming: Tweak the GStreamer decoder to avoid a compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-05-30 at 21:37 +0200, Francois Gouget wrote:
> We check that there is a matching frame in the queue before popping the
> old ones. So we know the inner loop will find a match and thus that
> frame will not be NULL. But figuring that out is too hard for the
> compiler.
> 
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
> ---
> 
> Adding an if (frame) check suggests that frame can indeed be NULL which 
> is not the case (verifying that we will find a match is the point of the 
> outer loop). So if this patch gets the compiler off our back it may be a 
> better solution.
> 
>  src/channel-display-gst.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> index 46a85ea..87741d9 100644
> --- a/src/channel-display-gst.c
> +++ b/src/channel-display-gst.c
> @@ -174,7 +174,11 @@ static GstFlowReturn new_sample(GstAppSink *gstappsink,
> gpointer video_decoder)
>          while (l) {
>              frame = l->data;
>              if (frame->timestamp == GST_BUFFER_PTS(buffer)) {
> -                /* Now that we know there is a match, remove the older
> +                /* The frame is now ready for display */
> +                frame->sample = sample;
> +                g_queue_push_tail(decoder->display_queue, frame);
> +
> +                /* Now that we know there is a match, remove it and the older
>                   * frames from the decoding queue.
>                   */
>                  while ((frame = g_queue_pop_head(decoder->decoding_queue))) {
> @@ -187,10 +191,6 @@ static GstFlowReturn new_sample(GstAppSink *gstappsink,
> gpointer video_decoder)
>                      SPICE_DEBUG("the GStreamer pipeline dropped a frame");
>                      free_frame(frame);
>                  }
> -
> -                /* The frame is now ready for display */
> -                frame->sample = sample;
> -                g_queue_push_tail(decoder->display_queue, frame);
>                  break;
>              }
>              l = l->next;
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]