mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
libs/gst/base/gstbasesink.c: Improve position reporting while flushing and other intermediate state changes. Fixes #5...
Original commit message from CVS: * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position), (gst_base_sink_query): Improve position reporting while flushing and other intermediate state changes. Fixes #553874.
This commit is contained in:
parent
db71547857
commit
a4b27adb00
2 changed files with 19 additions and 8 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* libs/gst/base/gstbasesink.c: (gst_base_sink_get_position),
|
||||||
|
(gst_base_sink_query):
|
||||||
|
Improve position reporting while flushing and other intermediate state
|
||||||
|
changes. Fixes #553874.
|
||||||
|
|
||||||
2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
|
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
|
||||||
|
|
|
@ -3225,7 +3225,7 @@ gst_base_sink_get_position_paused (GstBaseSink * basesink, gint64 * cur)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
|
gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
|
||||||
gint64 * cur)
|
gint64 * cur, gboolean * upstream)
|
||||||
{
|
{
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
|
@ -3320,8 +3320,8 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
/* cannot answer other than TIME, we return FALSE, which will
|
/* cannot answer other than TIME, ask to send the query upstream. */
|
||||||
* send the query upstream. */
|
*upstream = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3347,7 +3347,7 @@ in_pause:
|
||||||
}
|
}
|
||||||
wrong_state:
|
wrong_state:
|
||||||
{
|
{
|
||||||
/* in NULL or READY we always return 0 */
|
/* in NULL or READY we always return FALSE and -1 */
|
||||||
GST_DEBUG_OBJECT (basesink, "position in wrong state, return -1");
|
GST_DEBUG_OBJECT (basesink, "position in wrong state, return -1");
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
*cur = -1;
|
*cur = -1;
|
||||||
|
@ -3356,10 +3356,12 @@ wrong_state:
|
||||||
}
|
}
|
||||||
no_sync:
|
no_sync:
|
||||||
{
|
{
|
||||||
/* report last seen timestamp if any, else return FALSE so
|
/* report last seen timestamp if any, else ask upstream to answer */
|
||||||
* that upstream can answer */
|
|
||||||
if ((*cur = basesink->priv->current_sstart) != -1)
|
if ((*cur = basesink->priv->current_sstart) != -1)
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
else
|
||||||
|
*upstream = TRUE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "no sync, res %d, POSITION %" GST_TIME_FORMAT,
|
GST_DEBUG_OBJECT (basesink, "no sync, res %d, POSITION %" GST_TIME_FORMAT,
|
||||||
res, GST_TIME_ARGS (*cur));
|
res, GST_TIME_ARGS (*cur));
|
||||||
GST_OBJECT_UNLOCK (basesink);
|
GST_OBJECT_UNLOCK (basesink);
|
||||||
|
@ -3379,15 +3381,17 @@ gst_base_sink_query (GstElement * element, GstQuery * query)
|
||||||
{
|
{
|
||||||
gint64 cur = 0;
|
gint64 cur = 0;
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
gboolean upstream = FALSE;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, NULL);
|
gst_query_parse_position (query, &format, NULL);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesink, "position format %d", format);
|
GST_DEBUG_OBJECT (basesink, "position format %d", format);
|
||||||
|
|
||||||
/* first try to get the position based on the clock */
|
/* first try to get the position based on the clock */
|
||||||
if ((res = gst_base_sink_get_position (basesink, format, &cur))) {
|
if ((res =
|
||||||
|
gst_base_sink_get_position (basesink, format, &cur, &upstream))) {
|
||||||
gst_query_set_position (query, format, cur);
|
gst_query_set_position (query, format, cur);
|
||||||
} else {
|
} else if (upstream) {
|
||||||
/* fallback to peer query */
|
/* fallback to peer query */
|
||||||
res = gst_base_sink_peer_query (basesink, query);
|
res = gst_base_sink_peer_query (basesink, query);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue