GNOME Bugzilla – Bug 650646
rtspsrc doesn't connects by multicast
Last modified: 2011-05-24 07:44:46 UTC
After successful 'DESCRIBE' query rtspsrc sends 'SETUP' query which tunes up unicast instead of multicast although camera said multicast address '228.5.6.1': ######## $ gst-launch-0.10 rtspsrc location=rtsp://192.168.0.101:7070 debug=true ! fakesink Установка конвейера в состояние PAUSED... RTSP request message 0xbfa8fa94 request line: method: 'OPTIONS' uri: 'rtsp://192.168.0.101:7070/' version: '1.0' headers: key: 'User-Agent', value: 'RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)' key: 'ClientChallenge', value: '9e26d33f2984236010ef6253fb1887f7' key: 'CompanyID', value: 'KnKV4M4I/B2FjJ1TToLycw==' key: 'GUID', value: '00000000-0000-0000-0000-000000000000' key: 'RegionData', value: '0' key: 'PlayerStarttime', value: '[28/03/2003:22:50:23 00:00]' key: 'ClientID', value: 'Linux_2.4_6.0.9.1235_play32_RN01_EN_586' body: RTSP response message 0xbfa8fa78 status line: code: '200' reason: 'OK' version: '1.0' headers: key: 'CSeq', value: '1' key: 'Date', value: 'Thu, Jan 01 2004 15:36:01 GMT' key: 'Public', value: 'OPTIONS' key: 'Public', value: 'DESCRIBE' key: 'Public', value: 'SETUP' key: 'Public', value: 'PLAY' key: 'Public', value: 'TEARDOWN' body: length 0 RTSP request message 0xbfa8fa94 request line: method: 'DESCRIBE' uri: 'rtsp://192.168.0.101:7070/' version: '1.0' headers: key: 'Accept', value: 'application/sdp' body: RTSP response message 0xbfa8fa78 status line: code: '200' reason: 'OK' version: '1.0' headers: key: 'CSeq', value: '2' key: 'Date', value: 'Thu, Jan 01 2004 15:36:01 GMT' key: 'Content-Base', value: 'rtsp://192.168.0.101:7070/' key: 'Content-Type', value: 'application/sdp' key: 'Content-Length', value: '279' body: length 280 00000000 (0x93de9f8): 76 3d 30 0d 0a 6f 3d 2d 20 31 30 37 32 39 37 31 v=0..o=- 1072971 00000010 (0x93dea08): 33 36 31 30 30 36 39 30 30 30 30 20 31 20 49 4e 36100690000 1 IN 00000020 (0x93dea18): 20 49 50 34 20 32 32 38 2e 35 2e 36 2e 31 0d 0a IP4 228.5.6.1.. 00000030 (0x93dea28): 73 3d 53 65 73 73 69 6f 6e 20 73 74 72 65 61 6d s=Session stream 00000040 (0x93dea38): 65 64 20 62 79 20 52 54 50 2f 52 54 53 50 20 73 ed by RTP/RTSP s 00000050 (0x93dea48): 65 72 76 65 72 0d 0a 69 3d 49 50 20 45 6e 63 6f erver..i=IP Enco 00000060 (0x93dea58): 64 65 72 20 52 54 50 20 73 74 72 65 61 6d 65 72 der RTP streamer 00000070 (0x93dea68): 0d 0a 74 3d 30 20 30 0d 0a 61 3d 74 6f 6f 6c 3a ..t=0 0..a=tool: 00000080 (0x93dea78): 49 50 20 45 6e 63 6f 64 65 72 20 52 54 50 20 73 IP Encoder RTP s 00000090 (0x93dea88): 74 72 65 61 6d 65 72 20 56 32 30 30 39 2e 30 32 treamer V2009.02 000000a0 (0x93dea98): 2e 30 35 0d 0a 61 3d 74 79 70 65 3a 62 72 6f 61 .05..a=type:broa 000000b0 (0x93deaa8): 64 63 61 73 74 0d 0a 61 3d 63 6f 6e 74 72 6f 6c dcast..a=control 000000c0 (0x93deab8): 3a 2a 0d 0a 61 3d 72 61 6e 67 65 3a 6e 70 74 3d :*..a=range:npt= 000000d0 (0x93deac8): 6e 6f 77 2d 0d 0a 6d 3d 76 69 64 65 6f 20 35 30 now-..m=video 50 000000e0 (0x93dead8): 30 30 20 52 54 50 2f 41 56 50 20 32 36 0d 0a 63 00 RTP/AVP 26..c 000000f0 (0x93deae8): 3d 49 4e 20 49 50 34 20 32 32 38 2e 35 2e 36 2e =IN IP4 228.5.6. 00000100 (0x93deaf8): 31 0d 0a 61 3d 63 6f 6e 74 72 6f 6c 3a 74 72 61 1..a=control:tra 00000110 (0x93deb08): 63 6b 31 0d 0a 0d 0a 00 ck1..... sdp packet 0xbfa8fa18: version: '0' origin: username: '-' sess_id: '107297136100690000' sess_version: '1' nettype: 'IN' addrtype: 'IP4' addr: '228.5.6.1' session_name: 'Session streamed by RTP/RTSP server' information: 'IP Encoder RTP streamer' uri: '(NULL)' connection: nettype: '(NULL)' addrtype: '(NULL)' address: '(NULL)' ttl: '0' addr_number: '0' key: type: '(NULL)' data: '(NULL)' attributes: attribute 'tool' : 'IP Encoder RTP streamer V2009.02.05' attribute 'type' : 'broadcast' attribute 'control' : '*' attribute 'range' : 'npt=now-' medias: media 0: media: 'video' port: '5000' num_ports: '4294967295' proto: 'RTP/AVP' formats: format '26' information: '(NULL)' connections: nettype: 'IN' addrtype: 'IP4' address: '228.5.6.1' ttl: '0' addr_number: '0' key: type: '(NULL)' data: '(NULL)' attributes: attribute 'control' : 'track1' RTSP request message 0xbfa8f944 request line: method: 'SETUP' uri: 'rtsp://192.168.0.101:7070/track1' version: '1.0' headers: key: 'Transport', value: 'RTP/AVP/UDP;unicast;client_port=41650-41651' body: RTSP response message 0xbfa8f928 status line: code: '404' reason: 'Stream Not Found' version: '1.0' headers: key: 'CSeq', value: '3' key: 'Date', value: 'Thu, Jan 01 2004 15:36:01 GMT' body: length 0 ОШИБКА: Конвейер не хочет становиться на паузу. ОШИБКА: из элемента /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Не удалось записать в ресурс. Дополнительная отладочная информация: gstrtspsrc.c(4563): gst_rtspsrc_setup_streams (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Error (404): Not Found Установка конвейера в состояние NULL... Freeing pipeline ... ######## If I force rtspsrc to use multicast only then rtspsrc sends 'SETUP' query without 'client_port' field on which camera replies 'Bad Request': ######## RTSP request message 0xbfe73044 request line: method: 'SETUP' uri: 'rtsp://192.168.0.101:7070/track1' version: '1.0' headers: key: 'Transport', value: 'RTP/AVP/UDP;multicast' body: RTSP response message 0xbfe73028 status line: code: '400' reason: 'Bad Request' version: '1.0' headers: key: 'Date', value: 'Thu, Jan 01 2004 15:59:40 GMT' key: 'Allow', value: 'OPTIONS' key: 'Allow', value: 'DESCRIBE' key: 'Allow', value: 'SETUP' key: 'Allow', value: 'PLAY' key: 'Allow', value: 'TEARDOWN' body: length 0 ######## Here is what VLC (which works with this camera well) sends in similar case: ######## SETUP rtsp://192.168.1.100:7070/track1 RTSP/1.0 CSeq: 4 User-Agent: LibVLC/1.1.9 (LIVE555 Streaming Media v2011.01.06) Transport: RTP/AVP;multicast;client_port=5000-5001 ########
I have hacked file 'gstrtspsrc.c' from 'good plugins' v.0.10.28 source package by replacing this line in function 'gst_rtspsrc_create_transports_string': //g_string_append (result, ";multicast"); g_string_append (result, ";multicast;client_port=5000-5001"); Now the camera responds 'OK' on 'SETUP' request but rtspsrc plugin cannot parse it's respond: ###### RTSP request message 0xbf80fa94 request line: method: 'SETUP' uri: 'rtsp://192.168.0.102:7070/track1' version: '1.0' headers: key: 'Transport', value: 'RTP/AVP;multicast;client_port=5000-5001' body: RTSP response message 0xbf80fa78 status line: code: '200' reason: 'OK' version: '1.0' headers: key: 'CSeq', value: '3' key: 'Date', value: 'Thu, Jan 01 2004 23:09:30 GMT' key: 'Transport', value: 'multicast;destination=228.5.6.2;port=5000-5001;ttl=16' key: 'Session', value: '5' body: length 0 0:00:00.032873870 16121 0x9c71050 ERROR rtspsrc gstrtspsrc.c:5325:gst_rtspsrc_open_from_sdp:<rtspsrc0> setup failed ОШИБКА: Конвейер не хочет становиться на паузу. ОШИБКА: из элемента /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Не найдены поддерживаемые потоки. Возможно вам нужно указать больше протоколов или верное GStreamer RTSP расширение. Дополнительная отладочная информация: gstrtspsrc.c(5158): gst_rtspsrc_setup_streams (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0 Установка конвейера в состояние NULL... ###### This line from errors log: ###### 0:00:00.111733881 ^[[336m16085^[[00m 0x9e2f050 ^[[33;01mWARN ^[[00m ^[[00m rtspsrc gstrtspsrc.c:5030:gst_rtspsrc_setup_streams:<rtspsrc0>^[[00m failed to parse transport multicast;destination=228.5.6.2;port=5000-5001;ttl=16 ###### I can provide more info and more tests if it helps us to make rtspsrc plugin really good.
Update: the first part of bug was fixed in 'plugins-good' v0.10.29. Now it doesn't require to define multicast explicitly. But the rest is still the same: 'Bad Request' response from camera after 'SETUP' request.
can you please re-run your pipelines with LC_ALL=C LANG=C to get english error messages? Also a debug log with GST_DEBUG=rtp*:5,rtsp*:5 might be useful
Created attachment 188435 [details] Patched file to workaround bugs of some camera which viloates RFC2326
As said wtay from irc chat, my IP-camera violates RFC2326. So I have patched the source file 'gstrtspsrc.c' to accomodate it for my camera. It seems VLC team did the same thing. I supply patched source file. I don't know how to make a patch which would work in general case. So who are interested can use my patched file as is.