1
mirror of https://github.com/mpv-player/mpv synced 2024-09-28 17:52:52 +02:00

ao_dsound: remove duplicated code

This commit is contained in:
wm4 2014-03-16 09:51:46 +01:00
parent c7e620df96
commit 822e040ddb

View File

@ -300,23 +300,12 @@ static int write_buffer(struct ao *ao, unsigned char *data, int len)
if (SUCCEEDED(res)) {
if (!AF_FORMAT_IS_AC3(ao->format)) {
memcpy(lpvPtr1, data, dwBytes1);
if (lpvPtr2 != NULL)
memcpy(lpvPtr2, (char *)data + dwBytes1, dwBytes2);
p->write_offset += dwBytes1 + dwBytes2;
if (p->write_offset >= p->buffer_size)
p->write_offset = dwBytes2;
} else {
// Write to pointers without reordering.
memcpy(lpvPtr1, data, dwBytes1);
if (NULL != lpvPtr2)
memcpy(lpvPtr2, data + dwBytes1, dwBytes2);
p->write_offset += dwBytes1 + dwBytes2;
if (p->write_offset >= p->buffer_size)
p->write_offset = dwBytes2;
}
memcpy(lpvPtr1, data, dwBytes1);
if (NULL != lpvPtr2)
memcpy(lpvPtr2, data + dwBytes1, dwBytes2);
p->write_offset += dwBytes1 + dwBytes2;
if (p->write_offset >= p->buffer_size)
p->write_offset = dwBytes2;
// Release the data back to DirectSound.
res = IDirectSoundBuffer_Unlock(p->hdsbuf, lpvPtr1, dwBytes1, lpvPtr2,