libobs: Fix starting timestamp for preloaded frames

If audio monitoring is enabled and set to output only, the
obs_source_show_preloaded_video function would still incorrectly set the
current source audio output timestamp to the current system time, which
would cause audio to use an incorrect starting point from long ago for
the first starting audio segment if audio monitoring is then turned off
some time after having started the source.

Instead, the starting timestamp should be set to 0 if audio monitoring
is enabled with no output to stream, so that if/when audio monitoring is
disabled, it recalculates the starting timestamp of the first audio
packet on the spot again.

Closes obsproject/obs-studio#1522
master
jp9000 2018-12-03 08:44:55 -08:00
parent 4aa10cac3c
commit 4fa30c619c
1 changed files with 3 additions and 1 deletions

View File

@ -2484,7 +2484,9 @@ void obs_source_show_preloaded_video(obs_source_t *source)
source->async_active = true;
pthread_mutex_lock(&source->audio_buf_mutex);
sys_ts = os_gettime_ns();
sys_ts = (source->monitoring_type != OBS_MONITORING_TYPE_MONITOR_ONLY)
? os_gettime_ns()
: 0;
reset_audio_timing(source, source->last_frame_ts, sys_ts);
reset_audio_data(source, sys_ts);
pthread_mutex_unlock(&source->audio_buf_mutex);