stream: add MIN_QUEUED constant

This commit is contained in:
Wim Taymans 2018-06-27 15:38:41 +02:00
parent 6e92dbbe23
commit a7ec4e4688

View file

@ -40,6 +40,8 @@
#include "extensions/client-node.h" #include "extensions/client-node.h"
#define MAX_BUFFERS 64 #define MAX_BUFFERS 64
#define MIN_QUEUED 1
#define MASK_BUFFERS (MAX_BUFFERS-1) #define MASK_BUFFERS (MAX_BUFFERS-1)
#define MAX_PORTS 1 #define MAX_PORTS 1
@ -150,7 +152,7 @@ static inline struct buffer *pop_queue(struct stream *stream, struct queue *queu
uint32_t index, id; uint32_t index, id;
struct buffer *buffer; struct buffer *buffer;
if ((avail = spa_ringbuffer_get_read_index(&queue->ring, &index)) <= 0) if ((avail = spa_ringbuffer_get_read_index(&queue->ring, &index)) < MIN_QUEUED)
return NULL; return NULL;
id = queue->ids[index & MASK_BUFFERS]; id = queue->ids[index & MASK_BUFFERS];
@ -638,7 +640,7 @@ static int impl_node_process_output(struct spa_node *node)
} }
if (!SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) { if (!SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) {
call_process(impl); call_process(impl);
if (spa_ringbuffer_get_read_index(&impl->queued.ring, &index) > 0 && if (spa_ringbuffer_get_read_index(&impl->queued.ring, &index) >= MIN_QUEUED &&
io->status == SPA_STATUS_NEED_BUFFER) io->status == SPA_STATUS_NEED_BUFFER)
goto again; goto again;
} }