Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/mov: fix sidx timestamp handling, use PTS instead of DTS
@ 2025-12-31 12:11 Vivek Jain via ffmpeg-devel
  2026-01-05 16:43 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
  0 siblings, 1 reply; 2+ messages in thread
From: Vivek Jain via ffmpeg-devel @ 2025-12-31 12:11 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Vivek Jain

The 'sidx' earliest_presentation_time field is defined as PTS. Previously, it was incorrectly assigned to DTS, which could cause sync issues. This commit fixes the assignment to PTS as noted in the existing FIXME comment.
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 009ddfec80..f651d0387b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5892,9 +5892,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             } else if (has_sidx && !c->use_tfdt || fallback_sidx) {
                 // FIXME: sidx earliest_presentation_time is *PTS*, s.b.
                 // pts = frag_stream_info->sidx_pts;
-                dts = frag_stream_info->sidx_pts;
+                pts = frag_stream_info->sidx_pts; // <--- FIXED
                 av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64
-                        ", using it for dts\n", frag_stream_info->sidx_pts);
+                        ", using it for pts\n", frag_stream_info->sidx_pts); // Update log message too if you like, but logically just changing to pts is the key.
             } else {
                 dts = sc->track_end - sc->time_offset;
                 av_log(c->fc, AV_LOG_DEBUG, "found track end time %"PRId64
-- 
2.49.0.windows.1


-- 



Disclaimer
This email is governed by the Disclaimer Terms of  
somaiya.edu <http://somaiya.edu> which may be viewed at 
https://www.somaiya.edu/en/email-disclaimer 
<https://www.somaiya.edu/en/email-disclaimer>


Finally, please do not 
print this email unless it is necessary. Every unprinted email helps the 
environment.


_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [FFmpeg-devel] Re: [PATCH] avformat/mov: fix sidx timestamp handling, use PTS instead of DTS
  2025-12-31 12:11 [FFmpeg-devel] [PATCH] avformat/mov: fix sidx timestamp handling, use PTS instead of DTS Vivek Jain via ffmpeg-devel
@ 2026-01-05 16:43 ` Michael Niedermayer via ffmpeg-devel
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Niedermayer via ffmpeg-devel @ 2026-01-05 16:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Michael Niedermayer


[-- Attachment #1.1: Type: text/plain, Size: 1874 bytes --]

Hi Vivek

On Wed, Dec 31, 2025 at 05:41:22PM +0530, Vivek Jain via ffmpeg-devel wrote:
> The 'sidx' earliest_presentation_time field is defined as PTS. Previously, it was incorrectly assigned to DTS, which could cause sync issues. This commit fixes the assignment to PTS as noted in the existing FIXME comment.
> ---
>  libavformat/mov.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 009ddfec80..f651d0387b 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -5892,9 +5892,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>              } else if (has_sidx && !c->use_tfdt || fallback_sidx) {
>                  // FIXME: sidx earliest_presentation_time is *PTS*, s.b.
>                  // pts = frag_stream_info->sidx_pts;
> -                dts = frag_stream_info->sidx_pts;
> +                pts = frag_stream_info->sidx_pts; // <--- FIXED

This taken as a whole is wrong.

First step is explaining why there is a FIXME comment and outcommented code
only after that is understood can this be fixed, but either way
the fixme and fix cannot co-exist. Either its fixed or not

also the last change to this line should be considered 0de3b1f3588e1fc9e292098902ac79d8dd9792bc


>                  av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64
> -                        ", using it for dts\n", frag_stream_info->sidx_pts);
> +                        ", using it for pts\n", frag_stream_info->sidx_pts); // Update log message too if you like, but logically just changing to pts is the key.
>              } else {

This comment is not usefull

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What is money laundering? Its paying someone and not telling the government.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 163 bytes --]

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-05 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-31 12:11 [FFmpeg-devel] [PATCH] avformat/mov: fix sidx timestamp handling, use PTS instead of DTS Vivek Jain via ffmpeg-devel
2026-01-05 16:43 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git