path = klass->make_path_from_uri (client, ctx->uri);
/* get a handle to the configuration of the media in the session */
- sessmedia = gst_rtsp_session_get_media (session, path, &matched);
+ sessmedia = gst_rtsp_session_dup_media (session, path, &matched);
if (!sessmedia)
goto not_found;
/* unmanage the media in the session, returns false if all media session
* are torn down. */
keep_session = gst_rtsp_session_release_media (session, sessmedia);
+ g_object_unref (sessmedia);
/* construct the response now */
code = GST_RTSP_STS_OK;
send_generic_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
g_free (path);
+ g_object_unref (sessmedia);
return FALSE;
}
sig_failed:
send_generic_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
}
path = klass->make_path_from_uri (client, ctx->uri);
/* get a handle to the configuration of the media in the session */
- sessmedia = gst_rtsp_session_get_media (session, path, &matched);
+ sessmedia = gst_rtsp_session_dup_media (session, path, &matched);
if (!sessmedia)
goto not_found;
/* the state is now READY */
gst_rtsp_session_media_set_rtsp_state (sessmedia, GST_RTSP_STATE_READY);
+ g_object_unref (sessmedia);
g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_PAUSE_REQUEST], 0, ctx);
GST_ERROR ("client %p: no aggregate path %s", client, path);
send_generic_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
+ g_object_unref (sessmedia);
g_free (path);
return FALSE;
}
gst_rtsp_status_as_text (sig_result));
send_generic_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
+ g_object_unref (sessmedia);
g_object_unref (media);
return FALSE;
}
send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
ctx);
gst_rtsp_media_unlock (media);
+ g_object_unref (sessmedia);
g_object_unref (media);
return FALSE;
}
GST_ERROR ("client %p: pausing not supported", client);
send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
gst_rtsp_media_unlock (media);
+ g_object_unref (sessmedia);
g_object_unref (media);
return FALSE;
}
path = klass->make_path_from_uri (client, uri);
/* get a handle to the configuration of the media in the session */
- sessmedia = gst_rtsp_session_get_media (session, path, &matched);
+ sessmedia = gst_rtsp_session_dup_media (session, path, &matched);
if (!sessmedia)
goto not_found;
gst_rtsp_session_media_set_state (sessmedia, GST_STATE_PLAYING);
gst_rtsp_session_media_set_rtsp_state (sessmedia, GST_RTSP_STATE_PLAYING);
+ g_object_unref (sessmedia);
g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_PLAY_REQUEST], 0, ctx);
GST_ERROR ("client %p: no aggregate path %s", client, path);
send_generic_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
+ g_object_unref (sessmedia);
g_free (path);
return FALSE;
}
send_generic_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
invalid_state:
ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
pipeline_error:
ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
unsuspend_failed:
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
invalid_mode:
send_generic_response (client, code, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
unsupported_mode:
send_generic_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
get_rates_error:
send_generic_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
adjust_play_response_failed:
send_generic_response (client, code, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
rtp_info_error:
send_generic_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
}
return more;
}
-/**
- * gst_rtsp_session_get_media:
- * @sess: a #GstRTSPSession
- * @path: the path for the media
- * @matched: (out): the amount of matched characters
- *
- * Get the session media for @path. @matched will contain the number of matched
- * characters of @path.
- *
- * Returns: (transfer none) (nullable): the configuration for @path in @sess.
- */
-GstRTSPSessionMedia *
-gst_rtsp_session_get_media (GstRTSPSession * sess, const gchar * path,
- gint * matched)
+static GstRTSPSessionMedia *
+_gst_rtsp_session_get_media (GstRTSPSession * sess, const gchar * path,
+ gint * matched, gboolean dup)
{
GstRTSPSessionPrivate *priv;
GstRTSPSessionMedia *result;
}
}
}
+
+ if (result && dup)
+ result = g_object_ref (result);
g_mutex_unlock (&priv->lock);
*matched = best;
}
/**
+ * gst_rtsp_session_get_media:
+ * @sess: a #GstRTSPSession
+ * @path: the path for the media
+ * @matched: (out): the amount of matched characters
+ *
+ * Gets the session media for @path. @matched will contain the number of matched
+ * characters of @path.
+ *
+ * Returns: (transfer none) (nullable): the configuration for @path in @sess.
+ */
+GstRTSPSessionMedia *
+gst_rtsp_session_get_media (GstRTSPSession * sess, const gchar * path,
+ gint * matched)
+{
+ return _gst_rtsp_session_get_media (sess, path, matched, FALSE);
+}
+
+/**
+ * gst_rtsp_session_dup_media:
+ * @sess: a #GstRTSPSession
+ * @path: the path for the media
+ * @matched: (out): the amount of matched characters
+ *
+ * Gets the session media for @path, increasing its reference count. @matched
+ * will contain the number of matched characters of @path.
+ *
+ * Returns: (transfer full) (nullable): the configuration for @path in @sess,
+ * should be unreferenced when no longer needed.
+ *
+ * Since: 1.20
+ */
+GstRTSPSessionMedia *
+gst_rtsp_session_dup_media (GstRTSPSession * sess, const gchar * path,
+ gint * matched)
+{
+ return _gst_rtsp_session_get_media (sess, path, matched, TRUE);
+}
+
+/**
* gst_rtsp_session_filter:
* @sess: a #GstRTSPSession
* @func: (scope call) (allow-none): a callback