diff --git a/app/codec/ffmpeg/ffmpegdecoder.cpp b/app/codec/ffmpeg/ffmpegdecoder.cpp index 87f96bb8c..edb37d273 100644 --- a/app/codec/ffmpeg/ffmpegdecoder.cpp +++ b/app/codec/ffmpeg/ffmpegdecoder.cpp @@ -350,14 +350,7 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, CancelAtom *can int64_t footage_duration = fmt_ctx->duration; - bool bad_duration = false; - - // Catch when ffmpeg uses its inaccurate method of duration estimation so we can - // use manual calculation - if (fmt_ctx->duration_estimation_method == AVFMT_DURATION_FROM_BITRATE) { - bad_duration = true; - qWarning() << "Potentially bad duration estimation, using fallback. This could be slow."; - } + bool duration_guessed_from_bitrate = (fmt_ctx->duration_estimation_method == AVFMT_DURATION_FROM_BITRATE); // Dump it into the Footage object for (unsigned int i=0;inb_streams;i++) { @@ -418,8 +411,8 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, CancelAtom *can if (ret >= 0) { // Check if we need a manual duration - if (avstream->duration == AV_NOPTS_VALUE || bad_duration) { - if (footage_duration == AV_NOPTS_VALUE || bad_duration) { + if (avstream->duration == AV_NOPTS_VALUE || duration_guessed_from_bitrate) { + if (footage_duration == AV_NOPTS_VALUE || duration_guessed_from_bitrate) { // Manually read through file for duration int64_t new_dur; @@ -477,9 +470,9 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, CancelAtom *can channel_layout = static_cast(av_get_default_channel_layout(avstream->codecpar->channels)); } - if (avstream->duration == AV_NOPTS_VALUE || bad_duration) { + if (avstream->duration == AV_NOPTS_VALUE || duration_guessed_from_bitrate) { // Loop through stream until we get the whole duration - if (footage_duration == AV_NOPTS_VALUE || bad_duration) { + if (footage_duration == AV_NOPTS_VALUE || duration_guessed_from_bitrate) { Instance instance; instance.Open(filename_c, avstream->index);