Skip to content
Snippets Groups Projects
Commit c49c89a6 authored by Philippe Gorley's avatar Philippe Gorley Committed by Hugo Lefeuvre
Browse files

decoder: add more fallbacks if fps is 0


Change-Id: I59f25e4537c393674f1b62b0e12deb143d9fc108
Reviewed-by: default avatarHugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
parent e4ba16d1
No related branches found
No related tags found
No related merge requests found
......@@ -193,9 +193,14 @@ MediaDecoder::setupStream(AVMediaType mediaType)
}
avcodec_parameters_to_context(decoderCtx_, avStream_->codecpar);
decoderCtx_->framerate = avStream_->avg_frame_rate;
// in case FFmpeg could not find a framerate, fall back to the ones found in openInput
if (mediaType == AVMEDIA_TYPE_VIDEO && (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0))
if (mediaType == AVMEDIA_TYPE_VIDEO) {
if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
decoderCtx_->framerate = inputParams_.framerate;
if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
decoderCtx_->framerate = av_inv_q(decoderCtx_->time_base);
if (decoderCtx_->framerate.num == 0 || decoderCtx_->framerate.den == 0)
decoderCtx_->framerate = {30, 1};
}
decoderCtx_->thread_count = std::max(1u, std::min(8u, std::thread::hardware_concurrency()/2));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment