mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-09 13:30:06 -05:00
audioconvert: use the position rate to negotiate
When we have an io_position, use the rate as the samplerate when negotiating.
This commit is contained in:
parent
ed80d72d51
commit
7ba7179eee
4 changed files with 18 additions and 6 deletions
|
|
@ -744,18 +744,23 @@ static int port_enum_formats(void *object,
|
|||
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
|
||||
SPA_FORMAT_AUDIO_format, SPA_POD_Id(SPA_AUDIO_FORMAT_F32P),
|
||||
0);
|
||||
|
||||
if (other->have_format) {
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_rate, SPA_POD_Int(other->format.info.raw.rate),
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
||||
other->format.info.raw.channels, 1, INT32_MAX),
|
||||
0);
|
||||
} else {
|
||||
uint32_t rate = this->io_position ?
|
||||
this->io_position->clock.rate.denom : DEFAULT_RATE;
|
||||
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_rate, SPA_POD_CHOICE_RANGE_Int(DEFAULT_RATE, 1, INT32_MAX),
|
||||
SPA_FORMAT_AUDIO_rate, SPA_POD_CHOICE_RANGE_Int(rate, 0, INT32_MAX),
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
||||
DEFAULT_CHANNELS, 1, INT32_MAX),
|
||||
0);
|
||||
}
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(DEFAULT_CHANNELS, 1, INT32_MAX),
|
||||
0);
|
||||
*param = spa_pod_builder_pop(builder, &f);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue