Skip to content

Instantly share code, notes, and snippets.

@quietvoid
Created January 21, 2021 18:52
Show Gist options
  • Save quietvoid/5967dd3ec9d3f6e313f2e0c0ca28996f to your computer and use it in GitHub Desktop.
Save quietvoid/5967dd3ec9d3f6e313f2e0c0ca28996f to your computer and use it in GitHub Desktop.
Fixes MTK rendering when both Dolby Vision and HDR10+ are present
diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp
index d31253f7de..6fa8c6cf31 100644
--- a/xbmc/utils/BitstreamConverter.cpp
+++ b/xbmc/utils/BitstreamConverter.cpp
@@ -972,10 +972,21 @@ void CBitstreamConverter::BitstreamAllocAndCopy( uint8_t **poutbuf, int *poutbuf
void *tmp;
// MTK Dolby Vision decoder (seems) to expect header of size 4
- if (dovi_workaround &&
- (nal_type == HEVC_NAL_UNSPEC62 || nal_type == HEVC_NAL_UNSPEC63))
+ if (dovi_workaround)
{
- nal_header_size = 4;
+ if (nal_type == HEVC_NAL_UNSPEC62 || nal_type == HEVC_NAL_UNSPEC63)
+ {
+ nal_header_size = 4;
+ }
+ else if (nal_type == HEVC_NAL_SEI_PREFIX)
+ {
+ // Returns a black screen when HDR10+ metadata is also present
+ // Skip ITU-T T.35 SMPTE ST 2094-40 SEI prefix NALUS
+ if (in[0] == 78 && in[1] == 1 && in[2] == 4)
+ {
+ return;
+ }
+ }
}
*poutbuf_size += sps_pps_size + in_size + nal_header_size;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment