mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
audioconvert: configure resample channels correctly
Depending on the direction of the conversion, we run the resampler before or after the channelmix. This means we need to use the channel count before or after the channelmixer instead of always using the channels after channelmixing. Fixes #4595
This commit is contained in:
parent
a503244c10
commit
d43fb09ea1
1 changed files with 9 additions and 3 deletions
|
|
@ -1971,13 +1971,19 @@ static int setup_resample(struct impl *this)
|
|||
struct dir *in = &this->dir[SPA_DIRECTION_INPUT];
|
||||
struct dir *out = &this->dir[SPA_DIRECTION_OUTPUT];
|
||||
int res;
|
||||
uint32_t channels;
|
||||
|
||||
if (this->direction == SPA_DIRECTION_INPUT)
|
||||
channels = in->format.info.raw.channels;
|
||||
else
|
||||
channels = out->format.info.raw.channels;
|
||||
|
||||
spa_log_info(this->log, "%p: %s/%d@%d->%s/%d@%d", this,
|
||||
spa_debug_type_find_name(spa_type_audio_format, SPA_AUDIO_FORMAT_DSP_F32),
|
||||
out->format.info.raw.channels,
|
||||
channels,
|
||||
in->format.info.raw.rate,
|
||||
spa_debug_type_find_name(spa_type_audio_format, SPA_AUDIO_FORMAT_DSP_F32),
|
||||
out->format.info.raw.channels,
|
||||
channels,
|
||||
out->format.info.raw.rate);
|
||||
|
||||
if (this->props.resample_disabled && !this->resample_peaks &&
|
||||
|
|
@ -1987,7 +1993,7 @@ static int setup_resample(struct impl *this)
|
|||
if (this->resample.free)
|
||||
resample_free(&this->resample);
|
||||
|
||||
this->resample.channels = out->format.info.raw.channels;
|
||||
this->resample.channels = channels;
|
||||
this->resample.i_rate = in->format.info.raw.rate;
|
||||
this->resample.o_rate = out->format.info.raw.rate;
|
||||
this->resample.log = this->log;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue