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 739996 - videomixer: Drops a lot of frames, if one of the sources is live
videomixer: Drops a lot of frames, if one of the sources is live
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.4.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-12 08:44 UTC by Andrei Sarakeev
Modified: 2014-11-20 10:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pipeline schemas (9.79 KB, image/png)
2014-11-12 12:55 UTC, Andrei Sarakeev
  Details
videoaggregator: fix up qos handling for live sources (1.42 KB, patch)
2014-11-13 07:28 UTC, Matthew Waters (ystreet00)
reviewed Details | Review
aggregator: agg _get_latency() for subclass usage (3.23 KB, patch)
2014-11-17 03:06 UTC, Matthew Waters (ystreet00)
committed Details | Review
videoaggregator: fix up qos handling for live sources (1.48 KB, patch)
2014-11-17 03:07 UTC, Matthew Waters (ystreet00)
committed Details | Review

Description Andrei Sarakeev 2014-11-12 08:44:20 UTC
sample pipelines (from videomixer help):

GST_DEBUG=videomixer:6 \
gst-launch-1.0 \
  videotestsrc pattern=1 is-live=true ! \
  video/x-raw,format=AYUV,framerate=\(fraction\)10/1,width=100,height=100 ! \
  videobox border-alpha=0 top=-70 bottom=-70 right=-220 ! \
  videomixer name=mix sink_0::alpha=0.7 sink_1::alpha=0.5 ! \
  videoconvert ! xvimagesink \
  videotestsrc ! \
  video/x-raw,format=AYUV,framerate=\(fraction\)5/1,width=320,height=240 ! mix.

Note that the property is-live=true

part of log:
videomixer2.c:987:gst_videomixer2_fill_queues:<mix:sink_0> Taking new buffer with start time 0:00:07.402963486
videomixer2.c:987:gst_videomixer2_fill_queues:<mix:sink_1> Taking new buffer with start time 0:00:07.400000000
videomixer2.c:1195:gst_videomixer2_do_qos:<mix> qostime 0:00:07.400000000, earliest 0:00:07.408122570
videomixer2.c:1199:gst_videomixer2_do_qos:<mix> we are late, drop frame

STOP PIPELINE (show stats)

videomixer2.c:2031:gst_videomixer2_change_state:<mix> stopping collectpads
videomixer2.c:2044:gst_videomixer2_change_state:<mix> qos: rendered 39, dropped 37

If simply remove the check jitter from videomixer2.c (gst_videomixer2_do_qos), then it will work, and frames will not be dropped by the xvimagesink, because default max lateness value for videosink is 20ms
Comment 1 Andrei Sarakeev 2014-11-12 09:06:42 UTC
It can be even easier to leave only one living source:

GST_DEBUG=videomixer:6 \
  gst-launch-1.0 videotestsrc pattern=1 is-live=true ! \
  video/x-raw,format=AYUV ! \
  videomixer ! videoconvert ! xvimagesink

Ratio are rendered to dropped = 1/1
Comment 2 Sebastian Dröge (slomo) 2014-11-12 09:11:06 UTC
This is also still a problem with compositor from git master.
Comment 3 Andrei Sarakeev 2014-11-12 09:16:08 UTC
Why can not weaken the condition check jitter or remove it?
Comment 4 Andrei Sarakeev 2014-11-12 09:29:48 UTC
always jitter > 0 for live sources
and each second frame is drawn from the fact that the previous frame was dropped
Comment 5 Andrei Sarakeev 2014-11-12 09:40:01 UTC
I used to DirectShow on Windows, and decided to move to open source software, so cool to see the source code ;). But how many bugs here that do not give fulfill my task :(
Excuse me for my complaints.
Comment 6 Andrei Sarakeev 2014-11-12 12:55:07 UTC
Created attachment 290508 [details]
pipeline schemas

Short term correction:
for normal source:

   earliest_time = qos_timestamp + 2 * qos_diff + frame_duration;

For live source you need to make a correction. Shift by one frame (see schema, element inter)

   earliest_time = qos_timestamp + 2 * qos_diff + 2*frame_duration;

qos_diff always > 0

I can a little bit wrong, but this formula is more accurate for live sources
Comment 7 Tim-Philipp Müller 2014-11-12 13:04:47 UTC
Or perhaps it's just bug #640610 ?
Comment 8 Andrei Sarakeev 2014-11-13 06:28:59 UTC
comment 6: earliest_time_live_source = qos_timestamp + 2 * qos_diff
Comment 9 Matthew Waters (ystreet00) 2014-11-13 07:28:03 UTC
Created attachment 290578 [details] [review]
videoaggregator: fix up qos handling for live sources

The other option is to put the frame dropping under a !live flag.
Comment 10 Andrei Sarakeev 2014-11-13 08:45:31 UTC
comment 9. Agreed. Why is this not in the repository?
Comment 11 Sebastian Dröge (slomo) 2014-11-13 12:23:57 UTC
Review of attachment 290578 [details] [review]:

Maybe we should instead just disable QoS for live pipelines. Or only use this formula with the 2*diff if the pipeline is not live.
Comment 12 Matthew Waters (ystreet00) 2014-11-17 03:06:43 UTC
Created attachment 290828 [details] [review]
aggregator: agg _get_latency() for subclass usage
Comment 13 Matthew Waters (ystreet00) 2014-11-17 03:07:21 UTC
Created attachment 290829 [details] [review]
videoaggregator: fix up qos handling for live sources
Comment 14 Thibault Saunier 2014-11-17 10:00:10 UTC
Review of attachment 290828 [details] [review]:

That looks good to me.
Comment 15 Thibault Saunier 2014-11-17 10:00:29 UTC
Review of attachment 290829 [details] [review]:

Sounds right.
Comment 16 Tim-Philipp Müller 2014-11-17 10:10:05 UTC
Typo in commit message: "adative" :)
Comment 17 Matthew Waters (ystreet00) 2014-11-17 11:42:55 UTC
commit 051955e5fac2b124bc50655c811bb13794b6d278
Author: Matthew Waters <matthew@centricular.com>
Date:   Mon Nov 17 14:00:10 2014 +1100

    aggregator: add _get_latency() for subclass usage
    
    API: gst_aggregator_get_latency
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739996

commit f4a10c64c872dbe1d4ed2d5d3b730704dda43f87
Author: Matthew Waters <matthew@centricular.com>
Date:   Mon Nov 17 14:05:01 2014 +1100

    videoaggregator: fix up QoS handling for live sources
    
    Only attempt adaptive drop when we are not live
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739996
Comment 18 Matthew Waters (ystreet00) 2014-11-17 12:21:00 UTC
commit 0053ad08471e14bed592fe125f1b2999d23c00cd
Author: Matthew Waters <matthew@centricular.com>
Date:   Mon Nov 17 23:16:03 2014 +1100

    videomixer: fix up QoS handling for live sources
    
    Only attempt adaptive drop when we are not live
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739996