libobs: Fix an issue that would cause audio stuttering
Under certain circumstances, the timing_adjust variable would cause line 1161 to continually trigger over and over again. The "loop detection" code incorrectly made it so that any timestamp that was just simply below the expected value would be seen as a jump. After that, the timing_adjust variable would be set for the frame again, and then the audio would see it as a jump again after that, and those two things would continue endlessly. This would cause stuttering particularly with certain devices (particularly elgato/lgp/hdpvr) where the audio/video data are decoded and sent at varying/different/unpredictable times. To fix this issue, it should not detect values below as jumps, but instead should only do it for values that exceed the MAX_TS_VAR (maximum timestamp variance) value.
This commit is contained in:
@@ -1158,8 +1158,7 @@ static void source_output_audio_data(obs_source_t *source,
|
||||
* will have a timestamp jump. If that case is encountered,
|
||||
* just clear the audio data in that small window and force a
|
||||
* resync. This handles all cases rather than just looping. */
|
||||
} else if (in.timestamp < source->next_audio_sys_ts_min ||
|
||||
diff > MAX_TS_VAR) {
|
||||
} else if (diff > MAX_TS_VAR) {
|
||||
reset_audio_timing(source, data->timestamp,
|
||||
os_time);
|
||||
in.timestamp = data->timestamp + source->timing_adjust;
|
||||
|
Reference in New Issue
Block a user