提交 d43d59ca 编写于 作者: J jp9000

libobs: Remove seamless audio loop handling

The seamless audio looping code would erroneously trigger for things
that weren't loops, causing the audio data to continually push back and
ignore timestamps, thus going out of sync.

There does need to be loop handling code, but due to the fact that other
things may need to trigger this code, it's best just to clear the audio
data and start from a fresh sync point.  Unfortunately for the case of
loops, this means the window in which audio data loops and video frames
loop need to be muted.
上级 eae1328a
......@@ -540,7 +540,6 @@ struct obs_source {
bool audio_pending;
bool user_muted;
bool muted;
bool resync_audio_with_video;
struct obs_source *next_audio_source;
struct obs_source **prev_next_audio_source;
uint64_t audio_ts;
......
......@@ -1134,33 +1134,28 @@ static void source_output_audio_data(obs_source_t *source,
in.timestamp += source->timing_adjust;
pthread_mutex_lock(&source->audio_buf_mutex);
if (source->next_audio_sys_ts_min == in.timestamp) {
if (source->resync_audio_with_video)
source->resync_audio_with_video = false;
else
push_back = true;
push_back = true;
} else if (source->next_audio_sys_ts_min) {
diff = uint64_diff(source->next_audio_sys_ts_min, in.timestamp);
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. */
push_back = true;
/* This typically 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. 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) {
reset_audio_timing(source, data->timestamp,
source->next_audio_sys_ts_min);
push_back = true;
source->resync_audio_with_video = true;
os_time);
reset_audio_data(source, os_time);
in.timestamp = data->timestamp + source->timing_adjust;
}
}
......@@ -1178,8 +1173,6 @@ static void source_output_audio_data(obs_source_t *source,
source->last_sync_offset = sync_offset;
}
pthread_mutex_lock(&source->audio_buf_mutex);
if (push_back)
source_output_audio_push_back(source, &in);
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册