mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
media: check state
Make sure we are in the right state when collecting the position and duration. Only make ourselves PREPARED when we were previously PREPARING.
This commit is contained in:
parent
edf2ef4f0b
commit
241baba20a
1 changed files with 7 additions and 4 deletions
|
@ -309,6 +309,10 @@ collect_media_stats (GstRTSPMedia * media)
|
||||||
GstRTSPMediaPrivate *priv = media->priv;
|
GstRTSPMediaPrivate *priv = media->priv;
|
||||||
gint64 position, duration;
|
gint64 position, duration;
|
||||||
|
|
||||||
|
if (priv->status != GST_RTSP_MEDIA_STATUS_PREPARED &&
|
||||||
|
priv->status != GST_RTSP_MEDIA_STATUS_PREPARING)
|
||||||
|
return;
|
||||||
|
|
||||||
priv->range.unit = GST_RTSP_RANGE_NPT;
|
priv->range.unit = GST_RTSP_RANGE_NPT;
|
||||||
|
|
||||||
GST_INFO ("collect media stats");
|
GST_INFO ("collect media stats");
|
||||||
|
@ -1092,8 +1096,6 @@ gst_rtsp_media_set_status (GstRTSPMedia * media, GstRTSPMediaStatus status)
|
||||||
GstRTSPMediaPrivate *priv = media->priv;
|
GstRTSPMediaPrivate *priv = media->priv;
|
||||||
|
|
||||||
g_mutex_lock (&priv->lock);
|
g_mutex_lock (&priv->lock);
|
||||||
/* never overwrite the error status */
|
|
||||||
if (priv->status != GST_RTSP_MEDIA_STATUS_ERROR)
|
|
||||||
priv->status = status;
|
priv->status = status;
|
||||||
GST_DEBUG ("setting new status to %d", status);
|
GST_DEBUG ("setting new status to %d", status);
|
||||||
g_cond_broadcast (&priv->cond);
|
g_cond_broadcast (&priv->cond);
|
||||||
|
@ -1222,6 +1224,7 @@ default_handle_message (GstRTSPMedia * media, GstMessage * message)
|
||||||
GST_INFO ("%p: got ASYNC_DONE", media);
|
GST_INFO ("%p: got ASYNC_DONE", media);
|
||||||
collect_media_stats (media);
|
collect_media_stats (media);
|
||||||
|
|
||||||
|
if (priv->status == GST_RTSP_MEDIA_STATUS_PREPARING)
|
||||||
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
|
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
|
||||||
} else {
|
} else {
|
||||||
GST_INFO ("%p: ignoring ASYNC_DONE", media);
|
GST_INFO ("%p: ignoring ASYNC_DONE", media);
|
||||||
|
|
Loading…
Reference in a new issue