alsa-pcm: don't force quantum for iec958 formats

This fixes an issue introduced in 771f71f622
where the quantum is forced and may break applications the specify their
own quantum.

Signed-off-by: Lukas Rusak <lorusak@gmail.com>
This commit is contained in:
Lukas Rusak 2024-04-27 13:28:51 -07:00 committed by Wim Taymans
parent 8ff40e6252
commit 9e88aafa30
2 changed files with 10 additions and 6 deletions

View file

@ -1970,7 +1970,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
state->have_format, state->started);
state->use_mmap = !state->disable_mmap;
state->force_position = false;
state->force_rate = false;
switch (fmt->media_subtype) {
case SPA_MEDIA_SUBTYPE_raw:
@ -2033,7 +2033,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
0, aes3);
state->force_position = true;
state->force_rate = true;
break;
}
case SPA_MEDIA_SUBTYPE_dsd:
@ -2818,15 +2818,19 @@ static inline int check_position_config(struct state *state, bool starting)
if (SPA_UNLIKELY((pos = state->position) == NULL))
return 0;
if (state->force_position ||
(state->disable_tsched && (starting || state->started) && !state->following)) {
if (state->disable_tsched && (starting || state->started) && !state->following) {
target_duration = state->period_frames;
target_rate = SPA_FRACTION(1, state->rate);
pos->clock.target_duration = target_duration;
pos->clock.target_rate = target_rate;
} else {
target_duration = pos->clock.target_duration;
target_rate = pos->clock.target_rate;
if (state->force_rate && !state->following) {
target_rate = SPA_FRACTION(1, state->rate);
pos->clock.target_rate = target_rate;
} else {
target_rate = pos->clock.target_rate;
}
}
if (target_duration == 0 || target_rate.denom == 0)
return -EIO;

View file

@ -228,7 +228,7 @@ struct state {
unsigned int auto_link:1;
unsigned int linked:1;
unsigned int is_batch:1;
unsigned int force_position:1;
unsigned int force_rate:1;
uint64_t iec958_codecs;