This is what several other players do and what FFmpeg already does for the sidx atom. Fixes ticket #7679.
Unified · Split
| @@ -4550,17 +4550,17 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4549 unmodified lines | ||
| 4550 | 4550 | track_id = avio_rb32(pb); |
| 4551 | 4551 | if (!track_id) |
| 4552 | 4552 | return AVERROR_INVALIDDATA; |
| 4553 | − frag->track_id = track_id; | |
| 4554 | − set_frag_stream(&c->frag_index, track_id); | |
| 4555 | 4553 | for (i = 0; i < c->trex_count; i++) |
| 4556 | − if (c->trex_data[i].track_id == frag->track_id) { | |
| 4554 | + if (c->trex_data[i].track_id == track_id) { | |
| 4557 | 4555 | trex = &c->trex_data[i]; |
| 4558 | 4556 | break; |
| 4559 | 4557 | } |
| 4560 | 4558 | if (!trex) { |
| 4561 | − av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n"); | |
| 4562 | − return AVERROR_INVALIDDATA; | |
| 4559 | + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding trex (id %u)\n", track_id); | |
| 4560 | + return 0; | |
| 4563 | 4561 | } |
| 4562 | + frag->track_id = track_id; | |
| 4563 | + set_frag_stream(&c->frag_index, track_id); | |
| 4564 | 4564 | |
| 4565 | 4565 | frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ? |
| 4566 | 4566 | avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ? |
| @@ -4639,8 +4639,8 @@ static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 72 unmodified lines | ||
| 4639 | 4639 | } |
| 4640 | 4640 | } |
| 4641 | 4641 | if (!st) { |
| 4642 | − av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); | |
| 4643 | − return AVERROR_INVALIDDATA; | |
| 4642 | + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id); | |
| 4643 | + return 0; | |
| 4644 | 4644 | } |
| 4645 | 4645 | sc = st->priv_data; |
| 4646 | 4646 | if (sc->pseudo_stream_id + 1 != frag->stsd_id && sc->pseudo_stream_id != -1) |
| @@ -4686,8 +4686,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 39 unmodified lines | ||
| 4686 | 4686 | } |
| 4687 | 4687 | } |
| 4688 | 4688 | if (!st) { |
| 4689 | − av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); | |
| 4690 | − return AVERROR_INVALIDDATA; | |
| 4689 | + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id); | |
| 4690 | + return 0; | |
| 4691 | 4691 | } |
| 4692 | 4692 | sc = st->priv_data; |
| 4693 | 4693 | if (sc->pseudo_stream_id+1 != frag->stsd_id && sc->pseudo_stream_id != -1) |