client: only add RTP-Info when we have the info

Only add RTP-Info for a stream when we can get the seqnum and timestamp from the
depayloader.
This commit is contained in:
Wim Taymans 2009-05-23 16:17:02 +02:00 committed by Wim Taymans
parent bace3b601b
commit 8fcbe501dc

View file

@ -465,7 +465,7 @@ handle_play_request (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPSession *ses
GstRTSPMessage response = { 0 }; GstRTSPMessage response = { 0 };
GstRTSPStatusCode code; GstRTSPStatusCode code;
GString *rtpinfo; GString *rtpinfo;
guint n_streams, i; guint n_streams, i, infocount;
guint timestamp, seqnum; guint timestamp, seqnum;
gchar *str; gchar *str;
GstRTSPTimeRange *range; GstRTSPTimeRange *range;
@ -498,10 +498,11 @@ handle_play_request (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPSession *ses
rtpinfo = g_string_new (""); rtpinfo = g_string_new ("");
n_streams = gst_rtsp_media_n_streams (media->media); n_streams = gst_rtsp_media_n_streams (media->media);
for (i = 0; i < n_streams; i++) { for (i = 0, infocount = 0; i < n_streams; i++) {
GstRTSPSessionStream *sstream; GstRTSPSessionStream *sstream;
GstRTSPMediaStream *stream; GstRTSPMediaStream *stream;
GstRTSPTransport *tr; GstRTSPTransport *tr;
GObjectClass *payobjclass;
gchar *uristr; gchar *uristr;
/* get the stream as configured in the session */ /* get the stream as configured in the session */
@ -517,15 +518,26 @@ handle_play_request (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPSession *ses
stream = sstream->media_stream; stream = sstream->media_stream;
g_object_get (G_OBJECT (stream->payloader), "seqnum", &seqnum, NULL); payobjclass = G_OBJECT_GET_CLASS (stream->payloader);
g_object_get (G_OBJECT (stream->payloader), "timestamp", &timestamp, NULL);
if (i > 0) if (g_object_class_find_property (payobjclass, "seqnum") &&
g_object_class_find_property (payobjclass, "timestamp")) {
GObject *payobj;
payobj = G_OBJECT (stream->payloader);
/* only add RTP-Info for streams with seqnum and timestamp */
g_object_get (payobj, "seqnum", &seqnum, "timestamp", &timestamp, NULL);
if (infocount > 0)
g_string_append (rtpinfo, ", "); g_string_append (rtpinfo, ", ");
uristr = gst_rtsp_url_get_request_uri (uri); uristr = gst_rtsp_url_get_request_uri (uri);
g_string_append_printf (rtpinfo, "url=%s/stream=%d;seq=%u;rtptime=%u", uristr, i, seqnum, timestamp); g_string_append_printf (rtpinfo, "url=%s/stream=%d;seq=%u;rtptime=%u", uristr, i, seqnum, timestamp);
g_free (uristr); g_free (uristr);
infocount++;
}
} }
/* construct the response now */ /* construct the response now */