libobs: Add async video/audio decoupling functions

Decoupling the audio from the video causes the audio to be played right
when it's received rather than attempt to sync up to the video frames.
This is useful with certain async sources/devices when the audio/video
timestamps are not reliable.

Naturally because it plays audio right when it's received, this should
only be used when the async source is operating in unbuffered mode,
otherwise the video frame timing will be out of sync by the amount of
buffering the video currently has.
This commit is contained in:
jp9000
2017-09-29 00:37:33 -07:00
parent d768717b8c
commit b54f70ef8d
4 changed files with 38 additions and 4 deletions

View File

@@ -165,7 +165,10 @@ static void on_audio_playback(void *param, obs_source_t *source,
UINT32 pad = 0;
monitor->client->lpVtbl->GetCurrentPadding(monitor->client, &pad);
if (monitor->source_has_video) {
bool decouple_audio =
source->async_unbuffered && source->async_decoupled;
if (monitor->source_has_video && !decouple_audio) {
uint64_t ts = audio_data->timestamp - ts_offset;
if (!process_audio_delay(monitor, (float**)(&resample_data[0]),