diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 4215fd9897..c8d6021259 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -260,8 +260,9 @@ VideoLayersAllocation CreateVideoLayersAllocation( // Encoder may drop frames internally if `maxFramerate` is set. spatial_layer.frame_rate_fps = std::min( encoder_config.simulcastStream[si].maxFramerate, - (current_rate.framerate_fps * frame_rate_fraction) / - VideoEncoder::EncoderInfo::kMaxFramerateFraction); + rtc::saturated_cast( + (current_rate.framerate_fps * frame_rate_fraction) / + VideoEncoder::EncoderInfo::kMaxFramerateFraction)); } } else if (encoder_config.numberOfSimulcastStreams == 1) { // TODO(bugs.webrtc.org/12000): Implement support for AV1 with @@ -329,8 +330,9 @@ VideoLayersAllocation CreateVideoLayersAllocation( // Encoder may drop frames internally if `maxFramerate` is set. spatial_layer.frame_rate_fps = std::min( encoder_config.spatialLayers[si].maxFramerate, - (current_rate.framerate_fps * frame_rate_fraction) / - VideoEncoder::EncoderInfo::kMaxFramerateFraction); + rtc::saturated_cast( + (current_rate.framerate_fps * frame_rate_fraction) / + VideoEncoder::EncoderInfo::kMaxFramerateFraction)); } }