Commit 6d227be7 authored by Sebastian Pölsterl's avatar Sebastian Pölsterl

Use GStreamer's debugging subsystem

parent 87fbfa54
......@@ -36,6 +36,9 @@ enum
PROP_LAST
};
GST_DEBUG_CATEGORY_STATIC (rtsp_client_debug);
#define GST_CAT_DEFAULT rtsp_client_debug
static void gst_rtsp_client_get_property (GObject * object, guint propid,
GValue * value, GParamSpec * pspec);
static void gst_rtsp_client_set_property (GObject * object, guint propid,
......@@ -73,6 +76,8 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
tunnels =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
tunnels_lock = g_mutex_new ();
GST_DEBUG_CATEGORY_INIT (rtsp_client_debug, "rtspclient", 0, "GstRTSPClient");
}
static void
......@@ -87,7 +92,7 @@ gst_rtsp_client_finalize (GObject * obj)
GstRTSPClient *client = GST_RTSP_CLIENT (obj);
GList *walk;
g_message ("finalize client %p", client);
GST_INFO ("finalize client %p", client);
/* remove weak-ref from sessions */
for (walk = client->sessions; walk; walk = g_list_next (walk)) {
......@@ -259,7 +264,7 @@ find_media (GstRTSPClient * client, GstRTSPUrl * uri, GstRTSPMessage * request)
} else {
/* we have seen this uri before, used cached media */
media = client->media;
g_message ("reusing cached media %p", media);
GST_INFO ("reusing cached media %p", media);
}
if (media)
......@@ -601,7 +606,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPUrl * uri,
sstream = gst_rtsp_session_media_get_stream (media, i);
/* get the transport, if there is no transport configured, skip this stream */
if (!(tr = sstream->trans.transport)) {
g_message ("stream %d is not configured", i);
GST_INFO ("stream %d is not configured", i);
continue;
}
......@@ -633,7 +638,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPUrl * uri,
infocount++;
} else {
g_warning ("RTP-Info cannot be determined for stream %d", i);
GST_WARNING ("RTP-Info cannot be determined for stream %d", i);
}
}
......@@ -685,7 +690,7 @@ invalid_state:
static void
do_keepalive (GstRTSPSession * session)
{
g_message ("keep session %p alive", session);
GST_INFO ("keep session %p alive", session);
gst_rtsp_session_touch (session);
}
......@@ -1023,7 +1028,7 @@ static void
client_session_finalized (GstRTSPClient * client, GstRTSPSession * session)
{
if (!(client->sessions = g_list_remove (client->sessions, session))) {
g_message ("all sessions finalized, close the connection");
GST_INFO ("all sessions finalized, close the connection");
g_source_destroy ((GSource *) client->watch);
}
}
......@@ -1041,7 +1046,7 @@ client_watch_session (GstRTSPClient * client, GstRTSPSession * session)
return;
}
g_message ("watching session %p", session);
GST_INFO ("watching session %p", session);
g_object_weak_ref (G_OBJECT (session), (GWeakNotify) client_session_finalized,
client);
......@@ -1063,7 +1068,7 @@ handle_request (GstRTSPClient * client, GstRTSPMessage * request)
gst_rtsp_message_dump (request);
#endif
g_message ("client %p: received a request", client);
GST_INFO ("client %p: received a request", client);
gst_rtsp_message_parse_request (request, &method, &uristr, &version);
......@@ -1327,7 +1332,7 @@ message_sent (GstRTSPWatch * watch, guint cseq, gpointer user_data)
client = GST_RTSP_CLIENT (user_data);
/* g_message ("client %p: sent a message with cseq %d", client, cseq); */
/* GST_INFO ("client %p: sent a message with cseq %d", client, cseq); */
return GST_RTSP_OK;
}
......@@ -1338,7 +1343,7 @@ closed (GstRTSPWatch * watch, gpointer user_data)
GstRTSPClient *client = GST_RTSP_CLIENT (user_data);
const gchar *tunnelid;
g_message ("client %p: connection closed", client);
GST_INFO ("client %p: connection closed", client);
if ((tunnelid = gst_rtsp_connection_get_tunnelid (client->connection))) {
g_mutex_lock (tunnels_lock);
......@@ -1359,7 +1364,7 @@ error (GstRTSPWatch * watch, GstRTSPResult result, gpointer user_data)
gchar *str;
str = gst_rtsp_strresult (result);
g_message ("client %p: received an error %s", client, str);
GST_INFO ("client %p: received an error %s", client, str);
g_free (str);
return GST_RTSP_OK;
......@@ -1373,14 +1378,14 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
client = GST_RTSP_CLIENT (user_data);
g_message ("client %p: tunnel start", client);
GST_INFO ("client %p: tunnel start", client);
/* store client in the pending tunnels */
tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
if (tunnelid == NULL)
goto no_tunnelid;
g_message ("client %p: inserting %s", client, tunnelid);
GST_INFO ("client %p: inserting %s", client, tunnelid);
/* we can't have two clients connecting with the same tunnelid */
g_mutex_lock (tunnels_lock);
......@@ -1395,13 +1400,13 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
/* ERRORS */
no_tunnelid:
{
g_message ("client %p: no tunnelid provided", client);
GST_INFO ("client %p: no tunnelid provided", client);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
tunnel_existed:
{
g_mutex_unlock (tunnels_lock);
g_message ("client %p: tunnel session %s existed", client, tunnelid);
GST_INFO ("client %p: tunnel session %s existed", client, tunnelid);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
}
......@@ -1413,7 +1418,7 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
GstRTSPClient *client = GST_RTSP_CLIENT (user_data);
GstRTSPClient *oclient;
g_message ("client %p: tunnel complete", client);
GST_INFO ("client %p: tunnel complete", client);
/* find previous tunnel */
tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
......@@ -1430,7 +1435,7 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
g_hash_table_remove (tunnels, tunnelid);
g_mutex_unlock (tunnels_lock);
g_message ("client %p: found tunnel %p", client, oclient);
GST_INFO ("client %p: found tunnel %p", client, oclient);
/* merge the tunnels into the first client */
gst_rtsp_connection_do_tunnel (oclient->connection, client->connection);
......@@ -1446,13 +1451,13 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
/* ERRORS */
no_tunnelid:
{
g_message ("client %p: no tunnelid provided", client);
GST_INFO ("client %p: no tunnelid provided", client);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
no_tunnel:
{
g_mutex_unlock (tunnels_lock);
g_message ("client %p: tunnel session %s not found", client, tunnelid);
GST_INFO ("client %p: tunnel session %s not found", client, tunnelid);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
}
......@@ -1494,7 +1499,7 @@ gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel)
GST_RTSP_CHECK (gst_rtsp_connection_accept (sock, &conn), accept_failed);
url = gst_rtsp_connection_get_url (conn);
g_message ("added new client %p ip %s:%d", client, url->host, url->port);
GST_INFO ("added new client %p ip %s:%d", client, url->host, url->port);
client->connection = conn;
......@@ -1508,7 +1513,7 @@ gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel)
else
context = NULL;
g_message ("attaching to context %p", context);
GST_INFO ("attaching to context %p", context);
client->watchid = gst_rtsp_watch_attach (client->watch, context);
gst_rtsp_watch_unref (client->watch);
......@@ -1520,7 +1525,7 @@ accept_failed:
{
gchar *str = gst_rtsp_strresult (res);
g_error ("Could not accept client on server socket %d: %s", sock, str);
GST_ERROR ("Could not accept client on server socket %d: %s", sock, str);
g_free (str);
return FALSE;
}
......
......@@ -30,6 +30,9 @@ enum
PROP_LAST
};
GST_DEBUG_CATEGORY (rtsp_media_debug);
#define GST_CAT_DEFAULT rtsp_media_debug
static void gst_rtsp_media_factory_get_property (GObject *object, guint propid,
GValue *value, GParamSpec *pspec);
static void gst_rtsp_media_factory_set_property (GObject *object, guint propid,
......@@ -81,6 +84,8 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
klass->construct = default_construct;
klass->configure = default_configure;
klass->create_pipeline = default_create_pipeline;
GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmedia", 0, "GstRTSPMedia");
}
static void
......@@ -340,7 +345,7 @@ gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory, const GstRTSPUrl
if (key)
g_free (key);
g_message ("constructed media %p for url %s", media, url->abspath);
GST_INFO ("constructed media %p for url %s", media, url->abspath);
return media;
}
......@@ -375,7 +380,7 @@ default_get_element (GstRTSPMediaFactory *factory, const GstRTSPUrl *url)
if (error != NULL) {
/* a recoverable error was encountered */
g_warning ("recoverable parsing error: %s", error->message);
GST_WARNING ("recoverable parsing error: %s", error->message);
g_error_free (error);
}
return element;
......@@ -424,7 +429,7 @@ gst_rtsp_media_factory_collect_streams (GstRTSPMediaFactory *factory, const GstR
stream = g_new0 (GstRTSPMediaStream, 1);
stream->payloader = elem;
g_message ("found stream %d with payloader %p", i, elem);
GST_INFO ("found stream %d with payloader %p", i, elem);
pad = gst_element_get_static_pad (elem, "src");
......@@ -444,7 +449,7 @@ gst_rtsp_media_factory_collect_streams (GstRTSPMediaFactory *factory, const GstR
if ((elem = gst_bin_get_by_name (GST_BIN (element), name))) {
/* a stream that will dynamically create pads to provide RTP packets */
g_message ("found dynamic element %d, %p", i, elem);
GST_INFO ("found dynamic element %d, %p", i, elem);
media->dynamic = g_list_prepend (media->dynamic, elem);
......
......@@ -21,6 +21,9 @@
G_DEFINE_TYPE (GstRTSPMediaMapping, gst_rtsp_media_mapping, G_TYPE_OBJECT);
GST_DEBUG_CATEGORY_EXTERN (rtsp_media_debug);
#define GST_CAT_DEFAULT rtsp_media_debug
static void gst_rtsp_media_mapping_finalize (GObject * obj);
static GstRTSPMediaFactory * find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url);
......@@ -76,7 +79,7 @@ find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url)
if (result)
g_object_ref (result);
g_message ("found media %p for url abspath %s", result, url->abspath);
GST_INFO ("found media %p for url abspath %s", result, url->abspath);
return result;
}
......
This diff is collapsed.
......@@ -37,6 +37,9 @@ enum
G_DEFINE_TYPE (GstRTSPServer, gst_rtsp_server, G_TYPE_OBJECT);
GST_DEBUG_CATEGORY_STATIC (rtsp_server_debug);
#define GST_CAT_DEFAULT rtsp_server_debug
static void gst_rtsp_server_get_property (GObject *object, guint propid,
GValue *value, GParamSpec *pspec);
static void gst_rtsp_server_set_property (GObject *object, guint propid,
......@@ -102,6 +105,8 @@ gst_rtsp_server_class_init (GstRTSPServerClass * klass)
GST_TYPE_RTSP_MEDIA_MAPPING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
klass->accept_client = default_accept_client;
GST_DEBUG_CATEGORY_INIT (rtsp_server_debug, "rtspserver", 0, "GstRTSPServer");
}
static void
......@@ -399,7 +404,7 @@ gst_rtsp_server_sink_init_send (GstRTSPServer * server)
"listened on server socket %d, returning from connection setup",
server->server_sock.fd);
g_message ("listening on port %d", server->port);
GST_INFO_OBJECT (server, "listening on port %d", server->port);
return TRUE;
......@@ -474,7 +479,7 @@ default_accept_client (GstRTSPServer *server, GIOChannel *channel)
/* ERRORS */
accept_failed:
{
g_error ("Could not accept client on server socket %d: %s (%d)",
GST_ERROR_OBJECT (server, "Could not accept client on server socket %d: %s (%d)",
server->server_sock.fd, g_strerror (errno), errno);
gst_object_unref (client);
return NULL;
......@@ -511,7 +516,7 @@ gst_rtsp_server_io_func (GIOChannel *channel, GIOCondition condition, GstRTSPSer
gst_object_unref (client);
}
else {
g_print ("received unknown event %08x", condition);
GST_WARNING_OBJECT (server, "received unknown event %08x", condition);
}
return TRUE;
......
......@@ -30,6 +30,9 @@ enum
PROP_LAST
};
GST_DEBUG_CATEGORY (rtsp_session_debug);
#define GST_CAT_DEFAULT rtsp_session_debug
static void gst_rtsp_session_pool_get_property (GObject *object, guint propid,
GValue *value, GParamSpec *pspec);
static void gst_rtsp_session_pool_set_property (GObject *object, guint propid,
......@@ -59,6 +62,7 @@ gst_rtsp_session_pool_class_init (GstRTSPSessionPoolClass * klass)
klass->create_session_id = create_session_id;
GST_DEBUG_CATEGORY_INIT (rtsp_session_debug, "rtspsession", 0, "GstRTSPSession");
}
static void
......@@ -300,24 +304,24 @@ gst_rtsp_session_pool_create (GstRTSPSessionPool *pool)
/* ERRORS */
no_function:
{
g_warning ("no create_session_id vmethod in GstRTSPSessionPool %p", pool);
GST_WARNING ("no create_session_id vmethod in GstRTSPSessionPool %p", pool);
return NULL;
}
no_session:
{
g_warning ("can't create session id with GstRTSPSessionPool %p", pool);
GST_WARNING ("can't create session id with GstRTSPSessionPool %p", pool);
return NULL;
}
collision:
{
g_warning ("can't find unique sessionid for GstRTSPSessionPool %p", pool);
GST_WARNING ("can't find unique sessionid for GstRTSPSessionPool %p", pool);
g_mutex_unlock (pool->lock);
g_free (id);
return NULL;
}
too_many_sessions:
{
g_warning ("session pool reached max sessions of %d", pool->max_sessions);
GST_WARNING ("session pool reached max sessions of %d", pool->max_sessions);
g_mutex_unlock (pool->lock);
g_free (id);
return NULL;
......@@ -464,7 +468,7 @@ collect_timeout (gchar *sessionid, GstRTSPSession *sess, GstPoolSource *psrc)
g_source_get_current_time ((GSource*)psrc, &now);
timeout = gst_rtsp_session_next_timeout (sess, &now);
g_message ("%p: next timeout: %d", sess, timeout);
GST_INFO ("%p: next timeout: %d", sess, timeout);
if (psrc->timeout == -1 || timeout < psrc->timeout)
psrc->timeout = timeout;
}
......@@ -487,7 +491,7 @@ gst_pool_source_prepare (GSource * source, gint * timeout)
result = psrc->timeout == 0;
g_message ("prepare %d, %d", psrc->timeout, result);
GST_INFO ("prepare %d, %d", psrc->timeout, result);
return result;
}
......@@ -495,7 +499,7 @@ gst_pool_source_prepare (GSource * source, gint * timeout)
static gboolean
gst_pool_source_check (GSource * source)
{
g_message ("check");
GST_INFO ("check");
return gst_pool_source_prepare (source, NULL);
}
......@@ -508,7 +512,7 @@ gst_pool_source_dispatch (GSource * source, GSourceFunc callback,
GstPoolSource *psrc = (GstPoolSource *) source;
GstRTSPSessionPoolFunc func = (GstRTSPSessionPoolFunc) callback;
g_message ("dispatch");
GST_INFO ("dispatch");
if (func)
res = func (psrc->pool, user_data);
......@@ -523,7 +527,7 @@ gst_pool_source_finalize (GSource * source)
{
GstPoolSource *psrc = (GstPoolSource *) source;
g_message ("finalize %p", psrc);
GST_INFO ("finalize %p", psrc);
g_object_unref (psrc->pool);
psrc->pool = NULL;
......
......@@ -32,6 +32,9 @@ enum
PROP_LAST
};
GST_DEBUG_CATEGORY_EXTERN (rtsp_session_debug);
#define GST_CAT_DEFAULT rtsp_session_debug
static void gst_rtsp_session_get_property (GObject *object, guint propid,
GValue *value, GParamSpec *pspec);
static void gst_rtsp_session_set_property (GObject *object, guint propid,
......@@ -72,7 +75,7 @@ gst_rtsp_session_init (GstRTSPSession * session)
static void
gst_rtsp_session_free_stream (GstRTSPSessionStream *stream)
{
g_message ("free session stream %p", stream);
GST_INFO ("free session stream %p", stream);
/* remove callbacks now */
gst_rtsp_session_stream_set_callbacks (stream, NULL, NULL, NULL, NULL);
......@@ -91,7 +94,7 @@ gst_rtsp_session_free_media (GstRTSPSessionMedia *media, GstRTSPSession *session
size = media->streams->len;
g_message ("free session media %p", media);
GST_INFO ("free session media %p", media);
gst_rtsp_session_media_set_state (media, GST_STATE_NULL);
......@@ -121,7 +124,7 @@ gst_rtsp_session_finalize (GObject * obj)
session = GST_RTSP_SESSION (obj);
g_message ("finalize session %p", session);
GST_INFO ("finalize session %p", session);
/* free all media */
g_list_foreach (session->medias, (GFunc) gst_rtsp_session_free_media,
......@@ -208,7 +211,7 @@ gst_rtsp_session_manage_media (GstRTSPSession *sess, const GstRTSPUrl *uri,
sess->medias = g_list_prepend (sess->medias, result);
g_message ("manage new media %p in session %p", media, result);
GST_INFO ("manage new media %p in session %p", media, result);
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment