media: Check dynamically if the pipeline supports seeking

We should not depend on whether or not the pipeline state change
returned NO_PREROLL or not. A media could dynamically change its
element and switch from seekable to non seekable so it's best to test
the seekable nature of the pipeline dynamically when we try to do a seek.
This commit is contained in:
Youness Alaoui 2013-09-09 21:51:44 -04:00 committed by Wim Taymans
parent 33dc78209c
commit 917bbfcc20

View file

@ -1251,6 +1251,7 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
gboolean res;
GstClockTime start, stop;
GstSeekType start_type, stop_type;
GstQuery *query;
klass = GST_RTSP_MEDIA_GET_CLASS (media);
@ -1264,6 +1265,18 @@ gst_rtsp_media_seek (GstRTSPMedia * media, GstRTSPTimeRange * range)
if (priv->status != GST_RTSP_MEDIA_STATUS_PREPARED)
goto not_prepared;
/* Update the seekable state of the pipeline in case it changed */
query = gst_query_new_seeking (GST_FORMAT_TIME);
if (gst_element_query (priv->pipeline, query)) {
GstFormat format;
gboolean seekable;
gint64 start, end;
gst_query_parse_seeking (query, &format, &seekable, &start, &end);
priv->seekable = seekable;
}
gst_query_unref (query);
if (!priv->seekable)
goto not_seekable;