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 664123 - [h264parse] Conversion from AVC to byte stream fails for nal_length_size != 4
[h264parse] Conversion from AVC to byte stream fails for nal_length_size != 4
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: 2011-11-15 16:33 UTC by Jonas Larsson
Modified: 2011-11-16 10:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to force memcpy dst offset to 4 for avc-> byte-stream wrapping (940 bytes, patch)
2011-11-15 16:33 UTC, Jonas Larsson
committed Details | Review

Description Jonas Larsson 2011-11-15 16:33:38 UTC
Created attachment 201455 [details] [review]
Patch to force memcpy dst offset to 4 for avc-> byte-stream wrapping

Sample clip
http://dl.dropbox.com/u/27392332/content/3G2/H264_AAC/H264_352x240_15fps_0300kbps_AAC-HE_096kbps_44khz_ST.3g2

gst-launch filesrc location=H264_352x240_15fps_0300kbps_AAC-HE_096kbps_44khz_ST.3g2 ! qtdemux ! h264parse ! fakesink

ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: No valid frames found before end of stream

The reason can be found in gst_h264_parse_wrap_nal
Here a new buffer is allocated and filled with the byte-stream start code (0x00000001), then the original buffer is memcpyd into the new buffer with starting offset h264parse->nal_length_size.

In the sample clip and many others, nal_length_size != 4 . In this case it's 2. That is, the last two bytes of the written start code is overwritten so later on it can't sync to the stream. No frames are detected.

When wrapping the nal avc -> byte-stream, always write the start code and put the nal after it regardless of nal_length_size.
Comment 1 Mark Nauwelaerts 2011-11-16 10:05:38 UTC
Thanks, committed.

commit 5099ff23afb85539fa0f226598b358547c00fc27
Author: Jonas Larsson <jonas@hallerud.se>
Date:   Wed Nov 16 10:56:24 2011 +0100

    h264parse: outgoing byte stream prefix always has size 4
    
    Fixes #664123.