summaryrefslogtreecommitdiff
path: root/ext/openh264/gstopenh264enc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openh264/gstopenh264enc.cpp')
-rw-r--r--ext/openh264/gstopenh264enc.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp
index b8b80c491..103794197 100644
--- a/ext/openh264/gstopenh264enc.cpp
+++ b/ext/openh264/gstopenh264enc.cpp
@@ -1042,8 +1042,13 @@ gst_openh264enc_handle_frame (GstVideoEncoder * encoder,
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);
- if (nal_type == NAL_SPS || nal_type == NAL_PPS)
- gst_buffer_fill (hdr, nal_offset, frame_info.sLayerInfo[i].pBsBuf, frame_info.sLayerInfo[i].pNalLengthInByte[j]);
+ /* 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, gst_buffer_ref (hdr));
}