Skip to content

Commit

Permalink
Video: Enable threads for video decoding.
Browse files Browse the repository at this point in the history
This was previously getting (accidentally?) enabled by the call to
`avformat_find_stream_info()`.  See #9262.
  • Loading branch information
unknownbrackets committed Mar 23, 2017
1 parent d408b99 commit 7a7e4ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Core/HW/MediaEngine.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 7a7e4ed

Please sign in to comment.