diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2017-05-11 15:16:22 +0200 |
---|---|---|
committer | Matthieu Bouron <matthieu.bouron@gmail.com> | 2017-05-23 15:53:37 +0200 |
commit | 6ee4b20f4ae3e726868d3efa038ed3103f69d2a2 (patch) | |
tree | f913a8730f670e3611ec07133fe435260f1e2af0 | |
parent | 3e38bf95c53714f5b5d8c5214481073aedf7d11d (diff) | |
download | ffmpeg-6ee4b20f4ae3e726868d3efa038ed3103f69d2a2.tar.gz |
lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out
Some samples have their metadata track time_scale incorrectly set to 0
and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71
prevents playback of those samples. Setting the time_scale to 1 fixes
playback.
-rw-r--r-- | libavformat/mov.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index f2296f8917..036693a652 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1232,8 +1232,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->time_scale = avio_rb32(pb); if (sc->time_scale <= 0) { - av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale); + sc->time_scale = 1; } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ @@ -1262,8 +1262,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { - av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", c->time_scale); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); + c->time_scale = 1; } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); |