diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 6cc0b7a0..e6694610 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -415,8 +415,12 @@ bool Session::populateDecoderProperties(SDL_Window* window) "Using colorspace override: %d", m_StreamConfig.colorSpace); } + else if (!m_StreamConfig.enableHdr) { + m_StreamConfig.colorSpace = decoder->getDecoderSdrColorspace(); + } else { - m_StreamConfig.colorSpace = decoder->getDecoderColorspace(); + // In HDR mode, we opt for Rec 2020 for WCG displays + m_StreamConfig.colorSpace = COLORSPACE_REC_2020; } m_StreamConfig.colorRange = qEnvironmentVariableIntValue("COLOR_RANGE_OVERRIDE", &ok); diff --git a/app/streaming/video/decoder.h b/app/streaming/video/decoder.h index e96350f8..c7a4c784 100644 --- a/app/streaming/video/decoder.h +++ b/app/streaming/video/decoder.h @@ -67,7 +67,7 @@ public: virtual bool isAlwaysFullScreen() = 0; virtual bool isHdrSupported() = 0; virtual int getDecoderCapabilities() = 0; - virtual int getDecoderColorspace() = 0; + virtual int getDecoderSdrColorspace() = 0; virtual int getDecoderColorRange() = 0; virtual QSize getDecoderMaxResolution() = 0; virtual int submitDecodeUnit(PDECODE_UNIT du) = 0; diff --git a/app/streaming/video/ffmpeg-renderers/dxva2.cpp b/app/streaming/video/ffmpeg-renderers/dxva2.cpp index 3025dddc..4c823619 100644 --- a/app/streaming/video/ffmpeg-renderers/dxva2.cpp +++ b/app/streaming/video/ffmpeg-renderers/dxva2.cpp @@ -989,7 +989,7 @@ Exit: overlayVertexBuffer->Release(); } -int DXVA2Renderer::getDecoderColorspace() +int DXVA2Renderer::getDecoderSdrColorspace() { if (m_DeviceQuirks & DXVA2_QUIRK_NO_VP) { // StretchRect() assumes Rec 601 on Intel and Qualcomm GPUs. diff --git a/app/streaming/video/ffmpeg-renderers/dxva2.h b/app/streaming/video/ffmpeg-renderers/dxva2.h index a2e23cb3..851660db 100644 --- a/app/streaming/video/ffmpeg-renderers/dxva2.h +++ b/app/streaming/video/ffmpeg-renderers/dxva2.h @@ -19,7 +19,7 @@ public: virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override; virtual void renderFrame(AVFrame* frame) override; virtual void notifyOverlayUpdated(Overlay::OverlayType type) override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; virtual int getDecoderCapabilities() override; private: diff --git a/app/streaming/video/ffmpeg-renderers/mmal.cpp b/app/streaming/video/ffmpeg-renderers/mmal.cpp index 98cf663d..4d86a4d2 100644 --- a/app/streaming/video/ffmpeg-renderers/mmal.cpp +++ b/app/streaming/video/ffmpeg-renderers/mmal.cpp @@ -210,7 +210,7 @@ bool MmalRenderer::initialize(PDECODER_PARAMETERS params) return true; } -int MmalRenderer::getDecoderColorspace() +int MmalRenderer::getDecoderSdrColorspace() { // MMAL seems to always use Rec. 709 colorspace for rendering // even when we try to set something else in the input format. diff --git a/app/streaming/video/ffmpeg-renderers/mmal.h b/app/streaming/video/ffmpeg-renderers/mmal.h index 560a8b36..1edb0869 100644 --- a/app/streaming/video/ffmpeg-renderers/mmal.h +++ b/app/streaming/video/ffmpeg-renderers/mmal.h @@ -17,7 +17,7 @@ public: virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override; virtual bool needsTestFrame() override; virtual int getRendererAttributes() override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; private: static void InputPortCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer); diff --git a/app/streaming/video/ffmpeg-renderers/renderer.h b/app/streaming/video/ffmpeg-renderers/renderer.h index d71f1eb9..f226d77d 100644 --- a/app/streaming/video/ffmpeg-renderers/renderer.h +++ b/app/streaming/video/ffmpeg-renderers/renderer.h @@ -153,7 +153,7 @@ public: return 0; } - virtual int getDecoderColorspace() { + virtual int getDecoderSdrColorspace() { // Rec 601 is default return COLORSPACE_REC_601; } @@ -177,7 +177,7 @@ public: default: // If the colorspace is not populated, assume the encoder // is sending the colorspace that we requested. - return getDecoderColorspace(); + return getDecoderSdrColorspace(); } } diff --git a/app/streaming/video/ffmpeg-renderers/vaapi.cpp b/app/streaming/video/ffmpeg-renderers/vaapi.cpp index 34c42b8a..09fe6c8a 100644 --- a/app/streaming/video/ffmpeg-renderers/vaapi.cpp +++ b/app/streaming/video/ffmpeg-renderers/vaapi.cpp @@ -470,7 +470,7 @@ VAAPIRenderer::isDirectRenderingSupported() return false; } -int VAAPIRenderer::getDecoderColorspace() +int VAAPIRenderer::getDecoderSdrColorspace() { // Gallium drivers don't support Rec 709 yet - https://gitlab.freedesktop.org/mesa/mesa/issues/1915 // Intel-vaapi-driver defaults to Rec 601 - https://github.com/intel/intel-vaapi-driver/blob/021bcb79d1bd873bbd9fbca55f40320344bab866/src/i965_output_dri.c#L186 diff --git a/app/streaming/video/ffmpeg-renderers/vaapi.h b/app/streaming/video/ffmpeg-renderers/vaapi.h index 71594d0e..8651bca1 100644 --- a/app/streaming/video/ffmpeg-renderers/vaapi.h +++ b/app/streaming/video/ffmpeg-renderers/vaapi.h @@ -41,7 +41,7 @@ public: virtual void renderFrame(AVFrame* frame) override; virtual bool needsTestFrame() override; virtual bool isDirectRenderingSupported() override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; virtual int getDecoderCapabilities() override; virtual void notifyOverlayUpdated(Overlay::OverlayType) override; diff --git a/app/streaming/video/ffmpeg-renderers/vdpau.cpp b/app/streaming/video/ffmpeg-renderers/vdpau.cpp index 8f948743..552bc1aa 100644 --- a/app/streaming/video/ffmpeg-renderers/vdpau.cpp +++ b/app/streaming/video/ffmpeg-renderers/vdpau.cpp @@ -428,7 +428,7 @@ bool VDPAURenderer::needsTestFrame() return true; } -int VDPAURenderer::getDecoderColorspace() +int VDPAURenderer::getDecoderSdrColorspace() { // VDPAU defaults to Rec 601. // https://http.download.nvidia.com/XFree86/vdpau/doxygen/html/group___vdp_video_mixer.html#ga65580813e9045d94b739ed2bb8b62b46 diff --git a/app/streaming/video/ffmpeg-renderers/vdpau.h b/app/streaming/video/ffmpeg-renderers/vdpau.h index 0e8fc957..6687f235 100644 --- a/app/streaming/video/ffmpeg-renderers/vdpau.h +++ b/app/streaming/video/ffmpeg-renderers/vdpau.h @@ -19,7 +19,7 @@ public: virtual void waitToRender() override; virtual void renderFrame(AVFrame* frame) override; virtual bool needsTestFrame() override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; virtual int getDecoderCapabilities() override; private: diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index fc362b38..7855db2b 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -87,9 +87,9 @@ int FFmpegVideoDecoder::getDecoderCapabilities() return capabilities; } -int FFmpegVideoDecoder::getDecoderColorspace() +int FFmpegVideoDecoder::getDecoderSdrColorspace() { - return m_FrontendRenderer->getDecoderColorspace(); + return m_FrontendRenderer->getDecoderSdrColorspace(); } int FFmpegVideoDecoder::getDecoderColorRange() diff --git a/app/streaming/video/ffmpeg.h b/app/streaming/video/ffmpeg.h index 4caf2c74..68a17244 100644 --- a/app/streaming/video/ffmpeg.h +++ b/app/streaming/video/ffmpeg.h @@ -20,7 +20,7 @@ public: virtual bool isAlwaysFullScreen() override; virtual bool isHdrSupported() override; virtual int getDecoderCapabilities() override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; virtual int getDecoderColorRange() override; virtual QSize getDecoderMaxResolution() override; virtual int submitDecodeUnit(PDECODE_UNIT du) override; diff --git a/app/streaming/video/slvid.cpp b/app/streaming/video/slvid.cpp index 5008847e..262f0567 100644 --- a/app/streaming/video/slvid.cpp +++ b/app/streaming/video/slvid.cpp @@ -63,7 +63,7 @@ SLVideoDecoder::getDecoderCapabilities() } int -SLVideoDecoder::getDecoderColorspace() +SLVideoDecoder::getDecoderSdrColorspace() { return COLORSPACE_REC_709; } diff --git a/app/streaming/video/slvid.h b/app/streaming/video/slvid.h index e6adea6d..9f318da5 100644 --- a/app/streaming/video/slvid.h +++ b/app/streaming/video/slvid.h @@ -14,7 +14,7 @@ public: virtual bool isHardwareAccelerated() override; virtual bool isAlwaysFullScreen() override; virtual int getDecoderCapabilities() override; - virtual int getDecoderColorspace() override; + virtual int getDecoderSdrColorspace() override; virtual int getDecoderColorRange() override; virtual QSize getDecoderMaxResolution() override; virtual int submitDecodeUnit(PDECODE_UNIT du) override;