mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-14 11:53:16 +00:00
alsa: increase target for a52 and dca
For encoded format, we need to send bigger chunks to make the encoder happy. Add a new min_delay variable with this info so that we never leave less than that amount of samples in the ringbuffer. Fixes #2650
This commit is contained in:
parent
cbc75dc98d
commit
e5ac60b2b2
|
@ -1583,11 +1583,18 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
if (is_batch)
|
||||
state->headroom += period_size;
|
||||
|
||||
if (spa_strstartswith(state->props.device, "a52") ||
|
||||
spa_strstartswith(state->props.device, "dca"))
|
||||
state->min_delay = SPA_MIN(2048u, state->buffer_frames);
|
||||
else
|
||||
state->min_delay = 0;
|
||||
|
||||
state->headroom = SPA_MIN(state->headroom, state->buffer_frames);
|
||||
state->start_delay = state->default_start_delay;
|
||||
|
||||
state->latency[state->port_direction].min_rate = state->headroom;
|
||||
state->latency[state->port_direction].max_rate = state->headroom;
|
||||
state->latency[state->port_direction].min_rate =
|
||||
state->latency[state->port_direction].max_rate =
|
||||
SPA_MAX(state->min_delay, state->headroom);
|
||||
|
||||
spa_log_info(state->log, "%s (%s): format:%s access:%s-%s rate:%d channels:%d "
|
||||
"buffer frames %lu, period frames %lu, periods %u, frame_size %zd "
|
||||
|
@ -1859,7 +1866,7 @@ static int get_status(struct state *state, uint64_t current_time,
|
|||
*delay = avail;
|
||||
*target = SPA_MAX(*target, state->read_size);
|
||||
}
|
||||
*target = SPA_MIN(*target, state->buffer_frames);
|
||||
*target = SPA_CLAMP(*target, state->min_delay, state->buffer_frames);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ struct state {
|
|||
uint32_t last_threshold;
|
||||
uint32_t headroom;
|
||||
uint32_t start_delay;
|
||||
uint32_t min_delay;
|
||||
|
||||
uint32_t duration;
|
||||
unsigned int alsa_started:1;
|
||||
|
|
Loading…
Reference in a new issue