Fix issue resulting in freezing video-stream on peak bitrate on 1080P

This commit is contained in:
loki 2019-12-22 00:05:00 +01:00
commit e4c81c3a97
2 changed files with 11 additions and 5 deletions

View file

@ -4,7 +4,7 @@ Requirements:
Compilation:
* git clone <repository> --recurse-submodules
* mkdir build && cd build
* cmake -DCMAKE_BUILD_TYPE=Release ..
* cmake ..
* make
@ -31,6 +31,12 @@ Usage:
Note:
* The Windows key is not passed through by Moonlight, therefore Sunshine maps Right-Alt key to the Windows key
* If you set Video Bitrate to 0.5Mb/s:
* Sunshine will use CRF or QP to controll the quality of the stream. (See example configuration file for more details)
* This is less CPU intensive and it has lower average bandwith requirements compared to manually setting bitrate to acceptable quality
* However, it has higher peak bitrates, forcing Sunshine to drop entire frames when streaming 1080P due to their size.
* When this happens, the video portion of the stream appears to be frozen.
* This is rare enough that using this for the desktop environment is tolerable (in my opinion), however for gaming not so much.
Credits:

View file

@ -116,10 +116,10 @@ void encodeThread(
av_dict_set(&options, "tune", config::video.tune.c_str(), 0);
if(config.bitrate > 500) {
ctx->rc_max_rate = 2000000;
ctx->rc_buffer_size = 2000000;
ctx->bit_rate = config.bitrate * 1000;
// av_dict_set_int(&options, "qp", config::video.qp, 0);
config.bitrate *= 1000;
ctx->rc_max_rate = config.bitrate;
ctx->rc_buffer_size = 100000;
ctx->bit_rate = config.bitrate;
}
else if(config::video.crf != 0) {
av_dict_set_int(&options, "crf", config::video.crf, 0);