libobs: Buffer-smoothing enhancements
If an audio source does not provide enough data at a steady pace, the timestamp update does not happen, and buffering increases until it maxes out. To counteract this, update the timestamp anyway. Another issue for decoupled audio sources is that timing is not adjusted for divergence from system time. Making this adjustment is better for timing stability. 5+ hours of stable audio without any buffering on my GV-USB2 where it used to add 21ms every 5 mintues or so. Fixes https://obsproject.com/mantis/view.php?id=1269
This commit is contained in:
parent
534c553b23
commit
da87f08da4
@ -211,6 +211,7 @@ static inline void discard_audio(struct obs_core_audio *audio,
|
||||
if (is_audio_source)
|
||||
blog(LOG_DEBUG, "can't discard, data still pending");
|
||||
#endif
|
||||
source->audio_ts = ts->end;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1267,8 +1267,11 @@ static void source_output_audio_data(obs_source_t *source,
|
||||
if (diff > MAX_TS_VAR && !using_direct_ts)
|
||||
handle_ts_jump(source, source->next_audio_ts_min,
|
||||
in.timestamp, diff, os_time);
|
||||
else if (diff < TS_SMOOTHING_THRESHOLD)
|
||||
else if (diff < TS_SMOOTHING_THRESHOLD) {
|
||||
if (source->async_unbuffered && source->async_decoupled)
|
||||
source->timing_adjust = os_time - in.timestamp;
|
||||
in.timestamp = source->next_audio_ts_min;
|
||||
}
|
||||
}
|
||||
|
||||
source->last_audio_ts = in.timestamp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user