GNOME Bugzilla – Bug 779088
videoencoder: produces incorrect dts with vtenc, when crossing segment boundary
Last modified: 2018-11-03 11:54:52 UTC
This bug is subtle and involves segment boundaries: GstVideoEncoderBase, if dts == -1, will attempt to set it to a sane value. In one case, it picks the "lowest unsent PTS". However, consider the case where there are e.g. 2 outstanding frames: one from one segment and another in a different segment. You cannot compare the PTS of these frames without factoring in the segment base. However, the code does not do that at all: https://github.com/GStreamer/gst-plugins-base/blob/master/gst-libs/gst/video/gstvideoencoder.c#L2114
Just for additional context, input to vtenc is something like this (conceptually): SEGMENT event, start=0s, base=0s, ... ... BUFFER pts=14.7s BUFFER pts=14.8s BUFFER pts=14.9s SEGMENT event, start=0s, base=15s, ... BUFFER pts=0.0s BUFFER pts=0.1s ...
I guess a quick hack would be to drain the encoder on new segments, but I don't like much this solution, since it will introduce spurious keyframes. Maybe we should also store the stream-time and search in stream-time ?
-- 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/339.