After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 608417 - rtspsrc problem with \n and \r as first line
rtspsrc problem with \n and \r as first line
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.10.26
Other Linux
: Normal normal
: 0.10.27
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-29 08:38 UTC by Nicola
Modified: 2010-02-12 11:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wireshark dump that demostrate the problem (62.04 KB, application/cap)
2010-01-29 08:38 UTC, Nicola
  Details
vlc can see the stream with no problem here is the wireshark dump (327.82 KB, application/cap)
2010-01-29 08:39 UTC, Nicola
  Details
rtsp: ignore empty first lines (1.33 KB, patch)
2010-01-29 10:34 UTC, Wim Taymans
none Details | Review
there an additional g_print("builder line valore %d\n",builder->line); from my previous attempt (7.59 KB, text/plain)
2010-01-29 12:59 UTC, Nicola
  Details
possible patch (1.15 KB, patch)
2010-01-29 15:34 UTC, Wim Taymans
none Details | Review

Description Nicola 2010-01-29 08:38:44 UTC
Created attachment 152552 [details]
wireshark dump that demostrate the problem

I have some strange problem with an rtsp stream, attacched is a dump with wireshark for the following pipeline:

gst-launch rtspsrc debug=true location=rtsp://192.168.2.24/media/video1 ! decodebin ! autovideosink

the pipeline exit with this error:

gstrtspsrc.c(3766): gst_rtspsrc_try_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive message. (Parse error)
Comment 1 Nicola 2010-01-29 08:39:35 UTC
Created attachment 152553 [details]
vlc can see the stream with no problem here is the wireshark dump
Comment 2 Wim Taymans 2010-01-29 09:50:14 UTC
It seems it's because of the Data header that is in french:

0090  69 6f 6e 3a 20 32 34 0d  0a 44 61 74 65 3a 20 76   ion: 24. .Date: v
00a0  65 6e 2c 20 32 39 20 67  65 6e 20 32 30 31 30 20   en, 29 g en 2010 
00b0  30 38 3a 30 35 3a 33 36  20 47 4d 54 0d 0a 0d 0a   08:05:36  GMT....
Comment 3 Wim Taymans 2010-01-29 09:51:28 UTC
hmm, sorry. maybe not
Comment 4 Wim Taymans 2010-01-29 09:57:20 UTC
It's the reply from the SETUP request that has 2 extra bytes (\r\n), they should not be there.
Comment 5 Nicola 2010-01-29 10:30:52 UTC
Hi Wim, 

do you plan to release a workaround (maybe an additional property for rtspsrc)?

If no can you point me towards the code I have to modify?

thanks
Nicola
Comment 6 Wim Taymans 2010-01-29 10:34:07 UTC
Created attachment 152559 [details] [review]
rtsp: ignore empty first lines

When we get a request or response from a server, ignore empty lines before the
response or request status lines.

Fixes #608417
Comment 7 Wim Taymans 2010-01-29 10:34:58 UTC
Please try attached patch and let me know if it works.
Comment 8 Nicola 2010-01-29 12:24:04 UTC
No Wim, it doesn't work, I added an addtional g_print:

if (empty && builder->line == 0) {
	    g_print("empy\n\n\n\n\n");
	    break;
	}

and it is never printed, (g_print before and after the above code works)

Nicola
Comment 9 Wim Taymans 2010-01-29 12:32:20 UTC
Can you apply this patch and paste the output here?

diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
index 9300532..1a4bb16 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -1893,6 +1893,8 @@ build_next (GstRTSPBuilder * builder, GstRTSPMessage * message,
         if (res != GST_RTSP_OK)
           goto done;
 
+        gst_util_dump_mem (builder->buffer, builder->offset);
+
         /* check for empty line */
         empty = builder->buffer[0] == '\0';
Comment 10 Nicola 2010-01-29 12:59:03 UTC
Created attachment 152566 [details]
there an additional g_print("builder line valore %d\n",builder->line); from my previous attempt
Comment 11 Wim Taymans 2010-01-29 15:34:20 UTC
Created attachment 152586 [details] [review]
possible patch

The server is still quite broken but attached patch at least makes rtspsrc connect properly.

The next thing is that this server is always sending an RTP timestamp of 0...
Comment 12 Nicola 2010-01-29 16:09:13 UTC
Thanks now if works! What kind of problem I can have with RTP timestamp of 0? Probably I cannot use the gstrtpjitterbuffer, other problems?. I'll ping sony for this problem.

Do you think \r\n fix will go in the next gstreamer release? I think will be useful for other people too.
Comment 13 Wim Taymans 2010-01-29 16:18:36 UTC
(In reply to comment #12)
> Thanks now if works! What kind of problem I can have with RTP timestamp of 0?
> Probably I cannot use the gstrtpjitterbuffer, other problems?. I'll ping sony
> for this problem.

GStreamer does not increment timestamps in this case and frames are dropped. I'm going to try to work around this.

> 
> Do you think \r\n fix will go in the next gstreamer release? I think will be
> useful for other people too.

Surely.
Comment 14 Wim Taymans 2010-01-29 16:20:33 UTC
The RTP timestamp problems only seem to happen in TCP mode.
Comment 15 Wim Taymans 2010-02-12 11:19:32 UTC
commit 30fd219e6367d413eb22961ad9a94ca74d286e8e
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Fri Jan 29 16:34:44 2010 +0100

    rtsp: ignore \n and \r as the first line
    
    Be more forgiving for bad servers and ignore \r and \n when we are looking for
    the response/request line.
    
    See #608417