avifil32: Overwrite dwRate in the audiostream with the nBlockAlign from the wave header.

This commit is contained in:
Julius Schwartzenberg 2010-01-12 00:30:54 +01:00 committed by Alexandre Julliard
parent 3cbaaaa564
commit cf73a26c6b
2 changed files with 10 additions and 3 deletions

View File

@ -1819,7 +1819,14 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
if (FAILED(hr))
return hr;
};
if (pStream->lpFormat != NULL && pStream->sInfo.fccType == streamtypeAUDIO)
{
WAVEFORMATEX *wfx = pStream->lpFormat; /* wfx->nBlockAlign = wfx->nChannels * wfx->wBitsPerSample / 8; could be added */
pStream->sInfo.dwSampleSize = wfx->nBlockAlign; /* to deal with corrupt wfx->nBlockAlign but Windows doesn't do this */
TRACE("Block size reset to %u, chan=%u bpp=%u\n", wfx->nBlockAlign, wfx->nChannels, wfx->wBitsPerSample);
pStream->sInfo.dwScale = 1;
pStream->sInfo.dwRate = wfx->nSamplesPerSec;
}
if (mmioAscend(This->hmmio, &ck, 0) != S_OK)
return AVIERR_FILEREAD;
}

View File

@ -404,7 +404,7 @@ static void test_ash1_corruption(void)
/* The result will still be 2, because the value is dynamically replaced with the nBlockAlign
value from the stream format header. The next test will prove this */
todo_wine{ ok(asi1.dwSampleSize == 2, "got %u (expected 2)\n", asi1.dwSampleSize); }
ok(asi1.dwSampleSize == 2, "got %u (expected 2)\n", asi1.dwSampleSize);
AVIStreamRelease(pStream1);
AVIFileRelease(pFile);
@ -438,7 +438,7 @@ static void test_ash1_corruption2(void)
ok(AVIStreamInfo(pStream1, &asi1, sizeof(AVISTREAMINFO)) == 0, "Unable to read stream info\n");
/* The result will also be the corrupt value, as explained above. */
todo_wine{ ok(asi1.dwSampleSize == 0xdead, "got 0x%x (expected 0xdead)\n", asi1.dwSampleSize); }
ok(asi1.dwSampleSize == 0xdead, "got 0x%x (expected 0xdead)\n", asi1.dwSampleSize);
AVIStreamRelease(pStream1);
AVIFileRelease(pFile);