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 667838 - jitterbuffer: don't produce lost-events for expired packets
jitterbuffer: don't produce lost-events for expired packets
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal major
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-13 00:17 UTC by Håvard Graff (hgr)
Modified: 2012-12-13 11:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (3.57 KB, patch)
2012-01-13 00:17 UTC, Håvard Graff (hgr)
none Details | Review
test (12.46 KB, text/plain)
2012-01-13 00:22 UTC, Håvard Graff (hgr)
  Details
GstTestClock (6.84 KB, application/zip)
2012-01-13 00:27 UTC, Håvard Graff (hgr)
  Details
test (19.51 KB, text/plain)
2012-02-06 22:30 UTC, Håvard Graff (hgr)
  Details
patch (5.14 KB, patch)
2012-02-06 22:31 UTC, Håvard Graff (hgr)
none Details | Review
Missing types and functions referenced in the original patch. (3.17 KB, application/zip)
2012-09-04 12:38 UTC, Idar Tollefsen
  Details

Description Håvard Graff (hgr) 2012-01-13 00:17:39 UTC
Created attachment 205152 [details] [review]
patch

he scenario where you have a gap in a steady flow of packets of
say 10 seconds (500 packets of with duration of 20ms), the jitterbuffer
will idle up until it receives the first buffer after the gap, but will
then go on to produce 499 lost-events, to "cover up" the gap.

Now this is obviously wrong, since the last possible time for the earliest
lost-events to be played out has obviously expired, but the fact that
the jitterbuffer has a "length", represented with its own latency combined
with the total latency downstream, allows for covering up at least some
of this gap.

So in the case of the "length" being 200ms, while having received packet
500, the jitterbuffer should still create a timeout for packet 491, which
will have its time expire at 10,02 seconds, specially since it might
actually arrive in time! But obviously, waiting for packet 100, that had
its time expire at 2 seconds, (remembering that the current time is 10)
is useless...

The patch will "move up" the packet it should be waiting for based on
the current time and jitterbuffer "length"

I am going to attach a test-case and the gsttestclock that is essential for this kind of tests.
Comment 1 Håvard Graff (hgr) 2012-01-13 00:22:52 UTC
Created attachment 205153 [details]
test

the jitterbuffer-lost-event testcases
Comment 2 Håvard Graff (hgr) 2012-01-13 00:27:12 UTC
Created attachment 205154 [details]
GstTestClock

This is a Test-clock written by Ole-Andre Ravnaas.

It basically allow you to take control of time in your pipeline, collecting and releasing id-waits. Great for writing deterministic tests.
Comment 3 Olivier Crête 2012-01-13 01:30:03 UTC
TestClock looks neat, I've wanted to write one of these for a long time.

I though the lost-events where produced when the next packet was expected? Not when the next know packet is? Or did I miss something ?
Comment 4 Håvard Graff (hgr) 2012-01-17 20:18:41 UTC
(In reply to comment #3)
> TestClock looks neat, I've wanted to write one of these for a long time.

It is! I hope it will find its way into -core or -base so that it can benefit all of man-kind. Even comes with its own test-suite. :)
> 
> I though the lost-events where produced when the next packet was expected? Not
> when the next know packet is? Or did I miss something ?

You only missed the fact that there needs to be a gap for a lost-event to be produced. Aka, the seq-num space between two buffers. So without that other buffer arriving, no lost-event produced. This patch is trying to fix the fact that this gap can be huge, and then the jitterbuffer currently does the wrong thing IMO.
Comment 5 Håvard Graff (hgr) 2012-01-17 20:20:52 UTC
Comment on attachment 205152 [details] [review]
patch

Test is good, but this patch is not quite right yet. Discovered some issues with it, so will write some more tests to expose its weaknesses, and submit a new one.
Comment 6 Håvard Graff (hgr) 2012-02-06 22:30:56 UTC
Created attachment 206937 [details]
test

Two more tests added and some improvements.
Comment 7 Håvard Graff (hgr) 2012-02-06 22:31:50 UTC
Created attachment 206938 [details] [review]
patch

This patch now makes all the tests pass.
Comment 8 Håvard Graff (hgr) 2012-08-21 11:49:37 UTC
Since this has gotten so little love, I thought I would spell out the problem this patch fixes:

If you are using rtpmanager, and you get into a hold/resume situation, where packets stops arriving, you are basically screwed without this patch... :)
Comment 9 Idar Tollefsen 2012-09-04 12:38:36 UTC
Created attachment 223420 [details]
Missing types and functions referenced in the original patch.

Sebastian Rasmussen discovered that there were pieces missing from this patch. There are some functions and types referenced in the test clock that aren't part of the test clock implementation itself.

I've created a new attachment, testutils.zip, with a header and implementation of the missing pieces.
Comment 10 Wim Taymans 2012-12-13 11:35:30 UTC
commit 9c94f1187c1cdc13e2ea3bb019052c0887df0584
Author: Havard Graff <havard.graff@tandberg.com>
Date:   Fri Jan 13 01:11:31 2012 +0100

    jitterbuffer: bundle together late lost-events
    
    The scenario where you have a gap in a steady flow of packets of
    say 10 seconds (500 packets of with duration of 20ms), the jitterbuffer
    will idle up until it receives the first buffer after the gap, but will
    then go on to produce 499 lost-events, to "cover up" the gap.
    
    Now this is obviously wrong, since the last possible time for the earliest
    lost-events to be played out has obviously expired, but the fact that
    the jitterbuffer has a "length", represented with its own latency combined
    with the total latency downstream, allows for covering up at least some
    of this gap.
    
    So in the case of the "length" being 200ms, while having received packet
    500, the jitterbuffer should still create a timeout for packet 491, which
    will have its time expire at 10,02 seconds, specially since it might
    actually arrive in time! But obviously, waiting for packet 100, that had
    its time expire at 2 seconds, (remembering that the current time is 10)
    is useless...
    
    The patch will create one "big" lost-event for the first 490 packets,
    and then go on to create single ones if they can reach their
    playout deadline.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=667838
Comment 11 Wim Taymans 2012-12-13 11:38:18 UTC
Tests are broken, please port. I commited and disabled them so they are not fogotten.


commit 50391c77731544b61f14d9c65cb9b4a1f00d9028
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Thu Dec 13 12:36:20 2012 +0100

    check: add (but disable) more rtp jitterbuffer tests
    
    Tests need to be ported to 1.0 before they can be enabled but added here so they
    don't get forgotten.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=667838