diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index eb28583565..d9398cf8be 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -458,14 +458,18 @@ bool MediaEngine::setVideoStream(int streamNum, bool force) { // Find the decoder for the video stream AVCodec *pCodec = avcodec_find_decoder(m_pCodecCtx->codec_id); - if (pCodec == NULL) { + if (pCodec == nullptr) { return false; } - // Open codec - if (avcodec_open2(m_pCodecCtx, pCodec, nullptr) < 0) { - return false; // Could not open codec + AVDictionary *opt = nullptr; + av_dict_set(&opt, "threads", "0", 0); + int openResult = avcodec_open2(m_pCodecCtx, pCodec, &opt); + av_dict_free(&opt); + if (openResult < 0) { + return false; } + m_pCodecCtxs[streamNum] = m_pCodecCtx; } #endif