GNOME Bugzilla – Bug 668381
[h264parse] [codecparsers] SEI parsing fails when payload contains emulation_prevention_three_byte
Last modified: 2012-02-15 14:12:43 UTC
Created attachment 205738 [details] [review] Patch implementing suggested fix gst_h264_parser_parse_sei in gst-libs/gst/codecparsers/gsth264parser.c : After SEI payloadType and payload_size are read, NalReader size is set to payload_size. There are comments to this assignment saying "Set the nal reader size properly". This is however not a properly set size. It assumes that the payload is not escaped with emulation_prevention_three_byte, but this is not always the case. When emulation_prevention_three_byte are present in the payload, more bytes than payload_size must be available, otherwise parsing will fail. I suggest setting of this "proper" size is removed as there is no way of knowing how many bytes must actually be read until we have payload_size bytes without scanning for emulation_prevention_three_byte in the payload. This is how it's done in legacyh264parse.
Created attachment 205739 [details] First few NALs from a stream that is incorrectly parsed
Note that bug 668380 prevents the SPS of the attached stream from being parsed. This bug shows up once that's fixed. gst-launch -v --gst-debug-level=2 filesrc location=t.264 ! h264parse ! fakesink WARN gst_h264_parser_parse_pic_timing: failed to read uint32, nbits: 24 WARN gst_h264_parser_parse_pic_timing: error parsing "Picture timing" This particular stream has one SEI with timing info for each frame, so we get two logged warnings per frame (== log spew)
Thanks, committed, on master: commit e373df2a973db5c4f99ead59565d2f4f7e8297a9 Author: Jonas Larsson <jonas@hallerud.se> Date: Wed Feb 15 15:07:35 2012 +0100 codecparsers: h264: fix SEI parsing ... in the presence of emulation_prevention_three_byte. Fixes #668381. and 0.10: commit 29b9b2c6d088f7be76c5ca642bed447830f34677 Author: Jonas Larsson <jonas@hallerud.se> Date: Wed Feb 15 15:07:35 2012 +0100 codecparsers: h264: fix SEI parsing ... in the presence of emulation_prevention_three_byte. Fixes #668381.