1 /* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24 * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 #define BTSTACK_FILE__ "btstack_sbc_decoder_bluedroid.c" 39 40 // ***************************************************************************** 41 // 42 // SBC decoder based on Bluedroid library 43 // 44 // ***************************************************************************** 45 46 #include "btstack_config.h" 47 48 #include <stdint.h> 49 50 #include <stdlib.h> 51 #include <string.h> 52 53 #ifdef LOG_FRAME_STATUS 54 #include <stdio.h> 55 #endif 56 57 #include "btstack_debug.h" 58 #include "btstack_util.h" 59 #include "btstack_sbc.h" 60 #include "btstack_sbc_plc.h" 61 62 #include "oi_codec_sbc.h" 63 #include "oi_assert.h" 64 65 #define mSBC_SYNCWORD 0xad 66 #define SBC_SYNCWORD 0x9c 67 #define SBC_MAX_CHANNELS 2 68 // #define LOG_FRAME_STATUS 69 70 #define DECODER_DATA_SIZE (SBC_MAX_CHANNELS*SBC_MAX_BLOCKS*SBC_MAX_BANDS * 4 + SBC_CODEC_MIN_FILTER_BUFFERS*SBC_MAX_BANDS*SBC_MAX_CHANNELS * 2) 71 72 typedef struct { 73 OI_UINT32 bytes_in_frame_buffer; 74 OI_CODEC_SBC_DECODER_CONTEXT decoder_context; 75 76 uint8_t frame_buffer[SBC_MAX_FRAME_LEN]; 77 int16_t pcm_plc_data[SBC_MAX_CHANNELS * SBC_MAX_BANDS * SBC_MAX_BLOCKS]; 78 int16_t pcm_data[SBC_MAX_CHANNELS * SBC_MAX_BANDS * SBC_MAX_BLOCKS]; 79 uint32_t pcm_bytes; 80 OI_UINT32 decoder_data[(DECODER_DATA_SIZE+3)/4]; 81 int first_good_frame_found; 82 int h2_sequence_nr; 83 uint16_t msbc_bad_bytes; 84 } bludroid_decoder_state_t; 85 86 static btstack_sbc_decoder_state_t * sbc_decoder_state_singleton = NULL; 87 static bludroid_decoder_state_t bd_decoder_state; 88 89 // Testing only - START 90 static int plc_enabled = 1; 91 static int corrupt_frame_period = -1; 92 // Testing - STOP 93 94 void btstack_sbc_decoder_test_set_plc_enabled(int enabled){ 95 plc_enabled = enabled; 96 } 97 98 void btstack_sbc_decoder_test_simulate_corrupt_frames(int period){ 99 corrupt_frame_period = period; 100 } 101 102 static int find_sequence_of_zeros(const OI_BYTE *frame_data, OI_UINT32 frame_bytes, int seq_length){ 103 int zero_seq_count = 0; 104 unsigned int i; 105 for (i=0; i<frame_bytes; i++){ 106 if (frame_data[i] == 0) { 107 zero_seq_count++; 108 if (zero_seq_count >= seq_length) return zero_seq_count; 109 } else { 110 zero_seq_count = 0; 111 } 112 } 113 return 0; 114 } 115 116 // returns position of mSBC sync word 117 static int find_h2_sync(const OI_BYTE *frame_data, OI_UINT32 frame_bytes, int * sync_word_nr){ 118 int syncword = mSBC_SYNCWORD; 119 uint8_t h2_first_byte = 0; 120 uint8_t h2_second_byte = 0; 121 122 unsigned int i; 123 for (i=0; i<frame_bytes; i++){ 124 if (frame_data[i] == syncword) { 125 // check: first byte == 1 126 if (h2_first_byte == 1) { 127 // check lower nibble of second byte == 0x08 128 uint8_t ln = h2_second_byte & 0x0F; 129 if (ln == 8) { 130 // check if bits 0+2 == bits 1+3 131 uint8_t hn = h2_second_byte >> 4; 132 if ( ((hn>>1) & 0x05) == (hn & 0x05) ) { 133 *sync_word_nr = ((hn & 0x04) >> 1) | (hn & 0x01); 134 return i; 135 } 136 } 137 } 138 } 139 h2_first_byte = h2_second_byte; 140 h2_second_byte = frame_data[i]; 141 } 142 return -1; 143 } 144 145 int btstack_sbc_decoder_num_samples_per_frame(btstack_sbc_decoder_state_t * state){ 146 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t *) state->decoder_state; 147 return decoder_state->decoder_context.common.frameInfo.nrof_blocks * decoder_state->decoder_context.common.frameInfo.nrof_subbands; 148 } 149 150 int btstack_sbc_decoder_num_channels(btstack_sbc_decoder_state_t * state){ 151 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t *) state->decoder_state; 152 return decoder_state->decoder_context.common.frameInfo.nrof_channels; 153 } 154 155 int btstack_sbc_decoder_sample_rate(btstack_sbc_decoder_state_t * state){ 156 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t *) state->decoder_state; 157 return decoder_state->decoder_context.common.frameInfo.frequency; 158 } 159 160 #ifdef OI_DEBUG 161 void OI_AssertFail(const char* file, int line, const char* reason){ 162 log_error("AssertFail file %s, line %d, reason %s", file, line, reason); 163 } 164 #endif 165 166 void btstack_sbc_decoder_init(btstack_sbc_decoder_state_t * state, btstack_sbc_mode_t mode, void (*callback)(int16_t * data, int num_samples, int num_channels, int sample_rate, void * context), void * context){ 167 if (sbc_decoder_state_singleton && (sbc_decoder_state_singleton != state) ){ 168 log_error("SBC decoder: different sbc decoder state already registered"); 169 } 170 OI_STATUS status = OI_STATUS_SUCCESS; 171 switch (mode){ 172 case SBC_MODE_STANDARD: 173 // note: we always request stereo output, even for mono input 174 status = OI_CODEC_SBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data), 2, 2, FALSE); 175 break; 176 case SBC_MODE_mSBC: 177 status = OI_CODEC_mSBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data)); 178 break; 179 default: 180 break; 181 } 182 183 if (status != OI_STATUS_SUCCESS){ 184 log_error("SBC decoder: error during reset %d\n", status); 185 } 186 187 sbc_decoder_state_singleton = state; 188 189 bd_decoder_state.bytes_in_frame_buffer = 0; 190 bd_decoder_state.pcm_bytes = sizeof(bd_decoder_state.pcm_data); 191 bd_decoder_state.h2_sequence_nr = -1; 192 bd_decoder_state.first_good_frame_found = 0; 193 194 memset(state, 0, sizeof(btstack_sbc_decoder_state_t)); 195 state->handle_pcm_data = callback; 196 state->mode = mode; 197 state->context = context; 198 state->decoder_state = &bd_decoder_state; 199 btstack_sbc_plc_init(&state->plc_state); 200 } 201 202 static void append_received_sbc_data(bludroid_decoder_state_t * state, const uint8_t * buffer, int size){ 203 int numFreeBytes = sizeof(state->frame_buffer) - state->bytes_in_frame_buffer; 204 205 if (size > numFreeBytes){ 206 log_error("SBC data: more bytes read %u than free bytes in buffer %u", size, numFreeBytes); 207 } 208 209 (void)memcpy(state->frame_buffer + state->bytes_in_frame_buffer, buffer, 210 size); 211 state->bytes_in_frame_buffer += size; 212 } 213 214 static void btstack_sbc_decoder_bluedroid_simulate_error(const OI_BYTE *frame_data) { 215 static int frame_count = 0; 216 if (corrupt_frame_period > 0){ 217 frame_count++; 218 219 if ((frame_count % corrupt_frame_period) == 0){ 220 *(uint8_t*)&frame_data[5] = 0; 221 frame_count = 0; 222 } 223 } 224 } 225 226 static void btstack_sbc_decoder_process_sbc_data(btstack_sbc_decoder_state_t * state, const uint8_t * buffer, int size){ 227 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 228 int input_bytes_to_process = size; 229 int keep_decoding = 1; 230 231 while (keep_decoding) { 232 // Fill decoder_state->frame_buffer as much as possible. 233 int bytes_free_in_frame_buffer = SBC_MAX_FRAME_LEN - decoder_state->bytes_in_frame_buffer; 234 int bytes_to_append = btstack_min(input_bytes_to_process, bytes_free_in_frame_buffer); 235 if (bytes_to_append){ 236 append_received_sbc_data(decoder_state, buffer, bytes_to_append); 237 buffer += bytes_to_append; 238 input_bytes_to_process -= bytes_to_append; 239 } 240 241 // Decode the next frame in decoder_state->frame_buffer. 242 int bytes_in_frame_buffer_before_decoding = decoder_state->bytes_in_frame_buffer; 243 const OI_BYTE *frame_data = decoder_state->frame_buffer; 244 OI_UINT32 frame_data_len = decoder_state->bytes_in_frame_buffer; 245 OI_STATUS status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 246 &frame_data, 247 &frame_data_len, 248 decoder_state->pcm_plc_data, 249 &(decoder_state->pcm_bytes)); 250 uint16_t bytes_processed = bytes_in_frame_buffer_before_decoding - frame_data_len; 251 252 // testing only - corrupt frame periodically 253 btstack_sbc_decoder_bluedroid_simulate_error(frame_data); 254 255 // Handle decoding result. 256 switch(status){ 257 case OI_STATUS_SUCCESS: 258 case OI_CODEC_SBC_PARTIAL_DECODE: 259 state->handle_pcm_data(decoder_state->pcm_plc_data, 260 btstack_sbc_decoder_num_samples_per_frame(state), 261 btstack_sbc_decoder_num_channels(state), 262 btstack_sbc_decoder_sample_rate(state), state->context); 263 state->good_frames_nr++; 264 break; 265 266 case OI_CODEC_SBC_NOT_ENOUGH_HEADER_DATA: 267 case OI_CODEC_SBC_NOT_ENOUGH_BODY_DATA: 268 case OI_CODEC_SBC_NOT_ENOUGH_AUDIO_DATA: 269 if (input_bytes_to_process > 0){ 270 // Should never occur: The SBC codec claims there is not enough bytes in the frame_buffer, 271 // but the frame_buffer was full. (The frame_buffer is always full before decoding when input_bytes_to_process > 0.) 272 // Clear frame_buffer. 273 log_info("SBC decode: frame_buffer too small for frame"); 274 bytes_processed = bytes_in_frame_buffer_before_decoding; 275 } else { 276 // Exit decode loop, because there is not enough data in frame_buffer to decode the next frame. 277 keep_decoding = 0; 278 } 279 break; 280 281 case OI_CODEC_SBC_NO_SYNCWORD: 282 // This means the entire frame_buffer did not contain the syncword. 283 // Discard the frame_buffer contents. 284 log_info("SBC decode: no syncword found"); 285 bytes_processed = bytes_in_frame_buffer_before_decoding; 286 break; 287 288 case OI_CODEC_SBC_CHECKSUM_MISMATCH: 289 // The next frame is somehow corrupt. 290 log_info("SBC decode: checksum error"); 291 // Did the codec consume any bytes? 292 if (bytes_processed > 0){ 293 // Good. Nothing to do. 294 } else { 295 // Skip the bogus frame by skipping the header. 296 bytes_processed = 1; 297 } 298 break; 299 300 case OI_STATUS_INVALID_PARAMETERS: 301 // This caused by corrupt frames. 302 // The codec apparently does not recover from this. 303 // Re-initialize the codec. 304 log_info("SBC decode: invalid parameters: resetting codec"); 305 if (OI_CODEC_SBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data), 2, 2, FALSE) != OI_STATUS_SUCCESS){ 306 log_info("SBC decode: resetting codec failed"); 307 308 } 309 break; 310 default: 311 // Anything else went wrong. 312 // Skip a few bytes and try again. 313 bytes_processed = 1; 314 log_info("SBC decode: unknown status %d", status); 315 break; 316 } 317 318 // Remove decoded frame from decoder_state->frame_buffer. 319 if (bytes_processed > bytes_in_frame_buffer_before_decoding) { 320 bytes_processed = bytes_in_frame_buffer_before_decoding; 321 } 322 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, bytes_in_frame_buffer_before_decoding - bytes_processed); 323 decoder_state->bytes_in_frame_buffer -= bytes_processed; 324 } 325 } 326 327 328 static void btstack_sbc_decoder_insert_missing_frames(btstack_sbc_decoder_state_t *state) { 329 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 330 const unsigned int MSBC_FRAME_SIZE = 60; 331 332 while (decoder_state->first_good_frame_found && (decoder_state->msbc_bad_bytes >= MSBC_FRAME_SIZE)){ 333 334 decoder_state->msbc_bad_bytes -= MSBC_FRAME_SIZE; 335 state->bad_frames_nr++; 336 337 // prepare zero signal frame 338 const OI_BYTE * frame_data = btstack_sbc_plc_zero_signal_frame(); 339 OI_UINT32 bytes_in_frame_buffer = 57; 340 341 // log_info("Trace bad frame generator, bad bytes %u", decoder_state->msbc_bad_bytes); 342 OI_STATUS status = status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 343 &frame_data, 344 &bytes_in_frame_buffer, 345 decoder_state->pcm_plc_data, 346 &(decoder_state->pcm_bytes)); 347 348 if (status) { 349 log_error("SBC decoder for ZIR frame: error %d\n", status); 350 } 351 352 if (bytes_in_frame_buffer){ 353 log_error("PLC: not all bytes of zero frame processed, left %u\n", (unsigned int) bytes_in_frame_buffer); 354 } 355 356 if (plc_enabled) { 357 btstack_sbc_plc_bad_frame(&state->plc_state, decoder_state->pcm_plc_data, decoder_state->pcm_data); 358 } else { 359 (void)memcpy(decoder_state->pcm_data, 360 decoder_state->pcm_plc_data, 361 decoder_state->pcm_bytes); 362 } 363 364 state->handle_pcm_data(decoder_state->pcm_data, 365 btstack_sbc_decoder_num_samples_per_frame(state), 366 btstack_sbc_decoder_num_channels(state), 367 btstack_sbc_decoder_sample_rate(state), state->context); 368 } 369 } 370 371 static void btstack_sbc_decoder_drop_processed_bytes(bludroid_decoder_state_t * decoder_state, uint16_t bytes_processed){ 372 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer-bytes_processed); 373 decoder_state->bytes_in_frame_buffer -= bytes_processed; 374 } 375 376 static void btstack_sbc_decoder_process_msbc_data(btstack_sbc_decoder_state_t * state, int packet_status_flag, const uint8_t * buffer, int size){ 377 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 378 int input_bytes_to_process = size; 379 const unsigned int MSBC_FRAME_SIZE = 60; 380 381 while (input_bytes_to_process > 0){ 382 383 // Use PLC to insert missing frames (after first sync found) 384 btstack_sbc_decoder_insert_missing_frames(state); 385 // fill buffer with new data 386 int bytes_missing_for_complete_msbc_frame = MSBC_FRAME_SIZE - decoder_state->bytes_in_frame_buffer; 387 int bytes_to_append = btstack_min(input_bytes_to_process, bytes_missing_for_complete_msbc_frame); 388 if (bytes_to_append) { 389 append_received_sbc_data(decoder_state, buffer, bytes_to_append); 390 buffer += bytes_to_append; 391 input_bytes_to_process -= bytes_to_append; 392 } 393 // complete frame in buffer? 394 if (decoder_state->bytes_in_frame_buffer < MSBC_FRAME_SIZE) break; 395 396 uint16_t bytes_in_frame_buffer_before_decoding = decoder_state->bytes_in_frame_buffer; 397 uint16_t bytes_processed = 0; 398 const OI_BYTE *frame_data = decoder_state->frame_buffer; 399 400 // testing only - corrupt frame periodically 401 btstack_sbc_decoder_bluedroid_simulate_error(frame_data); 402 403 // assert frame looks like this: 01 x8 AD [rest of frame 56 bytes] 00 404 int h2_syncword = 0; 405 int h2_sync_pos = find_h2_sync(frame_data, decoder_state->bytes_in_frame_buffer, &h2_syncword); 406 if (h2_sync_pos < 0){ 407 // no sync found, discard all but last 2 bytes 408 bytes_processed = decoder_state->bytes_in_frame_buffer - 2; 409 btstack_sbc_decoder_drop_processed_bytes(decoder_state, bytes_processed); 410 // don't try PLC without at least a single good frame 411 if (decoder_state->first_good_frame_found){ 412 decoder_state->msbc_bad_bytes += bytes_processed; 413 } 414 continue; 415 } 416 417 decoder_state->h2_sequence_nr = h2_syncword; 418 419 // drop data before it 420 bytes_processed = h2_sync_pos - 2; 421 if (bytes_processed > 0){ 422 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer-bytes_processed); 423 decoder_state->bytes_in_frame_buffer -= bytes_processed; 424 // don't try PLC without at least a single good frame 425 if (decoder_state->first_good_frame_found){ 426 decoder_state->msbc_bad_bytes += bytes_processed; 427 } 428 continue; 429 } 430 431 int bad_frame = 0; 432 int zero_seq_found = find_sequence_of_zeros(frame_data, decoder_state->bytes_in_frame_buffer, 20); 433 434 // after first valid frame, zero sequences count as bad frames 435 if (decoder_state->first_good_frame_found){ 436 bad_frame = zero_seq_found || packet_status_flag; 437 } 438 439 if (bad_frame){ 440 // stats 441 if (zero_seq_found){ 442 state->zero_frames_nr++; 443 } else { 444 state->bad_frames_nr++; 445 } 446 #ifdef LOG_FRAME_STATUS 447 if (zero_seq_found){ 448 printf("%d : ZERO FRAME\n", decoder_state->h2_sequence_nr); 449 } else { 450 printf("%d : BAD FRAME\n", decoder_state->h2_sequence_nr); 451 } 452 #endif 453 // retry after dropping 3 byte sync 454 bytes_processed = 3; 455 btstack_sbc_decoder_drop_processed_bytes(decoder_state, bytes_processed); 456 decoder_state->msbc_bad_bytes += bytes_processed; 457 // log_info("Trace bad frame"); 458 continue; 459 } 460 461 //ready to decode frame 462 OI_STATUS status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 463 &frame_data, 464 &(decoder_state->bytes_in_frame_buffer), 465 decoder_state->pcm_plc_data, 466 &(decoder_state->pcm_bytes)); 467 468 bytes_processed = bytes_in_frame_buffer_before_decoding - decoder_state->bytes_in_frame_buffer; 469 // log_info("Trace decode status %u, processed %u (bad bytes %u), bytes in buffer %u", (int) status, bytes_processed, decoder_state->msbc_bad_bytes, decoder_state->bytes_in_frame_buffer); 470 471 switch(status){ 472 case 0: 473 // synced 474 decoder_state->first_good_frame_found = 1; 475 476 // get rid of padding byte, not processed by SBC decoder 477 decoder_state->bytes_in_frame_buffer = 0; 478 479 // restart counting bad bytes 480 decoder_state->msbc_bad_bytes = 0; 481 482 // feed good frame into PLC history 483 btstack_sbc_plc_good_frame(&state->plc_state, decoder_state->pcm_plc_data, decoder_state->pcm_data); 484 485 // deliver PCM data 486 state->handle_pcm_data(decoder_state->pcm_data, 487 btstack_sbc_decoder_num_samples_per_frame(state), 488 btstack_sbc_decoder_num_channels(state), 489 btstack_sbc_decoder_sample_rate(state), state->context); 490 491 // stats 492 state->good_frames_nr++; 493 continue; 494 495 case OI_CODEC_SBC_CHECKSUM_MISMATCH: 496 // The next frame is somehow corrupt. 497 log_debug("OI_CODEC_SBC_CHECKSUM_MISMATCH"); 498 // Did the codec consume any bytes? 499 if (bytes_processed > 0){ 500 // Good. Nothing to do. 501 } else { 502 // Skip the bogus frame by skipping the header. 503 bytes_processed = 1; 504 } 505 break; 506 507 case OI_STATUS_INVALID_PARAMETERS: 508 // This caused by corrupt frames. 509 // The codec apparently does not recover from this. 510 // Re-initialize the codec. 511 log_info("SBC decode: invalid parameters: resetting codec"); 512 if (OI_CODEC_mSBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data)) != OI_STATUS_SUCCESS){ 513 log_info("SBC decode: resetting codec failed"); 514 } 515 break; 516 default: 517 log_info("Frame decode error: %d", status); 518 break; 519 } 520 521 // on success, while loop was restarted, so all processed bytes have been "bad" 522 decoder_state->msbc_bad_bytes += bytes_processed; 523 524 // drop processed bytes from frame buffer 525 btstack_sbc_decoder_drop_processed_bytes(decoder_state, bytes_processed); 526 } 527 } 528 529 void btstack_sbc_decoder_process_data(btstack_sbc_decoder_state_t * state, int packet_status_flag, const uint8_t * buffer, int size){ 530 if (state->mode == SBC_MODE_mSBC){ 531 btstack_sbc_decoder_process_msbc_data(state, packet_status_flag, buffer, size); 532 } else { 533 btstack_sbc_decoder_process_sbc_data(state, buffer, size); 534 } 535 } 536