mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
alsa: distuingish real underruns from left_to_play=0
This commit is contained in:
parent
dfe3f90b37
commit
6b6d14626d
2 changed files with 6 additions and 2 deletions
|
|
@ -410,6 +410,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
|
||||||
|
|
||||||
static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) {
|
static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) {
|
||||||
size_t left_to_play;
|
size_t left_to_play;
|
||||||
|
pa_bool_t underrun = FALSE;
|
||||||
|
|
||||||
/* We use <= instead of < for this check here because an underrun
|
/* We use <= instead of < for this check here because an underrun
|
||||||
* only happens after the last sample was processed, not already when
|
* only happens after the last sample was processed, not already when
|
||||||
|
|
@ -422,6 +423,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
|
||||||
|
|
||||||
/* We got a dropout. What a mess! */
|
/* We got a dropout. What a mess! */
|
||||||
left_to_play = 0;
|
left_to_play = 0;
|
||||||
|
underrun = TRUE;
|
||||||
|
|
||||||
#ifdef DEBUG_TIMING
|
#ifdef DEBUG_TIMING
|
||||||
PA_DEBUG_TRAP;
|
PA_DEBUG_TRAP;
|
||||||
|
|
@ -443,7 +445,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
|
||||||
pa_bool_t reset_not_before = TRUE;
|
pa_bool_t reset_not_before = TRUE;
|
||||||
|
|
||||||
if (!u->first && !u->after_rewind) {
|
if (!u->first && !u->after_rewind) {
|
||||||
if (left_to_play < u->watermark_inc_threshold)
|
if (underrun || left_to_play < u->watermark_inc_threshold)
|
||||||
increase_watermark(u);
|
increase_watermark(u);
|
||||||
else if (left_to_play > u->watermark_dec_threshold) {
|
else if (left_to_play > u->watermark_dec_threshold) {
|
||||||
reset_not_before = FALSE;
|
reset_not_before = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -406,6 +406,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
|
||||||
static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) {
|
static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) {
|
||||||
size_t left_to_record;
|
size_t left_to_record;
|
||||||
size_t rec_space = u->hwbuf_size - u->hwbuf_unused;
|
size_t rec_space = u->hwbuf_size - u->hwbuf_unused;
|
||||||
|
pa_bool_t overrun = FALSE;
|
||||||
|
|
||||||
/* We use <= instead of < for this check here because an overrun
|
/* We use <= instead of < for this check here because an overrun
|
||||||
* only happens after the last sample was processed, not already when
|
* only happens after the last sample was processed, not already when
|
||||||
|
|
@ -418,6 +419,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
|
||||||
|
|
||||||
/* We got a dropout. What a mess! */
|
/* We got a dropout. What a mess! */
|
||||||
left_to_record = 0;
|
left_to_record = 0;
|
||||||
|
overrun = TRUE;
|
||||||
|
|
||||||
#ifdef DEBUG_TIMING
|
#ifdef DEBUG_TIMING
|
||||||
PA_DEBUG_TRAP;
|
PA_DEBUG_TRAP;
|
||||||
|
|
@ -434,7 +436,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
|
||||||
if (u->use_tsched) {
|
if (u->use_tsched) {
|
||||||
pa_bool_t reset_not_before = TRUE;
|
pa_bool_t reset_not_before = TRUE;
|
||||||
|
|
||||||
if (left_to_record < u->watermark_inc_threshold)
|
if (overrun || left_to_record < u->watermark_inc_threshold)
|
||||||
increase_watermark(u);
|
increase_watermark(u);
|
||||||
else if (left_to_record > u->watermark_dec_threshold) {
|
else if (left_to_record > u->watermark_dec_threshold) {
|
||||||
reset_not_before = FALSE;
|
reset_not_before = FALSE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue