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 652155 - [ffmpegdec] generates invalid timestamps for audio streams
[ffmpegdec] generates invalid timestamps for audio streams
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-libav
git master
Other All
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-06-09 00:22 UTC by Matej Knopp
Modified: 2012-04-30 21:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple patch (1023 bytes, patch)
2011-06-09 00:22 UTC, Matej Knopp
rejected Details | Review
Patch to use input timestamps only at the beginning (1.05 KB, patch)
2011-06-09 04:56 UTC, Matej Knopp
rejected Details | Review

Description Matej Knopp 2011-06-09 00:22:31 UTC
Created attachment 189509 [details] [review]
Simple patch

(Note, this only concerns audio decoding)

gstffmpegdec uses input buffer timestamp for output if the timestamp is valid (gst_ffmpegdec_audio_frame), but that's not always correct because AVCodecParser has internal buffer, so the actual data on the output might be coming from buffer that has been read in previous iterations. Simple patch attached.
Comment 1 Matej Knopp 2011-06-09 04:08:29 UTC
Actually, the patch doesn't fix the problem. The input buffer TS and duration do not map well to output TS and duration for audio streams. After decoding the output buffer can have different size than the input buffer.

It looks like perhaps the solution is only to use the input TS the beginning (and discontinuity) and just keep computing output timestamps.
Comment 2 Matej Knopp 2011-06-09 04:56:32 UTC
Created attachment 189523 [details] [review]
Patch to use input timestamps only at the beginning

The patch will use computed timestamps during the stream and use the timestamps from input only at the beginning or discontinuity. 

If the input buffer duration is different than the output buffer duration (seems to happen with all decoders I've tested) I don't see point of trying to pass the input timestamp to output as it won't really be valid.
Comment 3 David Schleef 2011-07-14 21:19:23 UTC
This is not how timestamps are supposed to work.  Timestamps can "wander around" what you might expect given the number of samples, without having discont flags set on buffers.  The audio sink will fix it up, more or less successfully.  So, the second patch is incorrect.

Bug report sounds valid, however.
Comment 4 Matej Knopp 2011-07-14 21:27:04 UTC
Well, thanks for the explanation but I'm still not sure how the timestamps are supposed to work in gstreamer then, because even if as you say the sink can currently fix them, some muxers that I've tried can't. Could you maybe explain the "wandering around" part some more? I know this can be fixed by a simple filter in the pipeline after the FFMpeg decoder and I plan to do that given that my patch got rejected, but before I do that I'd like to know if there is something significant that I'm missing regarding audio timestamps.
Comment 5 Matej Knopp 2012-04-30 21:05:50 UTC
Don't think this is relevant anymore.