GNOME Bugzilla – Bug 797292
mpegts: support for JPEG 2000 is broken
Last modified: 2018-11-03 14:36:24 UTC
The following pipeline used to work: $ gst-launch-1.0 -v videotestsrc ! openjpegenc ! jpeg2000parse ! mpegtsmux ! tsdemux ! jpeg2000parse ! openjpegdec ! videoconvert ! ximagesink Now, with gst-plugins-bad master and OpenJPEG master, I get these errors: :00:00.076905409 26973 0x194c0a0 ERROR tsdemux tsdemux.c:2795:parse_jp2k_access_unit: Required size (23237) greater than remaining size in buffer (23229) 0:00:00.076924988 26973 0x194c0a0 ERROR tsdemux tsdemux.c:2807:parse_jp2k_access_unit: Failed to parse JP2K access unit
Whoever fixes this should add a jpeg2000 to gat-validate to prevent further regression.
Reference bug: https://bugzilla.gnome.org/show_bug.cgi?id=753323
Annex S of this doc describes J2K elementary stream header: https://www.itu.int/rec/T-REC-H.222.0-201206-S/en
mpegtsmux_prepare_jpeg2000 receives an input J2K buffer of size X, and adds an elsm header of size 38, to create a buffer of size X+38. However, the buffer that tsdemux receives has a header of size 46, which triggers an error. If I comment out the code that triggers an error, then the video displays correctly.
So, there are 8 more bytes in the demux header.
Actually, the header size is the same for both mux and demux, but the demux payload is 8 bytes shorted than the mux payload.
So, the problem is: for the very first (preroll) frame, the payload J2K buffer is shifted to the right by 8 bytes, so that the last 8 bytes are missing. This triggers an error condition in the code.
-- 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-bad/issues/802.