Skip to content

Commit

Permalink
Use measured peak bandwidth if it is higher than 1.2x target bitrate
Browse files Browse the repository at this point in the history
  • Loading branch information
danstiner committed Mar 28, 2021
1 parent 8e848e8 commit 0e0e3a4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions plugins/obs-outputs/ftl-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,17 @@ static void set_peak_bitrate(struct ftl_stream *stream)
// 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.
stream->peak_kbps = stream->params.peak_kbps =
user_desired_bitrate * 12 / 10;
int min_bitrate = user_desired_bitrate * 12 / 10;
if (results.peak_kbps > 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;
}
else
{
warn("Speed test result was slower than 1.2x the target bitrate, considering lowering your bitrate");
stream->peak_kbps = stream->params.peak_kbps = min_bitrate;
}
ftl_ingest_update_params(&stream->ftl_handle, &stream->params);
}

Expand Down

0 comments on commit 0e0e3a4

Please sign in to comment.