diff mbox series

[FFmpeg-devel] avformat/demux: fix pcm read too much when call find_stream_info

Message ID 20240603102534.1134995-1-hiccupzhu@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/demux: fix pcm read too much when call find_stream_info | expand

Checks

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

Commit Message

Shiqi Zhu June 3, 2024, 10:25 a.m. UTC
Signed-off-by: Shiqi Zhu <hiccupzhu@gmail.com>
---
 libavformat/demux.c    | 2 ++
 tests/ref/seek/lavf-al | 4 ++--
 tests/ref/seek/lavf-ul | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer June 4, 2024, 12:16 a.m. UTC | #1
On Mon, Jun 03, 2024 at 06:25:34PM +0800, Shiqi Zhu wrote:
> Signed-off-by: Shiqi Zhu <hiccupzhu@gmail.com>
> ---
>  libavformat/demux.c    | 2 ++
>  tests/ref/seek/lavf-al | 4 ++--
>  tests/ref/seek/lavf-ul | 4 ++--
>  3 files changed, 6 insertions(+), 4 deletions(-)

breaks fate

--- ./tests/ref/fate/gapless-mp3	2024-06-04 00:45:51.981958561 +0200
+++ tests/data/fate/gapless-mp3	2024-06-04 02:15:01.740935194 +0200
@@ -1,5 +1,5 @@
 d7e884aea266b63f1547f1ad10188c08 *tests/data/fate/gapless-mp3.out-1
 c96c3ae7bd3300fd2f4debac222de5b7
-75bc539914297a191f40af2d737d7380 *tests/data/fate/gapless-mp3.out-2
-c96c3ae7bd3300fd2f4debac222de5b7
-ab21e0bd0c2d84426153d4cde919a1e3 *tests/data/fate/gapless-mp3.out-3
+b3c8c3d1ed0bf2b131cea783991cc4c3 *tests/data/fate/gapless-mp3.out-2
+6af69aebf2e5e5439ada6b0cf98dfca0
+b3c8c3d1ed0bf2b131cea783991cc4c3 *tests/data/fate/gapless-mp3.out-3
Test gapless-mp3 failed. Look at tests/data/fate/gapless-mp3.err for details.
make: *** [tests/Makefile:311: fate-gapless-mp3] Error 1

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/demux.c b/libavformat/demux.c
index dc65f9ad91..c878839175 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1117,6 +1117,8 @@  static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             if (pkt->pts == AV_NOPTS_VALUE)
                 pkt->pts = sti->cur_dts;
             pkt->dts = pkt->pts;
+            if (sti->first_dts == AV_NOPTS_VALUE)
+                sti->first_dts = is_relative(pkt->dts) ? pkt->dts - RELATIVE_TS_BASE : pkt->dts;
             if (pkt->pts != AV_NOPTS_VALUE && duration.num >= 0)
                 sti->cur_dts = av_add_stable(st->time_base, pkt->pts, duration, 1);
         }
diff --git a/tests/ref/seek/lavf-al b/tests/ref/seek/lavf-al
index 4cf458835a..075bc4e627 100644
--- a/tests/ref/seek/lavf-al
+++ b/tests/ref/seek/lavf-al
@@ -20,7 +20,7 @@  ret: 0         st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos:  23097 size:  2048
 ret: 0         st: 0 flags:0  ts:-0.058322
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  2048
 ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos:  43008 size:  1092
+ret: 0         st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos:  43814 size:  286
 ret: 0         st:-1 flags:0  ts: 1.730004
 ret: 0         st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos:  38147 size:  2048
 ret: 0         st:-1 flags:1  ts: 0.624171
@@ -28,7 +28,7 @@  ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:  2048
 ret: 0         st: 0 flags:0  ts:-0.481678
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  2048
 ret: 0         st: 0 flags:1  ts: 2.412517
-ret: 0         st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos:  43008 size:  1092
+ret: 0         st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos:  43814 size:  286
 ret: 0         st:-1 flags:0  ts: 1.306672
 ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos:  28812 size:  2048
 ret: 0         st:-1 flags:1  ts: 0.200839
diff --git a/tests/ref/seek/lavf-ul b/tests/ref/seek/lavf-ul
index 4cf458835a..549e5c3d19 100644
--- a/tests/ref/seek/lavf-ul
+++ b/tests/ref/seek/lavf-ul
@@ -20,7 +20,7 @@  ret: 0         st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos:  23097 size:  2048
 ret: 0         st: 0 flags:0  ts:-0.058322
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  2048
 ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos:  43008 size:  1092
+ret: 0         st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos:  43814 size:   286
 ret: 0         st:-1 flags:0  ts: 1.730004
 ret: 0         st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos:  38147 size:  2048
 ret: 0         st:-1 flags:1  ts: 0.624171
@@ -28,7 +28,7 @@  ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:  2048
 ret: 0         st: 0 flags:0  ts:-0.481678
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  2048
 ret: 0         st: 0 flags:1  ts: 2.412517
-ret: 0         st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos:  43008 size:  1092
+ret: 0         st: 0 flags:1 dts: 1.987029 pts: 1.987029 pos:  43814 size:   286
 ret: 0         st:-1 flags:0  ts: 1.306672
 ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos:  28812 size:  2048
 ret: 0         st:-1 flags:1  ts: 0.200839