Regardless of the source being an AVFMT_NOTIMESTAMPS format, if the timestamps are generated like when using the use_wallclock_as_timestamps demuxer option, then they are reliable. Fixes ticket #11268
Unified · Split
| @@ -945,9 +945,18 @@ int ist_use(InputStream *ist, int decoding_needed, · 944 unmodified lines | |||
| 945 | 945 | ||
| 946 | if (decoding_needed && ds->sch_idx_dec < 0) { | 946 | if (decoding_needed && ds->sch_idx_dec < 0) { |
| 947 | int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; | 947 | int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; |
| 948 | int is_unreliable = !!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS); | ||
| 949 | int64_t use_wallclock_as_timestamps; | ||
| 950 | |||
| 951 | ret = av_opt_get_int(d->f.ctx, "use_wallclock_as_timestamps", 0, &use_wallclock_as_timestamps); | ||
| 952 | if (ret < 0) | ||
| 953 | return ret; | ||
| 954 | |||
| 955 | if (use_wallclock_as_timestamps) | ||
| 956 | is_unreliable = 0; | ||
| 948 | 957 | ||
| 949 | ds->dec_opts.flags |= (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) | | 958 | ds->dec_opts.flags |= (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) | |
| 950 | (!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) | | 959 | (!!is_unreliable * DECODER_FLAG_TS_UNRELIABLE) | |
| 951 | (!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS) | 960 | (!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS) |
| 952 | #if FFMPEG_OPT_TOP | 961 | #if FFMPEG_OPT_TOP |
| 953 | | ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST) | 962 | | ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST) |