mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
h265parser: Fix NAL size check for identification
Unlike H264, H265 requires 2 bytes after the start code to allow NAL identification. This would otherwise report a broken NAL and skip important data. Fixes #1287 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1251>
This commit is contained in:
parent
4332dc195d
commit
9029631f75
1 changed files with 7 additions and 0 deletions
|
@ -1414,6 +1414,13 @@ gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
|
|||
|
||||
nalu->sc_offset = offset + off1;
|
||||
|
||||
/* The scanner ensures one byte passed the start code but to
|
||||
* identify an HEVC NAL, we need 2. */
|
||||
if (size - nalu->sc_offset - 3 < 2) {
|
||||
GST_DEBUG ("Not enough bytes after start code to identify");
|
||||
return GST_H265_PARSER_NO_NAL;
|
||||
}
|
||||
|
||||
/* sc might have 2 or 3 0-bytes */
|
||||
if (nalu->sc_offset > 0 && data[nalu->sc_offset - 1] == 00)
|
||||
nalu->sc_offset--;
|
||||
|
|
Loading…
Reference in a new issue