mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
h264parse: Fix splitting of multiple NALU per buffer
Conversion to byte-stream/nal crashes without that because the baseparse frame of all NALUs is finished for the first NALU, then used again for parsing the second NALU. Just that now the buffer of the frame is already gone. Instead we create temporary frames for every NALU.
This commit is contained in:
parent
c4fbff50df
commit
1b747bfecb
1 changed files with 11 additions and 2 deletions
|
@ -714,12 +714,21 @@ gst_h264_parse_handle_frame_packetized (GstBaseParse * parse,
|
||||||
|
|
||||||
/* dispatch per NALU if needed */
|
/* dispatch per NALU if needed */
|
||||||
if (h264parse->split_packetized) {
|
if (h264parse->split_packetized) {
|
||||||
|
GstBaseParseFrame tmp_frame;
|
||||||
|
|
||||||
|
gst_base_parse_frame_init (&tmp_frame);
|
||||||
|
tmp_frame.flags |= frame->flags;
|
||||||
|
tmp_frame.offset = frame->offset;
|
||||||
|
tmp_frame.overhead = frame->overhead;
|
||||||
|
tmp_frame.buffer = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL,
|
||||||
|
nalu.offset, nalu.size);
|
||||||
|
|
||||||
/* note we don't need to come up with a sub-buffer, since
|
/* note we don't need to come up with a sub-buffer, since
|
||||||
* subsequent code only considers input buffer's metadata.
|
* subsequent code only considers input buffer's metadata.
|
||||||
* Real data is either taken from input by baseclass or
|
* Real data is either taken from input by baseclass or
|
||||||
* a replacement output buffer is provided anyway. */
|
* a replacement output buffer is provided anyway. */
|
||||||
gst_h264_parse_parse_frame (parse, frame);
|
gst_h264_parse_parse_frame (parse, &tmp_frame);
|
||||||
ret = gst_base_parse_finish_frame (parse, frame, nl + nalu.size);
|
ret = gst_base_parse_finish_frame (parse, &tmp_frame, nl + nalu.size);
|
||||||
left -= nl + nalu.size;
|
left -= nl + nalu.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue