[FFmpeg-devel] [RFC PATCH 2/2] ffmpeg_demux: make readrate stall warning input-specific
Marvin Scholz
epirat07 at gmail.com
Tue Apr 22 23:56:41 EEST 2025
Given the readrate catchup is input-specific, it seems to make sense to
also warn on a per-input demux basis.
---
fftools/ffmpeg_demux.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 6e01efc420..1f7ec20a43 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -101,6 +101,8 @@ typedef struct DemuxStream {
int64_t resume_pts;
// measure of how far behind packet reading is against spceified readrate
int64_t lag;
+ // state for resume after stall warning
+ int resume_warned;
} DemuxStream;
typedef struct Demuxer {
@@ -504,7 +506,6 @@ static void readrate_sleep(Demuxer *d)
(f->start_time != AV_NOPTS_VALUE ? f->start_time : 0)
);
int64_t initial_burst = AV_TIME_BASE * d->readrate_initial_burst;
- int resume_warn = 0;
for (int i = 0; i < f->nb_streams; i++) {
InputStream *ist = f->streams[i];
@@ -523,12 +524,12 @@ static void readrate_sleep(Demuxer *d)
ds->lag = lag;
ds->resume_wc = now;
ds->resume_pts = pts;
- av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &resume_warn,
+ av_log_once(ds, AV_LOG_WARNING, AV_LOG_DEBUG, &ds->resume_warned,
"Resumed reading at pts %0.3f with rate %0.3f after a lag of %0.3fs\n",
(float)pts/AV_TIME_BASE, d->readrate_catchup, (float)lag/AV_TIME_BASE);
}
if (ds->lag && !lag)
- ds->lag = ds->resume_wc = ds->resume_pts = 0;
+ ds->lag = ds->resume_wc = ds->resume_pts = ds->resume_warned = 0;
if (ds->resume_wc) {
elapsed = now - ds->resume_wc;
limit_pts = ds->resume_pts + elapsed * d->readrate_catchup;
--
2.39.5 (Apple Git-154)
More information about the ffmpeg-devel
mailing list