Skip to content

Commit

Permalink
capture/dshow: Add workaround for OBS virtual camera
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiatka committed Jul 8, 2024
1 parent 8f6c5fb commit af4090a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/video_capture/DirectShowGrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit af4090a

Please sign in to comment.