зеркало из https://github.com/mozilla/gecko-dev.git
Bug 468260 - Update libsydneyaudio to fix sunaudio malloc error and win32 sound issues - rs=roc
This commit is contained in:
Родитель
1b8d2de4e1
Коммит
616bd4a9ee
|
@ -293,11 +293,12 @@ sa_stream_write(sa_stream_t *s, const void *data, size_t nbytes)
|
|||
*/
|
||||
result = SA_SUCCESS;
|
||||
buf = new_buffer(nbytes);
|
||||
memcpy(buf->data,data, nbytes);
|
||||
|
||||
if ( buf == NULL)
|
||||
if (buf == NULL)
|
||||
return SA_ERROR_OOM;
|
||||
|
||||
memcpy(buf->data,data, nbytes);
|
||||
|
||||
pthread_mutex_lock(&s->mutex);
|
||||
if (!s->bl_head)
|
||||
s->bl_head = buf;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
// FIX ME: block size and block should be determined based on the OggPlay offset
|
||||
// for audio track
|
||||
#define BLOCK_SIZE 2560
|
||||
#define BLOCK_SIZE 1024
|
||||
#define BLOCK_COUNT 32
|
||||
#define DEFAULT_DEVICE_NAME "Default WAVE Device"
|
||||
#define DEFAULT_DEVICE WAVE_MAPPER
|
||||
|
@ -203,7 +203,7 @@ int sa_stream_get_write_size(sa_stream_t *s, size_t *size) {
|
|||
ERROR_IF_NO_INIT(s);
|
||||
|
||||
EnterCriticalSection(&(s->waveCriticalSection));
|
||||
avail = s->waveFreeBlockCount * BLOCK_SIZE;
|
||||
avail = (s->waveFreeBlockCount-1) * BLOCK_SIZE;
|
||||
if (s->waveFreeBlockCount != BLOCK_COUNT) {
|
||||
current = &(s->waveBlocks[s->waveCurrentBlock]);
|
||||
avail += BLOCK_SIZE - current->dwUser;
|
||||
|
@ -492,6 +492,12 @@ int writeAudio(sa_stream_t *s, LPSTR data, int bytes) {
|
|||
current = &(s->waveBlocks[s->waveCurrentBlock]);
|
||||
|
||||
while(bytes > 0) {
|
||||
/*
|
||||
* wait for a block to become free
|
||||
*/
|
||||
while (!(s->waveFreeBlockCount))
|
||||
WaitForSingleObject(s->callbackEvent, INFINITE);
|
||||
|
||||
/* first make sure the header we're going to use is unprepared */
|
||||
if(current->dwFlags & WHDR_PREPARED) {
|
||||
status = waveOutUnprepareHeader(s->hWaveOut, current, sizeof(WAVEHDR));
|
||||
|
@ -518,14 +524,6 @@ int writeAudio(sa_stream_t *s, LPSTR data, int bytes) {
|
|||
EnterCriticalSection(&(s->waveCriticalSection));
|
||||
s->waveFreeBlockCount--;
|
||||
LeaveCriticalSection(&(s->waveCriticalSection));
|
||||
/*
|
||||
* wait for a block to become free
|
||||
*/
|
||||
while (!(s->waveFreeBlockCount)) {
|
||||
//printf("All audio buffer blocks empty\n");
|
||||
WaitForSingleObject(s->callbackEvent, INFINITE);
|
||||
//Sleep(10);
|
||||
}
|
||||
|
||||
/*
|
||||
* point to the next block
|
||||
|
|
Загрузка…
Ссылка в новой задаче