gstrtpjitterbuffer: Drop a lot of buffer because of too large 'seqnum_base'
rtsp://*** ! autovideosink
When I use this command to play a rtsp stream, sometimes I find the decoder cann't get buffer for long time. -----command----- gst-launch-1.0 uridecodebin uri=According to the log: GST_DEBUG=rtpjitterbuffer:5 , I found the element "rtpjitterbuffer" drop some buffers. The relevant source code is as follows:
`if (priv->seqnum_base != -1) { gint gap;
gap = gst_rtp_buffer_compare_seqnum (priv->seqnum_base, seqnum);
if (gap < 0) {
GST_DEBUG_OBJECT (jitterbuffer,
"packet seqnum #%d before seqnum-base #%d", seqnum,
priv->seqnum_base);
gst_buffer_unref (buffer);
goto finished;
} else if (gap > 16384) {
/* From now on don't compare against the seqnum base anymore as
* at some point in the future we will wrap around and also that
* much reordering is very unlikely */
priv->seqnum_base = -1;
}
}`
If the seqnum of the buffer is bigger than seqnum-base, the buffer is pushed into down stream, otherwise, the element drop it by gst_buffer_unref. What's more, if seqnum of the buffer is 16384(I don't know why is 16384) bigger than seqnum_base, set seqnum_base to -1. However, if the seqnum_base is too large, like 50000 or 60000. There is not exist that the seqnum is 16384 bigger than seqnum_base. Because the seqnum is of type guint16(0~65535). The seqnum is reset to 0 after 65535. At the time, the seqnum is smaller than seqnum_base. If the seqnum_base is 50000, it will drop 50000 buffers! And I found the seqnum_base is always -1 when I use some other types camera. However for the test camera, the seqnum_base is a random value. If you would like to help me, I would be very grateful!
The test camera is HIKVISION , DS-IPC-T12H-IA