Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets
@ 2024-03-01 13:39 Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame Nicolas Gaullier
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

This is the following of https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10843

The file submited by Michael highlighted 3 different and independent issues I missed in the first version:
- some corrupt mpegts files are missing the zero_byte at the NAL, but a "full" NAL start including the zero_byte
can be found just afterwards, so they can be identified. In some cases, there might be a terminal null byte
at the end of the previous frame and thus it is "borrowed" by current code to form a complete, full NAL start: 
in such a case, the fix fetch_timestamp now get the pts of the previous pes, which is not expected.
So, I've added a h264_parser patch (new patch 4)
- the index may be negative even for the very first packet, despite pointing to no data, so
I've added the "!s->frame_offset" condition to enable the "fetch timestamp in the past" patch
- the mpegts demuxer has a "split packets" logic according to its max_packet_size, and in my understanding,
the behavious of the current code does not look good, the cur_frame_arrays are fed with kind of "empty entries",
which now raises an issue because some "past entries" are required to get proper timestamps from the previous frame,
so this had to be fixed (new patch 1) : the entries of the splited packets should be merged to get consistent entries

Patch 3: I forced the AVCodecParserContext offset to be positive.
Patch 5: unchanged. Still not sure whether this patch is somewhat "required", "useless", or "bad".

What possibly remains: as seen with some h264 broken streams in the wild, there might be other broken stream issues (hevc?).
If such issues currently exists (but currently with no serious effect), there would be a regression in the PTS/DTS values.
So any testing with corrupt streams beyond h264 is wellcome to see if other parsers require a fix (say a hack).

For remembering, sample files and cover letter of the first version:
https://ffmpeg.org/pipermail/ffmpeg-devel/2024-February/321819.html

Nicolas Gaullier (5):
  avcodec/parser: merge packets from the same frame
  avcodec/parser: reindent after previous commit
  avcodec/parser: fix fetch_timestamp in a scenario with unaligned
    packets
  avcodec/h264_parser: fix start of packet for some broken streams
  lavf/demux: duplicate side_data in parse_packet()

 libavcodec/h264_parser.c                      |  11 +-
 libavcodec/parser.c                           |  29 ++--
 libavformat/demux.c                           |  23 ++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +++++++++---------
 tests/ref/fate/ts-demux                       |   8 +-
 5 files changed, 131 insertions(+), 104 deletions(-)

-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
  2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
@ 2024-03-01 13:39 ` Nicolas Gaullier
  2024-03-03 22:06   ` Michael Niedermayer
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 2/5] avcodec/parser: reindent after previous commit Nicolas Gaullier
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

The mpegts demuxer splits packets according to its max_packet_size.
This currently fills the AVCodecParserContext s->cur_frame_* arrays with
kind of 'empty' entries: no pts/dts.
This patch merges these entries, so the parser behaviour is independent
from the demuxer settings.
This patch is required for the following patch which will fetch 'past'
timestamps from past cur_frames.

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 libavcodec/parser.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index efc28b8918..249f81d4bb 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -142,6 +142,7 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
         memset(dummy_buf, 0, sizeof(dummy_buf));
         buf = dummy_buf;
     } else if (s->cur_offset + buf_size != s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
+        if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 || pts != AV_NOPTS_VALUE ) {
         /* add a new packet descriptor */
         i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
         s->cur_frame_start_index = i;
@@ -150,6 +151,9 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
         s->cur_frame_pts[i]      = pts;
         s->cur_frame_dts[i]      = dts;
         s->cur_frame_pos[i]      = pos;
+        } else {
+            s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + buf_size;
+        }
     }
 
     if (s->fetch_timestamp) {
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/5] avcodec/parser: reindent after previous commit
  2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame Nicolas Gaullier
@ 2024-03-01 13:39 ` Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 libavcodec/parser.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 249f81d4bb..ede9e7e8b4 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -143,14 +143,14 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
         buf = dummy_buf;
     } else if (s->cur_offset + buf_size != s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
         if (pos != s->cur_frame_pos[s->cur_frame_start_index] || pos <= 0 || pts != AV_NOPTS_VALUE ) {
-        /* add a new packet descriptor */
-        i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
-        s->cur_frame_start_index = i;
-        s->cur_frame_offset[i]   = s->cur_offset;
-        s->cur_frame_end[i]      = s->cur_offset + buf_size;
-        s->cur_frame_pts[i]      = pts;
-        s->cur_frame_dts[i]      = dts;
-        s->cur_frame_pos[i]      = pos;
+            /* add a new packet descriptor */
+            i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
+            s->cur_frame_start_index = i;
+            s->cur_frame_offset[i]   = s->cur_offset;
+            s->cur_frame_end[i]      = s->cur_offset + buf_size;
+            s->cur_frame_pts[i]      = pts;
+            s->cur_frame_dts[i]      = dts;
+            s->cur_frame_pos[i]      = pos;
         } else {
             s->cur_frame_end[s->cur_frame_start_index] = s->cur_offset + buf_size;
         }
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets
  2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 2/5] avcodec/parser: reindent after previous commit Nicolas Gaullier
@ 2024-03-01 13:39 ` Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 4/5] avcodec/h264_parser: fix start of packet for some broken streams Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet() Nicolas Gaullier
  4 siblings, 0 replies; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

Fix fetch_timestamp when the frame start is in a previous packet.

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 libavcodec/parser.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index ede9e7e8b4..e4e9fbf48f 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -102,7 +102,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove, int fuzzy)
                 s->dts    = s->cur_frame_dts[i];
                 s->pts    = s->cur_frame_pts[i];
                 s->pos    = s->cur_frame_pos[i];
-                s->offset = s->next_frame_offset - s->cur_frame_offset[i];
+                s->offset = FFMAX( 0, s->next_frame_offset - s->cur_frame_offset[i]);
             }
             if (remove)
                 s->cur_frame_offset[i] = INT64_MAX;
@@ -157,11 +157,11 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
     }
 
     if (s->fetch_timestamp) {
-        s->fetch_timestamp = 0;
         s->last_pts        = s->pts;
         s->last_dts        = s->dts;
         s->last_pos        = s->pos;
-        ff_fetch_timestamp(s, 0, 0, 0);
+        ff_fetch_timestamp(s, FFMIN(s->fetch_timestamp, 0), 0, 0);
+        s->fetch_timestamp = 0;
     }
     /* WARNING: the returned index can be negative */
     index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
@@ -178,12 +178,13 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
 
     /* update the file pointer */
     if (*poutbuf_size) {
+        s->fetch_timestamp   = index >= 0 || !s->frame_offset ? 1 : index;
+
         /* fill the data for the current frame */
         s->frame_offset = s->next_frame_offset;
 
         /* offset of the next frame */
         s->next_frame_offset = s->cur_offset + index;
-        s->fetch_timestamp   = 1;
     } else {
         /* Don't return a pointer to dummy_buf. */
         *poutbuf = NULL;
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2 4/5] avcodec/h264_parser: fix start of packet for some broken streams
  2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
                   ` (2 preceding siblings ...)
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
@ 2024-03-01 13:39 ` Nicolas Gaullier
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet() Nicolas Gaullier
  4 siblings, 0 replies; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 libavcodec/h264_parser.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 94cfbc481e..6b721ec253 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -124,7 +124,16 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
             if (nalu_type == H264_NAL_SEI || nalu_type == H264_NAL_SPS ||
                 nalu_type == H264_NAL_PPS || nalu_type == H264_NAL_AUD) {
                 if (pc->frame_start_found) {
-                    i++;
+                    /* Some streams in the wild are missing the zero_byte at the NAL_AUD:
+                     * it is following just afterwards.
+                     * To avoid any accidental borrowing of a byte in the previous frame
+                     * (which would return a negative index and indicate that fetch_timestamps
+                     * has to get the pts from the previous frame),
+                     * better have the start of packet strictly aligned.
+                     * To make it a more general rule, just test the following three bytes are null.
+                     */
+                    i += 1 + (!p->is_avc && state == 5 && i == 3 && nalu_type == H264_NAL_AUD &&
+                        buf_size >= 9 && !AV_RB24(buf + 5));
                     goto found;
                 }
             } else if (nalu_type == H264_NAL_SLICE || nalu_type == H264_NAL_DPA ||
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet()
  2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
                   ` (3 preceding siblings ...)
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 4/5] avcodec/h264_parser: fix start of packet for some broken streams Nicolas Gaullier
@ 2024-03-01 13:39 ` Nicolas Gaullier
  2024-03-01 13:49   ` James Almer
  4 siblings, 1 reply; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-01 13:39 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Nicolas Gaullier

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
---
 libavformat/demux.c                           |  23 ++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +++++++++---------
 tests/ref/fate/ts-demux                       |   8 +-
 3 files changed, 104 insertions(+), 91 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 2e1d0ed66d..722bb35c4c 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1186,7 +1186,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
     FFStream *const sti = ffstream(st);
     const uint8_t *data = pkt->data;
     int size = pkt->size;
-    int ret = 0, got_output = flush;
+    int ret = 0, got_output = flush, pkt_side_data_consumed = 0;
 
     if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
         // preserve 0-size sync packets
@@ -1231,10 +1231,19 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
         }
 
         if (pkt->side_data) {
-            out_pkt->side_data       = pkt->side_data;
-            out_pkt->side_data_elems = pkt->side_data_elems;
-            pkt->side_data          = NULL;
-            pkt->side_data_elems    = 0;
+            if (!pkt_side_data_consumed) {
+                out_pkt->side_data       = pkt->side_data;
+                out_pkt->side_data_elems = pkt->side_data_elems;
+                pkt_side_data_consumed = 1;
+            } else for (int i = 0; i < pkt->side_data_elems; i++) {
+                const AVPacketSideData *const src_sd = &pkt->side_data[i];
+                uint8_t *dst_data = av_packet_new_side_data(out_pkt, src_sd->type, src_sd->size);
+                if (!dst_data) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
+                memcpy(dst_data, src_sd->data, src_sd->size);
+            }
         }
 
         /* set the duration */
@@ -1286,6 +1295,10 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
     }
 
 fail:
+    if (pkt_side_data_consumed) {
+        pkt->side_data          = NULL;
+        pkt->side_data_elems    = 0;
+    }
     if (ret < 0)
         av_packet_unref(out_pkt);
     av_packet_unref(pkt);
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 548cab01c6..ee49e331f3 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -7,19 +7,19 @@ video|1|18982|0.210911|15382|0.170911|3600|0.040000|13092|84788|___|MPEGTS Strea
 video|1|22582|0.250911|18982|0.210911|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
 video|1|26182|0.290911|22582|0.250911|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
 audio|0|0|0.000000|0|0.000000|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
-audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__
-audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__
-audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__
-audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__
-audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__
-audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__
-audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__
-audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__
-audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__
-audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__
-audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__
-audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__
-audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__
+audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|29782|0.330911|26182|0.290911|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
 video|1|33382|0.370911|29782|0.330911|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
 video|1|36982|0.410911|33382|0.370911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
@@ -31,35 +31,35 @@ video|1|54982|0.610911|51382|0.570911|3600|0.040000|13449|240640|___|MPEGTS Stre
 video|1|58582|0.650911|54982|0.610911|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
 video|1|62182|0.690911|58582|0.650911|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
 audio|0|32915|0.365722|32915|0.365722|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
-audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__
-audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__
-audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__
-audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__
-audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__
-audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__
-audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__
-audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__
-audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__
-audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__
-audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__
-audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__
-audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__
+audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|65782|0.730911|62182|0.690911|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
 video|1|69382|0.770911|65782|0.730911|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
 video|1|72982|0.810911|69382|0.770911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
 video|1|76582|0.850911|72982|0.810911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
 video|1|80182|0.890911|76582|0.850911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
 audio|0|65829|0.731433|65829|0.731433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
-audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__
-audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__
-audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__
-audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__
-audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__
-audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__
-audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__
-audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__
-audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__
-audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__
+audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|83782|0.930911|80182|0.890911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
 video|1|87382|0.970911|83782|0.930911|3600|0.040000|24711|361336|K__
 video|1|91964|1.021822|88364|0.981822|3600|0.040000|24801|564|K__|MPEGTS Stream ID|224
@@ -71,19 +71,19 @@ video|1|109964|1.221822|106364|1.181822|3600|0.040000|13092|84788|___|MPEGTS Str
 video|1|113564|1.261822|109964|1.221822|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
 video|1|117164|1.301822|113564|1.261822|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
 audio|0|90982|1.010911|90982|1.010911|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
-audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__
-audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__
-audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__
-audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__
-audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__
-audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__
-audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__
-audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__
-audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__
-audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__
-audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__
-audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__
-audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__
+audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|120764|1.341822|117164|1.301822|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
 video|1|124364|1.381822|120764|1.341822|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
 video|1|127964|1.421822|124364|1.381822|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
@@ -95,51 +95,51 @@ video|1|145964|1.621822|142364|1.581822|3600|0.040000|13449|240640|___|MPEGTS St
 video|1|149564|1.661822|145964|1.621822|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
 video|1|153164|1.701822|149564|1.661822|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
 audio|0|123897|1.376633|123897|1.376633|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
-audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__
-audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__
-audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__
-audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__
-audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__
-audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__
-audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__
-audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__
-audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__
-audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__
-audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__
-audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__
-audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__
+audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|156764|1.741822|153164|1.701822|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
 video|1|160364|1.781822|156764|1.741822|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
 video|1|163964|1.821822|160364|1.781822|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
 video|1|167564|1.861822|163964|1.821822|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
 video|1|171164|1.901822|167564|1.861822|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
 audio|0|156811|1.742344|156811|1.742344|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
-audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__
-audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__
-audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__
-audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__
-audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__
-audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__
-audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__
-audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__
-audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__
-audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__
+audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|174764|1.941822|171164|1.901822|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
 video|1|178364|1.981822|174764|1.941822|3600|0.040000|24711|361336|K__
 video|1|139582|1.550911|135982|1.510911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
 video|1|143182|1.590911|139582|1.550911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
 video|1|146782|1.630911|143182|1.590911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
 audio|0|132429|1.471433|132429|1.471433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
-audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__
-audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__
-audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__
-audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__
-audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__
-audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__
-audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__
-audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__
-audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__
-audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__
+audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
+audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
 video|1|150382|1.670911|146782|1.630911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
 video|1|153982|1.710911|150382|1.670911|3600|0.040000|24711|361336|K__
 video|1|161182|1.790911|157582|1.750911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index b01f525c38..4274a0e145 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -10,11 +10,11 @@ packet|codec_type=video|stream_index=0|pts=3912677354|pts_time=43474.192822|dts=
 packet|codec_type=video|stream_index=0|pts=3912683360|pts_time=43474.259556|dts=3912678855|dts_time=43474.209500|duration=1501|duration_time=0.016678|size=61720|pos=325240|flags=___|data_hash=CRC32:7e6594e5|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 packet|codec_type=video|stream_index=0|pts=3912680357|pts_time=43474.226189|dts=3912680357|dts_time=43474.226189|duration=1501|duration_time=0.016678|size=17416|pos=390852|flags=___|data_hash=CRC32:31c8b89d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 packet|codec_type=audio|stream_index=1|pts=3912633305|pts_time=43473.703389|dts=3912633305|dts_time=43473.703389|duration=2880|duration_time=0.032000|size=1536|pos=218080|flags=K__|data_hash=CRC32:25b60d38|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
-packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf
-packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d
+packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
+packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
 packet|codec_type=audio|stream_index=2|pts=3912634060|pts_time=43473.711778|dts=3912634060|dts_time=43473.711778|duration=2880|duration_time=0.032000|size=768|pos=235564|flags=K__|data_hash=CRC32:34b350c9|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
-packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8
-packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a
+packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
+packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
 packet|codec_type=video|stream_index=0|pts=3912681858|pts_time=43474.242867|dts=3912681858|dts_time=43474.242867|duration=1501|duration_time=0.016678|size=18144|pos=409464|flags=___|data_hash=CRC32:826f8e8e|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 packet|codec_type=video|stream_index=0|pts=3912687864|pts_time=43474.309600|dts=3912683360|dts_time=43474.259556|duration=1501|duration_time=0.016678|size=56848|pos=428640|flags=___|data_hash=CRC32:6b15be8c|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
 packet|codec_type=video|stream_index=0|pts=3912684861|pts_time=43474.276233|dts=3912684861|dts_time=43474.276233|duration=1501|duration_time=0.016678|size=16296|pos=489176|flags=___|data_hash=CRC32:911b1649|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
-- 
2.30.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet()
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet() Nicolas Gaullier
@ 2024-03-01 13:49   ` James Almer
  2024-03-01 13:54     ` James Almer
  0 siblings, 1 reply; 11+ messages in thread
From: James Almer @ 2024-03-01 13:49 UTC (permalink / raw)
  To: ffmpeg-devel

On 3/1/2024 10:39 AM, Nicolas Gaullier wrote:
> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
> ---
>   libavformat/demux.c                           |  23 ++-
>   tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +++++++++---------
>   tests/ref/fate/ts-demux                       |   8 +-
>   3 files changed, 104 insertions(+), 91 deletions(-)
> 
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index 2e1d0ed66d..722bb35c4c 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -1186,7 +1186,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
>       FFStream *const sti = ffstream(st);
>       const uint8_t *data = pkt->data;
>       int size = pkt->size;
> -    int ret = 0, got_output = flush;
> +    int ret = 0, got_output = flush, pkt_side_data_consumed = 0;
>   
>       if (!size && !flush && sti->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) {
>           // preserve 0-size sync packets
> @@ -1231,10 +1231,19 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
>           }
>   
>           if (pkt->side_data) {
> -            out_pkt->side_data       = pkt->side_data;
> -            out_pkt->side_data_elems = pkt->side_data_elems;
> -            pkt->side_data          = NULL;
> -            pkt->side_data_elems    = 0;
> +            if (!pkt_side_data_consumed) {

Can't you just check for out_pkt->side_data instead?

> +                out_pkt->side_data       = pkt->side_data;
> +                out_pkt->side_data_elems = pkt->side_data_elems;
> +                pkt_side_data_consumed = 1;
> +            } else for (int i = 0; i < pkt->side_data_elems; i++) {
> +                const AVPacketSideData *const src_sd = &pkt->side_data[i];
> +                uint8_t *dst_data = av_packet_new_side_data(out_pkt, src_sd->type, src_sd->size);
> +                if (!dst_data) {
> +                    ret = AVERROR(ENOMEM);
> +                    goto fail;
> +                }
> +                memcpy(dst_data, src_sd->data, src_sd->size);
> +            }
>           }
>   
>           /* set the duration */
> @@ -1286,6 +1295,10 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
>       }
>   
>   fail:
> +    if (pkt_side_data_consumed) {
> +        pkt->side_data          = NULL;
> +        pkt->side_data_elems    = 0;
> +    }
>       if (ret < 0)
>           av_packet_unref(out_pkt);
>       av_packet_unref(pkt);
> diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> index 548cab01c6..ee49e331f3 100644
> --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> @@ -7,19 +7,19 @@ video|1|18982|0.210911|15382|0.170911|3600|0.040000|13092|84788|___|MPEGTS Strea
>   video|1|22582|0.250911|18982|0.210911|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
>   video|1|26182|0.290911|22582|0.250911|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
>   audio|0|0|0.000000|0|0.000000|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
> -audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__
> -audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__
> -audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__
> -audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__
> -audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__
> -audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__
> -audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__
> -audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__
> -audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__
> -audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__
> -audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__
> -audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__
> -audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__
> +audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|29782|0.330911|26182|0.290911|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
>   video|1|33382|0.370911|29782|0.330911|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
>   video|1|36982|0.410911|33382|0.370911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
> @@ -31,35 +31,35 @@ video|1|54982|0.610911|51382|0.570911|3600|0.040000|13449|240640|___|MPEGTS Stre
>   video|1|58582|0.650911|54982|0.610911|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
>   video|1|62182|0.690911|58582|0.650911|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
>   audio|0|32915|0.365722|32915|0.365722|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
> -audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__
> -audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__
> -audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__
> -audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__
> -audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__
> -audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__
> -audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__
> -audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__
> -audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__
> -audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__
> -audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__
> -audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__
> -audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__
> +audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|65782|0.730911|62182|0.690911|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
>   video|1|69382|0.770911|65782|0.730911|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
>   video|1|72982|0.810911|69382|0.770911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>   video|1|76582|0.850911|72982|0.810911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>   video|1|80182|0.890911|76582|0.850911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>   audio|0|65829|0.731433|65829|0.731433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
> -audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__
> -audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__
> -audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__
> -audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__
> -audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__
> -audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__
> -audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__
> -audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__
> -audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__
> -audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__
> +audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|83782|0.930911|80182|0.890911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>   video|1|87382|0.970911|83782|0.930911|3600|0.040000|24711|361336|K__
>   video|1|91964|1.021822|88364|0.981822|3600|0.040000|24801|564|K__|MPEGTS Stream ID|224
> @@ -71,19 +71,19 @@ video|1|109964|1.221822|106364|1.181822|3600|0.040000|13092|84788|___|MPEGTS Str
>   video|1|113564|1.261822|109964|1.221822|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
>   video|1|117164|1.301822|113564|1.261822|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
>   audio|0|90982|1.010911|90982|1.010911|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
> -audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__
> -audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__
> -audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__
> -audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__
> -audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__
> -audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__
> -audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__
> -audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__
> -audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__
> -audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__
> -audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__
> -audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__
> -audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__
> +audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|120764|1.341822|117164|1.301822|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
>   video|1|124364|1.381822|120764|1.341822|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
>   video|1|127964|1.421822|124364|1.381822|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
> @@ -95,51 +95,51 @@ video|1|145964|1.621822|142364|1.581822|3600|0.040000|13449|240640|___|MPEGTS St
>   video|1|149564|1.661822|145964|1.621822|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
>   video|1|153164|1.701822|149564|1.661822|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
>   audio|0|123897|1.376633|123897|1.376633|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
> -audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__
> -audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__
> -audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__
> -audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__
> -audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__
> -audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__
> -audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__
> -audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__
> -audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__
> -audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__
> -audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__
> -audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__
> -audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__
> +audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|156764|1.741822|153164|1.701822|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
>   video|1|160364|1.781822|156764|1.741822|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
>   video|1|163964|1.821822|160364|1.781822|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>   video|1|167564|1.861822|163964|1.821822|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>   video|1|171164|1.901822|167564|1.861822|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>   audio|0|156811|1.742344|156811|1.742344|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
> -audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__
> -audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__
> -audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__
> -audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__
> -audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__
> -audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__
> -audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__
> -audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__
> -audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__
> -audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__
> +audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|174764|1.941822|171164|1.901822|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>   video|1|178364|1.981822|174764|1.941822|3600|0.040000|24711|361336|K__
>   video|1|139582|1.550911|135982|1.510911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>   video|1|143182|1.590911|139582|1.550911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>   video|1|146782|1.630911|143182|1.590911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>   audio|0|132429|1.471433|132429|1.471433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
> -audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__
> -audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__
> -audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__
> -audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__
> -audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__
> -audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__
> -audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__
> -audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__
> -audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__
> -audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__
> +audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
> +audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>   video|1|150382|1.670911|146782|1.630911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>   video|1|153982|1.710911|150382|1.670911|3600|0.040000|24711|361336|K__
>   video|1|161182|1.790911|157582|1.750911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> index b01f525c38..4274a0e145 100644
> --- a/tests/ref/fate/ts-demux
> +++ b/tests/ref/fate/ts-demux
> @@ -10,11 +10,11 @@ packet|codec_type=video|stream_index=0|pts=3912677354|pts_time=43474.192822|dts=
>   packet|codec_type=video|stream_index=0|pts=3912683360|pts_time=43474.259556|dts=3912678855|dts_time=43474.209500|duration=1501|duration_time=0.016678|size=61720|pos=325240|flags=___|data_hash=CRC32:7e6594e5|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>   packet|codec_type=video|stream_index=0|pts=3912680357|pts_time=43474.226189|dts=3912680357|dts_time=43474.226189|duration=1501|duration_time=0.016678|size=17416|pos=390852|flags=___|data_hash=CRC32:31c8b89d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>   packet|codec_type=audio|stream_index=1|pts=3912633305|pts_time=43473.703389|dts=3912633305|dts_time=43473.703389|duration=2880|duration_time=0.032000|size=1536|pos=218080|flags=K__|data_hash=CRC32:25b60d38|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
> -packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf
> -packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d
> +packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
> +packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>   packet|codec_type=audio|stream_index=2|pts=3912634060|pts_time=43473.711778|dts=3912634060|dts_time=43473.711778|duration=2880|duration_time=0.032000|size=768|pos=235564|flags=K__|data_hash=CRC32:34b350c9|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
> -packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8
> -packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a
> +packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
> +packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>   packet|codec_type=video|stream_index=0|pts=3912681858|pts_time=43474.242867|dts=3912681858|dts_time=43474.242867|duration=1501|duration_time=0.016678|size=18144|pos=409464|flags=___|data_hash=CRC32:826f8e8e|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>   packet|codec_type=video|stream_index=0|pts=3912687864|pts_time=43474.309600|dts=3912683360|dts_time=43474.259556|duration=1501|duration_time=0.016678|size=56848|pos=428640|flags=___|data_hash=CRC32:6b15be8c|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>   packet|codec_type=video|stream_index=0|pts=3912684861|pts_time=43474.276233|dts=3912684861|dts_time=43474.276233|duration=1501|duration_time=0.016678|size=16296|pos=489176|flags=___|data_hash=CRC32:911b1649|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet()
  2024-03-01 13:49   ` James Almer
@ 2024-03-01 13:54     ` James Almer
  0 siblings, 0 replies; 11+ messages in thread
From: James Almer @ 2024-03-01 13:54 UTC (permalink / raw)
  To: ffmpeg-devel

On 3/1/2024 10:49 AM, James Almer wrote:
> On 3/1/2024 10:39 AM, Nicolas Gaullier wrote:
>> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
>> ---
>>   libavformat/demux.c                           |  23 ++-
>>   tests/ref/fate/concat-demuxer-simple2-lavf-ts | 164 +++++++++---------
>>   tests/ref/fate/ts-demux                       |   8 +-
>>   3 files changed, 104 insertions(+), 91 deletions(-)
>>
>> diff --git a/libavformat/demux.c b/libavformat/demux.c
>> index 2e1d0ed66d..722bb35c4c 100644
>> --- a/libavformat/demux.c
>> +++ b/libavformat/demux.c
>> @@ -1186,7 +1186,7 @@ static int parse_packet(AVFormatContext *s, 
>> AVPacket *pkt,
>>       FFStream *const sti = ffstream(st);
>>       const uint8_t *data = pkt->data;
>>       int size = pkt->size;
>> -    int ret = 0, got_output = flush;
>> +    int ret = 0, got_output = flush, pkt_side_data_consumed = 0;
>>       if (!size && !flush && sti->parser->flags & 
>> PARSER_FLAG_COMPLETE_FRAMES) {
>>           // preserve 0-size sync packets
>> @@ -1231,10 +1231,19 @@ static int parse_packet(AVFormatContext *s, 
>> AVPacket *pkt,
>>           }
>>           if (pkt->side_data) {
>> -            out_pkt->side_data       = pkt->side_data;
>> -            out_pkt->side_data_elems = pkt->side_data_elems;
>> -            pkt->side_data          = NULL;
>> -            pkt->side_data_elems    = 0;
>> +            if (!pkt_side_data_consumed) {
> 
> Can't you just check for out_pkt->side_data instead?

Nevermind, i misread the code.

Please add a comment about how pkt_side_data_consumed prevents copying 
side data for the first (and potentially only) output iteration.

> 
>> +                out_pkt->side_data       = pkt->side_data;
>> +                out_pkt->side_data_elems = pkt->side_data_elems;
>> +                pkt_side_data_consumed = 1;
>> +            } else for (int i = 0; i < pkt->side_data_elems; i++) {
>> +                const AVPacketSideData *const src_sd = 
>> &pkt->side_data[i];
>> +                uint8_t *dst_data = av_packet_new_side_data(out_pkt, 
>> src_sd->type, src_sd->size);
>> +                if (!dst_data) {
>> +                    ret = AVERROR(ENOMEM);
>> +                    goto fail;
>> +                }
>> +                memcpy(dst_data, src_sd->data, src_sd->size);
>> +            }
>>           }
>>           /* set the duration */
>> @@ -1286,6 +1295,10 @@ static int parse_packet(AVFormatContext *s, 
>> AVPacket *pkt,
>>       }
>>   fail:
>> +    if (pkt_side_data_consumed) {
>> +        pkt->side_data          = NULL;
>> +        pkt->side_data_elems    = 0;
>> +    }
>>       if (ret < 0)
>>           av_packet_unref(out_pkt);
>>       av_packet_unref(pkt);
>> diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 
>> b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
>> index 548cab01c6..ee49e331f3 100644
>> --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
>> +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
>> @@ -7,19 +7,19 @@ 
>> video|1|18982|0.210911|15382|0.170911|3600|0.040000|13092|84788|___|MPEGTS Strea
>>   
>> video|1|22582|0.250911|18982|0.210911|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
>>   
>> video|1|26182|0.290911|22582|0.250911|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
>>   audio|0|0|0.000000|0|0.000000|2351|0.026122|208|152844|K__|MPEGTS 
>> Stream ID|192
>> -audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__
>> -audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__
>> -audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__
>> -audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__
>> -audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__
>> -audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__
>> -audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__
>> -audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__
>> -audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__
>> -audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__
>> -audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__
>> -audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__
>> -audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__
>> +audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K__|MPEGTS 
>> Stream ID|192
>> +audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K__|MPEGTS 
>> Stream ID|192
>> +audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K__|MPEGTS 
>> Stream ID|192
>> +audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K__|MPEGTS 
>> Stream ID|192
>> +audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|29782|0.330911|26182|0.290911|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
>>   
>> video|1|33382|0.370911|29782|0.330911|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
>>   
>> video|1|36982|0.410911|33382|0.370911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
>> @@ -31,35 +31,35 @@ 
>> video|1|54982|0.610911|51382|0.570911|3600|0.040000|13449|240640|___|MPEGTS Stre
>>   
>> video|1|58582|0.650911|54982|0.610911|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
>>   
>> video|1|62182|0.690911|58582|0.650911|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
>>   
>> audio|0|32915|0.365722|32915|0.365722|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
>> -audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__
>> -audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__
>> -audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__
>> -audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__
>> -audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__
>> -audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__
>> -audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__
>> -audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__
>> -audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__
>> -audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__
>> -audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__
>> -audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__
>> -audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__
>> +audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|65782|0.730911|62182|0.690911|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
>>   
>> video|1|69382|0.770911|65782|0.730911|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
>>   
>> video|1|72982|0.810911|69382|0.770911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>>   
>> video|1|76582|0.850911|72982|0.810911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>>   
>> video|1|80182|0.890911|76582|0.850911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>>   
>> audio|0|65829|0.731433|65829|0.731433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
>> -audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__
>> -audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__
>> -audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__
>> -audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__
>> -audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__
>> -audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__
>> -audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__
>> -audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__
>> -audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__
>> -audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__
>> +audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|83782|0.930911|80182|0.890911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>>   video|1|87382|0.970911|83782|0.930911|3600|0.040000|24711|361336|K__
>>   
>> video|1|91964|1.021822|88364|0.981822|3600|0.040000|24801|564|K__|MPEGTS Stream ID|224
>> @@ -71,19 +71,19 @@ 
>> video|1|109964|1.221822|106364|1.181822|3600|0.040000|13092|84788|___|MPEGTS Str
>>   
>> video|1|113564|1.261822|109964|1.221822|3600|0.040000|12755|98700|___|MPEGTS Stream ID|224
>>   
>> video|1|117164|1.301822|113564|1.261822|3600|0.040000|12023|111860|___|MPEGTS Stream ID|224
>>   
>> audio|0|90982|1.010911|90982|1.010911|2351|0.026122|208|152844|K__|MPEGTS Stream ID|192
>> -audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__
>> -audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__
>> -audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__
>> -audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__
>> -audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__
>> -audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__
>> -audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__
>> -audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__
>> -audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__
>> -audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__
>> -audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__
>> -audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__
>> -audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__
>> +audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|120764|1.341822|117164|1.301822|3600|0.040000|14098|124268|___|MPEGTS Stream ID|224
>>   
>> video|1|124364|1.381822|120764|1.341822|3600|0.040000|13329|139120|___|MPEGTS Stream ID|224
>>   
>> video|1|127964|1.421822|124364|1.381822|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
>> @@ -95,51 +95,51 @@ 
>> video|1|145964|1.621822|142364|1.581822|3600|0.040000|13449|240640|___|MPEGTS St
>>   
>> video|1|149564|1.661822|145964|1.621822|3600|0.040000|12398|254552|___|MPEGTS Stream ID|224
>>   
>> video|1|153164|1.701822|149564|1.661822|3600|0.040000|13455|267336|___|MPEGTS Stream ID|224
>>   
>> audio|0|123897|1.376633|123897|1.376633|2351|0.026122|209|308508|K__|MPEGTS Stream ID|192
>> -audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__
>> -audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__
>> -audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__
>> -audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__
>> -audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__
>> -audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__
>> -audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__
>> -audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__
>> -audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__
>> -audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__
>> -audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__
>> -audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__
>> -audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__
>> +audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|156764|1.741822|153164|1.701822|3600|0.040000|13836|281624|___|MPEGTS Stream ID|224
>>   
>> video|1|160364|1.781822|156764|1.741822|3600|0.040000|12163|295912|___|MPEGTS Stream ID|224
>>   
>> video|1|163964|1.821822|160364|1.781822|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>>   
>> video|1|167564|1.861822|163964|1.821822|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>>   
>> video|1|171164|1.901822|167564|1.861822|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>>   
>> audio|0|156811|1.742344|156811|1.742344|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
>> -audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__
>> -audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__
>> -audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__
>> -audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__
>> -audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__
>> -audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__
>> -audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__
>> -audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__
>> -audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__
>> -audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__
>> +audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|174764|1.941822|171164|1.901822|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>>   video|1|178364|1.981822|174764|1.941822|3600|0.040000|24711|361336|K__
>>   
>> video|1|139582|1.550911|135982|1.510911|3600|0.040000|12692|311516|___|MPEGTS Stream ID|224
>>   
>> video|1|143182|1.590911|139582|1.550911|3600|0.040000|10824|325052|___|MPEGTS Stream ID|224
>>   
>> video|1|146782|1.630911|143182|1.590911|3600|0.040000|11286|336144|___|MPEGTS Stream ID|224
>>   
>> audio|0|132429|1.471433|132429|1.471433|2351|0.026122|209|386716|K__|MPEGTS Stream ID|192
>> -audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__
>> -audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__
>> -audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__
>> -audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__
>> -audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__
>> -audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__
>> -audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__
>> -audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__
>> -audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__
>> -audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__
>> +audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>> +audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__|MPEGTS Stream ID|192
>>   
>> video|1|150382|1.670911|146782|1.630911|3600|0.040000|12678|347800|___|MPEGTS Stream ID|224
>>   video|1|153982|1.710911|150382|1.670911|3600|0.040000|24711|361336|K__
>>   
>> video|1|161182|1.790911|157582|1.750911|3600|0.040000|12135|155852|___|MPEGTS Stream ID|224
>> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
>> index b01f525c38..4274a0e145 100644
>> --- a/tests/ref/fate/ts-demux
>> +++ b/tests/ref/fate/ts-demux
>> @@ -10,11 +10,11 @@ 
>> packet|codec_type=video|stream_index=0|pts=3912677354|pts_time=43474.192822|dts=
>>   
>> packet|codec_type=video|stream_index=0|pts=3912683360|pts_time=43474.259556|dts=3912678855|dts_time=43474.209500|duration=1501|duration_time=0.016678|size=61720|pos=325240|flags=___|data_hash=CRC32:7e6594e5|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>>   
>> packet|codec_type=video|stream_index=0|pts=3912680357|pts_time=43474.226189|dts=3912680357|dts_time=43474.226189|duration=1501|duration_time=0.016678|size=17416|pos=390852|flags=___|data_hash=CRC32:31c8b89d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>>   
>> packet|codec_type=audio|stream_index=1|pts=3912633305|pts_time=43473.703389|dts=3912633305|dts_time=43473.703389|duration=2880|duration_time=0.032000|size=1536|pos=218080|flags=K__|data_hash=CRC32:25b60d38|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>> -packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf
>> -packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d
>> +packet|codec_type=audio|stream_index=1|pts=3912636185|pts_time=43473.735389|dts=3912636185|dts_time=43473.735389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:d4e30aaf|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>> +packet|codec_type=audio|stream_index=1|pts=3912639065|pts_time=43473.767389|dts=3912639065|dts_time=43473.767389|duration=2880|duration_time=0.032000|size=1536|pos=N/A|flags=K__|data_hash=CRC32:32d6d14d|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>>   
>> packet|codec_type=audio|stream_index=2|pts=3912634060|pts_time=43473.711778|dts=3912634060|dts_time=43473.711778|duration=2880|duration_time=0.032000|size=768|pos=235564|flags=K__|data_hash=CRC32:34b350c9|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>> -packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8
>> -packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a
>> +packet|codec_type=audio|stream_index=2|pts=3912636940|pts_time=43473.743778|dts=3912636940|dts_time=43473.743778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:457881f8|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>> +packet|codec_type=audio|stream_index=2|pts=3912639820|pts_time=43473.775778|dts=3912639820|dts_time=43473.775778|duration=2880|duration_time=0.032000|size=768|pos=N/A|flags=K__|data_hash=CRC32:1abb0d9a|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=189
>>   
>> packet|codec_type=video|stream_index=0|pts=3912681858|pts_time=43474.242867|dts=3912681858|dts_time=43474.242867|duration=1501|duration_time=0.016678|size=18144|pos=409464|flags=___|data_hash=CRC32:826f8e8e|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>>   
>> packet|codec_type=video|stream_index=0|pts=3912687864|pts_time=43474.309600|dts=3912683360|dts_time=43474.259556|duration=1501|duration_time=0.016678|size=56848|pos=428640|flags=___|data_hash=CRC32:6b15be8c|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
>>   
>> packet|codec_type=video|stream_index=0|pts=3912684861|pts_time=43474.276233|dts=3912684861|dts_time=43474.276233|duration=1501|duration_time=0.016678|size=16296|pos=489176|flags=___|data_hash=CRC32:911b1649|side_datum/mpegts_stream_id:side_data_type=MPEGTS Stream ID|side_datum/mpegts_stream_id:id=224
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
  2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame Nicolas Gaullier
@ 2024-03-03 22:06   ` Michael Niedermayer
  2024-03-04 17:38     ` Nicolas Gaullier
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Niedermayer @ 2024-03-03 22:06 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 5183 bytes --]

On Fri, Mar 01, 2024 at 02:39:19PM +0100, Nicolas Gaullier wrote:
> The mpegts demuxer splits packets according to its max_packet_size.
> This currently fills the AVCodecParserContext s->cur_frame_* arrays with
> kind of 'empty' entries: no pts/dts.
> This patch merges these entries, so the parser behaviour is independent
> from the demuxer settings.
> This patch is required for the following patch which will fetch 'past'
> timestamps from past cur_frames.
> 
> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
> ---
>  libavcodec/parser.c | 4 ++++
>  1 file changed, 4 insertions(+)

Breaks fate-seek-lavf-as


--- ./tests/ref/seek/lavf-asf	2024-02-28 23:42:14.743496132 +0100
+++ tests/data/fate/seek-lavf-asf	2024-03-03 23:06:08.850893410 +0100
@@ -1,53 +0,0 @@
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size:   209
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size:   209
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 1 flags:0  ts: 2.577000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size:   209
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 0 flags:0  ts: 2.153000
-ret: 0         st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size:   209
-ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size:   209
-ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size:   209
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size:   209
-ret: 0         st: 1 flags:0  ts: 1.307000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size:   209
-ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size:   209
-ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
-ret: 0         st: 1 flags:0  ts: 2.672000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size:   209
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size:   209
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    693 size:   208
Test seek-lavf-asf failed. Look at tests/data/fate/seek-lavf-asf.err for details.
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
[asf @ 0x5623c91f8280] asf_read_pts failed
Assertion pkt->pos == asf_st->packet_pos failed at libavformat/asfdec_f.c:1478
Aborted (core dumped)
threads=1
tests/Makefile:318: recipe for target 'fate-seek-lavf-asf' failed
make: *** [fate-seek-lavf-asf] Error 134

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
  2024-03-03 22:06   ` Michael Niedermayer
@ 2024-03-04 17:38     ` Nicolas Gaullier
  2024-03-05 20:51       ` Michael Niedermayer
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Gaullier @ 2024-03-04 17:38 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

>De : ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> De la part de Michael Niedermayer
>Envoyé : dimanche 3 mars 2024 23:07
>À : FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
>Objet : Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
>
>On Fri, Mar 01, 2024 at 02:39:19PM +0100, Nicolas Gaullier wrote:
>> The mpegts demuxer splits packets according to its max_packet_size.
>> This currently fills the AVCodecParserContext s->cur_frame_* arrays 
>> with kind of 'empty' entries: no pts/dts.
>> This patch merges these entries, so the parser behaviour is 
>> independent from the demuxer settings.
>> This patch is required for the following patch which will fetch 'past'
>> timestamps from past cur_frames.
>> 
>> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
>> ---
>>  libavcodec/parser.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
>Breaks fate-seek-lavf-as

Really sorry about that, I was not aware that assert-level=2 had to be enabled to get full fate tests.
Maybe this should be documented in the fate.texi.
I also checked the green light on patchwork... It seems at least assert-level=1 is not supposed to consume too much cpu, so maybe it could be enabled for patchwork?

Thank you very much for taking time for this review.
Nicolas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
  2024-03-04 17:38     ` Nicolas Gaullier
@ 2024-03-05 20:51       ` Michael Niedermayer
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2024-03-05 20:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Andriy Gelman


[-- Attachment #1.1: Type: text/plain, Size: 1741 bytes --]

Hi

On Mon, Mar 04, 2024 at 05:38:48PM +0000, Nicolas Gaullier wrote:
> >De : ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> De la part de Michael Niedermayer
> >Envoyé : dimanche 3 mars 2024 23:07
> >À : FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> >Objet : Re: [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame
> >
> >On Fri, Mar 01, 2024 at 02:39:19PM +0100, Nicolas Gaullier wrote:
> >> The mpegts demuxer splits packets according to its max_packet_size.
> >> This currently fills the AVCodecParserContext s->cur_frame_* arrays 
> >> with kind of 'empty' entries: no pts/dts.
> >> This patch merges these entries, so the parser behaviour is 
> >> independent from the demuxer settings.
> >> This patch is required for the following patch which will fetch 'past'
> >> timestamps from past cur_frames.
> >> 
> >> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
> >> ---
> >>  libavcodec/parser.c | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >
> >Breaks fate-seek-lavf-as
> 
> Really sorry about that, I was not aware that assert-level=2 had to be enabled to get full fate tests.
> Maybe this should be documented in the fate.texi.

patch welcome


> I also checked the green light on patchwork... It seems at least assert-level=1 is not supposed to consume too much cpu, so maybe it could be enabled for patchwork?

CCing Andriy


thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-03-05 20:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-01 13:39 [FFmpeg-devel] [PATCH v2 0/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 1/5] avcodec/parser: merge packets from the same frame Nicolas Gaullier
2024-03-03 22:06   ` Michael Niedermayer
2024-03-04 17:38     ` Nicolas Gaullier
2024-03-05 20:51       ` Michael Niedermayer
2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 2/5] avcodec/parser: reindent after previous commit Nicolas Gaullier
2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 3/5] avcodec/parser: fix fetch_timestamp in a scenario with unaligned packets Nicolas Gaullier
2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 4/5] avcodec/h264_parser: fix start of packet for some broken streams Nicolas Gaullier
2024-03-01 13:39 ` [FFmpeg-devel] [PATCH v2 5/5] lavf/demux: duplicate side_data in parse_packet() Nicolas Gaullier
2024-03-01 13:49   ` James Almer
2024-03-01 13:54     ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git