[Live-devel] Presentation time, multicast and multiple client connections

DJM-Avalesta david.myers at avalesta.com
Thu Jul 7 13:06:45 PDT 2022



Hi,

My embedded video server outputs an H264 Multicast video stream at 
25fps.

It is a requirement that multiple VLC client sessions join the stream 
via ONVIF which results in an RTSP handshake to get the multicast SDP 
details to join.

This works fine, however when each new client joins I get a jump in 
presentation time which results in a glitch in the video of all 
connected VLC clients.

My code for setting the presentation time is really simple:-

if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0)
         gettimeofday(&fPresentationTime, NULL);
else
{
     // Increment by the sample time
    _ unsigned uSeconds = fPresentationTime.tv_usec + 1000000/25; 
//25fps, _the frame rate (40ms)
     fPresentationTime.tv_sec += uSeconds/1000000;
     fPresentationTime.tv_usec = uSeconds%1000000;
}

I don't set fPresentation time anywhere else, so I can't understand why 
I get this jump in presentation time which can be up to 500ms.
A wireshark trace looks like this:

2779    6.395002    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38492, Time=2630245072 FU-A 
Start:non-IDR-Slice
2780    6.395002    10.26.7.77    232.26.7.77    H264    1197    
PT=H264, SSRC=0x2DC80377, Seq=38493, Time=2630245072, Mark FU-A End
2781    6.456028    10.26.7.77    232.26.7.77    H264    66    PT=H264, 
SSRC=0x2DC80377, Seq=38494, Time=2630248672 SPS
2782    6.456028    10.26.7.77    232.26.7.77    H264    60    PT=H264, 
SSRC=0x2DC80377, Seq=38495, Time=2630248672 PPS
2783    6.457999    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38496, Time=2630248672 FU-A 
Start:IDR-Slice
2784    6.457999    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38497, Time=2630248672 FU-A
2785    6.457999    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38498, Time=2630248672 FU-A
2786    6.459001    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38499, Time=2630248672 FU-A
2787    6.459001    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38500, Time=2630248672 FU-A
2788    6.460000    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38501, Time=2630248672 FU-A
2789    6.460000    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38502, Time=2630248672 FU-A
2790    6.460000    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38503, Time=2630248672 FU-A
2791    6.460993    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38504, Time=2630248672 FU-A
2792    6.460993    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38505, Time=2630248672 FU-A
2793    6.462031    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38506, Time=2630248672 FU-A
2794    6.462031    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38507, Time=2630248672 FU-A
2795    6.462985    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38508, Time=2630248672 FU-A
2796    6.462985    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38509, Time=2630248672 FU-A
2797    6.463033    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38510, Time=2630248672 FU-A
2798    6.463985    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38511, Time=2630248672 FU-A
2799    6.463985    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38512, Time=2630248672 FU-A
2800    6.464981    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38513, Time=2630248672 FU-A
2801    6.464981    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38514, Time=2630248672 FU-A
2802    6.465982    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38515, Time=2630248672 FU-A
2803    6.465982    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38516, Time=2630248672 FU-A
2804    6.466982    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38517, Time=2630248672 FU-A
2805    6.466982    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38518, Time=2630248672 FU-A
2806    6.466982    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38519, Time=2630248672 FU-A
2807    6.468009    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38520, Time=2630248672 FU-A
2808    6.468009    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38521, Time=2630248672 FU-A
2809    6.468984    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38522, Time=2630248672 FU-A
2810    6.468984    10.26.7.77    232.26.7.77    H264    1097    
PT=H264, SSRC=0x2DC80377, Seq=38523, Time=2630248672, Mark FU-A End
2811    6.476999    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38524, Time=2630252272 FU-A 
Start:non-IDR-Slice
2812    6.476999    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38525, Time=2630252272 FU-A
2813    6.476999    10.26.7.77    232.26.7.77    H264    108    PT=H264, 
SSRC=0x2DC80377, Seq=38526, Time=2630252272, Mark FU-A End
2819    6.514185    10.26.7.83    10.26.7.77    RTSP    177    OPTIONS 
rtsp://10.26.7.77:554/stream0 RTSP/1.0
2821    6.515988    10.26.7.77    10.26.7.83    RTSP    206    Reply: 
RTSP/1.0 200 OK
2822    6.516092    10.26.7.83    10.26.7.77    RTSP    203    DESCRIBE 
rtsp://10.26.7.77:554/stream0 RTSP/1.0
2823    6.518007    10.26.7.77    10.26.7.83    RTSP    229    Reply: 
RTSP/1.0 401 Unauthorized
2824    6.518098    10.26.7.83    10.26.7.77    RTSP    400    DESCRIBE 
rtsp://10.26.7.77:554/stream0 RTSP/1.0
2825    6.520986    10.26.7.77    10.26.7.83    RTSP/SDP    723    
Reply: RTSP/1.0 200 OK
2826    6.521655    10.26.7.83    10.26.7.77    RTSP    424    SETUP 
rtsp://10.26.7.77/stream0/track1 RTSP/1.0
2827    6.524993    10.26.7.77    10.26.7.83    RTSP    242    Reply: 
RTSP/1.0 200 OK
2828    6.525466    10.26.7.83    232.26.7.77    RTP    46    Unknown 
RTP version 3
2830    6.525553    10.26.7.83    232.26.7.77    RTP    46    Unknown 
RTP version 3
2832    6.525616    10.26.7.83    10.26.7.77    RTSP    403    PLAY 
rtsp://10.26.7.77/stream0/ RTSP/1.0
2834    6.530026    10.26.7.77    10.26.7.83    RTSP    234    Reply: 
RTSP/1.0 200 OK
2835    6.530026    10.26.7.77    232.26.7.77    H264    66    PT=H264, 
SSRC=0x2DC80377, Seq=38527, Time=2630338005 SPS
2837    6.530026    10.26.7.77    232.26.7.77    H264    60    PT=H264, 
SSRC=0x2DC80377, Seq=38528, Time=2630338005 PPS
2838    6.531997    10.26.7.77    232.26.7.77    H264    1498    
PT=H264, SSRC=0x2DC80377, Seq=38529, Time=2630338005 FU-A 
Start:IDR-Slice

Everything is fine with the timestamp increasing by 3600 (40ms) each 
frame, until the next VLC client joins. The next video frame has a 
timestamp
which is around 95ms after the previous frame even though it has the 
next sequence number so no frames are missing.

What could be causing this jump in fPresentationTime? Is there anything 
in the live555 library under the hood which modifies this variable? If 
fPresentationTime got set to zero, that would cause gettimeofday() to be 
called and this could explain it, but I can't see why this would happen.

Any help or advice would be very welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20220707/826b935c/attachment.htm>


More information about the live-devel mailing list