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 675761 - videoencoder: Support latency adjustment with dynamic framerate
videoencoder: Support latency adjustment with dynamic framerate
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-09 15:53 UTC by Nicolas Dufresne (ndufresne)
Modified: 2018-11-03 11:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
videoencoder: Remove done ToDo (857 bytes, patch)
2012-05-09 15:57 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
videoencoder: Remove trailing white space (1.31 KB, patch)
2012-05-09 15:57 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
videoencoder: Port to GQueue (5.62 KB, patch)
2012-05-09 15:57 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
videoencoder: Documentation fix (1.01 KB, patch)
2012-05-09 15:57 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
videoencoder: Add support for dynamic framerate and latency (4.88 KB, patch)
2012-05-09 15:57 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
x264enc: Don't set latency while holding object lock (3.79 KB, text/plain)
2012-05-09 16:05 UTC, Nicolas Dufresne (ndufresne)
  Details

Description Nicolas Dufresne (ndufresne) 2012-05-09 15:53:00 UTC
Currently, live src like v4l2src (many uvc cameras) dynamically change (reduce) the framerate to compensate for lower ambiant light. In a live pipeline, this has the effect of increasing the effective latency. This is because most encoders have a latency in frames, but exposes that latency in time. When the framerate dynamically changes, the latency is not increased. This can be solve in the base class by monitoring the effective latency time (time duration of the buffered frames). This will not prevent some of the buffer to be late and dropped, but will at least allow the pipeline to exit the recovery (1 fps) mode.

Some people have thought that this could be solved using videorate, but videorate does not operate in live mode. It will only produce frames when the next one arrive. videorate could expose it's latency to compensate, but duplicating frames is not very efficient.
Comment 1 Nicolas Dufresne (ndufresne) 2012-05-09 15:57:24 UTC
Created attachment 213743 [details] [review]
videoencoder: Remove done ToDo
Comment 2 Nicolas Dufresne (ndufresne) 2012-05-09 15:57:26 UTC
Created attachment 213744 [details] [review]
videoencoder: Remove trailing white space
Comment 3 Nicolas Dufresne (ndufresne) 2012-05-09 15:57:28 UTC
Created attachment 213745 [details] [review]
videoencoder: Port to GQueue
Comment 4 Nicolas Dufresne (ndufresne) 2012-05-09 15:57:31 UTC
Created attachment 213746 [details] [review]
videoencoder: Documentation fix
Comment 5 Nicolas Dufresne (ndufresne) 2012-05-09 15:57:33 UTC
Created attachment 213747 [details] [review]
videoencoder: Add support for dynamic framerate and latency

Most encoder know their latency in frames, but set it in time. This time
will vary with the framerate. This code will increase the latency if the
framerate is detected to be slower then expected, allowing the sink to exit
recovery mode.
Comment 6 Nicolas Dufresne (ndufresne) 2012-05-09 16:05:58 UTC
Created attachment 213748 [details]
x264enc: Don't set latency while holding object lock

This reverts commit 30a0b50e9ca0d625e61f994d4f8acd022dcddf38.
Comment 7 Nicolas Dufresne (ndufresne) 2012-05-09 16:07:04 UTC
Comment on attachment 213748 [details]
x264enc: Don't set latency while holding object lock

Sorry, wrong bug.
Comment 9 Nicolas Dufresne (ndufresne) 2012-07-16 19:11:07 UTC
Any comments about this patch ?
Comment 10 Edward Hervey 2014-04-15 06:31:33 UTC
Definitely sounds like something we'd want for 1.x also.

Note that videorate *should* also have a live mode, by which it uses timeouts/deadline to push again the current frame if it still hasn't got a new one before the configured latency (which could default to be 1 or 2 output frame durations).
Comment 11 Edward Hervey 2018-05-08 05:24:11 UTC
Nicolas, is this still valid ? Can you rebase your patches against master if so.
Comment 12 Nicolas Dufresne (ndufresne) 2018-05-08 13:44:12 UTC
I never forgot about this one, but also never got the time to revisit. I will try and rebase. The idea works, but I'm not sure it scales very well (e.g. if there is multiple encoders). A second opinion would be nice. It would also solve the fact the with 0/1 framerate none of the element reports latency, so live dynamic framerate does not work.
Comment 13 GStreamer system administrator 2018-11-03 11:21:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/66.