Prevent HEVC streaming with the software decoder for performance reasons

This commit is contained in:
Cameron Gutman 2018-07-26 19:26:22 -07:00
parent f5499be215
commit 0bde932550
2 changed files with 31 additions and 14 deletions

View File

@ -310,14 +310,10 @@ bool Session::validateLaunch()
QStringList warningList; QStringList warningList;
if (m_StreamConfig.supportsHevc) { if (m_StreamConfig.supportsHevc) {
if (m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC || bool hevcForced = m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC ||
m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC_HDR) { m_Preferences.videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC_HDR;
if (m_Computer->maxLumaPixelsHEVC == 0) {
emit displayLaunchWarning("Your host PC GPU doesn't support HEVC. " if (!isHardwareDecodeAvailable(m_Preferences.videoDecoderSelection,
"A GeForce GTX 900-series (Maxwell) or later GPU is required for HEVC streaming.");
}
}
else if (!isHardwareDecodeAvailable(m_Preferences.videoDecoderSelection,
VIDEO_FORMAT_H265, VIDEO_FORMAT_H265,
m_StreamConfig.width, m_StreamConfig.width,
m_StreamConfig.height, m_StreamConfig.height,
@ -327,6 +323,17 @@ bool Session::validateLaunch()
// never use it for software decoding (unless common-c starts // never use it for software decoding (unless common-c starts
// respecting it for HEVC). // respecting it for HEVC).
m_StreamConfig.supportsHevc = false; m_StreamConfig.supportsHevc = false;
if (hevcForced) {
emit displayLaunchWarning("This PC's GPU doesn't support HEVC decoding.");
}
}
if (hevcForced) {
if (m_Computer->maxLumaPixelsHEVC == 0) {
emit displayLaunchWarning("Your host PC GPU doesn't support HEVC. "
"A GeForce GTX 900-series (Maxwell) or later GPU is required for HEVC streaming.");
}
} }
} }
@ -348,7 +355,7 @@ bool Session::validateLaunch()
m_StreamConfig.width, m_StreamConfig.width,
m_StreamConfig.height, m_StreamConfig.height,
m_StreamConfig.fps)) { m_StreamConfig.fps)) {
emit displayLaunchWarning("Your client PC GPU doesn't support HEVC Main10 decoding for HDR streaming."); emit displayLaunchWarning("This PC's GPU doesn't support HEVC Main10 decoding for HDR streaming.");
} }
else { else {
// TODO: Also validate display capabilites // TODO: Also validate display capabilites

View File

@ -1,5 +1,7 @@
#include "renderer.h" #include "renderer.h"
#include <Limelight.h>
SdlRenderer::SdlRenderer() SdlRenderer::SdlRenderer()
: m_Renderer(nullptr), : m_Renderer(nullptr),
m_Texture(nullptr) m_Texture(nullptr)
@ -25,10 +27,18 @@ bool SdlRenderer::prepareDecoderContext(AVCodecContext*)
} }
bool SdlRenderer::initialize(SDL_Window* window, bool SdlRenderer::initialize(SDL_Window* window,
int, int videoFormat,
int width, int width,
int height) int height)
{ {
// 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).
if (videoFormat != VIDEO_FORMAT_H264) {
return false;
}
m_Renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); m_Renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (!m_Renderer) { if (!m_Renderer) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,