if (priv->status == GST_RTSP_MEDIA_STATUS_UNPREPARING) {
GST_DEBUG ("shutting down after EOS");
finish_unprepare (media);
- g_object_unref (media);
}
break;
default:
priv->reused = TRUE;
priv->status = GST_RTSP_MEDIA_STATUS_UNPREPARED;
+ /* when the media is not reusable, this will effectively unref the media and
+ * recreate it */
+ g_signal_emit (media, gst_rtsp_media_signals[SIGNAL_UNPREPARED], 0, NULL);
+
+ /* the source has the last ref to the media */
if (priv->source) {
+ GST_DEBUG ("destroy source");
g_source_destroy (priv->source);
g_source_unref (priv->source);
- priv->source = NULL;
}
-
- /* when the media is not reusable, this will effectively unref the media and
- * recreate it */
- g_signal_emit (media, gst_rtsp_media_signals[SIGNAL_UNPREPARED], 0, NULL);
}
/* called with state-lock */
if (priv->eos_shutdown) {
GST_DEBUG ("sending EOS for shutdown");
/* ref so that we don't disappear */
- g_object_ref (media);
gst_element_send_event (priv->pipeline, gst_event_new_eos ());
/* we need to go to playing again for the EOS to propagate, normally in this
* state, nothing is receiving data from us anymore so this is ok. */