After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730039 - rtpjitterbuffer: jitter buffer stalls if first seqnum is different than seqnum-base
rtpjitterbuffer: jitter buffer stalls if first seqnum is different than seqnu...
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-12 23:20 UTC by Aleix Conchillo Flaqué
Modified: 2014-05-14 17:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
always push first packet (1021 bytes, patch)
2014-05-12 23:43 UTC, Aleix Conchillo Flaqué
none Details | Review

Description Aleix Conchillo Flaqué 2014-05-12 23:20:24 UTC
After, this commit:

commit 18b69419fd0a262f4ad2aa80a412a868e67870d6
Author: Wim Taymans <wtaymans@redhat.com>
Date:   Tue Apr 29 15:29:31 2014 +0200

    rtpjitterbuffer: rework packet insert
    
    Rework the packet queue so that the most common action (insert a packet
    at the tail of the queue) goes very fast.
    
    Report if a packet was inserted at the head instead of the tail so that
    we can know when to retry _pop or _peek.

If the first received packet is different than the one in seqnum-base, items will not be popped from the jitter buffer.

seqnum-base is obtained from RTP-Info (in PLAY response). It could be that RTP-Info contains a different sequence number than the first packet really received.
Comment 1 Aleix Conchillo Flaqué 2014-05-12 23:43:33 UTC
Created attachment 276416 [details] [review]
always push first packet

This is just a workaround. It solves the problem, but it's probably not the way to solve this.
Comment 2 Aleix Conchillo Flaqué 2014-05-13 14:27:35 UTC
Not sure if the following is a realistic case, but I think it could happen. With the new approach, what would happen in this case?

10345 10346 -1
h            t

10344 is to be inserted. But because of this:

  for (; list; list = g_list_previous (list)) {
    ...

    if (qitem->seqnum == -1)
      break;

It seems it will be inserted in the tail:

10345 10346 -1 10344
h                  t

instead of:

10344 10345 10346 -1
h                  t
Comment 3 Wim Taymans 2014-05-13 14:43:24 UTC
(In reply to comment #2)
> Not sure if the following is a realistic case, but I think it could happen.
> With the new approach, what would happen in this case?
> 
> 10345 10346 -1
> h            t
> 
> 10344 is to be inserted. But because of this:
> 
>   for (; list; list = g_list_previous (list)) {
>     ...
> 
>     if (qitem->seqnum == -1)
>       break;
> 
> It seems it will be inserted in the tail:
> 
> 10345 10346 -1 10344
> h                  t
> 
> instead of:
> 
> 10344 10345 10346 -1
> h                  t

It looks like that break; should be a continue;
Comment 4 Aleix Conchillo Flaqué 2014-05-13 14:47:00 UTC
(In reply to comment #3)
> 
> It looks like that break; should be a continue;

the problem with a continue and the new approach is that buffers would be inserted before events. continue was fine before.
Comment 5 Wim Taymans 2014-05-13 14:56:39 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > 
> > It looks like that break; should be a continue;
> 
> the problem with a continue and the new approach is that buffers would be
> inserted before events. continue was fine before.

True, it should only move the buffer before the event if there is another buffer before the event that has a larger seqnum.
Comment 6 Aleix Conchillo Flaqué 2014-05-13 15:16:23 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > 
> > > It looks like that break; should be a continue;
> > 
> > the problem with a continue and the new approach is that buffers would be
> > inserted before events. continue was fine before.
> 
> True, it should only move the buffer before the event if there is another
> buffer before the event that has a larger seqnum.

Right. I can try to fix this today, unless you are already fixing it. Let me know.
Comment 7 Wim Taymans 2014-05-13 15:24:47 UTC
(In reply to comment #6)

> Right. I can try to fix this today, unless you are already fixing it. Let me
> know.

Go ahead and propose a fix.
Comment 8 Aleix Conchillo Flaqué 2014-05-13 19:49:07 UTC
(In reply to comment #7)
> (In reply to comment #6)
> 
> > Right. I can try to fix this today, unless you are already fixing it. Let me
> > know.
> 
> Go ahead and propose a fix.

Just filed bug 730078 with a patch.

Interestingly, my problem mentioned in this bug was fixed too. I was receiving the packet with seqnum-base late, but because this new bug it was never inserted properly.

In any case, what happens if packet with seqnum-base is lost?
Comment 9 Wim Taymans 2014-05-14 08:36:46 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > 
> > > Right. I can try to fix this today, unless you are already fixing it. Let me
> > > know.
> > 
> > Go ahead and propose a fix.
> 
> Just filed bug 730078 with a patch.
> 
> Interestingly, my problem mentioned in this bug was fixed too. I was receiving
> the packet with seqnum-base late, but because this new bug it was never
> inserted properly.
> 
> In any case, what happens if packet with seqnum-base is lost?

It should probably estimate when it should be received and wait until the last moment before
generating a lost-packet event.

We don't do anything like this, it would involve estimating a time in the past using seqnum-base+1
timestamp and seqnum-base+2 packet spacing. not sure it is worth it. What happens now is that
seqnum-base+1 is delayed as much as possible (waiting for seqnum-base) but there is never a lost-packet 
event generated for seqnum-base.
Comment 10 Aleix Conchillo Flaqué 2014-05-14 17:41:04 UTC
(In reply to comment #9)

> > 
> > In any case, what happens if packet with seqnum-base is lost?
> 
> It should probably estimate when it should be received and wait until the last
> moment before
> generating a lost-packet event.
> 
> We don't do anything like this, it would involve estimating a time in the past
> using seqnum-base+1
> timestamp and seqnum-base+2 packet spacing. not sure it is worth it. What
> happens now is that
> seqnum-base+1 is delayed as much as possible (waiting for seqnum-base) but
> there is never a lost-packet 
> event generated for seqnum-base.

Right. Thanks for the comment.

I just verified that this bug is not an issue anymore and that it was a consequence of bug 730078.

I verfied it by sending a sequence number a bit lower than the first packet in RTP-Info (gst-rtsp-server/rtsp-stream-transport.c::gst_rtsp_stream_transport_get_rtpinfo).