diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index ee82a9df..40b60bb8 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -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: diff --git a/app/streaming/video.cpp b/app/streaming/video.cpp index be743be9..805f9b17 100644 --- a/app/streaming/video.cpp +++ b/app/streaming/video.cpp @@ -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;