[vlc-devel] Using vlc as a relay source for Darwin Streaming Server.

Leonardo leonardo_c at libero.it
Sat Feb 25 12:36:19 CET 2006


As well known, vlc can operate as an encoder for a Darwin Streaming Server
(DSS) by creating an sdp file, copying it to /usr/local/movies and starting to
send media flows with the same options used for sdp creation.
DSS will happily reflect the flows to every requesting client; just make sure
to use the "ttl=" option in the #rtp module for sdp creation.

Troubles arise trying to use vlc as an "Origin" in the frame work of the
OpenCDN (http://labtel.ing.uniroma1.it/opencdn/) project.
In that case, DSS is configured as a relay and, according to a "pull" 
paradigm, it needs to act as an RTSP client towards vlc in order to make a
remote stream locally available to clients.
In that way, the sdp metadata is tranferred to DSS during the RTSP negotiation
phase, and no manual copy of the sdp file is needed...the only problem is that
DSS seems to be unable to complete an RTSP request with vlc configured as an
RTSP server !!!

After some thought a difference has been found between the headers format of
the RTSP DESCRIBE answer returned by vlc and the one returned by DSS.
As vlc is perfectly able to complete an RTSP request to DSS while DSS cannot 
do the same with vlc configured as an RTSP server the incompatibility could 
be on the vlc side, so the need to dig into the code.

In the following the formal description of the problem and its solution.

2 computers:
- PC#1 ( call it vlc_pc): runs vlc-0.8.2 compiled from sources;
- PC#2 (call it darwin_pc): runs Darwin Streaming Server.
Goal:
- use vlc on PC#1 with the following command to generate the sdp of a 
  file/live-content and make it available to DSS via the rtsp protocol:
[root at vlc_pc]# vlc -vvv my_file.mp4 --sout 
'#rtp{port=1234,ttl=8,sdp=rtsp://vlc_pc_ip_addr/test_vlc.sdp}' 
- use Darwin on PC#2 as a relay with the following configuration:
Relay Name: darwin_relay
Status:  Enabled  # AFTER vlc STARTED TO STREAM.
Source Settings 
 Source Hostname or IP Address: vlc_pc_ip_addr  # LOOK AT THE rtp MODULE IN THE VLC COMMAND. 
 Mount Point: test_vlc.sdp  # LOOK AT THE rtp MODULE IN THE VLC COMMAND.
 Request incoming stream
Destination Settings (1 of 1)
 Hostname or IP Address: 127.0.0.1
 Announced UDP
 Mount Point: test_darwin.sdp

It works having recompiled vlc after the following changes in 
vlc-0.8.2/modules/stream_out/rtp.c:
- ROW 736:
i_size += strlen( "a=control:*/trackid=*\r\n" ) + strlen( p_sys->psz_rtsp_control ) + 10; --->
i_size += strlen( "a=control:*/trackID=*\r\n" ) + strlen(p_sys->psz_rtsp_control) + 10;
- ROW 789:
p += sprintf( p, "a=control:%s/trackid=%d\r\n", p_sys->psz_rtsp_control, i ); --->
p += sprintf( p, "a=control:trackID=%d\r\n", i );
- ROW 1033:
sprintf( psz_urlc, "%s/trackid=%d", p_sys->psz_rtsp_path, p_sys->i_es ); --->
sprintf( psz_urlc, "%s/trackID=%d", p_sys->psz_rtsp_path,p_sys->i_es );

The problem was in the a=control fields of the sdp:
- vlc generates the fields:
a=control:rtsp://vlc_pc:554/test.sdp/trackid=0
a=control:rtsp://vlc_pc:554/test.sdp/trackid=1
- while Darwin expects the fields to be:
a=control:trackID=0
a=control:trackID=1

To use vlc with telnet interface it's necessary to make similar changes in
vlc-0.8.2/modules/misc/rtsp.c too:
- ROWS 361-362:
asprintf( &psz_urlc, "%s/trackid=%d", p_media->psz_rtsp_path, p_media->i_es ); --->
asprintf( &psz_urlc, "%s/trackID=%d", p_media->psz_rtsp_path, p_media->i_es );
- ROWS 985-986:
i_size += strlen( "a=control:*/trackid=*\r\n" ) + strlen( p_media->psz_rtsp_control ) + 10; --->
i_size += strlen( "a=control:*/trackID=*\r\n" ) + strlen( p_media->psz_rtsp_control ) + 10;
- ROWS 1042-1043:
p += sprintf( p, "a=control:%s/trackid=%d\r\n", p_media->psz_rtsp_control, i ); --->
p += sprintf( p, "a=control:trackID=%d\r\n", i);

Attached You can find a diff file with all the changes.

The above mentioned changes don't affect regular vlc to vlc operations.

Please, can You insert those changes in one of the next daily code snapshots? 
If You can't, there's a reason ?
That would be very important to us because We are trying to integrate vlc
within the OpenCDN project frame work. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff_vlc
Type: text/x-diff
Size: 2297 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20060225/6b25a690/attachment.diff>


More information about the vlc-devel mailing list