low-latency video encoding creation failed, error code 12902

VTCompressionSessionCreate returned 12902 if kVTVideoEncoderSpecification_EnableLowLatencyRateControl was picked. Code: CFMutableDictionaryRef encoderSpecification = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL);

        CFDictionarySetValue(encoderSpecification, kVTVideoEncoderSpecification_EnableLowLatencyRateControl, kCFBooleanTrue);

    OSStatus result = VTCompressionSessionCreate(kCFAllocatorDefault, 640, 360, kCMVideoCodecType_H264, encoderSpecification, nullptr, nullptr, cb, outputCallbackRefCon, &m_session);

    if(result != noErr){         return result;     }

Got another message: Low latency RC mode requires hardware encoder. Here is my machine info: Hardware Overview:

  Model Name: MacBook Pro

  Model Identifier: MacBookPro17,1

  Chip: Apple M1

  Total Number of Cores: 8 (4 performance and 4 efficiency)

  Memory: 8 GB

  System Firmware Version: 6723.120.36

  OS Loader Version: 6723.120.36

  Serial Number (system): C02FK0FAQ05H

  Hardware UUID: 098EBBDA-3841-5A29-B7C9-A982E675E6D5

  Provisioning UDID: 00008103-000D446921D1001E

  Activation Lock Status: Enabled

Apple M1:   Chipset Model: Apple M1   Type: GPU   Bus: Built-In   Total Number of Cores: 8   Vendor: Apple (0x106b)   Metal Family: Supported, Metal GPUFamily Apple 7

So M1 chip doesn't support low latency RC mode? Can someone help? Thanks a lot in advance.

modified the code little bit, and add RequireHardwareAcceleratedVideoEncoder in the encoder specification. const void *encoderKeys[] = { kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder,kVTVideoEncoderSpecification_EnableLowLatencyRateControl}, set both to true, but still get 12902 error.

low-latency video encoding creation failed, error code 12902
 
 
Q