diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 45502cad7..4e7c9acb2 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -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; diff --git a/spa/plugins/alsa/alsa-pcm.h b/spa/plugins/alsa/alsa-pcm.h index 4b6b629b8..61ca8f642 100644 --- a/spa/plugins/alsa/alsa-pcm.h +++ b/spa/plugins/alsa/alsa-pcm.h @@ -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;