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 781928 - videoaggregator: issues with live mode when the input framerates are different from the output framerate
videoaggregator: issues with live mode when the input framerates are differen...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-29 02:42 UTC by Mathieu Duponchelle
Modified: 2018-01-23 19:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
API: GstAggregatorPad.skip_buffer virtual method (4.79 KB, patch)
2017-10-16 11:56 UTC, Mathieu Duponchelle
none Details | Review
API: GstAggregatorPad.skip_buffer virtual method (2.85 KB, patch)
2017-12-28 11:14 UTC, Mathieu Duponchelle
committed Details | Review
videoaggregatorpad: implement skip_buffer (2.02 KB, patch)
2017-12-28 11:17 UTC, Mathieu Duponchelle
committed Details | Review

Description Mathieu Duponchelle 2017-04-29 02:42:43 UTC
How to reproduce:

Get wondershaper (available on Fedora at least).


```
sudo wondershaper wlp6s0 1000000 100
GST_DEBUG=*videoaggregator*:6 gst-launch-1.0 videotestsrc pattern=ball is-live=true ! videorate ! video/x-raw, framerate=30/1 ! identity ! compositor name=comp sink_0::alpha=0.5 sink_1::alpha=0.5 sink_2::alpha=0.5 ! video/x-raw, framerate=5/1 ! queue ! xvimagesink  uridecodebin uri=https://media.w3.org/2010/05/sintel/trailer.webm ! videorate ! comp. 2>&1 | grep "Producing buffer\|replacing old buffer\|Taking new buffer"
```

Observed behaviour:

The ball moves at 5fps as expected, but its movement is 6 times slower than it would otherwise be.

The timestamps that are mixed progressively drift from the output timestamps.

Expected behaviour:

The ball should move at 5fps, but 5 out of 6 frames should be skipped, thus maintaining the speed of its movement.

Of course this is a simple example to highlight the problem, with actual sources the decoder very quickly ends up dropping frames because of QOS.
Comment 1 Mathieu Duponchelle 2017-10-16 11:56:40 UTC
Created attachment 361662 [details] [review]
API: GstAggregatorPad.skip_buffer virtual method

Allows subclasses to prevent buffers from being queued.

GstVideoAggregatorPad implements the virtual method and skips
buffers from sources with a framerate higher than its output
framerate.

Fixes
Comment 2 Tim-Philipp Müller 2017-12-28 10:03:45 UTC
Aggregator is in core now, so patch needs to be split, sorry :)

I haven't really looked at the implementation, but was just wondering: this means we would basically drop the latest buffer, right? I wonder if anyone would ever want a mode where any older (already queued?) buffer should be dropped instead?
Comment 3 Tim-Philipp Müller 2017-12-28 10:08:57 UTC
Also wonder if this could be unit-tested without too much ėffort somehow.
Comment 4 Mathieu Duponchelle 2017-12-28 11:14:42 UTC
Created attachment 366043 [details] [review]
API: GstAggregatorPad.skip_buffer virtual method

Allows subclasses to prevent buffers from being queued.
Comment 5 Mathieu Duponchelle 2017-12-28 11:17:01 UTC
Created attachment 366044 [details] [review]
videoaggregatorpad: implement skip_buffer

Skip buffers from sources with a framerate higher than the output
framerate.
Comment 6 Mathieu Duponchelle 2017-12-28 11:18:07 UTC
Easier way to test this:

gst-launch-1.0 videotestsrc pattern=ball is-live=true ! videorate ! video/x-raw, framerate=30/1 ! identity ! compositor name=comp sink_0::alpha=0.5 sink_1::alpha=0.5 sink_2::alpha=0.5 ! video/x-raw, framerate=5/1 ! queue ! xvimagesink  uridecodebin uri=https://media.w3.org/2010/05/sintel/trailer.webm ! identity sleep-time=2000000 ! videorate ! comp.

Observed and expected results are the same as before.
Comment 7 Mathieu Duponchelle 2017-12-28 11:30:27 UTC
(In reply to Tim-Philipp Müller from comment #2)
> Aggregator is in core now, so patch needs to be split, sorry :)
> 
> I haven't really looked at the implementation, but was just wondering: this
> means we would basically drop the latest buffer, right? I wonder if anyone
> would ever want a mode where any older (already queued?) buffer should be
> dropped instead?

No, we drop exactly the same buffers as would be dropped later on if the other input wasn't late, as we compute "output_start_running_time" and compare the buffer's PTS + duration
Comment 8 Tim-Philipp Müller 2018-01-22 13:11:42 UTC
What's up with these patches? Are they good to go? Are you waiting for more review?
Comment 9 Mathieu Duponchelle 2018-01-23 12:57:47 UTC
Yes, they are, we should definitely push them
Comment 10 Mathieu Duponchelle 2018-01-23 19:18:18 UTC
Comment on attachment 366043 [details] [review]
API: GstAggregatorPad.skip_buffer virtual method

Attachment 366043 [details] pushed as 9f69034 - API: GstAggregatorPad.skip_buffer virtual method
Comment 11 Mathieu Duponchelle 2018-01-23 19:20:00 UTC
Attachment 366044 [details] pushed as 99f646b - videoaggregatorpad: implement skip_buffer