ui/handler, encoder: Allow overriding lag in frames

The lag in frames is not dictated by the number of threads being used by some encoders. At least for hardware encoders, the expected frame lag in real time encoding is 1 + the number of bframes
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-10-03 20:09:34 +02:00
parent d0dc4be985
commit 4cac28a8a3
4 changed files with 13 additions and 3 deletions
+4 -1
View File
@@ -878,6 +878,9 @@ bool obsffmpeg::encoder::update(obs_data_t* settings)
nullptr, "=", ";");
}
if (_handler)
_handler->override_lag_in_frames(_lag_in_frames, settings, _codec, _context);
// Handler Logging
if (_handler)
_handler->log_options(settings, _codec, _context);
@@ -1102,7 +1105,7 @@ bool obsffmpeg::encoder::encode_avframe(std::shared_ptr<AVFrame> frame, encoder_
bool sent_frame = false;
bool recv_packet = false;
bool should_lag = (_lag_in_frames - _count_send_frames) <= 0;
bool should_lag = (_count_send_frames >= _lag_in_frames);
auto loop_begin = std::chrono::high_resolution_clock::now();
auto loop_end = loop_begin + std::chrono::milliseconds(50);