player: Set default position and duration value to GST_CLOCK_TIME_NONE

When the position query fails the returned value shall remain -1 instead of 0 to
avoid confusion on application side between error and beginning of media.

https://bugzilla.gnome.org/show_bug.cgi?id=797066
This commit is contained in:
Philippe Normand 2018-09-01 11:23:33 +01:00
parent 0146ad219e
commit d1ed94491e

View file

@ -760,7 +760,7 @@ gst_player_get_property (GObject * object, guint prop_id,
g_value_get_string (value));
break;
case PROP_POSITION:{
gint64 position = 0;
gint64 position = GST_CLOCK_TIME_NONE;
gst_element_query_position (self->playbin, GST_FORMAT_TIME, &position);
g_value_set_uint64 (value, position);
@ -1699,7 +1699,7 @@ duration_changed_cb (G_GNUC_UNUSED GstBus * bus, G_GNUC_UNUSED GstMessage * msg,
gpointer user_data)
{
GstPlayer *self = GST_PLAYER (user_data);
gint64 duration;
gint64 duration = GST_CLOCK_TIME_NONE;
if (gst_element_query_duration (self->playbin, GST_FORMAT_TIME, &duration)) {
emit_duration_changed (self, duration);