waylandsink: Use a boolean in combination with render_cond to comply with GCond's usage documentation

This commit is contained in:
George Kiagiadakis 2014-03-11 17:48:46 +02:00
parent 66f8c1389b
commit 5bb889a3df
2 changed files with 9 additions and 4 deletions

View file

@ -585,6 +585,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
render_last_buffer (sink); render_last_buffer (sink);
/* notify _resume_rendering() in case it's waiting */ /* notify _resume_rendering() in case it's waiting */
sink->rendered = TRUE;
g_cond_broadcast (&sink->render_cond); g_cond_broadcast (&sink->render_cond);
if (buffer != to_render) if (buffer != to_render)
@ -736,11 +737,14 @@ gst_wayland_sink_resume_rendering (GstWaylandVideo * video)
GST_OBJECT_LOCK (sink); GST_OBJECT_LOCK (sink);
sink->drawing_frozen = FALSE; sink->drawing_frozen = FALSE;
if (GST_STATE (sink) == GST_STATE_PLAYING) if (GST_STATE (sink) == GST_STATE_PLAYING) {
g_cond_wait (&sink->render_cond, GST_OBJECT_GET_LOCK (sink)); sink->rendered = FALSE;
else if (sink->window && sink->last_buffer && while (sink->rendered == FALSE)
g_atomic_int_get (&sink->redraw_pending) == FALSE) g_cond_wait (&sink->render_cond, GST_OBJECT_GET_LOCK (sink));
} else if (sink->window && sink->last_buffer &&
g_atomic_int_get (&sink->redraw_pending) == FALSE) {
render_last_buffer (sink); render_last_buffer (sink);
}
GST_OBJECT_UNLOCK (sink); GST_OBJECT_UNLOCK (sink);
} }

View file

@ -63,6 +63,7 @@ struct _GstWaylandSink
gboolean redraw_pending; gboolean redraw_pending;
gboolean drawing_frozen; gboolean drawing_frozen;
gboolean rendered;
GCond render_cond; GCond render_cond;
GstBuffer *last_buffer; GstBuffer *last_buffer;
}; };