From 534c553b233cf247fc4fe2d2ca3fef40a5eaba96 Mon Sep 17 00:00:00 2001 From: James Park Date: Fri, 5 Jul 2019 07:31:07 -0700 Subject: [PATCH] win-dshow: Decouple audio from video If a device produces video and audio timestamps atdifferent rates, this divergence can cause massive buffering on the audio side, leading to a capped audio buffer, and total sound loss. This change allows a hardcoded list of devices to use the existing decoupling logic. For now, only "GV-USB2" has been added. When combined with another fix, 5+ hours of stable audio without any buffering on my GV-USB2 where it used to drop sound completely after an hour or so. Partially fixes https://obsproject.com/mantis/view.php?id=1269 --- plugins/win-dshow/win-dshow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp index b6434abf2..b150e8d9b 100644 --- a/plugins/win-dshow/win-dshow.cpp +++ b/plugins/win-dshow/win-dshow.cpp @@ -800,6 +800,11 @@ static inline bool IsEncoded(const VideoConfig &config) wstrstri(config.name.c_str(), L"stream engine") != NULL; } +static inline bool IsDecoupled(const VideoConfig &config) +{ + return wstrstri(config.name.c_str(), L"GV-USB2") != NULL; +} + inline void DShowInput::SetupBuffering(obs_data_t *settings) { BufferingType bufType; @@ -813,6 +818,7 @@ inline void DShowInput::SetupBuffering(obs_data_t *settings) useBuffering = bufType == BufferingType::On; obs_source_set_async_unbuffered(source, !useBuffering); + obs_source_set_async_decoupled(source, IsDecoupled(videoConfig)); } static DStr GetVideoFormatName(VideoFormat format); -- GitLab