diff mbox series

[FFmpeg-devel] libavformar/demux: fix dts being incorrectly set to pts

Message ID 20240515094302.1912784-1-hiccupzhu@gmail.com
State New
Headers show
Series [FFmpeg-devel] libavformar/demux: fix dts being incorrectly set to pts | 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 May 15, 2024, 9:43 a.m. UTC
Signed-off-by: Shiqi Zhu <hiccupzhu@gmail.com>
---
 libavformat/demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt May 15, 2024, 10:21 a.m. UTC | #1
Shiqi Zhu:
> Signed-off-by: Shiqi Zhu <hiccupzhu@gmail.com>
> ---
>  libavformat/demux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index ecefe7e0a7..e19b8b6473 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -1112,7 +1112,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
>              /* presentation is not delayed : PTS and DTS are the same */
>              if (pkt->pts == AV_NOPTS_VALUE)
>                  pkt->pts = pkt->dts;
> -            update_initial_timestamps(s, pkt->stream_index, pkt->pts,
> +            update_initial_timestamps(s, pkt->stream_index, pkt->dts,
>                                        pkt->pts, pkt);
>              if (pkt->pts == AV_NOPTS_VALUE)
>                  pkt->pts = sti->cur_dts;

Can you provide an example for which this matters?

- Andreas
Shiqi Zhu May 15, 2024, 11:22 a.m. UTC | #2
Andreas:
>
> Shiqi Zhu:
> > Signed-off-by: Shiqi Zhu <hiccupzhu@gmail.com>
> > ---
> >  libavformat/demux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > index ecefe7e0a7..e19b8b6473 100644
> > --- a/libavformat/demux.c
> > +++ b/libavformat/demux.c
> > @@ -1112,7 +1112,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
> >              /* presentation is not delayed : PTS and DTS are the same */
> >              if (pkt->pts == AV_NOPTS_VALUE)
> >                  pkt->pts = pkt->dts;
> > -            update_initial_timestamps(s, pkt->stream_index, pkt->pts,
> > +            update_initial_timestamps(s, pkt->stream_index, pkt->dts,
> >                                        pkt->pts, pkt);
> >              if (pkt->pts == AV_NOPTS_VALUE)
> >                  pkt->pts = sti->cur_dts;
>
> Can you provide an example for which this matters?
>
> - Andreas

There is no example yet, I saw this when reviewing the code.
So, is it reasonable to use pts instead of dts settings here?

- Shiqi
diff mbox series

Patch

diff --git a/libavformat/demux.c b/libavformat/demux.c
index ecefe7e0a7..e19b8b6473 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1112,7 +1112,7 @@  static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
             /* presentation is not delayed : PTS and DTS are the same */
             if (pkt->pts == AV_NOPTS_VALUE)
                 pkt->pts = pkt->dts;
-            update_initial_timestamps(s, pkt->stream_index, pkt->pts,
+            update_initial_timestamps(s, pkt->stream_index, pkt->dts,
                                       pkt->pts, pkt);
             if (pkt->pts == AV_NOPTS_VALUE)
                 pkt->pts = sti->cur_dts;