diff mbox

[FFmpeg-devel,1/2,v2] mov: Remove ancient heuristic hack

Message ID 1472140695-10290-1-git-send-email-derek.buitenhuis@gmail.com
State Accepted
Commit 04f8d312877ffdcb816c7ff74b94eaa06dd6e1f0
Headers show

Commit Message

Derek Buitenhuis Aug. 25, 2016, 3:58 p.m. UTC
This breaks files with legitimate single-entry edit lists,
and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
has no link to any known sample in its commit message.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
---
 libavformat/isom.h | 1 -
 libavformat/mov.c  | 8 +-------
 2 files changed, 1 insertion(+), 8 deletions(-)

Comments

Michael Niedermayer Aug. 25, 2016, 4:18 p.m. UTC | #1
On Thu, Aug 25, 2016 at 04:58:14PM +0100, Derek Buitenhuis wrote:
> This breaks files with legitimate single-entry edit lists,
> and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b,
> has no link to any known sample in its commit message.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
>  libavformat/isom.h | 1 -
>  libavformat/mov.c  | 8 +-------
>  2 files changed, 1 insertion(+), 8 deletions(-)

ok if i push with the changes requested in:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-August/198303.html
? (seems another reply with forgotten CC)

Thanks
[...]
Derek Buitenhuis Aug. 25, 2016, 4:49 p.m. UTC | #2
On 8/25/2016 5:18 PM, Michael Niedermayer wrote:
> ok if i push with the changes requested in:
> https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-August/198303.html
> ? (seems another reply with forgotten CC)

You can change 'hack' to 'incorrect workaround' if you wish.

However, removing the part about the sample being missing in
the commit message would be wrong, because it is, in fact, not
linked in the commit message.

- Derek
Derek Buitenhuis Aug. 25, 2016, 5:13 p.m. UTC | #3
On 8/25/2016 5:49 PM, Derek Buitenhuis wrote:
> However, removing the part about the sample being missing in
> the commit message would be wrong, because it is, in fact, not
> linked in the commit message.

I must step out now, so please push whenever some consensus is
reached. No point in bikeshedding over a commit message, and
whilst I think it'd be silly to remove this bit, I do not feel
strongly about it.

- Derek
diff mbox

Patch

diff --git a/libavformat/isom.h b/libavformat/isom.h
index df6c15a..2246fed 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -155,7 +155,6 @@  typedef struct MOVStreamContext {
     MOVDref *drefs;
     int dref_id;
     int timecode_track;
-    int wrong_dts;        ///< dts are wrong due to huge ctts offset (iMovie files)
     int width;            ///< tkhd width
     int height;           ///< tkhd height
     int dts_shift;        ///< dts shift when ctts is negative
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1bc3800..54c63ad 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2802,12 +2802,8 @@  static void mov_build_index(MOVContext *mov, AVStream *st)
             sc->time_offset = start_time - empty_duration;
             current_dts = -sc->time_offset;
             if (sc->ctts_count>0 && sc->stts_count>0 &&
-                sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
-                /* more than 16 frames delay, dts are likely wrong
-                   this happens with files created by iMovie */
-                sc->wrong_dts = 1;
+                sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16)
                 st->codecpar->video_delay = 1;
-            }
         }
 
         if (!unsupported && st->codecpar->codec_id == AV_CODEC_ID_AAC && start_time > 0)
@@ -5352,8 +5348,6 @@  static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
             sc->ctts_index++;
             sc->ctts_sample = 0;
         }
-        if (sc->wrong_dts)
-            pkt->dts = AV_NOPTS_VALUE;
     } else {
         int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
             st->index_entries[sc->current_sample].timestamp : st->duration;