output/osx: clear render buffer when there's not enough data
When we don't have enough data, generate some silence, hoping the input buffer will fill soon. Reducing the render buffer size is not legal.
This commit is contained in:
parent
f405d27c56
commit
97b4a6b51f
1
NEWS
1
NEWS
@ -3,6 +3,7 @@ ver 0.16.7 (2011/??/??)
|
|||||||
- httpd: fix excessive buffering
|
- httpd: fix excessive buffering
|
||||||
- openal: force 16 bit playback, as 8 bit doesn't work
|
- openal: force 16 bit playback, as 8 bit doesn't work
|
||||||
- osx: remove sleep call from render callback
|
- osx: remove sleep call from render callback
|
||||||
|
- osx: clear render buffer when there's not enough data
|
||||||
* fix moving after current song
|
* fix moving after current song
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ osx_render(void *vdata,
|
|||||||
g_mutex_lock(od->mutex);
|
g_mutex_lock(od->mutex);
|
||||||
|
|
||||||
bytes_to_copy = MIN(od->len, buffer_size);
|
bytes_to_copy = MIN(od->len, buffer_size);
|
||||||
buffer_size = bytes_to_copy;
|
|
||||||
od->len -= bytes_to_copy;
|
od->len -= bytes_to_copy;
|
||||||
|
|
||||||
trailer_length = od->buffer_size - od->pos;
|
trailer_length = od->buffer_size - od->pos;
|
||||||
@ -140,7 +139,9 @@ osx_render(void *vdata,
|
|||||||
g_cond_signal(od->condition);
|
g_cond_signal(od->condition);
|
||||||
g_mutex_unlock(od->mutex);
|
g_mutex_unlock(od->mutex);
|
||||||
|
|
||||||
buffer->mDataByteSize = buffer_size;
|
if (bytes_to_copy < buffer_size)
|
||||||
|
memset((unsigned char*)buffer->mData + bytes_to_copy, 0,
|
||||||
|
buffer_size - bytes_to_copy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user