mirror of https://github.com/odrling/Aegisub
Juggle a weird control structure to be more regular.
Originally committed to SVN as r4086.
This commit is contained in:
parent
6fe0eb96be
commit
48e321f8ef
|
@ -354,23 +354,22 @@ void DirectSoundPlayer2Thread::Run()
|
|||
REPORT_ERROR("Could not reset playback buffer cursor before filling first buffer.")
|
||||
|
||||
HRESULT res = bfr->Lock(buffer_offset, 0, &buf, &buf_size, 0, 0, DSBLOCK_ENTIREBUFFER);
|
||||
while (FAILED(res)) // yes, while, so I can break out of it without a goto!
|
||||
if (FAILED(res))
|
||||
{
|
||||
if (res == DSERR_BUFFERLOST)
|
||||
{
|
||||
// Try to regain the buffer
|
||||
if (SUCCEEDED(bfr->Restore()) &&
|
||||
SUCCEEDED(bfr->Lock(buffer_offset, 0, &buf, &buf_size, 0, 0, DSBLOCK_ENTIREBUFFER)))
|
||||
if (FAILED(bfr->Restore()) ||
|
||||
FAILED(bfr->Lock(buffer_offset, 0, &buf, &buf_size, 0, 0, DSBLOCK_ENTIREBUFFER)))
|
||||
{
|
||||
//wxLogDebug(_T("DirectSoundPlayer2: Lost and restored buffer"));
|
||||
break;
|
||||
}
|
||||
|
||||
REPORT_ERROR("Lost buffer and could not restore it.")
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
REPORT_ERROR("Could not lock buffer for playback.")
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the buffer in case we can't fill it completely
|
||||
memset(buf, 0, buf_size);
|
||||
|
|
Loading…
Reference in New Issue