[Spice-devel] [PATCH] streaming: Tweak the GStreamer decoder to avoid a compiler warning
Marc-André Lureau
marcandre.lureau at gmail.com
Wed Jun 1 11:34:56 UTC 2016
hi
On Mon, May 30, 2016 at 9:37 PM, Francois Gouget
<fgouget at codeweavers.com> 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.
>
oh ok..
(btw, that's a weird code block, I don't really get why it's necessary)
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
>
> 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;
> --
> 2.8.1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
--
Marc-André Lureau
More information about the Spice-devel
mailing list