aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-11-24 19:08:15 +0100
committerAnton Khirnov <anton@khirnov.net>2023-12-14 08:11:05 +0100
commit9d7000b1bea097d715166e93475c71a0fb237f05 (patch)
tree8c5fc7d07e595ed4e8813e7cc67d7c23b1e081f6 /fftools/ffmpeg_demux.c
parentc9f38210fc498ada2605a1faac8aceb3d76e69c6 (diff)
downloadffmpeg-9d7000b1bea097d715166e93475c71a0fb237f05.tar.gz
fftools/ffmpeg: attach wallclock timing information to packets and frames
Will become useful in following commits.
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r--fftools/ffmpeg_demux.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 392b447338..d2466e885d 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -271,7 +271,7 @@ static void ts_discontinuity_process(Demuxer *d, InputStream *ist,
ts_discontinuity_detect(d, ist, pkt);
}
-static int ist_dts_update(DemuxStream *ds, AVPacket *pkt)
+static int ist_dts_update(DemuxStream *ds, AVPacket *pkt, FrameData *fd)
{
InputStream *ist = &ds->ist;
const AVCodecParameters *par = ist->par;
@@ -326,21 +326,12 @@ static int ist_dts_update(DemuxStream *ds, AVPacket *pkt)
break;
}
- av_assert0(!pkt->opaque_ref);
- if (ds->streamcopy_needed) {
- FrameData *fd;
-
- fd = packet_data(pkt);
- if (!fd)
- return AVERROR(ENOMEM);
-
- fd->dts_est = ds->dts;
- }
+ fd->dts_est = ds->dts;
return 0;
}
-static int ts_fixup(Demuxer *d, AVPacket *pkt)
+static int ts_fixup(Demuxer *d, AVPacket *pkt, FrameData *fd)
{
InputFile *ifile = &d->f;
InputStream *ist = ifile->streams[pkt->stream_index];
@@ -424,7 +415,7 @@ static int ts_fixup(Demuxer *d, AVPacket *pkt)
ts_discontinuity_process(d, ist, pkt);
// update estimated/predicted dts
- ret = ist_dts_update(ds, pkt);
+ ret = ist_dts_update(ds, pkt, fd);
if (ret < 0)
return ret;
@@ -436,9 +427,14 @@ static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
InputFile *f = &d->f;
InputStream *ist = f->streams[pkt->stream_index];
DemuxStream *ds = ds_from_ist(ist);
+ FrameData *fd;
int ret = 0;
- ret = ts_fixup(d, pkt);
+ fd = packet_data(pkt);
+ if (!fd)
+ return AVERROR(ENOMEM);
+
+ ret = ts_fixup(d, pkt, fd);
if (ret < 0)
return ret;
@@ -455,6 +451,8 @@ static int input_packet_process(Demuxer *d, AVPacket *pkt, unsigned *send_flags)
ds->data_size += pkt->size;
ds->nb_packets++;
+ fd->wallclock[LATENCY_PROBE_DEMUX] = av_gettime_relative();
+
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n",
f->index, pkt->stream_index,