bluez5: don't put side effects into spa_log_* arguments

spa_log_* are macros such that their arguments don't get executed if the
log topic is not enabled.
This commit is contained in:
Pauli Virtanen 2022-11-07 20:15:29 +02:00
parent bc2a02c283
commit e381a26de9

View file

@ -633,6 +633,7 @@ static int flush_data(struct impl *this, uint64_t now_time)
int written;
uint32_t total_frames;
struct port *port = &this->port;
int unused_buffer;
if (!this->flush_source.loop) {
/* I/O in error state */
@ -718,15 +719,21 @@ again:
return 0;
}
// This should be the same as buffer size to increase bitpool
// Bitpool shouldn't be increased when data is left over in the buffer
int unused_buffer = get_transport_unused_size(this);
/*
* Get socket queue size before writing to it.
* This should be the same as buffer size to increase bitpool
* Bitpool shouldn't be increased when data is left over in the buffer
*/
unused_buffer = get_transport_unused_size(this);
written = flush_buffer(this);
if (written == -EAGAIN) {
spa_log_trace(this->log, "%p: fail flush", this);
if (now_time - this->last_error > SPA_NSEC_PER_SEC / 2) {
spa_log_debug(this->log, "%p: reduce bitpool: %i", this, this->codec->reduce_bitpool(this->codec_data));
int res = this->codec->reduce_bitpool(this->codec_data);
spa_log_debug(this->log, "%p: reduce bitpool: %i", this, res);
this->last_error = now_time;
}
@ -794,7 +801,9 @@ again:
if (now_time - this->last_error > SPA_NSEC_PER_SEC) {
if (unused_buffer == (int)this->fd_buffer_size) {
spa_log_debug(this->log, "%p: increase bitpool: %i", this, this->codec->increase_bitpool(this->codec_data));
int res = this->codec->increase_bitpool(this->codec_data);
spa_log_debug(this->log, "%p: increase bitpool: %i", this, res);
}
this->last_error = now_time;
}