Ensure VideoLayersAllocation.frame_rate_fps can not overflow
Bug: webrtc:12000 Change-Id: I14d5f0f987fb20bd74e0428b3791bf370476296e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/204220 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33089}
This commit is contained in:
parent
37dfddd5e8
commit
1aa1d6463a
@ -260,8 +260,9 @@ VideoLayersAllocation CreateVideoLayersAllocation(
|
||||
// Encoder may drop frames internally if `maxFramerate` is set.
|
||||
spatial_layer.frame_rate_fps = std::min<uint8_t>(
|
||||
encoder_config.simulcastStream[si].maxFramerate,
|
||||
(current_rate.framerate_fps * frame_rate_fraction) /
|
||||
VideoEncoder::EncoderInfo::kMaxFramerateFraction);
|
||||
rtc::saturated_cast<uint8_t>(
|
||||
(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<uint8_t>(
|
||||
encoder_config.spatialLayers[si].maxFramerate,
|
||||
(current_rate.framerate_fps * frame_rate_fraction) /
|
||||
VideoEncoder::EncoderInfo::kMaxFramerateFraction);
|
||||
rtc::saturated_cast<uint8_t>(
|
||||
(current_rate.framerate_fps * frame_rate_fraction) /
|
||||
VideoEncoder::EncoderInfo::kMaxFramerateFraction));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user