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 MATTHIAS 24 * RINGWALD 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 #include <stdio.h> 50 #include <stdlib.h> 51 #include <string.h> 52 53 #include "btstack_sbc.h" 54 #include "btstack_sbc_plc.h" 55 56 #include "oi_codec_sbc.h" 57 #include "oi_assert.h" 58 #include "btstack.h" 59 60 #define mSBC_SYNCWORD 0xad 61 #define SBC_SYNCWORD 0x9c 62 #define SBC_MAX_CHANNELS 2 63 // #define LOG_FRAME_STATUS 64 65 #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) 66 67 typedef struct { 68 OI_UINT32 bytes_in_frame_buffer; 69 OI_CODEC_SBC_DECODER_CONTEXT decoder_context; 70 71 uint8_t frame_buffer[SBC_MAX_FRAME_LEN]; 72 int16_t pcm_plc_data[SBC_MAX_CHANNELS * SBC_MAX_BANDS * SBC_MAX_BLOCKS]; 73 int16_t pcm_data[SBC_MAX_CHANNELS * SBC_MAX_BANDS * SBC_MAX_BLOCKS]; 74 uint32_t pcm_bytes; 75 OI_UINT32 decoder_data[(DECODER_DATA_SIZE+3)/4]; 76 int first_good_frame_found; 77 int h2_sequence_nr; 78 uint16_t msbc_bad_bytes; 79 } bludroid_decoder_state_t; 80 81 static btstack_sbc_decoder_state_t * sbc_decoder_state_singleton = NULL; 82 static bludroid_decoder_state_t bd_decoder_state; 83 84 // Testing only - START 85 static int plc_enabled = 1; 86 static int corrupt_frame_period = -1; 87 // Testing - STOP 88 89 void btstack_sbc_decoder_test_set_plc_enabled(int enabled){ 90 plc_enabled = enabled; 91 } 92 93 void btstack_sbc_decoder_test_simulate_corrupt_frames(int period){ 94 corrupt_frame_period = period; 95 } 96 97 static int find_sequence_of_zeros(const OI_BYTE *frame_data, OI_UINT32 frame_bytes, int seq_length){ 98 int zero_seq_count = 0; 99 unsigned int i; 100 for (i=0; i<frame_bytes; i++){ 101 if (frame_data[i] == 0) { 102 zero_seq_count++; 103 if (zero_seq_count >= seq_length) return zero_seq_count; 104 } else { 105 zero_seq_count = 0; 106 } 107 } 108 return 0; 109 } 110 111 // returns position of mSBC sync word 112 static int find_h2_sync(const OI_BYTE *frame_data, OI_UINT32 frame_bytes, int * sync_word_nr){ 113 int syncword = mSBC_SYNCWORD; 114 uint8_t h2_first_byte = 0; 115 uint8_t h2_second_byte = 0; 116 117 unsigned int i; 118 for (i=0; i<frame_bytes; i++){ 119 if (frame_data[i] == syncword) { 120 // check: first byte == 1 121 if (h2_first_byte == 1) { 122 // check lower nibble of second byte == 0x08 123 uint8_t ln = h2_second_byte & 0x0F; 124 if (ln == 8) { 125 // check if bits 0+2 == bits 1+3 126 uint8_t hn = h2_second_byte >> 4; 127 if ( ((hn>>1) & 0x05) == (hn & 0x05) ) { 128 *sync_word_nr = ((hn & 0x04) >> 1) | (hn & 0x01); 129 return i; 130 } 131 } 132 } 133 } 134 h2_first_byte = h2_second_byte; 135 h2_second_byte = frame_data[i]; 136 } 137 return -1; 138 } 139 140 int btstack_sbc_decoder_num_samples_per_frame(btstack_sbc_decoder_state_t * state){ 141 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t *) state->decoder_state; 142 return decoder_state->decoder_context.common.frameInfo.nrof_blocks * decoder_state->decoder_context.common.frameInfo.nrof_subbands; 143 } 144 145 int btstack_sbc_decoder_num_channels(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_channels; 148 } 149 150 int btstack_sbc_decoder_sample_rate(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.frequency; 153 } 154 155 #ifdef OI_DEBUG 156 void OI_AssertFail(const char* file, int line, const char* reason){ 157 log_error("AssertFail file %s, line %d, reason %s", file, line, reason); 158 } 159 #endif 160 161 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){ 162 if (sbc_decoder_state_singleton && (sbc_decoder_state_singleton != state) ){ 163 log_error("SBC decoder: different sbc decoder state already registered"); 164 } 165 OI_STATUS status = OI_STATUS_SUCCESS; 166 switch (mode){ 167 case SBC_MODE_STANDARD: 168 // note: we always request stereo output, even for mono input 169 status = OI_CODEC_SBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data), 2, 2, FALSE); 170 break; 171 case SBC_MODE_mSBC: 172 status = OI_CODEC_mSBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data)); 173 break; 174 default: 175 break; 176 } 177 178 if (status != OI_STATUS_SUCCESS){ 179 log_error("SBC decoder: error during reset %d\n", status); 180 } 181 182 sbc_decoder_state_singleton = state; 183 184 bd_decoder_state.bytes_in_frame_buffer = 0; 185 bd_decoder_state.pcm_bytes = sizeof(bd_decoder_state.pcm_data); 186 bd_decoder_state.h2_sequence_nr = -1; 187 bd_decoder_state.first_good_frame_found = 0; 188 189 memset(state, 0, sizeof(btstack_sbc_decoder_state_t)); 190 state->handle_pcm_data = callback; 191 state->mode = mode; 192 state->context = context; 193 state->decoder_state = &bd_decoder_state; 194 btstack_sbc_plc_init(&state->plc_state); 195 } 196 197 static void append_received_sbc_data(bludroid_decoder_state_t * state, uint8_t * buffer, int size){ 198 int numFreeBytes = sizeof(state->frame_buffer) - state->bytes_in_frame_buffer; 199 200 // printf("append_received_sbc_data: bytes to append %u, sizeof %u, bytes in buffer %u, free %u\n", size,sizeof(state->frame_buffer), state->bytes_in_frame_buffer, numFreeBytes); 201 202 if (size > numFreeBytes){ 203 log_error("SBC data: more bytes read %u than free bytes in buffer %u", size, numFreeBytes); 204 } 205 206 (void)memcpy(state->frame_buffer + state->bytes_in_frame_buffer, buffer, 207 size); 208 state->bytes_in_frame_buffer += size; 209 } 210 211 static void btstack_sbc_decoder_bluedroid_simulate_error(const OI_BYTE *frame_data) { 212 static int frame_count = 0; 213 if (corrupt_frame_period > 0){ 214 frame_count++; 215 216 if ((frame_count % corrupt_frame_period) == 0){ 217 *(uint8_t*)&frame_data[5] = 0; 218 frame_count = 0; 219 } 220 } 221 } 222 223 static void btstack_sbc_decoder_process_sbc_data(btstack_sbc_decoder_state_t * state, uint8_t * buffer, int size){ 224 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 225 int input_bytes_to_process = size; 226 int keep_decoding = 1; 227 228 while (keep_decoding) { 229 // Fill decoder_state->frame_buffer as much as possible. 230 int bytes_free_in_frame_buffer = SBC_MAX_FRAME_LEN - decoder_state->bytes_in_frame_buffer; 231 int bytes_to_append = btstack_min(input_bytes_to_process, bytes_free_in_frame_buffer); 232 if (bytes_to_append){ 233 append_received_sbc_data(decoder_state, buffer, bytes_to_append); 234 buffer += bytes_to_append; 235 input_bytes_to_process -= bytes_to_append; 236 } 237 238 // Decode the next frame in decoder_state->frame_buffer. 239 int bytes_in_frame_buffer_before_decoding = decoder_state->bytes_in_frame_buffer; 240 const OI_BYTE *frame_data = decoder_state->frame_buffer; 241 OI_UINT32 frame_data_len = decoder_state->bytes_in_frame_buffer; 242 OI_STATUS status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 243 &frame_data, 244 &frame_data_len, 245 decoder_state->pcm_plc_data, 246 &(decoder_state->pcm_bytes)); 247 uint16_t bytes_processed = bytes_in_frame_buffer_before_decoding - frame_data_len; 248 249 // testing only - corrupt frame periodically 250 btstack_sbc_decoder_bluedroid_simulate_error(frame_data); 251 252 // Handle decoding result. 253 switch(status){ 254 case OI_STATUS_SUCCESS: 255 case OI_CODEC_SBC_PARTIAL_DECODE: 256 state->handle_pcm_data(decoder_state->pcm_plc_data, 257 btstack_sbc_decoder_num_samples_per_frame(state), 258 btstack_sbc_decoder_num_channels(state), 259 btstack_sbc_decoder_sample_rate(state), state->context); 260 state->good_frames_nr++; 261 break; 262 263 case OI_CODEC_SBC_NOT_ENOUGH_HEADER_DATA: 264 case OI_CODEC_SBC_NOT_ENOUGH_BODY_DATA: 265 case OI_CODEC_SBC_NOT_ENOUGH_AUDIO_DATA: 266 if (input_bytes_to_process > 0){ 267 // Should never occur: The SBC codec claims there is not enough bytes in the frame_buffer, 268 // but the frame_buffer was full. (The frame_buffer is always full before decoding when input_bytes_to_process > 0.) 269 // Clear frame_buffer. 270 log_info("SBC decode: frame_buffer too small for frame"); 271 bytes_processed = bytes_in_frame_buffer_before_decoding; 272 } else { 273 // Exit decode loop, because there is not enough data in frame_buffer to decode the next frame. 274 keep_decoding = 0; 275 } 276 break; 277 278 case OI_CODEC_SBC_NO_SYNCWORD: 279 // This means the entire frame_buffer did not contain the syncword. 280 // Discard the frame_buffer contents. 281 log_info("SBC decode: no syncword found"); 282 bytes_processed = bytes_in_frame_buffer_before_decoding; 283 break; 284 285 case OI_CODEC_SBC_CHECKSUM_MISMATCH: 286 // The next frame is somehow corrupt. 287 log_info("SBC decode: checksum error"); 288 // Did the codec consume any bytes? 289 if (bytes_processed > 0){ 290 // Good. Nothing to do. 291 } else { 292 // Skip the bogus frame by skipping the header. 293 bytes_processed = 1; 294 } 295 break; 296 297 case OI_STATUS_INVALID_PARAMETERS: 298 // This caused by corrupt frames. 299 // The codec apparently does not recover from this. 300 // Re-initialize the codec. 301 log_info("SBC decode: invalid parameters: resetting codec"); 302 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){ 303 log_info("SBC decode: resetting codec failed"); 304 305 } 306 break; 307 default: 308 // Anything else went wrong. 309 // Skip a few bytes and try again. 310 bytes_processed = 1; 311 log_info("SBC decode: unknown status %d", status); 312 break; 313 } 314 315 // Remove decoded frame from decoder_state->frame_buffer. 316 if (bytes_processed > bytes_in_frame_buffer_before_decoding) { 317 bytes_processed = bytes_in_frame_buffer_before_decoding; 318 } 319 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, bytes_in_frame_buffer_before_decoding - bytes_processed); 320 decoder_state->bytes_in_frame_buffer -= bytes_processed; 321 } 322 } 323 324 325 static void btstack_sbc_decoder_insert_missing_frames(btstack_sbc_decoder_state_t *state) { 326 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 327 const unsigned int MSBC_FRAME_SIZE = 60; 328 329 while (decoder_state->first_good_frame_found && (decoder_state->msbc_bad_bytes >= MSBC_FRAME_SIZE)){ 330 331 decoder_state->msbc_bad_bytes -= MSBC_FRAME_SIZE; 332 state->bad_frames_nr++; 333 334 // prepare zero signal frame 335 const OI_BYTE * frame_data = btstack_sbc_plc_zero_signal_frame(); 336 OI_UINT32 bytes_in_frame_buffer = 57; 337 338 // log_info("Trace bad frame generator, bad bytes %u", decoder_state->msbc_bad_bytes); 339 OI_STATUS status = status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 340 &frame_data, 341 &bytes_in_frame_buffer, 342 decoder_state->pcm_plc_data, 343 &(decoder_state->pcm_bytes)); 344 345 if (status) { 346 log_error("SBC decoder for ZIR frame: error %d\n", status); 347 } 348 349 if (bytes_in_frame_buffer){ 350 log_error("PLC: not all bytes of zero frame processed, left %u\n", bytes_in_frame_buffer); 351 } 352 353 if (plc_enabled) { 354 btstack_sbc_plc_bad_frame(&state->plc_state, decoder_state->pcm_plc_data, decoder_state->pcm_data); 355 } else { 356 (void)memcpy(decoder_state->pcm_data, 357 decoder_state->pcm_plc_data, 358 decoder_state->pcm_bytes); 359 } 360 361 state->handle_pcm_data(decoder_state->pcm_data, 362 btstack_sbc_decoder_num_samples_per_frame(state), 363 btstack_sbc_decoder_num_channels(state), 364 btstack_sbc_decoder_sample_rate(state), state->context); 365 } 366 } 367 368 static void btstack_sbc_decoder_process_msbc_data(btstack_sbc_decoder_state_t * state, int packet_status_flag, uint8_t * buffer, int size){ 369 bludroid_decoder_state_t * decoder_state = (bludroid_decoder_state_t*)state->decoder_state; 370 int input_bytes_to_process = size; 371 const unsigned int MSBC_FRAME_SIZE = 60; 372 373 while (input_bytes_to_process > 0){ 374 375 // Use PLC to insert missing frames (after first sync found) 376 btstack_sbc_decoder_insert_missing_frames(state); 377 378 // fill buffer with new data 379 int bytes_missing_for_complete_msbc_frame = MSBC_FRAME_SIZE - decoder_state->bytes_in_frame_buffer; 380 int bytes_to_append = btstack_min(input_bytes_to_process, bytes_missing_for_complete_msbc_frame); 381 if (bytes_to_append) { 382 append_received_sbc_data(decoder_state, buffer, bytes_to_append); 383 buffer += bytes_to_append; 384 input_bytes_to_process -= bytes_to_append; 385 } 386 387 // complete frame in buffer? 388 if (decoder_state->bytes_in_frame_buffer < MSBC_FRAME_SIZE) break; 389 390 uint16_t bytes_in_frame_buffer_before_decoding = decoder_state->bytes_in_frame_buffer; 391 uint16_t bytes_processed = 0; 392 const OI_BYTE *frame_data = decoder_state->frame_buffer; 393 394 // testing only - corrupt frame periodically 395 btstack_sbc_decoder_bluedroid_simulate_error(frame_data); 396 397 // assert frame looks like this: 01 x8 AD [rest of frame 56 bytes] 00 398 int h2_syncword = 0; 399 int h2_sync_pos = find_h2_sync(frame_data, decoder_state->bytes_in_frame_buffer, &h2_syncword); 400 if (h2_sync_pos < 0){ 401 // no sync found, discard all but last 2 bytes 402 bytes_processed = decoder_state->bytes_in_frame_buffer - 2; 403 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer); 404 decoder_state->bytes_in_frame_buffer -= bytes_processed; // == 2 405 // don't try PLC without at least a single good frame 406 if (decoder_state->first_good_frame_found){ 407 decoder_state->msbc_bad_bytes += bytes_processed; 408 } 409 continue; 410 } 411 412 decoder_state->h2_sequence_nr = h2_syncword; 413 414 // drop data before it 415 bytes_processed = h2_sync_pos - 2; 416 if (bytes_processed > 2){ 417 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer); 418 decoder_state->bytes_in_frame_buffer -= bytes_processed; 419 // don't try PLC without at least a single good frame 420 if (decoder_state->first_good_frame_found){ 421 decoder_state->msbc_bad_bytes += bytes_processed; 422 } 423 continue; 424 } 425 426 int bad_frame = 0; 427 int zero_seq_found = find_sequence_of_zeros(frame_data, decoder_state->bytes_in_frame_buffer, 20); 428 429 // after first valid frame, zero sequences count as bad frames 430 if (decoder_state->first_good_frame_found){ 431 bad_frame = zero_seq_found || packet_status_flag; 432 } 433 434 if (bad_frame){ 435 // stats 436 if (zero_seq_found){ 437 state->zero_frames_nr++; 438 } else { 439 state->bad_frames_nr++; 440 } 441 #ifdef LOG_FRAME_STATUS 442 if (zero_seq_found){ 443 printf("%d : ZERO FRAME\n", decoder_state->h2_sequence_nr); 444 } else { 445 printf("%d : BAD FRAME\n", decoder_state->h2_sequence_nr); 446 } 447 #endif 448 // retry after dropoing 3 byte sync 449 bytes_processed = 3; 450 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer); 451 decoder_state->bytes_in_frame_buffer -= bytes_processed; 452 decoder_state->msbc_bad_bytes += bytes_processed; 453 // log_info("Trace bad frame"); 454 continue; 455 } 456 457 // ready to decode frame 458 OI_STATUS status = OI_CODEC_SBC_DecodeFrame(&(decoder_state->decoder_context), 459 &frame_data, 460 &(decoder_state->bytes_in_frame_buffer), 461 decoder_state->pcm_plc_data, 462 &(decoder_state->pcm_bytes)); 463 464 bytes_processed = bytes_in_frame_buffer_before_decoding - decoder_state->bytes_in_frame_buffer; 465 // 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); 466 467 switch(status){ 468 case 0: 469 // synced 470 decoder_state->first_good_frame_found = 1; 471 472 // get rid of padding byte, not processed by SBC decoder 473 decoder_state->bytes_in_frame_buffer = 0; 474 475 // restart counting bad bytes 476 decoder_state->msbc_bad_bytes = 0; 477 478 // feed good frame into PLC history 479 btstack_sbc_plc_good_frame(&state->plc_state, decoder_state->pcm_plc_data, decoder_state->pcm_data); 480 481 // deliver PCM data 482 state->handle_pcm_data(decoder_state->pcm_data, 483 btstack_sbc_decoder_num_samples_per_frame(state), 484 btstack_sbc_decoder_num_channels(state), 485 btstack_sbc_decoder_sample_rate(state), state->context); 486 487 // stats 488 state->good_frames_nr++; 489 continue; 490 491 case OI_CODEC_SBC_CHECKSUM_MISMATCH: 492 // The next frame is somehow corrupt. 493 log_debug("OI_CODEC_SBC_CHECKSUM_MISMATCH"); 494 // Did the codec consume any bytes? 495 if (bytes_processed > 0){ 496 // Good. Nothing to do. 497 } else { 498 // Skip the bogus frame by skipping the header. 499 bytes_processed = 1; 500 } 501 break; 502 503 case OI_STATUS_INVALID_PARAMETERS: 504 // This caused by corrupt frames. 505 // The codec apparently does not recover from this. 506 // Re-initialize the codec. 507 log_info("SBC decode: invalid parameters: resetting codec"); 508 if (OI_CODEC_mSBC_DecoderReset(&(bd_decoder_state.decoder_context), bd_decoder_state.decoder_data, sizeof(bd_decoder_state.decoder_data)) != OI_STATUS_SUCCESS){ 509 log_info("SBC decode: resetting codec failed"); 510 } 511 break; 512 default: 513 log_info("Frame decode error: %d", status); 514 break; 515 } 516 517 // on success, while loop was restarted, so all processed bytes have been "bad" 518 decoder_state->msbc_bad_bytes += bytes_processed; 519 520 // drop processed bytes from frame buffer 521 memmove(decoder_state->frame_buffer, decoder_state->frame_buffer + bytes_processed, decoder_state->bytes_in_frame_buffer); 522 } 523 } 524 525 void btstack_sbc_decoder_process_data(btstack_sbc_decoder_state_t * state, int packet_status_flag, uint8_t * buffer, int size){ 526 if (state->mode == SBC_MODE_mSBC){ 527 btstack_sbc_decoder_process_msbc_data(state, packet_status_flag, buffer, size); 528 } else { 529 btstack_sbc_decoder_process_sbc_data(state, buffer, size); 530 } 531 } 532