Skip to content

Commit 7a28544

Browse files
committed
try to setup desired sampleRate
1 parent 0d42110 commit 7a28544

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/device.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,15 @@ bool HDevice::SetupAudioCapture(IBaseFilter *filter, AudioConfig &config)
468468
Error(L"Could not get closest audio media type");
469469
return false;
470470
}
471+
} else {
472+
// useDefaultConfig case
473+
if (config.sampleRate != 0) {
474+
WAVEFORMATEX *wfex =
475+
reinterpret_cast<WAVEFORMATEX *>(audioMediaType->pbFormat);
476+
// set the desired sampleRate
477+
wfex->nSamplesPerSec = config.sampleRate;
478+
Debug(L"\tdesired sampleRate = %d", config.sampleRate);
479+
}
471480
}
472481

473482
if (!!pinConfig) {

0 commit comments

Comments
 (0)