mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
audioadapter: clear buffers when format is reconfigured
Always clear the Buffers when the format is reconfigured because they depend on the Format.
This commit is contained in:
parent
915539e6d4
commit
223d016a5e
1 changed files with 12 additions and 8 deletions
|
|
@ -486,6 +486,13 @@ static int negotiate_buffers(struct impl *this)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear_buffers(struct impl *this)
|
||||||
|
{
|
||||||
|
free(this->buffers);
|
||||||
|
this->buffers = NULL;
|
||||||
|
this->n_buffers = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int configure_format(struct impl *this, uint32_t flags, const struct spa_pod *format)
|
static int configure_format(struct impl *this, uint32_t flags, const struct spa_pod *format)
|
||||||
{
|
{
|
||||||
uint8_t buffer[4096];
|
uint8_t buffer[4096];
|
||||||
|
|
@ -529,11 +536,11 @@ static int configure_format(struct impl *this, uint32_t flags, const struct spa_
|
||||||
}
|
}
|
||||||
|
|
||||||
this->have_format = format != NULL;
|
this->have_format = format != NULL;
|
||||||
if (format == NULL) {
|
clear_buffers(this);
|
||||||
this->n_buffers = 0;
|
|
||||||
} else if (this->target != this->follower) {
|
if (format != NULL && this->target != this->follower)
|
||||||
res = negotiate_buffers(this);
|
res = negotiate_buffers(this);
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1842,10 +1849,7 @@ static int impl_clear(struct spa_handle *handle)
|
||||||
|
|
||||||
spa_handle_clear(this->hnd_convert);
|
spa_handle_clear(this->hnd_convert);
|
||||||
|
|
||||||
if (this->buffers)
|
clear_buffers(this);
|
||||||
free(this->buffers);
|
|
||||||
this->buffers = NULL;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue