onRateUpdate method

FutureOr<void> onRateUpdate(
  1. dynamic streamId,
  2. dynamic streamInfo,
  3. dynamic videoIndex,
  4. dynamic fps,
  5. dynamic bitrateKbps,
)
override

@detail callback @author wangzhanqiang @brief When the frame rate or bit rate of a custom encoded stream changes, the callback is triggered @param streamId The ID of the encoded stream that changes @param streamInfo The properties of the encoded stream that changes @param videoIndex The subscript of the corresponding encoded stream @param fps The frame rate after the change, the unit: fps @param bitrateKbps The code rate after the change, the unit: kbps

Implementation

FutureOr<void> onRateUpdate(dynamic streamId, dynamic streamInfo,
    dynamic videoIndex, dynamic fps, dynamic bitrateKbps) async {
  if ($instance == null || $instance is! IExternalVideoEncoderEventHandler) {
    return;
  }
  return ($instance as IExternalVideoEncoderEventHandler).onRateUpdate?.call(
      streamId.toString(),
      int.tryParse(videoIndex.toString()) ?? 0,
      int.tryParse(fps.toString()) ?? 0,
      int.tryParse(bitrateKbps.toString()) ?? 0);
}