mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
h264parse: also consider nal_length_size when inserting codec data
See #676174.
This commit is contained in:
parent
6e78920416
commit
7f72b99426
1 changed files with 9 additions and 3 deletions
|
@ -1577,6 +1577,7 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
|||
GstByteWriter bw;
|
||||
GstBuffer *new_buf;
|
||||
const gboolean bs = h264parse->format == GST_H264_PARSE_FORMAT_BYTE;
|
||||
const gint nls = 4 - h264parse->nal_length_size;
|
||||
gboolean ok;
|
||||
|
||||
gst_byte_writer_init_with_size (&bw, gst_buffer_get_size (buffer),
|
||||
|
@ -1587,7 +1588,10 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
|||
if ((codec_nal = h264parse->sps_nals[i])) {
|
||||
gsize nal_size = gst_buffer_get_size (codec_nal);
|
||||
GST_DEBUG_OBJECT (h264parse, "inserting SPS nal");
|
||||
ok &= gst_byte_writer_put_uint32_be (&bw, bs ? 1 : nal_size);
|
||||
ok &= gst_byte_writer_put_uint32_be (&bw,
|
||||
bs ? 1 : (nal_size << (nls * 8)));
|
||||
ok &= gst_byte_writer_set_pos (&bw,
|
||||
gst_byte_writer_get_pos (&bw) - nls);
|
||||
ok &= gst_byte_writer_put_buffer (&bw, codec_nal, 0, nal_size);
|
||||
h264parse->last_report = new_ts;
|
||||
}
|
||||
|
@ -1596,8 +1600,10 @@ gst_h264_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
|||
if ((codec_nal = h264parse->pps_nals[i])) {
|
||||
gsize nal_size = gst_buffer_get_size (codec_nal);
|
||||
GST_DEBUG_OBJECT (h264parse, "inserting PPS nal");
|
||||
ok &= gst_byte_writer_put_uint32_be (&bw, bs ? 1 : nal_size);
|
||||
ok &= gst_byte_writer_put_buffer (&bw, codec_nal, 0, nal_size);
|
||||
ok &= gst_byte_writer_put_uint32_be (&bw,
|
||||
bs ? 1 : (nal_size << (nls * 8)));
|
||||
ok &= gst_byte_writer_set_pos (&bw,
|
||||
gst_byte_writer_get_pos (&bw) - nls);
|
||||
h264parse->last_report = new_ts;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue