h264parse: When input alignment=AU, always drain each packet.

If the input alignment claims AU alignment, each received
buffer should contain a complete video frame, so never hold over parts
of buffers for later processing. Also reduces latency, as packets
are parsed/converted and output immediately instead of 1 buffer
later.

Fixes a problem where an (arguably disallowed) padding byte on the
end of a buffer is detected as an extra byte in the following
start code, and messes up the timestamping that should apply to
that start code.
This commit is contained in:
Jan Schmidt 2016-05-10 03:32:59 +10:00
parent afc0136137
commit 92e7e3a3bf
2 changed files with 8 additions and 1 deletions

View file

@ -1086,7 +1086,9 @@ gst_h264_parse_handle_frame (GstBaseParse * parse,
GST_LOG_OBJECT (h264parse, "resuming frame parsing");
}
drain = GST_BASE_PARSE_DRAINING (parse);
/* Always consume the entire input buffer when in_align == ALIGN_AU */
drain = GST_BASE_PARSE_DRAINING (parse)
|| h264parse->in_align == GST_H264_PARSE_ALIGN_AU;
nonext = FALSE;
current_off = h264parse->current_off;
@ -1918,6 +1920,8 @@ gst_h264_parse_get_timestamp (GstH264Parse * h264parse,
g_return_if_fail (out_ts != NULL);
upstream = *out_ts;
GST_LOG_OBJECT (h264parse, "Upstream ts %" GST_TIME_FORMAT,
GST_TIME_ARGS (upstream));
if (!frame) {
GST_LOG_OBJECT (h264parse, "no frame data -> 0 duration");
@ -2611,6 +2615,8 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
h264parse->packetized = TRUE;
}
h264parse->in_align = align;
return TRUE;
/* ERRORS */

View file

@ -71,6 +71,7 @@ struct _GstH264Parse
/* state */
GstH264NalParser *nalparser;
guint state;
guint in_align;
guint align;
guint format;
gint current_off;