h264parse: fix regression in output buffer timestamping
Specifically, properly mark a buffer (NALU or AU) to start a frame or not.
This commit is contained in:
parent
e2da34e6b6
commit
997ec65cdf
@ -1453,7 +1453,7 @@ gst_h264_parse_push_nal (GstH264Parse * h264parse, GstBuffer * nal,
|
|||||||
guint8 *data;
|
guint8 *data;
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
guint outsize, size, nal_length = h264parse->nal_length_size;
|
guint outsize, size, nal_length = h264parse->nal_length_size;
|
||||||
gboolean start = h264parse->picture_start;
|
gboolean start;
|
||||||
gboolean complete;
|
gboolean complete;
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (nal);
|
data = GST_BUFFER_DATA (nal);
|
||||||
@ -1466,6 +1466,8 @@ gst_h264_parse_push_nal (GstH264Parse * h264parse, GstBuffer * nal,
|
|||||||
nal_type = data[nal_length] & 0x1f;
|
nal_type = data[nal_length] & 0x1f;
|
||||||
GST_LOG_OBJECT (h264parse, "nal type: %d", nal_type);
|
GST_LOG_OBJECT (h264parse, "nal type: %d", nal_type);
|
||||||
h264parse->picture_start |= (nal_type == 1 || nal_type == 2 || nal_type == 5);
|
h264parse->picture_start |= (nal_type == 1 || nal_type == 2 || nal_type == 5);
|
||||||
|
/* first_mb_in_slice == 0 considered start of frame */
|
||||||
|
start = h264parse->picture_start && (data[nal_length + 1] & 0x80);
|
||||||
if (G_UNLIKELY (!next_nal)) {
|
if (G_UNLIKELY (!next_nal)) {
|
||||||
complete = TRUE;
|
complete = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -1545,13 +1547,16 @@ gst_h264_parse_push_nal (GstH264Parse * h264parse, GstBuffer * nal,
|
|||||||
outbuf = gst_adapter_take_buffer (h264parse->picture_adapter, outsize);
|
outbuf = gst_adapter_take_buffer (h264parse->picture_adapter, outsize);
|
||||||
outbuf = gst_buffer_make_metadata_writable (outbuf);
|
outbuf = gst_buffer_make_metadata_writable (outbuf);
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||||
|
|
||||||
|
/* AU always starts a frame */
|
||||||
|
start = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
outbuf = gst_h264parse_write_nal_prefix (h264parse, nal);
|
outbuf = gst_h264parse_write_nal_prefix (h264parse, nal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_start)
|
if (_start)
|
||||||
*_start = (h264parse->picture_start != start);
|
*_start = start;
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
@ -1740,9 +1745,6 @@ gst_h264_parse_chain_forward (GstH264Parse * h264parse, gboolean discont,
|
|||||||
if (!outbuf) {
|
if (!outbuf) {
|
||||||
/* no complete unit yet, go for next round */
|
/* no complete unit yet, go for next round */
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
if (h264parse->merge)
|
|
||||||
start = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore upstream dts that stalls or goes backward. Upstream elements
|
/* Ignore upstream dts that stalls or goes backward. Upstream elements
|
||||||
|
Loading…
x
Reference in New Issue
Block a user