Skip to content

Commit

Permalink
Pass the actual temporal id to GMPVideoEncodedFrame (#3828)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pehrsons authored Dec 18, 2024
1 parent fc1605c commit 1c47e71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion module/gmp-openh264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,13 @@ class OpenH264VideoEncoder : public GMPVideoEncoder, public RefCounted {
// Buffer up the data.
uint32_t length = 0;
std::vector<uint32_t> 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)
Expand Down Expand Up @@ -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= "
Expand Down

0 comments on commit 1c47e71

Please sign in to comment.