Hi Eric,
After implementing the ICCVID codec, the intro AVI in Half-Life plays nicely, however when it finishes, WinMM gets stuck in a loop while cleaning up in MCIAVI_mciPlay.
I think it's trying to wait for the sound to finish, however I'm not sure how to fix the problem. The patch below makes it work, but I'm not sure what bad side effects it will have...
Any ideas?
Mike
Index: dlls/winmm/mciavi/mciavi.c =================================================================== RCS file: /cvstrees/crossover/office/wine/dlls/winmm/mciavi/mciavi.c,v retrieving revision 1.1.1.10 diff -u -r1.1.1.10 mciavi.c --- dlls/winmm/mciavi/mciavi.c 10 Jan 2004 00:11:58 -0000 1.1.1.10 +++ dlls/winmm/mciavi/mciavi.c 20 Jan 2004 16:22:23 -0000 @@ -503,12 +503,14 @@ }
if (wma->lpWaveFormat) { +#if 0 while (wma->dwEventCount != nHdr - 1) { LeaveCriticalSection(&wma->cs); Sleep(100); EnterCriticalSection(&wma->cs); } +#endif
/* just to get rid of some race conditions between play, stop and pause */ waveOutReset(wma->hWave);
Mike McCormack a écrit :
Hi Eric,
After implementing the ICCVID codec, the intro AVI in Half-Life plays nicely, however when it finishes, WinMM gets stuck in a loop while cleaning up in MCIAVI_mciPlay.
I think it's trying to wait for the sound to finish, however I'm not sure how to fix the problem. The patch below makes it work, but I'm not sure what bad side effects it will have...
Any ideas?
as an ugly hack, does setting the dwEventCount in the WINE_MCIAVI struct as volatile help ? (private_mciavi.h).
A+
Eric Pouech wrote:
Any ideas?
as an ugly hack, does setting the dwEventCount in the WINE_MCIAVI struct as volatile help ? (private_mciavi.h).
No, that didn't help, the one below does:
Mike
diff -u -r1.1.1.10 mciavi.c --- dlls/winmm/mciavi/mciavi.c 10 Jan 2004 00:11:58 -0000 1.1.1.10 +++ dlls/winmm/mciavi/mciavi.c 21 Jan 2004 02:51:15 -0000 @@ -503,7 +503,7 @@ }
if (wma->lpWaveFormat) { - while (wma->dwEventCount != nHdr - 1) + while (wma->dwEventCount < (nHdr - 1) ) { LeaveCriticalSection(&wma->cs); Sleep(100);
Mike McCormack wrote:
Eric Pouech wrote:
Any ideas?
as an ugly hack, does setting the dwEventCount in the WINE_MCIAVI struct as volatile help ? (private_mciavi.h).
No, that didn't help, the one below does:
Well, it sort of does... but with that patch, sometimes westuck in the critical section. I guess the question is why does dwEventCount count further than expected?
Mike
Well, it sort of does... but with that patch, sometimes westuck in the critical section. I guess the question is why does dwEventCount count further than expected?
yup. can you post a -debugmsg +mciavi trace A+
Here you go.
wine --debugmsg +mciavi,+winmm,+seh hl.exe >& hl-winmm.log
Pressed ^C after it hung.
Mike
Eric Pouech wrote:
yup. can you post a -debugmsg +mciavi trace A+
yup. can you post a -debugmsg +mciavi trace A+
does this fix it ? A+
Index: dlls/winmm/mciavi/mmoutput.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mciavi/mmoutput.c,v retrieving revision 1.11 diff -u -r1.11 mmoutput.c --- dlls/winmm/mciavi/mmoutput.c 5 Jan 2004 23:07:27 -0000 1.11 +++ dlls/winmm/mciavi/mmoutput.c 23 Jan 2004 20:38:26 -0000 @@ -563,7 +563,10 @@ ResetEvent(wma->hEvent); if (InterlockedDecrement(&wma->dwEventCount) < 0 || !wma->lpAudioIndex[wma->dwCurrAudioBlock].dwOffset) + { + InterlockedIncrement(&wma->dwEventCount); break; + }
mmioSeek(wma->hFile, wma->lpAudioIndex[wma->dwCurrAudioBlock].dwOffset, SEEK_SET); mmioRead(wma->hFile, waveHdr[whidx].lpData, wma->lpAudioIndex[wma->dwCurrAudioBlock].dwSize); @@ -573,7 +576,6 @@ waveOutWrite(wma->hWave, &waveHdr[whidx], sizeof(WAVEHDR)); wma->dwCurrAudioBlock++; } - InterlockedIncrement(&wma->dwEventCount); }
LRESULT MCIAVI_PaintFrame(WINE_MCIAVI* wma, HDC hDC)
Hi Eric,
Yes, I have confirmed that this patch fixes the problem.
Thanks!
Mike
Eric Pouech wrote:
does this fix it ? A+