Add HDR and colorspace fields to DECODE_UNIT

This commit is contained in:
Cameron Gutman 2023-03-11 11:36:21 -06:00
commit c9426a6a71
2 changed files with 19 additions and 0 deletions

View file

@ -453,6 +453,13 @@ static void reassembleFrame(int frameNumber) {
qdu->decodeUnit.presentationTimeMs = firstPacketPresentationTime;
qdu->decodeUnit.enqueueTimeMs = LiGetMillis();
// These might be wrong for a few frames during a transition between SDR and HDR,
// but the effects shouldn't very noticable since that's an infrequent operation.
//
// If we start sending this state in the frame header, we can make it 100% accurate.
qdu->decodeUnit.hdrActive = LiGetCurrentHostDisplayHdrMode();
qdu->decodeUnit.colorspace = (uint8_t)(qdu->decodeUnit.hdrActive ? COLORSPACE_REC_2020 : StreamConfig.colorSpace);
// IDR frames will have leading CSD buffers
if (nalChainHead->bufferType != BUFFER_TYPE_PICDATA) {
qdu->decodeUnit.frameType = FRAME_TYPE_IDR;