|
@@ -1143,11 +1143,34 @@ static void source_output_audio_data(obs_source_t *source,
|
|
in.timestamp += source->timing_adjust;
|
|
in.timestamp += source->timing_adjust;
|
|
|
|
|
|
if (source->next_audio_sys_ts_min == in.timestamp) {
|
|
if (source->next_audio_sys_ts_min == in.timestamp) {
|
|
- push_back = true;
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (source->resync_audio_with_video)
|
|
|
|
+ source->resync_audio_with_video = false;
|
|
|
|
+ else
|
|
|
|
+ push_back = true;
|
|
|
|
+
|
|
|
|
+ } else if (source->next_audio_sys_ts_min) {
|
|
diff = uint64_diff(source->next_audio_sys_ts_min, in.timestamp);
|
|
diff = uint64_diff(source->next_audio_sys_ts_min, in.timestamp);
|
|
- if (diff < TS_SMOOTHING_THRESHOLD)
|
|
|
|
|
|
+
|
|
|
|
+ if (diff < TS_SMOOTHING_THRESHOLD) {
|
|
|
|
+ if (source->resync_audio_with_video)
|
|
|
|
+ source->resync_audio_with_video = false;
|
|
|
|
+ else
|
|
|
|
+ push_back = true;
|
|
|
|
+
|
|
|
|
+ /* This only happens if used with async video when audio/video
|
|
|
|
+ * start transitioning in to a timestamp jump. Audio will
|
|
|
|
+ * typically have a timestamp jump, and then video will have a
|
|
|
|
+ * timestamp jump. It's important to not just push back the
|
|
|
|
+ * next non-reset audio data after this happens, as that will
|
|
|
|
+ * be the video re-syncing. */
|
|
|
|
+ } else if (in.timestamp < source->next_audio_sys_ts_min ||
|
|
|
|
+ diff > MAX_TS_VAR) {
|
|
|
|
+ reset_audio_timing(source, data->timestamp,
|
|
|
|
+ source->next_audio_sys_ts_min);
|
|
push_back = true;
|
|
push_back = true;
|
|
|
|
+ source->resync_audio_with_video = true;
|
|
|
|
+ in.timestamp = data->timestamp + source->timing_adjust;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
sync_offset = source->sync_offset;
|
|
sync_offset = source->sync_offset;
|