提交 5defc679 编写于 作者: J jp9000

Remove audio/video sync reference counter

This is actually unnecessary now that there's a hard limit on the
maximum offset in which audio can be inserted.

This also assumes too much about the audio; it assumes audio is always
on, where as with some devices (such as the elgato) audio is not on
until the stream starts, and when the video has already incremented the
counter.
上级 dc434380
......@@ -294,25 +294,6 @@ struct obs_source {
uint64_t last_frame_ts;
uint64_t last_sys_timestamp;
/*
* audio/video timestamp synchronization reference counter
*
* if audio goes outside of expected timing bounds, this number will
* be deremented.
*
* if video goes outside of expecting timing bounds, this number will
* be incremented.
*
* when this reference counter is at 0, it means ths audio is
* synchronized with the video and it is safe to play. when it's not
* 0, it means that audio and video are desynchronized, and thus not
* safe to play. this just generally ensures synchronization between
* audio/video when timing somehow becomes 'reset'.
*
* XXX: may be an overly cautious check
*/
volatile long av_sync_ref;
/* audio */
bool audio_failed;
struct resample_info sample_info;
......
......@@ -534,9 +534,7 @@ static inline void handle_ts_jump(obs_source_t source, uint64_t expected,
source->context.name, diff, expected, ts);
/* if has video, ignore audio data until reset */
if (source->info.output_flags & OBS_SOURCE_ASYNC)
os_atomic_dec_long(&source->av_sync_ref);
else
if (!(source->info.output_flags & OBS_SOURCE_ASYNC))
reset_audio_timing(source, ts);
}
......@@ -654,9 +652,6 @@ static void source_output_audio_line(obs_source_t source,
source->next_audio_ts_min = in.timestamp +
conv_frames_to_time(in.frames);
if (source->av_sync_ref != 0)
return;
in.timestamp += source->timing_adjust + source->sync_offset;
in.volume = source->user_volume * source->present_volume *
obs->audio.user_volume * obs->audio.present_volume;
......@@ -1514,7 +1509,6 @@ static bool ready_async_frame(obs_source_t source, uint64_t sys_time)
/* account for timestamp invalidation */
if (frame_out_of_bounds(source, frame_time)) {
source->last_frame_ts = next_frame->timestamp;
os_atomic_inc_long(&source->av_sync_ref);
} else {
frame_offset = frame_time - source->last_frame_ts;
source->last_frame_ts += frame_offset;
......@@ -1534,7 +1528,6 @@ static bool ready_async_frame(obs_source_t source, uint64_t sys_time)
if ((next_frame->timestamp - frame_time) > MAX_TIMESTAMP_JUMP) {
source->last_frame_ts =
next_frame->timestamp - frame_offset;
os_atomic_inc_long(&source->av_sync_ref);
}
frame_time = next_frame->timestamp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册