Loading system/stack/btm/btm_sco.cc +6 −4 Original line number Diff line number Diff line Loading @@ -327,10 +327,7 @@ void btm_route_sco_data(bluetooth::hci::ScoView valid_packet) { ? &bluetooth::audio::sco::swb::decode : &bluetooth::audio::sco::wbs::decode; rc = decode(&decoded); if (rc == 0) { LOG_DEBUG("Failed to decode %s frames", codec.c_str()); break; } if (rc == 0) break; written += bluetooth::audio::sco::write(decoded, rc); } Loading Loading @@ -1257,8 +1254,13 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { double packet_loss_ratio; if (fill_plc_stats(&num_decoded_frames, &packet_loss_ratio)) { const int16_t codec_id = sco_codec_type_to_id(codec_type); const std::string codec = sco_codec_type_text(codec_type); log_hfp_audio_packet_loss_stats(bd_addr, num_decoded_frames, packet_loss_ratio, codec_id); LOG_DEBUG( "Stopped SCO codec:%s, num_decoded_frames:%d, " "packet_loss_ratio:%lf", codec.c_str(), num_decoded_frames, packet_loss_ratio); } else { LOG_WARN("Failed to get the packet loss stats"); } Loading system/stack/btm/btm_sco_hci.cc +0 −25 Original line number Diff line number Diff line Loading @@ -509,7 +509,6 @@ struct tBTM_MSBC_INFO { const uint8_t* find_msbc_pkt_head() { if (read_corrupted) { LOG_DEBUG("Skip corrupted mSBC packets"); read_corrupted = false; return nullptr; } Loading Loading @@ -556,11 +555,6 @@ struct tBTM_MSBC_INFO { } size_t mark_pkt_dequeued() { LOG_DEBUG( "Try to mark an encoded packet dequeued: ro:%lu wo:%lu pkt_size:%lu", (unsigned long)encode_buf_ro, (unsigned long)encode_buf_wo, (unsigned long)packet_size); if (encode_buf_wo - encode_buf_ro < packet_size) return 0; encode_buf_ro += packet_size; Loading @@ -574,7 +568,6 @@ struct tBTM_MSBC_INFO { const uint8_t* sco_pkt_read_ptr() { if (encode_buf_wo - encode_buf_ro < packet_size) { LOG_DEBUG("Insufficient data as a SCO packet to read."); return nullptr; } Loading Loading @@ -637,8 +630,6 @@ bool enqueue_packet(const std::vector<uint8_t>& data, bool corrupted) { msbc_info->read_corrupted |= corrupted; if (msbc_info->write(data) != data.size()) { LOG_DEBUG("Fail to write packet with size %lu to buffer", (unsigned long)data.size()); return false; } Loading @@ -659,15 +650,11 @@ size_t decode(const uint8_t** out_data) { } if (msbc_info->decodable() < BTM_MSBC_PKT_LEN) { LOG_DEBUG("No complete mSBC packet to decode"); return 0; } frame_head = msbc_info->find_msbc_pkt_head(); if (frame_head == nullptr) { LOG_DEBUG("No valid mSBC packet to decode %lu, %lu", (unsigned long)msbc_info->decode_buf_ro, (unsigned long)msbc_info->decode_buf_wo); /* Done with parsing the raw bytes just read. If we couldn't find a valid * mSBC frame head, we shall treat the existing BTM_MSBC_PKT_LEN length * of mSBC data as a corrupted packet and conduct the PLC. */ Loading @@ -677,7 +664,6 @@ size_t decode(const uint8_t** out_data) { if (!GetInterfaceToProfiles()->msbcCodec->decodePacket( frame_head, msbc_info->decoded_pcm_buf, sizeof(msbc_info->decoded_pcm_buf))) { LOG_DEBUG("Decoding mSBC packet failed"); goto packet_loss; } Loading Loading @@ -708,16 +694,11 @@ size_t encode(int16_t* data, size_t len) { } if (len < BTM_MSBC_CODE_SIZE) { LOG_DEBUG( "PCM frames with size %lu is insufficient to be encoded into a mSBC " "packet", (unsigned long)len); return 0; } pkt_body = msbc_info->fill_msbc_pkt_template(); if (pkt_body == nullptr) { LOG_DEBUG("Failed to fill the template to fill the mSBC packet"); return 0; } Loading Loading @@ -925,11 +906,6 @@ struct tBTM_LC3_INFO { } size_t mark_pkt_dequeued() { LOG_DEBUG( "Try to mark an encoded packet dequeued: ro:%lu wo:%lu pkt_size:%lu", (unsigned long)encode_buf_ro, (unsigned long)encode_buf_wo, (unsigned long)packet_size); if (encode_buf_wo - encode_buf_ro < packet_size) return 0; encode_buf_ro += packet_size; Loading @@ -943,7 +919,6 @@ struct tBTM_LC3_INFO { const uint8_t* sco_pkt_read_ptr() { if (encode_buf_wo - encode_buf_ro < packet_size) { LOG_DEBUG("Insufficient data as a SCO packet to read."); return nullptr; } Loading Loading
system/stack/btm/btm_sco.cc +6 −4 Original line number Diff line number Diff line Loading @@ -327,10 +327,7 @@ void btm_route_sco_data(bluetooth::hci::ScoView valid_packet) { ? &bluetooth::audio::sco::swb::decode : &bluetooth::audio::sco::wbs::decode; rc = decode(&decoded); if (rc == 0) { LOG_DEBUG("Failed to decode %s frames", codec.c_str()); break; } if (rc == 0) break; written += bluetooth::audio::sco::write(decoded, rc); } Loading Loading @@ -1257,8 +1254,13 @@ void btm_sco_on_disconnected(uint16_t hci_handle, tHCI_REASON reason) { double packet_loss_ratio; if (fill_plc_stats(&num_decoded_frames, &packet_loss_ratio)) { const int16_t codec_id = sco_codec_type_to_id(codec_type); const std::string codec = sco_codec_type_text(codec_type); log_hfp_audio_packet_loss_stats(bd_addr, num_decoded_frames, packet_loss_ratio, codec_id); LOG_DEBUG( "Stopped SCO codec:%s, num_decoded_frames:%d, " "packet_loss_ratio:%lf", codec.c_str(), num_decoded_frames, packet_loss_ratio); } else { LOG_WARN("Failed to get the packet loss stats"); } Loading
system/stack/btm/btm_sco_hci.cc +0 −25 Original line number Diff line number Diff line Loading @@ -509,7 +509,6 @@ struct tBTM_MSBC_INFO { const uint8_t* find_msbc_pkt_head() { if (read_corrupted) { LOG_DEBUG("Skip corrupted mSBC packets"); read_corrupted = false; return nullptr; } Loading Loading @@ -556,11 +555,6 @@ struct tBTM_MSBC_INFO { } size_t mark_pkt_dequeued() { LOG_DEBUG( "Try to mark an encoded packet dequeued: ro:%lu wo:%lu pkt_size:%lu", (unsigned long)encode_buf_ro, (unsigned long)encode_buf_wo, (unsigned long)packet_size); if (encode_buf_wo - encode_buf_ro < packet_size) return 0; encode_buf_ro += packet_size; Loading @@ -574,7 +568,6 @@ struct tBTM_MSBC_INFO { const uint8_t* sco_pkt_read_ptr() { if (encode_buf_wo - encode_buf_ro < packet_size) { LOG_DEBUG("Insufficient data as a SCO packet to read."); return nullptr; } Loading Loading @@ -637,8 +630,6 @@ bool enqueue_packet(const std::vector<uint8_t>& data, bool corrupted) { msbc_info->read_corrupted |= corrupted; if (msbc_info->write(data) != data.size()) { LOG_DEBUG("Fail to write packet with size %lu to buffer", (unsigned long)data.size()); return false; } Loading @@ -659,15 +650,11 @@ size_t decode(const uint8_t** out_data) { } if (msbc_info->decodable() < BTM_MSBC_PKT_LEN) { LOG_DEBUG("No complete mSBC packet to decode"); return 0; } frame_head = msbc_info->find_msbc_pkt_head(); if (frame_head == nullptr) { LOG_DEBUG("No valid mSBC packet to decode %lu, %lu", (unsigned long)msbc_info->decode_buf_ro, (unsigned long)msbc_info->decode_buf_wo); /* Done with parsing the raw bytes just read. If we couldn't find a valid * mSBC frame head, we shall treat the existing BTM_MSBC_PKT_LEN length * of mSBC data as a corrupted packet and conduct the PLC. */ Loading @@ -677,7 +664,6 @@ size_t decode(const uint8_t** out_data) { if (!GetInterfaceToProfiles()->msbcCodec->decodePacket( frame_head, msbc_info->decoded_pcm_buf, sizeof(msbc_info->decoded_pcm_buf))) { LOG_DEBUG("Decoding mSBC packet failed"); goto packet_loss; } Loading Loading @@ -708,16 +694,11 @@ size_t encode(int16_t* data, size_t len) { } if (len < BTM_MSBC_CODE_SIZE) { LOG_DEBUG( "PCM frames with size %lu is insufficient to be encoded into a mSBC " "packet", (unsigned long)len); return 0; } pkt_body = msbc_info->fill_msbc_pkt_template(); if (pkt_body == nullptr) { LOG_DEBUG("Failed to fill the template to fill the mSBC packet"); return 0; } Loading Loading @@ -925,11 +906,6 @@ struct tBTM_LC3_INFO { } size_t mark_pkt_dequeued() { LOG_DEBUG( "Try to mark an encoded packet dequeued: ro:%lu wo:%lu pkt_size:%lu", (unsigned long)encode_buf_ro, (unsigned long)encode_buf_wo, (unsigned long)packet_size); if (encode_buf_wo - encode_buf_ro < packet_size) return 0; encode_buf_ro += packet_size; Loading @@ -943,7 +919,6 @@ struct tBTM_LC3_INFO { const uint8_t* sco_pkt_read_ptr() { if (encode_buf_wo - encode_buf_ro < packet_size) { LOG_DEBUG("Insufficient data as a SCO packet to read."); return nullptr; } Loading