feat(step-down): the bitrate floor is the tier's YouTube minimum
Step-down used a flat 3 Mbps (4 for vertical) as its floor — a number that had nothing to do with the tier being streamed. With CBR holding the target, that floor is a real picture-quality floor, so it has to follow YouTube's published H.264 table (support.google.com/youtube/answer/2853702): 6 at 1080p60, 5 at 1080p30, 3 at 720p. Models/RateLadder is that table as pure policy. Vertical is not a separate row: 1080x1920 and 1920x1080 are the same pixel count, so the frame rate alone picks the band. StepDownPolicy takes the floor as an optional constructor argument and refuses one above the starting rate, so an unusual start cannot begin under its own floor. Omitted, the historical 3/4 floor still applies, which keeps the existing policy tests meaningful and lets a caller opt in. One consequence worth knowing: the three-step budget can stop above the floor (12 → 9.6 → 7.7 → 6.2 from a 20% loss), so the floor is a limit, not a target. 669 pass, 0 warnings.
This commit is contained in:
@@ -105,8 +105,11 @@ public sealed class StepDownPolicy
|
||||
|
||||
/// <summary>Explicit geometry: the tier the creator actually chose, which is what decides the
|
||||
/// step budget (a 1080 start gets three, a 720 start gets one).</summary>
|
||||
/// <param name="floorBitrateMbps">The lowest rate a step-down may reach — the tier's YouTube
|
||||
/// minimum (<see cref="RateLadder"/>). Never below the starting rate, so an unusual start cannot
|
||||
/// begin already under its floor. Omitted, the historical 3/4 Mbps floor applies.</param>
|
||||
public StepDownPolicy(int startWidth, int startHeight, int startFps, double startBitrateMbps,
|
||||
bool allowClimb = false)
|
||||
bool allowClimb = false, double? floorBitrateMbps = null)
|
||||
{
|
||||
_vertical = startHeight > startWidth;
|
||||
_allowClimb = allowClimb;
|
||||
@@ -114,7 +117,9 @@ public sealed class StepDownPolicy
|
||||
_ceilingWidth = startWidth;
|
||||
_ceilingHeight = startHeight;
|
||||
_ceilingBitrateMbps = startBitrateMbps;
|
||||
_floorBitrateMbps = _vertical ? 4.0 : 3.0;
|
||||
_floorBitrateMbps = Math.Min(
|
||||
floorBitrateMbps ?? (_vertical ? 4.0 : 3.0),
|
||||
startBitrateMbps);
|
||||
|
||||
Fps = startFps;
|
||||
Width = startWidth;
|
||||
|
||||
Reference in New Issue
Block a user