mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
bluez5: do rate matching before next timeout
Because else we might not have a rate and divide by 0.
This commit is contained in:
parent
7b6680ba57
commit
157a97cc98
2 changed files with 6 additions and 6 deletions
|
|
@ -571,7 +571,7 @@ static int setup_matching(struct impl *this)
|
|||
|
||||
this->matching = this->following;
|
||||
this->resampling = this->matching ||
|
||||
(port->current_format.info.raw.rate != this->position->clock.rate.denom);
|
||||
(port->current_format.info.raw.rate != this->position->clock.target_rate.denom);
|
||||
} else {
|
||||
this->matching = false;
|
||||
this->resampling = false;
|
||||
|
|
@ -619,6 +619,8 @@ static void media_on_timeout(struct spa_source *source)
|
|||
rate = 48000;
|
||||
}
|
||||
|
||||
setup_matching(this);
|
||||
|
||||
this->next_time = now_time + duration * SPA_NSEC_PER_SEC / port->buffer.corr / rate;
|
||||
|
||||
if (SPA_LIKELY(this->clock)) {
|
||||
|
|
@ -630,8 +632,6 @@ static void media_on_timeout(struct spa_source *source)
|
|||
this->clock->next_nsec = this->next_time;
|
||||
}
|
||||
|
||||
setup_matching(this);
|
||||
|
||||
if (port->io) {
|
||||
int io_status = port->io->status;
|
||||
int status = produce_buffer(this);
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ static int setup_matching(struct impl *this)
|
|||
|
||||
this->matching = this->following;
|
||||
this->resampling = this->matching ||
|
||||
(port->current_format.info.raw.rate != this->position->clock.rate.denom);
|
||||
(port->current_format.info.raw.rate != this->position->clock.target_rate.denom);
|
||||
} else {
|
||||
this->matching = false;
|
||||
this->resampling = false;
|
||||
|
|
@ -618,6 +618,8 @@ static void sco_on_timeout(struct spa_source *source)
|
|||
rate = 48000;
|
||||
}
|
||||
|
||||
setup_matching(this);
|
||||
|
||||
this->next_time = now_time + duration * SPA_NSEC_PER_SEC / port->buffer.corr / rate;
|
||||
|
||||
if (SPA_LIKELY(this->clock)) {
|
||||
|
|
@ -629,8 +631,6 @@ static void sco_on_timeout(struct spa_source *source)
|
|||
this->clock->next_nsec = this->next_time;
|
||||
}
|
||||
|
||||
setup_matching(this);
|
||||
|
||||
if (port->io) {
|
||||
int io_status = port->io->status;
|
||||
int status = produce_buffer(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue