Skip to content

Commit

Permalink
fix BT source - release
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 committed Oct 29, 2020
1 parent 67ea623 commit 0503d03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/squeezelite/equalizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void equalizer_update(s8_t *gain) {
* process equalizer
*/
void equalizer_process(u8_t *buf, u32_t bytes, u32_t sample_rate) {
// don't want to process with output locked, so tak ethe small risk to miss one parametric update
// don't want to process with output locked, so take the small risk to miss one parametric update
if (equalizer.update) {
equalizer_close();
equalizer_open(sample_rate);
Expand Down
19 changes: 12 additions & 7 deletions components/squeezelite/output_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,37 @@ int32_t output_bt_data(uint8_t *data, int32_t len) {

// This is how the BTC layer calculates the number of bytes to
// for us to send. (BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16) - availPcmBytes
wanted_len=len;
SET_MIN_MAX(len,req);
TIME_MEASUREMENT_START(start_timer);
LOCK;
output.device_frames = 0; // todo: check if this is the right way do to this.

len /= BYTES_PER_FRAME;
wanted_len = len;

output.device_frames = 0;
output.updated = gettime_ms();
output.frames_played_dmp = output.frames_played;

SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);

do {
avail_data = _output_frames( wanted_len/BYTES_PER_FRAME )*BYTES_PER_FRAME; // Keep the transfer buffer full
wanted_len-=avail_data;
avail_data = _output_frames(wanted_len);
wanted_len -= avail_data;
} while (wanted_len > 0 && avail_data != 0);

if (wanted_len > 0) {
SET_MIN_MAX(wanted_len, under);
SET_MIN_MAX(wanted_len * BYTES_PER_FRAME, under);
}
output.frames_in_process = len-wanted_len;

output.frames_in_process = len - wanted_len;
equalizer_process(data, (len - wanted_len) * BYTES_PER_FRAME, output.current_sample_rate);

UNLOCK;
SET_MIN_MAX(TIME_MEASUREMENT_GET(start_timer),lock_out_time);
SET_MIN_MAX((len-wanted_len), rec);
TIME_MEASUREMENT_START(start_timer);

return len-wanted_len;
return (len - wanted_len) * BYTES_PER_FRAME;
}

void output_bt_tick(void) {
Expand Down

0 comments on commit 0503d03

Please sign in to comment.