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 658241 - video: add API to handle QoS events and dropping logic
video: add API to handle QoS events and dropping logic
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 617020 (view as bug list)
Depends on:
Blocks: 640017
 
 
Reported: 2011-09-05 10:15 UTC by Vincent Penquerc'h
Modified: 2012-06-12 15:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mpeg2dec: post QoS messages when dropping a frame due to QoS (2.39 KB, patch)
2011-09-05 10:15 UTC, Vincent Penquerc'h
committed Details | Review
theoradec: move the QoS logic to libgstvideo (5.17 KB, patch)
2011-09-05 13:00 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (4.93 KB, patch)
2011-09-05 13:00 UTC, Vincent Penquerc'h
needs-work Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (5.80 KB, patch)
2011-09-07 13:22 UTC, Vincent Penquerc'h
none Details | Review
theoradec: move the QoS logic to libgstvideo (5.58 KB, patch)
2011-09-07 13:22 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (5.79 KB, patch)
2011-09-07 13:53 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (9.25 KB, patch)
2011-09-07 15:06 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (9.41 KB, patch)
2011-09-08 17:17 UTC, Vincent Penquerc'h
none Details | Review
deinterlace: switch to the libgstvideo QoS tracking code (7.67 KB, patch)
2011-09-08 18:04 UTC, Vincent Penquerc'h
none Details | Review
videomixer2: switch to using the libgstvideo QoS tracking code (8.32 KB, patch)
2011-09-08 18:04 UTC, Vincent Penquerc'h
none Details | Review
mpeg2dec: switch to using the libgstvideo QoS tracking code (6.20 KB, patch)
2011-09-08 18:04 UTC, Vincent Penquerc'h
none Details | Review
ffmpegdec: switch to the new libgstvideo QoS tracking code (8.27 KB, patch)
2011-09-08 18:04 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (9.41 KB, patch)
2011-09-08 22:03 UTC, Vincent Penquerc'h
none Details | Review
ffmpegdec: switch to the new libgstvideo QoS tracking code (8.27 KB, patch)
2011-09-26 19:06 UTC, Vincent Penquerc'h
none Details | Review
jpegdec: switch to the libgstvideo qos code (5.91 KB, patch)
2011-10-05 13:52 UTC, Vincent Penquerc'h
none Details | Review
timing method (3.31 KB, patch)
2011-10-19 11:48 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (10.27 KB, patch)
2011-10-19 12:32 UTC, Vincent Penquerc'h
none Details | Review
theoradec: move the QoS logic to libgstvideo (5.53 KB, patch)
2011-10-19 12:33 UTC, Vincent Penquerc'h
none Details | Review
jpegdec: switch to the libgstvideo qos code (5.95 KB, patch)
2011-10-19 12:33 UTC, Vincent Penquerc'h
none Details | Review
deinterlace: switch to the libgstvideo QoS tracking code (7.71 KB, patch)
2011-10-19 12:34 UTC, Vincent Penquerc'h
none Details | Review
videomixer2: switch to using the libgstvideo QoS tracking code (8.36 KB, patch)
2011-10-19 12:34 UTC, Vincent Penquerc'h
none Details | Review
mpeg2dec: switch to using the libgstvideo QoS tracking code (6.16 KB, patch)
2011-10-19 12:35 UTC, Vincent Penquerc'h
none Details | Review
ffmpegdec: switch to the new libgstvideo QoS tracking code (8.31 KB, patch)
2011-10-19 12:35 UTC, Vincent Penquerc'h
none Details | Review
mpeg2dec: switch to using the libgstvideo QoS tracking code (5.88 KB, patch)
2011-10-19 15:57 UTC, Vincent Penquerc'h
none Details | Review
jasperdec: port to new QoS API (7.13 KB, patch)
2011-10-19 17:49 UTC, Vincent Penquerc'h
none Details | Review
basevideocodec: port to new QoS API (5.05 KB, patch)
2011-10-19 17:49 UTC, Vincent Penquerc'h
none Details | Review
goom: port to new QoS API (4.67 KB, patch)
2011-10-19 17:50 UTC, Vincent Penquerc'h
none Details | Review
goom2k1: port to new QoS API (4.82 KB, patch)
2011-10-19 17:50 UTC, Vincent Penquerc'h
none Details | Review
monoscope: port to the new QoS API (5.20 KB, patch)
2011-10-19 17:50 UTC, Vincent Penquerc'h
none Details | Review
shapewipe: port to new QoS API (6.26 KB, patch)
2011-10-19 17:50 UTC, Vincent Penquerc'h
none Details | Review
videomixer: port to new QoS API (7.08 KB, patch)
2011-10-19 17:50 UTC, Vincent Penquerc'h
none Details | Review
libgstvideo: add a new API to handle QoS events and dropping logic (10.27 KB, patch)
2011-10-19 17:51 UTC, Vincent Penquerc'h
none Details | Review
theoradec: move the QoS logic to libgstvideo (5.53 KB, patch)
2011-10-19 17:51 UTC, Vincent Penquerc'h
none Details | Review

Description Vincent Penquerc'h 2011-09-05 10:15:30 UTC
post QoS messages when dropping a frame due to QoS
Comment 1 Vincent Penquerc'h 2011-09-05 10:15:32 UTC
Created attachment 195676 [details] [review]
mpeg2dec: post QoS messages when dropping a frame due to QoS
Comment 2 Tim-Philipp Müller 2011-09-05 10:22:02 UTC
*** Bug 617020 has been marked as a duplicate of this bug. ***
Comment 3 Tim-Philipp Müller 2011-09-05 10:30:02 UTC
Cool, thanks for addingn this, but maybe we could move that whole block into a separate function, something along the lines of e.g. gst_jpeg_dec_do_qos() ?
Comment 4 Vincent Penquerc'h 2011-09-05 10:35:59 UTC
In fact, since it's all very similar between elements, maybe this could be moved to some lib in -base, if there's one that would be convenient for this kind of code.
Comment 5 Vincent Penquerc'h 2011-09-05 13:00:33 UTC
Created attachment 195689 [details] [review]
theoradec: move the QoS logic to libgstvideo
Comment 6 Vincent Penquerc'h 2011-09-05 13:00:43 UTC
Created attachment 195690 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic
Comment 7 Vincent Penquerc'h 2011-09-05 13:02:17 UTC
Something like this ?
Moved in libgstvideo with test case using theoradec.
I'll update my patches to other elements to use that when the API's OK'd.
Comment 8 Sebastian Dröge (slomo) 2011-09-07 10:53:30 UTC
Review of attachment 195690 [details] [review]:

::: gst-libs/gst/video/video.c
@@ +2367,3 @@
+  qt->diff = diff;
+  qt->timestamp = timestamp;
+  qt->earliest_time = qt->timestamp + qt->diff;

timestamp can be GST_CLOCK_TIME_NONE

The formula should be:

   if (diff > 0)
      et = ts + 2 * diff + frame_duration;
   else
      et = ts + diff

::: gst-libs/gst/video/video.h
@@ +444,3 @@
+  guint64 dropped;
+  GMutex *lock; /* protects the above */
+  GstElement *element;

Padding

@@ +445,3 @@
+  GMutex *lock; /* protects the above */
+  GstElement *element;
+} GstQoSTracker;

GstVideoQOSTracker because it's video specific

@@ +585,3 @@
+void           gst_video_qos_reset           (GstQoSTracker * qt);
+void           gst_video_qos_update          (GstQoSTracker * qt, GstEvent* event);
+gboolean       gst_video_qos_process_frame   (GstQoSTracker * qt, GstSegment *segment,

Make the segment const

@@ +587,3 @@
+gboolean       gst_video_qos_process_frame   (GstQoSTracker * qt, GstSegment *segment,
+                                             GstClockTime timestamp, GstClockTime duration);
+void           gst_video_qos_destroy         (GstQoSTracker * qt);

_clear() because it doesn't free the struct. Also name all functions like the struct, e.g. gst_video_qos_tracker_init()
Comment 9 Vincent Penquerc'h 2011-09-07 13:22:11 UTC
Created attachment 195872 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic
Comment 10 Vincent Penquerc'h 2011-09-07 13:22:24 UTC
Created attachment 195873 [details] [review]
theoradec: move the QoS logic to libgstvideo
Comment 11 Vincent Penquerc'h 2011-09-07 13:53:23 UTC
Created attachment 195875 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic

Use GstClockTime, not GstClockTimeDiff, for frame duration.
Comment 12 Vincent Penquerc'h 2011-09-07 15:06:06 UTC
Created attachment 195883 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic
Comment 13 Vincent Penquerc'h 2011-09-08 17:17:43 UTC
Created attachment 196015 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic

Do not ref the element, that would give us easy ref cycles.
Mention it in the doc blurb.
Comment 14 Vincent Penquerc'h 2011-09-08 18:04:13 UTC
Created attachment 196020 [details] [review]
deinterlace: switch to the libgstvideo QoS tracking code
Comment 15 Vincent Penquerc'h 2011-09-08 18:04:23 UTC
Created attachment 196021 [details] [review]
videomixer2: switch to using the libgstvideo QoS tracking code
Comment 16 Vincent Penquerc'h 2011-09-08 18:04:45 UTC
Created attachment 196022 [details] [review]
mpeg2dec: switch to using the libgstvideo QoS tracking code
Comment 17 Vincent Penquerc'h 2011-09-08 18:04:56 UTC
Created attachment 196023 [details] [review]
ffmpegdec: switch to the new libgstvideo QoS tracking code
Comment 18 Vincent Penquerc'h 2011-09-08 18:07:09 UTC
As the interface seems to be OK now, I've ported the elements that were posting QoS messages. Except GstBaseTransform, which does the same but isn't video. Not sure what to do here. Maybe move that QoS stuff to GstVideoFilter, and switch API there, but that would mean audio transforms can't use it unless I leave a copy of the code in GstBaseTransform, so...
Comment 19 Vincent Penquerc'h 2011-09-08 22:03:57 UTC
Created attachment 196041 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic

I'd left a stray GST_ERROR level debug log.
Comment 20 Vincent Penquerc'h 2011-09-26 19:06:50 UTC
Created attachment 197508 [details] [review]
ffmpegdec: switch to the new libgstvideo QoS tracking code
Comment 21 Vincent Penquerc'h 2011-10-05 13:52:12 UTC
Created attachment 198339 [details] [review]
jpegdec: switch to the libgstvideo qos code
Comment 22 Vincent Penquerc'h 2011-10-19 11:48:24 UTC
Created attachment 199418 [details] [review]
timing method
Comment 23 Vincent Penquerc'h 2011-10-19 11:49:33 UTC
Based on discussions, I'm putting this change here for comments, and if OK I'll integrate it in the patch, and change other elements to pass the appropriate method.
Comment 24 Vincent Penquerc'h 2011-10-19 12:32:57 UTC
Created attachment 199420 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic
Comment 25 Vincent Penquerc'h 2011-10-19 12:33:13 UTC
Created attachment 199421 [details] [review]
theoradec: move the QoS logic to libgstvideo
Comment 26 Vincent Penquerc'h 2011-10-19 12:33:37 UTC
Created attachment 199422 [details] [review]
jpegdec: switch to the libgstvideo qos code
Comment 27 Vincent Penquerc'h 2011-10-19 12:34:04 UTC
Created attachment 199423 [details] [review]
deinterlace: switch to the libgstvideo QoS tracking code
Comment 28 Vincent Penquerc'h 2011-10-19 12:34:13 UTC
Created attachment 199424 [details] [review]
videomixer2: switch to using the libgstvideo QoS tracking code
Comment 29 Vincent Penquerc'h 2011-10-19 12:35:04 UTC
Created attachment 199425 [details] [review]
mpeg2dec: switch to using the libgstvideo QoS tracking code
Comment 30 Vincent Penquerc'h 2011-10-19 12:35:27 UTC
Created attachment 199426 [details] [review]
ffmpegdec: switch to the new libgstvideo QoS tracking code
Comment 31 Vincent Penquerc'h 2011-10-19 15:57:54 UTC
Created attachment 199447 [details] [review]
mpeg2dec: switch to using the libgstvideo QoS tracking code

whoaaa, a debug rank switch slipped though - fixed.
Comment 32 Vincent Penquerc'h 2011-10-19 17:49:41 UTC
Created attachment 199459 [details] [review]
jasperdec: port to new QoS API

Untested, I don't have a test file for it.
Comment 33 Vincent Penquerc'h 2011-10-19 17:49:57 UTC
Created attachment 199460 [details] [review]
basevideocodec: port to new QoS API
Comment 34 Vincent Penquerc'h 2011-10-19 17:50:23 UTC
Created attachment 199461 [details] [review]
goom: port to new QoS API
Comment 35 Vincent Penquerc'h 2011-10-19 17:50:27 UTC
Created attachment 199462 [details] [review]
goom2k1: port to new QoS API
Comment 36 Vincent Penquerc'h 2011-10-19 17:50:30 UTC
Created attachment 199463 [details] [review]
monoscope: port to the new QoS API
Comment 37 Vincent Penquerc'h 2011-10-19 17:50:33 UTC
Created attachment 199464 [details] [review]
shapewipe: port to new QoS API
Comment 38 Vincent Penquerc'h 2011-10-19 17:50:36 UTC
Created attachment 199465 [details] [review]
videomixer: port to new QoS API
Comment 39 Vincent Penquerc'h 2011-10-19 17:51:39 UTC
Created attachment 199466 [details] [review]
libgstvideo: add a new API to handle QoS events and dropping logic
Comment 40 Vincent Penquerc'h 2011-10-19 17:51:49 UTC
Created attachment 199467 [details] [review]
theoradec: move the QoS logic to libgstvideo
Comment 41 Tim-Philipp Müller 2011-11-08 23:34:02 UTC
Ok, so:

 - I think *ideally* this should be handled by some relevant
    base class, whether that is GstVideoDecoder, GstVideoFilter
    or whatnot

 - however, I still think it's worth putting this as utility API into
   libgstvideo for now. It doesn't cost us much and it removes
   a considerable amount of code duplication all over the place.
   And it will likely be a while longer before e.g. GstBaseVideoDecoder
   is ready for prime time.

 - I'm a bit undecided about the GstVideoQoSTrackerMethod method
   argument to gst_video_qos_tracker_update(). I know you added it
   because I brought up the different formulas, but ultimately I'm not
   sure whether there's actually a good reason those formulas differ,
   or whether we should just not go with one of the two options (we
   could later still configure a method via the structure by doing
   gst_video_qos_tracker_set_method() or so if we found a good
   reason for the different strategies to exist).
Comment 42 Vincent Penquerc'h 2011-11-09 20:01:47 UTC
Well, I'll change the patches to whatever's decided in the end, I don't have a particular preference.

As far as I know, there isn't a good reason for the difference in algorithm, and an element gets to use this or that formula depending on where its QoS code was nicked from.

And I will still, for the record, mention that argument about not only decoders doing QoS, so bases classes probably needed to piggy back on a shared implementation anyway.
Comment 43 Stefan Sauer (gstreamer, gtkdoc dev) 2011-11-28 09:37:52 UTC
+1 for having this in the video library and then using it from elements. besides BaseVideoEnc/Dec its also VideoFilter that would benefit from this and many elements right now don't even handle QOS.
Comment 44 Vincent Penquerc'h 2012-06-12 14:57:46 UTC
Sooo... I'd forgot all about these old patches. What shall we do about them ? If I port them to latest 0.10, are they OK to push, or is there some leftover uncertainty about whether it's best hidden and taken care of by base classes (remembering that all users of QoS do not have a base class) ? I don't really want to go to the trouble of rebasing everything if they're not going up :p
Comment 45 Vincent Penquerc'h 2012-06-12 15:30:41 UTC
OK, so deemed not very useful on #gstreamer IRC, now that many/all video decoders have been ported to decoder base classes, so closing.