mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-02 09:33:33 +00:00
libobs: Fix corruption of audio data in audio_input_buf
Previously, source->next_audio_ts_min was incremented by conv_frames_to_time(sample_rate, in.frames) in each call of source_output_audio_data(), so only by the duration of the audio data itself. However, this does not take the current timestamp into account, which also includes execution time (audio source timestamps are not necessarily continuous). This causes the incoming audio timestamp to gradually deviate further from the expected next_audio_ts_min timestamp, eventually exceeding TS_SMOOTHING_THRESHOLD and then causing a call to source_output_audio_place() which either overwrites existing audio data and causes a glitch or puts data beyond the end of the buffer, inserting a gap and thus causing a dropout. Now use incoming timestamp for calculation of the next minimum timestamp.
This commit is contained in:
parent
6d5dd75e4a
commit
03518891c8
|
@ -1482,7 +1482,7 @@ static void source_output_audio_data(obs_source_t *source,
|
|||
|
||||
source->last_audio_ts = in.timestamp;
|
||||
source->next_audio_ts_min =
|
||||
in.timestamp + conv_frames_to_time(sample_rate, in.frames);
|
||||
data->timestamp + conv_frames_to_time(sample_rate, in.frames);
|
||||
|
||||
in.timestamp += source->timing_adjust;
|
||||
|
||||
|
|
Loading…
Reference in a new issue