mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
Have a memblock queue on the client side during recording. This makes the
record callback optional in stead of mandatory. For applications that wish to retain the old behaviour, simply call pa_stream_peek() followed by pa_stream_drop() in the callback. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@507 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
6f9a367abc
commit
45700da4eb
6 changed files with 98 additions and 11 deletions
|
|
@ -105,14 +105,19 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
|
|||
}
|
||||
|
||||
/* This is called whenever new data may is available */
|
||||
static void stream_read_callback(pa_stream *s, const void*data, size_t length, void *userdata) {
|
||||
assert(s && data && length);
|
||||
static void stream_read_callback(pa_stream *s, size_t length, void *userdata) {
|
||||
assert(s && length);
|
||||
void *data;
|
||||
|
||||
if (stdio_event)
|
||||
mainloop_api->io_enable(stdio_event, PA_IO_EVENT_OUTPUT);
|
||||
|
||||
pa_stream_peek(s, &data, &length);
|
||||
assert(data && length);
|
||||
|
||||
if (buffer) {
|
||||
fprintf(stderr, "Buffer overrun, dropping incoming data\n");
|
||||
pa_stream_drop(s);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +125,7 @@ static void stream_read_callback(pa_stream *s, const void*data, size_t length, v
|
|||
assert(buffer);
|
||||
memcpy(buffer, data, length);
|
||||
buffer_index = 0;
|
||||
pa_stream_drop(s);
|
||||
}
|
||||
|
||||
/* This routine is called whenever the stream state changes */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue