mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
cogl-gst: emit ready signal on sink only after the first frame is uploaded
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. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 53882aa0728c5540d8452045006a763e29d4306d)
This commit is contained in:
parent
71f6023e8a
commit
69247c10f3
@ -1027,6 +1027,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);
|
||||
|
||||
@ -1048,9 +1049,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;
|
||||
@ -1063,14 +1062,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;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user