[vlc-devel] Problem in livedotcom.cpp

Luca Abeni lucabe72 at email.it
Mon Oct 24 11:00:08 CEST 2005


I am testing vlc to receive RTP streams. In some experiments, I saw that
vlc has a lot of problems if there is a big jitter in the video frames'
arrival times.
For example, in an experiment I introduced a random delay, up to 3
seconds, on the video packets, and I saw that the video plays "almost
ok", but the audio is often interrupted - of course, I am pre-buffering
3 seconds of stream: the command line I use is
vlc --rt-priority -vvv --file-caching 3000 stream:test.sdp

(mp4ip player and QT player both correctly receive and play the stream,
without problems in the audio or in the video).

I tried to analyse the problem, and it seems to me that it is caused by
the way used to update the reference clock in
modules/demux/livedotcom.cpp: if I understand well, the i_pcr value used
es_out_Control( p_demux->out, ES_OUT_SET_PCR, i_pcr )
(in the Demux() function) is computed based on the presentation time of
the last received frame. This is ok if the jitter in the frame arrival
time is small, but seems to completely screw the reference clock if
frames can arrive up to 3 seconds late as in my test.

I do not know the vlc internals and the live.com code too much
(basically, I started to study vlc code to fix this problem), so maybe I
am asking a stupid question... But why is a PTS used to compute the PCR?

I tried to modify the code to update the reference clock based on the
NTP time contained in the last received SR RTCP packet, and this seems
to fix the problem I am seeing. I attach a patch that hopefully shows
what I mean (with this patch applied, vlc can succesfully play the
stream with delayed video packets).

Can someone comment on this patch: is it acceptable? Or am I
misunderstanding something?

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcr.diff
Type: text/x-patch
Size: 3919 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20051024/3d27b291/attachment.bin>

More information about the vlc-devel mailing list