From af4090a305f86712c988f33b04789d8d0428b3ab Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Mon, 8 Jul 2024 15:42:36 +0200 Subject: [PATCH] capture/dshow: Add workaround for OBS virtual camera --- src/video_capture/DirectShowGrabber.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index 734e7af02..f68fbe988 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -1088,6 +1088,15 @@ static int vidcap_dshow_init(struct vidcap_params *params, void **state) { res = s->filterGraph->QueryInterface(IID_IMediaControl, (void **) &s->mediaControl); HANDLE_ERR("Cannot find media control interface"); + if(get_friendly_name(s->moniker).find("OBS Virtual") != std::string::npos){ + IMediaFilter *pMediaFilter; + res = s->filterGraph->QueryInterface(IID_IMediaFilter, (void **) &pMediaFilter); + HANDLE_ERR("Cannot find media filter interface"); + + log_msg(LOG_LEVEL_WARNING, MOD_NAME "OBS virtual camera detected. Setting sync source to NULL!\n"); + pMediaFilter->SetSyncSource(NULL); + } + FILTER_STATE fs; res = s->mediaControl->Run(); while ((res = s->mediaControl->GetState(500, (OAFilterState*) &fs)) != VFW_S_CANT_CUE && !(res == S_OK && fs == State_Running)) {