iOS17 the encoder sets an average bit rate of 5Mbps. After one hour of live broadcast, the bit rate will suddenly drop to 1Mbps and cannot be restored.

iOS17, the encoder sets an average bit rate of 5Mbps.

in the first 25 minutes:the encoding rate is normal.

25 minutes-30minutes:The encoding bit rate will be reduced to 4M but can be restoredl.

30 minutes-70minutes:the encoding rate is normal.

70minutes-late:the bit rate will suddenly drop to 1Mbps and cannot be restored.

As shown in the figure below, the yellow line is the frame rate and the green line is the code rate.

The Code show as below

- (void)_setBitrate:(NSUInteger)bitrate forSession:(VTCompressionSessionRef)session {
    NSParameterAssert(session && bitrate);
    
    OSStatus status = VTSessionSetProperty(session, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(bitrate));
    if (status != noErr) NSLog(@"set AverageBitRate error");
    
    NSArray *limit = @[@(bitrate * 1.5/8), @(1)];
    status = VTSessionSetProperty(session, kVTCompressionPropertyKey_DataRateLimits, (__bridge CFArrayRef)limit);
    if (status != noErr) NSLog(@"set DataRateLimits error");
}

The problem only occurs in iOS17. Does anyone know what the reason is?

Replies

I have this issue too, do you have any update about this?

  • Restart encoder when bit rate drop or restart the encoder for a fixed duration

Add a Comment

Restart encoder when bit rate drop or restart the encoder for a fixed duration