mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:40:59 +00:00
mmdevapi: Use a sane default if no buffer size is requested.
This commit is contained in:
parent
9a30a29db5
commit
80fd691e9e
|
@ -211,6 +211,15 @@ static void test_audioclient(void)
|
|||
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, NULL, NULL);
|
||||
ok(hr == E_POINTER, "Initialize with null format returns %08x\n", hr);
|
||||
|
||||
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 0, 0, pwfx, NULL);
|
||||
ok(hr == S_OK, "Initialize with 0 buffer size returns %08x\n", hr);
|
||||
|
||||
IAudioClient_Release(ac);
|
||||
|
||||
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
|
||||
NULL, (void**)&ac);
|
||||
ok(hr == S_OK, "Activation failed with %08x\n", hr);
|
||||
|
||||
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, pwfx, NULL);
|
||||
ok(hr == S_OK, "Valid Initialize returns %08x\n", hr);
|
||||
|
||||
|
|
|
@ -799,6 +799,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if(!duration)
|
||||
duration = 300000; /* 0.03s */
|
||||
This->bufsize_frames = ceil((duration / 10000000.) * fmt->nSamplesPerSec);
|
||||
This->local_buffer = HeapAlloc(GetProcessHeap(), 0,
|
||||
This->bufsize_frames * fmt->nBlockAlign);
|
||||
|
|
|
@ -862,6 +862,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
|
|||
}else
|
||||
This->period_ms = MinimumPeriod / 10000;
|
||||
|
||||
if(!duration)
|
||||
duration = 300000; /* 0.03s */
|
||||
This->bufsize_frames = ceil(fmt->nSamplesPerSec * (duration / 10000000.));
|
||||
|
||||
if(This->dataflow == eCapture){
|
||||
|
|
|
@ -819,6 +819,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
|
|||
else
|
||||
This->period_us = DefaultPeriod / 10;
|
||||
|
||||
if(!duration)
|
||||
duration = 300000; /* 0.03s */
|
||||
This->bufsize_frames = ceil(fmt->nSamplesPerSec * (duration / 10000000.));
|
||||
This->local_buffer = HeapAlloc(GetProcessHeap(), 0,
|
||||
This->bufsize_frames * fmt->nBlockAlign);
|
||||
|
|
Loading…
Reference in a new issue