[Cogl] [PATCH] cogl-gst: emit ready signal on sink only after the first frame is uploaded
Robert Bragg
robert at sixbynine.org
Mon Aug 19 10:15:20 PDT 2013
Cool, I've pushed this to master as 53882aa0 and will also cherry pick
it to cogl-1.16.
thanks,
Robert
On Fri, Aug 9, 2013 at 10:44 PM, Lionel Landwerlin
<llandwerlin at gmail.com> wrote:
> Developers listening to the 'ready' signal on CoglGstVideoSink might
> call process the current frame once the signal is triggered. We need
> to ensure the first frame has been uploaded before letting people know
> that the sink is ready.
> ---
> cogl-gst/cogl-gst-video-sink.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
> index 6fd69f8..8bc5f78 100644
> --- a/cogl-gst/cogl-gst-video-sink.c
> +++ b/cogl-gst/cogl-gst-video-sink.c
> @@ -965,6 +965,7 @@ cogl_gst_source_dispatch (GSource *source,
> CoglGstSource *gst_source= (CoglGstSource*) source;
> CoglGstVideoSinkPrivate *priv = gst_source->sink->priv;
> GstBuffer *buffer;
> + gboolean pipeline_ready = FALSE;
>
> g_mutex_lock (&gst_source->buffer_lock);
>
> @@ -986,9 +987,7 @@ cogl_gst_source_dispatch (GSource *source,
> * the application requests it so we can emit the signal.
> * However we'll actually generate the pipeline lazily only if
> * the application actually asks for it. */
> - g_signal_emit (gst_source->sink,
> - video_sink_signals[PIPELINE_READY_SIGNAL],
> - 0 /* detail */);
> + pipeline_ready = TRUE;
> }
>
> buffer = gst_source->buffer;
> @@ -1001,14 +1000,19 @@ cogl_gst_source_dispatch (GSource *source,
> if (!priv->renderer->upload (gst_source->sink, buffer))
> goto fail_upload;
>
> - g_signal_emit (gst_source->sink,
> - video_sink_signals[NEW_FRAME_SIGNAL], 0,
> - NULL);
> gst_buffer_unref (buffer);
> }
> else
> GST_WARNING_OBJECT (gst_source->sink, "No buffers available for display");
>
> + if (G_UNLIKELY (pipeline_ready))
> + g_signal_emit (gst_source->sink,
> + video_sink_signals[PIPELINE_READY_SIGNAL],
> + 0 /* detail */);
> + g_signal_emit (gst_source->sink,
> + video_sink_signals[NEW_FRAME_SIGNAL], 0,
> + NULL);
> +
> return TRUE;
>
>
> --
> 1.8.4.rc1
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list