diff mbox series

[FFmpeg-devel] fftools/ffmpeg: log correct filter timebase with debug_ts

Message ID 20220705152526.5122-1-timo@rothenpieler.org
State New
Headers show
Series [FFmpeg-devel] fftools/ffmpeg: log correct filter timebase with debug_ts | 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
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Timo Rothenpieler July 5, 2022, 3:25 p.m. UTC
---
 fftools/ffmpeg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e7384f052a..6ec28f3019 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -766,6 +766,7 @@  static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
 {
     double float_pts = AV_NOPTS_VALUE; // this is identical to frame.pts but with higher precision
     AVCodecContext *enc = ost->enc_ctx;
+    AVRational filter_tb = (AVRational){ -1, -1 };
     if (!frame || frame->pts == AV_NOPTS_VALUE ||
         !enc || !ost->filter || !ost->filter->graph->graph)
         goto early_exit;
@@ -774,9 +775,9 @@  static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
         AVFilterContext *filter = ost->filter->filter;
 
         int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
-        AVRational filter_tb = av_buffersink_get_time_base(filter);
         AVRational tb = enc->time_base;
         int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16);
+        filter_tb = av_buffersink_get_time_base(filter);
 
         tb.den <<= extra_bits;
         float_pts =
@@ -798,8 +799,8 @@  early_exit:
                frame ? av_ts2str(frame->pts) : "NULL",
                frame ? av_ts2timestr(frame->pts, &enc->time_base) : "NULL",
                float_pts,
-               enc ? enc->time_base.num : -1,
-               enc ? enc->time_base.den : -1);
+               filter_tb.num,
+               filter_tb.den);
     }
 
     return float_pts;