Skip to content

Commit

Permalink
Fixed crash when connecting audio pin from Elgato device with audio r…
Browse files Browse the repository at this point in the history
…enderer
  • Loading branch information
FBirth authored and jp9000 committed Sep 17, 2014
1 parent 1a9d90c commit 1c248ca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion DShowPlugin/DeviceSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,24 @@ bool DeviceSource::LoadFilters()
IPin *audioPin = GetOutputPin(deviceFilter, &MEDIATYPE_Audio);
if (audioPin)
{
bConnected = SUCCEEDED(err = graph->ConnectDirect(audioPin, audioFilter->GetCapturePin(), nullptr));
IPin* audioRendererPin = NULL;

#if 1 // FMB NOTE: Connect with first (= the only) pin of audio renderer
IEnumPins* pIEnum = NULL;
if (SUCCEEDED(err = audioFilter->EnumPins(&pIEnum)))
{
IPin* pIPin = NULL;
pIEnum->Next(1, &audioRendererPin, NULL);
SafeRelease(pIEnum);
}
#else
audioFilter->FindPin(L"Audio Input pin (rendered)", &audioRendererPin);
#endif
if (audioRendererPin)
{
bConnected = SUCCEEDED(err = graph->ConnectDirect(audioPin, audioRendererPin, nullptr));
audioRendererPin->Release();
}
audioPin->Release();
}
}
Expand Down
2 changes: 1 addition & 1 deletion DShowPlugin/DeviceSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DeviceSource : public ImageSource
IBaseFilter *deviceFilter;
IBaseFilter *audioDeviceFilter;
CaptureFilter *captureFilter;
CaptureFilter *audioFilter;
IBaseFilter *audioFilter; // Audio renderer filter

//---------------------------------

Expand Down

0 comments on commit 1c248ca

Please sign in to comment.