Skip to content

Commit

Permalink
fixup! Use measured peak bandwidth if it is higher than 1.2x target b…
Browse files Browse the repository at this point in the history
…itrate
  • Loading branch information
danstiner committed Mar 30, 2021
1 parent 9c80428 commit 7925239
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/obs-outputs/ftl-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,16 +442,18 @@ static void set_peak_bitrate(struct ftl_stream *stream)
user_desired_bitrate, results.peak_kbps, results.starting_rtt,
results.ending_rtt, percent_lost);

// We still want to set the peak to about 1.2x what the target bitrate is,
// We want to set the peak to at least 1.2x what the target bitrate is,
// even if the speed test reported it should be lower. If we don't, FTL
// will queue data on the client and start adding latency. If the internet
// connection really can't handle the bitrate the user will see either lost frame
// and recovered frame counts go up, which is reflect in the dropped_frames count.
int min_bitrate = user_desired_bitrate * 12 / 10;
if (results.peak_kbps > min_bitrate)
// Assume we can use a significant percentage of the available bandwidth
int peak_usable_bitrate = results.peak_kbps * 8 / 10;

if (peak_usable_bitrate > min_bitrate)
{
// Assume we can use a large percentage of the available bandwidth
stream->peak_kbps = stream->params.peak_kbps = results.peak_kbps * 8 / 10;
stream->peak_kbps = stream->params.peak_kbps = peak_usable_bitrate;
}
else
{
Expand Down

0 comments on commit 7925239

Please sign in to comment.