From 0ca3f2d663192226ef8b5acbda0b2b269a8f7697 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sun, 1 Oct 2017 17:54:21 -0500 Subject: [PATCH] Fixing 16 thread limit on FFmpegReader --- src/FFmpegReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 66cbc25b..899aabfe 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -144,8 +144,8 @@ void FFmpegReader::Open() throw(InvalidFile, NoStreamsFound, InvalidCodec) pStream = pFormatCtx->streams[videoStream]; pCodecCtx = pFormatCtx->streams[videoStream]->codec; - // Set number of threads equal to number of processors + 1 - pCodecCtx->thread_count = OPEN_MP_NUM_PROCESSORS; + // Set number of threads equal to number of processors (not to exceed 16) + pCodecCtx->thread_count = min(OPEN_MP_NUM_PROCESSORS, 16); // Find the decoder for the video stream AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id); @@ -170,8 +170,8 @@ void FFmpegReader::Open() throw(InvalidFile, NoStreamsFound, InvalidCodec) aStream = pFormatCtx->streams[audioStream]; aCodecCtx = pFormatCtx->streams[audioStream]->codec; - // Set number of threads equal to number of processors + 1 - aCodecCtx->thread_count = OPEN_MP_NUM_PROCESSORS; + // Set number of threads equal to number of processors (not to exceed 16) + aCodecCtx->thread_count = min(OPEN_MP_NUM_PROCESSORS, 16); // Find the decoder for the audio stream AVCodec *aCodec = avcodec_find_decoder(aCodecCtx->codec_id);