Bound thread count at 4 (same as max slices) and don't use HEVC with the software decoder due to lack of slicing support in common-c

This commit is contained in:
Cameron Gutman 2018-07-08 17:50:42 -07:00
parent 7023bcf504
commit d0375a458a
2 changed files with 9 additions and 3 deletions

View File

@ -112,7 +112,11 @@ Session::Session(NvComputer* computer, NvApp& app)
{
case StreamingPreferences::VCC_AUTO:
// TODO: Determine if HEVC is better depending on the decoder
m_StreamConfig.supportsHevc = true;
// NOTE: HEVC currently uses only 1 slice regardless of what
// we provide in CAPABILITY_SLICES_PER_FRAME(), so we should
// never use it for software decoding (unless common-c starts
// respecting it for HEVC).
m_StreamConfig.supportsHevc = false;
m_StreamConfig.enableHdr = false;
break;
case StreamingPreferences::VCC_FORCE_H264:

View File

@ -5,6 +5,8 @@ AVPacket Session::s_Pkt;
AVCodecContext* Session::s_VideoDecoderCtx;
QByteArray Session::s_DecodeBuffer;
#define MAX_SLICES 4
int Session::getDecoderCapabilities()
{
int caps = 0;
@ -13,7 +15,7 @@ int Session::getDecoderCapabilities()
caps |= CAPABILITY_DIRECT_SUBMIT;
// Slice up to 4 times for parallel decode, once slice per core
caps |= CAPABILITY_SLICES_PER_FRAME(std::min(4, SDL_GetCPUCount()));
caps |= CAPABILITY_SLICES_PER_FRAME(std::min(MAX_SLICES, SDL_GetCPUCount()));
return caps;
}
@ -51,7 +53,7 @@ int Session::drSetup(int videoFormat, int width, int height, int /* frameRate */
// Enable slice multi-threading for software decoding
s_VideoDecoderCtx->flags |= AV_CODEC_FLAG_LOW_DELAY;
s_VideoDecoderCtx->thread_type = FF_THREAD_SLICE;
s_VideoDecoderCtx->thread_count = SDL_GetCPUCount();
s_VideoDecoderCtx->thread_count = std::min(MAX_SLICES, SDL_GetCPUCount());
// Setup decoding parameters
s_VideoDecoderCtx->width = width;