From 1c47e719e1be55d968dae01b8a004bdcd822bba8 Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Wed, 18 Dec 2024 10:25:57 +0100 Subject: [PATCH] Pass the actual temporal id to GMPVideoEncodedFrame (#3828) --- module/gmp-openh264.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/gmp-openh264.cpp b/module/gmp-openh264.cpp index 29a143fe7..4380c9c95 100644 --- a/module/gmp-openh264.cpp +++ b/module/gmp-openh264.cpp @@ -708,10 +708,13 @@ class OpenH264VideoEncoder : public GMPVideoEncoder, public RefCounted { // Buffer up the data. uint32_t length = 0; std::vector lengths; + unsigned char temporalId = 0; for (int i = 0; i < encoded->iLayerNum; ++i) { lengths.push_back (0); uint8_t* tmp = encoded->sLayerInfo[i].pBsBuf; + assert(encoded->sLayerInfo[i].uiSpatialId == 0); + temporalId = encoded->sLayerInfo[i].uiTemporalId; for (int j = 0; j < encoded->sLayerInfo[i].iNalCount; ++j) { lengths[i] += encoded->sLayerInfo[i].pNalLengthInByte[j]; // Convert from 4-byte start codes to GMP_BufferLength32 (NAL lengths) @@ -746,7 +749,7 @@ class OpenH264VideoEncoder : public GMPVideoEncoder, public RefCounted { f->SetBufferType (GMP_BufferLength32); if (gmp_api_version_ >= kGMPVersion36) { - f->SetTemporalLayerId (encoded->iLayerNum); + f->SetTemporalLayerId (temporalId); } GMPLOG (GL_DEBUG, "Encoding complete. type= "