libvpx speed control: no VP8 levels below 6, react to overload at once
The bench showed the adaptive `cpu-used` oscillating: with headroom at -6 it stepped VP8 down to -5 and -4, which on screen content cost about ten times the encode time for under 1 dB, the encoder fell behind, frames were dropped, and it stepped back up. VP8 now stays within -10..-6. A single frame that takes longer than the whole frame interval makes the encoder faster at once, and when a slower level has to be undone, the next attempt to go slower waits twice as long (up to 16x 15 frames). The simulcast test also checks that `EncodedSource::set_layer_bitrate` reaches exactly that layer's encoder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
1 parent
64a3b95742
commit
6187cc24de
3 files changed
+65
-15
No files matched your search
@@ -2004,6 +2004,19 @@ mod tests {
|
||||
let frames = collect(&mut source, |f| f.iter().any(|f| f.layer == 5 && f.keyframe)).await;
|
||||
assert!(!frames.iter().any(|f| f.layer == 0 && f.keyframe), "layer 0 got a keyframe");
|
||||
|
||||
// A viewer's estimate lowers layer 5's encoder bitrate only.
|
||||
source.set_layer_bitrate(5, 150_000);
|
||||
let target = |id| {
|
||||
let stats = source.streamer().stats();
|
||||
stats.layers.iter().find(|l| l.id == id).map(|l| l.bitrate)
|
||||
};
|
||||
let deadline = Instant::now() + Duration::from_secs(5);
|
||||
while target(5) != Some(150_000) {
|
||||
assert!(Instant::now() < deadline, "layer 5 at {:?}", target(5));
|
||||
tokio::time::sleep(Duration::from_millis(20)).await;
|
||||
}
|
||||
assert_eq!(target(0), Some(800_000));
|
||||
|
||||
// VP9, layer 5 gone, a new layer 7 at a fixed size.
|
||||
let fixed = LayerSpec { size: Some((96, 64)), ..layer(7, 1.0, None, 200_000) };
|
||||
let update = StreamerConfigUpdate {
|
||||
|
||||
Reference in new issue
Block a user