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 668381 - [h264parse] [codecparsers] SEI parsing fails when payload contains emulation_prevention_three_byte
[h264parse] [codecparsers] SEI parsing fails when payload contains emulation_...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-20 23:17 UTC by Jonas Larsson
Modified: 2012-02-15 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing suggested fix (919 bytes, patch)
2012-01-20 23:17 UTC, Jonas Larsson
committed Details | Review
First few NALs from a stream that is incorrectly parsed (1.77 KB, application/octet-stream)
2012-01-20 23:17 UTC, Jonas Larsson
  Details

Description Jonas Larsson 2012-01-20 23:17:20 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.
Comment 1 Jonas Larsson 2012-01-20 23:17:56 UTC
Created attachment 205739 [details]
First few NALs from a stream that is incorrectly parsed
Comment 2 Jonas Larsson 2012-01-20 23:29:16 UTC
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)
Comment 3 Mark Nauwelaerts 2012-02-15 14:12:26 UTC
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.