ffmpeg | branch: release/7.1 | James Almer <jamr...@gmail.com> | Tue Jul  8 
15:00:29 2025 -0300| [ca5c0a959d3a456fafa37fc84bf029af23a52ba4] | committer: 
James Almer

fftools/ffmpeg_demux: don't flag timestamps as unreliable if they are generated

Regardless of the source being an AVFMT_NOTIMESTAMPS format, if the timestamps
are generated like when using the use_wallclock_as_timestamps demuxer option,
then they are reliable.

Fixes ticket #11268

Signed-off-by: James Almer <jamr...@gmail.com>
(cherry picked from commit 1787fade209b1ecbd4b911c9d77a52bcdec13fa6)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca5c0a959d3a456fafa37fc84bf029af23a52ba4
---

 fftools/ffmpeg_demux.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 13aef15eab..d44dce1119 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -912,9 +912,18 @@ static int ist_use(InputStream *ist, int decoding_needed,
 
     if (decoding_needed && ds->sch_idx_dec < 0) {
         int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
+        int is_unreliable = !!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS);
+        int64_t use_wallclock_as_timestamps;
+
+        ret = av_opt_get_int(d->f.ctx, "use_wallclock_as_timestamps", 0, 
&use_wallclock_as_timestamps);
+        if (ret < 0)
+            return ret;
+
+        if (use_wallclock_as_timestamps)
+            is_unreliable = 0;
 
         ds->dec_opts.flags |= (!!ist->fix_sub_duration * 
DECODER_FLAG_FIX_SUB_DURATION) |
-                              (!!(d->f.ctx->iformat->flags & 
AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) |
+                              (!!is_unreliable * DECODER_FLAG_TS_UNRELIABLE) |
                               (!!(d->loop && is_audio) * 
DECODER_FLAG_SEND_END_TS)
 #if FFMPEG_OPT_TOP
                               | ((ist->top_field_first >= 0) * 
DECODER_FLAG_TOP_FIELD_FIRST)

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

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

Reply via email to