mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 04:57:06 +03:00
fix BT source - release
This commit is contained in:
@@ -76,7 +76,7 @@ void equalizer_update(s8_t *gain) {
|
|||||||
* process equalizer
|
* process equalizer
|
||||||
*/
|
*/
|
||||||
void equalizer_process(u8_t *buf, u32_t bytes, u32_t sample_rate) {
|
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) {
|
if (equalizer.update) {
|
||||||
equalizer_close();
|
equalizer_close();
|
||||||
equalizer_open(sample_rate);
|
equalizer_open(sample_rate);
|
||||||
|
|||||||
@@ -131,24 +131,29 @@ int32_t output_bt_data(uint8_t *data, int32_t len) {
|
|||||||
|
|
||||||
// This is how the BTC layer calculates the number of bytes to
|
// 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
|
// for us to send. (BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16) - availPcmBytes
|
||||||
wanted_len=len;
|
|
||||||
SET_MIN_MAX(len,req);
|
SET_MIN_MAX(len,req);
|
||||||
TIME_MEASUREMENT_START(start_timer);
|
TIME_MEASUREMENT_START(start_timer);
|
||||||
LOCK;
|
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.updated = gettime_ms();
|
||||||
output.frames_played_dmp = output.frames_played;
|
output.frames_played_dmp = output.frames_played;
|
||||||
|
|
||||||
SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);
|
SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
avail_data = _output_frames( wanted_len/BYTES_PER_FRAME )*BYTES_PER_FRAME; // Keep the transfer buffer full
|
avail_data = _output_frames(wanted_len);
|
||||||
wanted_len-=avail_data;
|
wanted_len -= avail_data;
|
||||||
} while (wanted_len > 0 && avail_data != 0);
|
} while (wanted_len > 0 && avail_data != 0);
|
||||||
|
|
||||||
if (wanted_len > 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);
|
equalizer_process(data, (len - wanted_len) * BYTES_PER_FRAME, output.current_sample_rate);
|
||||||
|
|
||||||
UNLOCK;
|
UNLOCK;
|
||||||
@@ -156,7 +161,7 @@ int32_t output_bt_data(uint8_t *data, int32_t len) {
|
|||||||
SET_MIN_MAX((len-wanted_len), rec);
|
SET_MIN_MAX((len-wanted_len), rec);
|
||||||
TIME_MEASUREMENT_START(start_timer);
|
TIME_MEASUREMENT_START(start_timer);
|
||||||
|
|
||||||
return len-wanted_len;
|
return (len - wanted_len) * BYTES_PER_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
void output_bt_tick(void) {
|
void output_bt_tick(void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user