h264parse->frame_start = FALSE;
h264parse->have_sps_in_frame = FALSE;
h264parse->have_pps_in_frame = FALSE;
+ h264parse->have_aud_in_frame = FALSE;
gst_adapter_clear (h264parse->frame_out);
}
if (pres != GST_H264_PARSER_OK)
return FALSE;
h264parse->aud_needed = FALSE;
+ h264parse->have_aud_in_frame = TRUE;
break;
default:
/* drop anything before the initial SPS */
parse_res = gst_h264_parser_identify_nalu_avc (h264parse->nalparser,
map.data, 0, map.size, nl, &nalu);
- /* there is no AUD in AVC, always enable insertion, the pre_push function
- * will only add it once, and will only add it for byte-stream output. */
+ /* Always enable AUD insertion per frame here. The pre_push function
+ * will only add it once, and will only add it for byte-stream output
+ * if AUD doesn't exist in the current frame */
h264parse->aud_insert = TRUE;
while (parse_res == GST_H264_PARSER_OK) {
/* In case of byte-stream, insert au delimiter by default
* if it doesn't exist */
- if (h264parse->aud_insert && h264parse->format == GST_H264_PARSE_FORMAT_BYTE) {
+ if (h264parse->aud_insert && !h264parse->have_aud_in_frame &&
+ h264parse->format == GST_H264_PARSE_FORMAT_BYTE) {
GST_DEBUG_OBJECT (h264parse, "Inserting AUD into the stream.");
if (h264parse->align == GST_H264_PARSE_ALIGN_AU) {
GstMemory *mem =
gboolean have_sps_in_frame;
gboolean have_pps_in_frame;
+ /* per frame AU Delimiter check used when in_format == avc or avc3 */
+ gboolean have_aud_in_frame;
+
+ /* tracing state whether h264parse needs to insert AUD or not.
+ * Used when in_format == byte-stream */
+ gboolean aud_needed;
+
+ /* For insertion of AU Delimiter */
+ gboolean aud_insert;
+
gboolean first_frame;
/* collected SPS and PPS NALUs */
GstVideoMultiviewFlags multiview_flags;
gboolean first_in_bundle;
- /* For insertion of AU Delimiter */
- gboolean aud_needed;
- gboolean aud_insert;
-
GstVideoParseUserData user_data;
GstVideoMasteringDisplayInfo mastering_display_info;