Commit cf73a26c authored by Julius Schwartzenberg's avatar Julius Schwartzenberg Committed by Alexandre Julliard

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

parent 3cbaaaa5
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment