GstRTSPContext * ctx);
static gboolean pre_signal_accumulator (GSignalInvocationHint * ihint,
GValue * return_accu, const GValue * handler_return, gpointer data);
-gboolean gst_rtsp_media_has_completed_sender (GstRTSPMedia * media);
G_DEFINE_TYPE_WITH_PRIVATE (GstRTSPClient, gst_rtsp_client, G_TYPE_OBJECT);
}
static void
+send_generic_error_response (GstRTSPClient * client, GstRTSPStatusCode code,
+ GstRTSPContext * ctx)
+{
+ GstRTSPClientClass *klass = GST_RTSP_CLIENT_GET_CLASS (client);
+ GstRTSPStatusCode adjusted_code = code;
+
+ if (klass->adjust_error_code != NULL) {
+ adjusted_code = klass->adjust_error_code (client, ctx, code);
+ if (adjusted_code != code) {
+ GST_DEBUG ("adjusted response error code from %d to %d", code,
+ adjusted_code);
+ }
+ }
+ send_generic_response (client, adjusted_code, ctx);
+}
+
+static void
send_option_not_supported_response (GstRTSPClient * client,
GstRTSPContext * ctx, const gchar * unsupported_options)
{
GstRTSPClientPrivate *priv = client->priv;
GstRTSPMediaFactory *factory;
GstRTSPMedia *media;
+ GstRTSPUrl *url;
gint path_len;
/* find the longest matching factory for the uri first */
else
path_len = strlen (path);
+ url = gst_rtsp_url_copy (ctx->uri);
+ /* normalize rtsp://<IP>:<PORT> to rtsp://<IP>:<PORT>/ */
+ if (url->abspath[0] == 0) {
+ g_free (url->abspath);
+ url->abspath = g_strdup ("/");
+ }
+
if (!paths_are_equal (priv->path, path, path_len)) {
/* remove any previously cached values before we try to construct a new
* media for uri */
clean_cached_media (client, TRUE);
/* prepare the media and add it to the pipeline */
- if (!(media = gst_rtsp_media_factory_construct (factory, ctx->uri)))
+ if (!(media = gst_rtsp_media_factory_construct (factory, url)))
goto no_media;
ctx->media = media;
GST_INFO ("reusing cached media %p for path %s", media, priv->path);
}
+ gst_rtsp_url_free (url);
g_object_unref (factory);
ctx->factory = NULL;
no_factory:
{
GST_ERROR ("client %p: no factory for path %s", client, path);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return NULL;
}
no_factory_access:
no_media:
{
GST_ERROR ("client %p: can't create media", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ gst_rtsp_url_free (url);
g_object_unref (factory);
ctx->factory = NULL;
return NULL;
no_thread:
{
GST_ERROR ("client %p: can't create thread", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ gst_rtsp_url_free (url);
g_object_unref (media);
ctx->media = NULL;
g_object_unref (factory);
no_prepare:
{
GST_ERROR ("client %p: can't prepare media", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ gst_rtsp_url_free (url);
g_object_unref (media);
ctx->media = NULL;
g_object_unref (factory);
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;
no_session:
{
GST_ERROR ("client %p: no session", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
return FALSE;
}
no_uri:
{
GST_ERROR ("client %p: no uri supplied", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
not_found:
{
GST_ERROR ("client %p: no media for uri", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
g_free (path);
return FALSE;
}
no_aggregate:
{
GST_ERROR ("client %p: no aggregate path %s", client, path);
- send_generic_response (client,
+ send_generic_error_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
g_free (path);
+ g_object_unref (sessmedia);
return FALSE;
}
sig_failed:
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
return FALSE;
}
bad_request:
{
GST_ERROR ("client %p: bad request", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
return FALSE;
}
bad_request:
{
GST_ERROR ("client %p: bad request", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
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);
no_session:
{
GST_ERROR ("client %p: no session", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
return FALSE;
}
no_uri:
{
GST_ERROR ("client %p: no uri supplied", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
not_found:
{
GST_ERROR ("client %p: no media for uri", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
g_free (path);
return FALSE;
}
no_aggregate:
{
GST_ERROR ("client %p: no aggregate path %s", client, path);
- send_generic_response (client,
+ send_generic_error_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
+ g_object_unref (sessmedia);
g_free (path);
return FALSE;
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
+ g_object_unref (sessmedia);
g_object_unref (media);
return FALSE;
}
invalid_state:
{
GST_ERROR ("client %p: not PLAYING or RECORDING", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- ctx);
+ send_generic_error_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;
}
not_supported:
{
GST_ERROR ("client %p: pausing not supported", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_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;
/* the scale and speed headers must always be added if they were present in
* the request. however, even if they were not, we still add them if
* applied_rate or rate deviate from the "normal", i.e. 1.0 */
+#ifdef TIZEN_PROFILE_TV
+ /* Temporal workaround fix for TV */
+ rate = applied_rate = 1.0;
+#else
if (!gst_rtsp_media_get_rates (media, &rate, &applied_rate))
goto get_rates_error;
g_assert (rate != 0 && applied_rate != 0);
-
+#endif
if (scale_present || applied_rate != 1.0)
gst_rtsp_message_take_header (ctx->response, GST_RTSP_HDR_SCALE,
g_strdup_printf ("%1.3f", applied_rate));
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);
no_session:
{
GST_ERROR ("client %p: no session", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
return FALSE;
}
no_uri:
{
GST_ERROR ("client %p: no uri supplied", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
not_found:
{
GST_ERROR ("client %p: media not found", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return FALSE;
}
no_aggregate:
{
GST_ERROR ("client %p: no aggregate path %s", client, path);
- send_generic_response (client,
+ send_generic_error_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
+ g_object_unref (sessmedia);
g_free (path);
return FALSE;
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
invalid_state:
{
GST_ERROR ("client %p: not PLAYING or READY", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- ctx);
+ send_generic_error_response (client,
+ GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
pipeline_error:
{
GST_ERROR ("client %p: failed to configure the pipeline", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- ctx);
+ send_generic_error_response (client,
+ GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
unsuspend_failed:
{
GST_ERROR ("client %p: unsuspend failed", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_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:
{
GST_ERROR ("client %p: seek failed", client);
- send_generic_response (client, code, ctx);
+ send_generic_error_response (client, code, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
unsupported_mode:
{
GST_ERROR ("client %p: media does not support PLAY", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
+ send_generic_error_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:
{
GST_ERROR ("client %p: failed obtaining rate and applied_rate", client);
- send_generic_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR, ctx);
+ send_generic_error_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:
{
GST_ERROR ("client %p: failed to adjust play response", client);
- send_generic_response (client, code, ctx);
+ send_generic_error_response (client, code, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
rtp_info_error:
{
GST_ERROR ("client %p: failed to add RTP-Info", client);
- send_generic_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_INTERNAL_SERVER_ERROR,
+ ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
+ g_object_unref (sessmedia);
return FALSE;
}
}
parse_failed:
{
GST_ERROR_OBJECT (client, "failed to parse blocksize");
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
}
no_uri:
{
GST_ERROR ("client %p: no uri", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
no_transport:
{
GST_ERROR ("client %p: no transport", client);
- send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT,
+ ctx);
goto cleanup_path;
}
no_pool:
{
GST_ERROR ("client %p: no session pool configured", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
goto cleanup_path;
}
media_not_found_no_reply:
media_not_found:
{
GST_ERROR ("client %p: media '%s' not found", client, path);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
goto cleanup_session;
}
control_not_found:
{
GST_ERROR ("client %p: no control in path '%s'", client, path);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
goto cleanup_session;
{
GST_ERROR ("client %p: stream '%s' not found", client,
GST_STR_NULL (control));
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
goto cleanup_session;
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
goto cleanup_path;
service_unavailable:
{
GST_ERROR ("client %p: can't create session", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
gst_rtsp_media_unlock (media);
g_object_unref (media);
goto cleanup_session;
sessmedia_unavailable:
{
GST_ERROR ("client %p: can't create session media", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
goto cleanup_transport;
}
configure_media_failed_no_reply:
unsupported_transports:
{
GST_ERROR ("client %p: unsupported transports", client);
- send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT,
+ ctx);
goto cleanup_transport;
}
unsupported_client_transport:
{
GST_ERROR ("client %p: unsupported client transport", client);
- send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT,
+ ctx);
goto cleanup_transport;
}
unsupported_mode:
GST_RTSP_TRANSPORT_MODE_PLAY),
! !(gst_rtsp_media_get_transport_mode (media) &
GST_RTSP_TRANSPORT_MODE_RECORD), ct->mode_play, ct->mode_record);
- send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT,
+ ctx);
goto cleanup_transport;
}
unsupported_range_unit:
{
GST_ERROR ("Client %p: does not support any range format we support",
client);
- send_generic_response (client, GST_RTSP_STS_NOT_IMPLEMENTED, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_IMPLEMENTED, ctx);
goto cleanup_transport;
}
keymgmt_error:
{
GST_ERROR ("client %p: keymgmt error", client);
- send_generic_response (client, GST_RTSP_STS_KEY_MANAGEMENT_FAILURE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_KEY_MANAGEMENT_FAILURE,
+ ctx);
goto cleanup_transport;
}
{
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
return FALSE;
}
no_uri:
{
GST_ERROR ("client %p: no uri", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
no_mount_points:
{
GST_ERROR ("client %p: no mount points configured", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return FALSE;
}
no_path:
{
GST_ERROR ("client %p: can't find path for url", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return FALSE;
}
no_media:
unsupported_mode:
{
GST_ERROR ("client %p: media does not support DESCRIBE", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
g_free (path);
gst_rtsp_media_unlock (media);
g_object_unref (media);
no_sdp:
{
GST_ERROR ("client %p: can't create SDP", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
g_free (path);
gst_rtsp_media_unlock (media);
g_object_unref (media);
no_uri:
{
GST_ERROR ("client %p: no uri", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
no_mount_points:
{
GST_ERROR ("client %p: no mount points configured", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return FALSE;
}
no_path:
{
GST_ERROR ("client %p: can't find path for url", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
gst_sdp_message_free (sdp);
return FALSE;
}
wrong_content_type:
{
GST_ERROR ("client %p: unknown content type", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
no_message:
{
GST_ERROR ("client %p: can't find SDP message", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
sdp_parse_failed:
{
GST_ERROR ("client %p: failed to parse SDP message", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
gst_sdp_message_free (sdp);
return FALSE;
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_sdp_message_free (sdp);
gst_rtsp_media_unlock (media);
g_object_unref (media);
unsupported_mode:
{
GST_ERROR ("client %p: media does not support ANNOUNCE", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
g_free (path);
gst_rtsp_media_unlock (media);
g_object_unref (media);
unhandled_sdp:
{
GST_ERROR ("client %p: can't handle SDP", client);
- send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE,
+ ctx);
g_free (path);
gst_rtsp_media_unlock (media);
g_object_unref (media);
no_session:
{
GST_ERROR ("client %p: no session", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
return FALSE;
}
no_uri:
{
GST_ERROR ("client %p: no uri supplied", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
return FALSE;
}
not_found:
{
GST_ERROR ("client %p: media not found", client);
- send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return FALSE;
}
no_aggregate:
{
GST_ERROR ("client %p: no aggregate path %s", client, path);
- send_generic_response (client,
+ send_generic_error_response (client,
GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED, ctx);
g_free (path);
return FALSE;
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
return FALSE;
}
unsupported_mode:
{
GST_ERROR ("client %p: media does not support RECORD", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_METHOD_NOT_ALLOWED, ctx);
return FALSE;
}
invalid_state:
{
GST_ERROR ("client %p: not PLAYING or READY", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- ctx);
+ send_generic_error_response (client,
+ GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE, ctx);
return FALSE;
}
pipeline_error:
{
GST_ERROR ("client %p: failed to configure the pipeline", client);
- send_generic_response (client, GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
- ctx);
+ send_generic_error_response (client,
+ GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE, ctx);
return FALSE;
}
unsuspend_failed:
{
GST_ERROR ("client %p: unsuspend failed", client);
- send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
return FALSE;
}
}
{
GST_ERROR ("client %p: pre signal returned error: %s", client,
gst_rtsp_status_as_text (sig_result));
- send_generic_response (client, sig_result, ctx);
+ send_generic_error_response (client, sig_result, ctx);
gst_rtsp_message_free (ctx->response);
return FALSE;
}
not_supported:
{
GST_ERROR ("client %p: version %d not supported", client, version);
- send_generic_response (client, GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED,
- ctx);
+ send_generic_error_response (client,
+ GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED, ctx);
goto done;
}
invalid_command_for_version:
{
GST_ERROR ("client %p: invalid command for version", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
goto done;
}
bad_request:
{
GST_ERROR ("client %p: bad request", client);
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
goto done;
}
no_pool:
{
GST_ERROR ("client %p: no pool configured", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
goto done;
}
session_not_found:
{
GST_ERROR ("client %p: session not found", client);
- send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
goto done;
}
not_authorized:
not_implemented:
{
GST_ERROR ("client %p: method %d not implemented", client, method);
- send_generic_response (client, GST_RTSP_STS_NOT_IMPLEMENTED, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_NOT_IMPLEMENTED, ctx);
goto done;
}
}
goto done;
if (result == GST_RTSP_ENOMEM) {
- send_generic_response (client, GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE,
+ ctx);
goto done;
}
if (result == GST_RTSP_EPARSE) {
- send_generic_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
+ send_generic_error_response (client, GST_RTSP_STS_BAD_REQUEST, ctx);
goto done;
}
gst_rtsp_watch_set_send_backlog (priv->watch, 0, WATCH_BACKLOG_SIZE);
+ /* take the lock before attaching the client watch, so that the client thread
+ * can not access the control channel timer until it's properly in place */
+ g_mutex_lock (&priv->lock);
+
GST_INFO ("client %p: attaching to context %p", client, context);
res = gst_rtsp_watch_attach (priv->watch, context);
/* Setting up a timeout for the RTSP control channel until a session
* is up where it is handling timeouts. */
- g_mutex_lock (&priv->lock);
/* remove old timeout if any */
rtsp_ctrl_timeout_remove_unlocked (client->priv);