diff --git a/app/streaming/video/ffmpeg-renderers/vt.mm b/app/streaming/video/ffmpeg-renderers/vt.mm index d8d9ffc2..0db46df7 100644 --- a/app/streaming/video/ffmpeg-renderers/vt.mm +++ b/app/streaming/video/ffmpeg-renderers/vt.mm @@ -301,7 +301,18 @@ public: m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709); break; case COLORSPACE_REC_2020: - m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020); + // This is necessary to ensure HDR works properly with external displays on macOS Sonoma. + if (frame->color_trc == AVCOL_TRC_SMPTE2084) { + if (@available(macOS 11.0, *)) { + m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2100_PQ); + } + else { + m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020); + } + } + else { + m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020); + } break; case COLORSPACE_REC_601: m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);