diff mbox series

[FFmpeg-devel] fftools/ffmpeg_demux: set stream index right before sending packet to scheduler

Message ID 20240205170959.11000-1-anton@khirnov.net
State Accepted
Commit 05fc6d3ce71e7e31040becec4bca1ac9beb0f366
Headers show
Series [FFmpeg-devel] fftools/ffmpeg_demux: set stream index right before sending packet to scheduler | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Feb. 5, 2024, 5:09 p.m. UTC
This avoids assuming that it survives unchanged through bitstream
filters, if present.
---
 fftools/ffmpeg_demux.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 60dc9620c2..3bf95e2c3f 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -475,8 +475,6 @@  static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
                av_ts2str(f->ts_offset),  av_ts2timestr(f->ts_offset, &AV_TIME_BASE_Q));
     }
 
-    pkt->stream_index = ds->sch_idx_stream;
-
     return 0;
 }
 
@@ -505,6 +503,8 @@  static int do_send(Demuxer *d, DemuxStream *ds, AVPacket *pkt, unsigned flags,
 {
     int ret;
 
+    pkt->stream_index = ds->sch_idx_stream;
+
     ret = sch_demux_send(d->sch, d->f.index, pkt, flags);
     if (ret == AVERROR_EOF) {
         av_packet_unref(pkt);
@@ -546,7 +546,6 @@  static int demux_send(Demuxer *d, DemuxThreadContext *dt, DemuxStream *ds,
 
             d->pkt_heartbeat->pts          = pkt->pts;
             d->pkt_heartbeat->time_base    = pkt->time_base;
-            d->pkt_heartbeat->stream_index = ds1->sch_idx_stream;
             d->pkt_heartbeat->opaque       = (void*)(intptr_t)PKT_OPAQUE_SUB_HEARTBEAT;
 
             ret = do_send(d, ds1, d->pkt_heartbeat, 0, "heartbeat");