summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2021-04-20 20:04:33 +0100
committerTim-Philipp Müller <tim@centricular.com>2021-08-24 23:42:27 +0100
commit67a49be61fadaf264daf08619d66e92d86d9a333 (patch)
treef9bc53748d291545a920dcc9509a1c729cbd1fac /ext
parent90c1732849c0233dd428d578ebbc481c23a36f4d (diff)
downloadgstreamer-plugins-bad-67a49be61fadaf264daf08619d66e92d86d9a333.tar.gz
openh264enc: fix broken header AU emission by base class
This encoder advertises alignment=au as output format, which means each output frame should contain a full decodable access unit. The video encoder base class is not aware of our output alignment and will output spurious buffers with just the SPS/PPS inside when we call gst_video_encoder_set_headers(), which is broken because each buffer is supposed to contain a full decodable access unit in our case. Just don't tell the base class about our headers, they will be sent at the beginning of each IDR frame anyway. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2178>
Diffstat (limited to 'ext')
-rw-r--r--ext/openh264/gstopenh264enc.cpp25
1 files changed, 0 insertions, 25 deletions
diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp
index 502eca92c..30af8e267 100644
--- a/ext/openh264/gstopenh264enc.cpp
+++ b/ext/openh264/gstopenh264enc.cpp
@@ -885,7 +885,6 @@ gst_openh264enc_handle_frame (GstVideoEncoder * encoder,
gfloat fps;
gint i, j;
gsize buf_length = 0;
- GList* headers = NULL;
GST_OBJECT_LOCK (openh264enc);
@@ -1034,34 +1033,10 @@ gst_openh264enc_handle_frame (GstVideoEncoder * encoder,
for (j = 0; j < frame_info.sLayerInfo[i].iNalCount; j++) {
layer_size += frame_info.sLayerInfo[i].pNalLengthInByte[j];
}
- /* detect header with NON_VIDEO_CODING_LAYER and fill headers list */
- if (frame_info.sLayerInfo[i].uiLayerType == NON_VIDEO_CODING_LAYER) {
- int nal_type;
- gint nal_offset = 0;
- GstBuffer* hdr = gst_buffer_new_and_alloc (layer_size);
- GST_BUFFER_FLAG_SET (hdr, GST_BUFFER_FLAG_HEADER);
- for (j = 0; j < frame_info.sLayerInfo[i].iNalCount; j++) {
- if (j > 0)
- nal_offset = nal_offset + frame_info.sLayerInfo[i].pNalLengthInByte[j-1];
- nal_type = ((* (frame_info.sLayerInfo[i].pBsBuf + nal_offset + 4)) & 0x1f);
- /* Note: This only works if SPS/PPS are the first two NALs in which case
- * nal_offset is the same for both the output and the bitstream buffer */
- if (nal_type == NAL_SPS || nal_type == NAL_PPS) {
- gst_buffer_fill (hdr, nal_offset,
- frame_info.sLayerInfo[i].pBsBuf + nal_offset,
- frame_info.sLayerInfo[i].pNalLengthInByte[j]);
- }
- }
- headers = g_list_append (headers, hdr); /* take ownership of hdr */
- }
gst_buffer_fill (frame->output_buffer, buf_length, frame_info.sLayerInfo[i].pBsBuf, layer_size);
buf_length += layer_size;
}
- /*Set headers from the frame_info*/
- if (headers)
- gst_video_encoder_set_headers (encoder, headers);
-
GST_LOG_OBJECT (openh264enc, "openh264 picture %scoded OK!",
(ret != cmResultSuccess) ? "NOT " : "");