Video: Enable threads for video decoding.

This was previously getting (accidentally?) enabled by the call to
`avformat_find_stream_info()`.  See #9262.
This commit is contained in:
Unknown W. Brackets 2017-03-22 20:36:42 -07:00
parent d408b9980a
commit 7a7e4ed23f

View file

@ -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