av1parse: Don't immediatly reset timestamp in presence of TD

When a TD is being processed, it is not always pushed immediatly. Resetting
the time information lead to lost of timestamp in TU to Frame conversion. The
TU would be formed by buffer of [TD][Frame], and the timestamp taken from
the TU buffer was lost then the TD was handled.

The handling of TS should be entirely done by the 3 functions:

- gst_av1_parse_handle_obu_to_obu() (direct input to output)
- gst_av1_parse_handle_to_big_align() Reset DTS on detected TU or TD
- gst_av1_parse_handle_to_small_and_equal_align() PTS on show frame, flat DTS

Fixes: 79312357a6
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8026>
This commit is contained in:
Nicolas Dufresne 2024-12-02 11:32:13 -05:00 committed by GStreamer Marge Bot
parent c79f83f4ec
commit 98d40251d8

View file

@ -1593,7 +1593,6 @@ gst_av1_parse_handle_one_obu (GstAV1Parse * self, GstAV1OBU * obu,
start a TU. We only check TD here. */
if (obu->obu_type == GST_AV1_OBU_TEMPORAL_DELIMITER) {
gst_av1_parse_reset_obu_data_state (self);
gst_av1_parse_reset_tu_timestamp (self);
if (check_new_tu) {
*check_new_tu = TRUE;
@ -1950,21 +1949,16 @@ again:
if (res != GST_AV1_PARSER_OK)
break;
/* Take the DTS from the first OBU of the TU */
if (!GST_CLOCK_TIME_IS_VALID (self->buffer_dts))
self->buffer_dts = GST_BUFFER_DTS (buffer);
check_new_tu = FALSE;
if (self->align == GST_AV1_PARSE_ALIGN_TEMPORAL_UNIT
|| self->align == GST_AV1_PARSE_ALIGN_TEMPORAL_UNIT_ANNEX_B) {
res = gst_av1_parse_handle_one_obu (self, &obu, &frame_complete,
&check_new_tu);
} else {
res = gst_av1_parse_handle_one_obu (self, &obu, &frame_complete, NULL);
}
res = gst_av1_parse_handle_one_obu (self, &obu, &frame_complete,
&check_new_tu);
if (res != GST_AV1_PARSER_OK)
break;
/* Take the DTS from the first OBU of the TU */
if (!GST_CLOCK_TIME_IS_VALID (self->buffer_dts) || check_new_tu)
self->buffer_dts = GST_BUFFER_DTS (buffer);
if (check_new_tu && (gst_adapter_available (self->cache_out) ||
gst_adapter_available (self->frame_cache))) {
complete = TRUE;