h264/h265parse: Fix handling of very last frame

Baseparse will never call us back on draining, so going into more: label will
cause the current frame to be discarded. So if we have a complete NAL, but not
a complete AU, make sure to terminate the frame properly.

This is a gression introduce by commit e88d848070 and
a194a87b26.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1208>
This commit is contained in:
Nicolas Dufresne 2020-04-22 17:53:39 -04:00 committed by GStreamer Merge Bot
parent 15365aba70
commit 0d637c14c5
2 changed files with 12 additions and 2 deletions

View file

@ -1546,8 +1546,13 @@ gst_h264_parse_handle_frame (GstBaseParse * parse,
/* expect at least 3 bytes start_code, and 1 bytes NALU header.
* the length of the NALU payload can be zero.
* (e.g. EOS/EOB placed at the end of an AU.) */
if (size - current_off < 4)
if (size - current_off < 4) {
/* Finish the frame if there is no more data in the stream */
if (drain)
break;
goto more;
}
}
end:

View file

@ -1341,8 +1341,13 @@ gst_h265_parse_handle_frame (GstBaseParse * parse,
/* expect at least 3 bytes start_code, and 2 bytes NALU header.
* the length of the NALU payload can be zero.
* (e.g. EOS/EOB placed at the end of an AU.) */
if (G_UNLIKELY (size - current_off < 5))
if (G_UNLIKELY (size - current_off < 5)) {
/* Finish the frame if there is no more data in the stream */
if (drain)
break;
goto more;
}
}
end: