mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
[input] Fix input writing too slowly for buffer to fill up after underrun
After an underrun the player doesn't read, so that meant input_wait would wait a second before allowing the input to write, even though the input_buffer was not full
This commit is contained in:
parent
9b31264a3c
commit
daf7d755eb
17
src/input.c
17
src/input.c
@ -471,10 +471,7 @@ input_wait(void)
|
|||||||
|
|
||||||
pthread_mutex_lock(&input_buffer.mutex);
|
pthread_mutex_lock(&input_buffer.mutex);
|
||||||
|
|
||||||
ts = timespec_reltoabs(input_loop_timeout);
|
// Is the buffer full? Then wait for a read or for loop_timeout to elapse
|
||||||
pthread_cond_timedwait(&input_buffer.cond, &input_buffer.mutex, &ts);
|
|
||||||
|
|
||||||
// Is the buffer full?
|
|
||||||
if (evbuffer_get_length(input_buffer.evbuf) > INPUT_BUFFER_THRESHOLD)
|
if (evbuffer_get_length(input_buffer.evbuf) > INPUT_BUFFER_THRESHOLD)
|
||||||
{
|
{
|
||||||
if (input_buffer.full_cb)
|
if (input_buffer.full_cb)
|
||||||
@ -483,8 +480,14 @@ input_wait(void)
|
|||||||
input_buffer.full_cb = NULL;
|
input_buffer.full_cb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&input_buffer.mutex);
|
ts = timespec_reltoabs(input_loop_timeout);
|
||||||
return -1;
|
pthread_cond_timedwait(&input_buffer.cond, &input_buffer.mutex, &ts);
|
||||||
|
|
||||||
|
if (evbuffer_get_length(input_buffer.evbuf) > INPUT_BUFFER_THRESHOLD)
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(&input_buffer.mutex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&input_buffer.mutex);
|
pthread_mutex_unlock(&input_buffer.mutex);
|
||||||
@ -597,7 +600,7 @@ input_read(void *data, size_t size, short *flags)
|
|||||||
if (*flags || (debug_elapsed > 10 * one_sec_size))
|
if (*flags || (debug_elapsed > 10 * one_sec_size))
|
||||||
{
|
{
|
||||||
debug_elapsed = 0;
|
debug_elapsed = 0;
|
||||||
DPRINTF(E_SPAM, L_PLAYER, "READ %zu bytes (%d/%d/%d), WROTE %zu bytes (%d/%d/%d), SIZE %zu (=%zu), FLAGS %04x\n",
|
DPRINTF(E_DBG, L_PLAYER, "READ %zu bytes (%d/%d/%d), WROTE %zu bytes (%d/%d/%d), SIZE %zu (=%zu), FLAGS %04x\n",
|
||||||
input_buffer.bytes_read,
|
input_buffer.bytes_read,
|
||||||
input_buffer.cur_read_quality.sample_rate,
|
input_buffer.cur_read_quality.sample_rate,
|
||||||
input_buffer.cur_read_quality.bits_per_sample,
|
input_buffer.cur_read_quality.bits_per_sample,
|
||||||
|
Loading…
Reference in New Issue
Block a user