Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 779f95cf authored by Jeremy Wu's avatar Jeremy Wu Committed by Gerrit Code Review
Browse files

Merge "Floss: rework |codec_type| associated with SCO" into main

parents b8bbc7e9 6675b0de
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -410,9 +410,10 @@ class JniHeadsetCallbacks : bluetooth::headset::Callbacks {
                                 signal, battery, addr.get());
  }

  void DebugDumpCallback(bool active, bool wbs, int total_num_decoded_frames,
                         double pkt_loss_ratio, uint64_t begin_ts,
                         uint64_t end_ts, const char* pkt_status_in_hex,
  void DebugDumpCallback(bool active, uint16_t codec_id,
                         int total_num_decoded_frames, double pkt_loss_ratio,
                         uint64_t begin_ts, uint64_t end_ts,
                         const char* pkt_status_in_hex,
                         const char* pkt_status_in_binary) override {
    ALOGE("Not implemented and shouldn't be called");
  }
+5 −5
Original line number Diff line number Diff line
@@ -1583,12 +1583,12 @@ bt_status_t HeadsetInterface::DebugDump() {
  CHECK_BTHF_INIT();
  tBTM_SCO_DEBUG_DUMP debug_dump = BTM_GetScoDebugDump();
  bt_hf_callbacks->DebugDumpCallback(
      debug_dump.is_active, debug_dump.is_wbs,
      debug_dump.is_active, debug_dump.codec_id,
      debug_dump.total_num_decoded_frames, debug_dump.pkt_loss_ratio,
      debug_dump.latest_msbc_data.begin_ts_raw_us,
      debug_dump.latest_msbc_data.end_ts_raw_us,
      debug_dump.latest_msbc_data.status_in_hex.c_str(),
      debug_dump.latest_msbc_data.status_in_binary.c_str());
      debug_dump.latest_data.begin_ts_raw_us,
      debug_dump.latest_data.end_ts_raw_us,
      debug_dump.latest_data.status_in_hex.c_str(),
      debug_dump.latest_data.status_in_binary.c_str());
  return BT_STATUS_SUCCESS;
}

+2 −2
Original line number Diff line number Diff line
@@ -127,13 +127,13 @@ void LogMetricA2dpPlaybackEvent(const hci::Address& address, int playback_state,
 * @param address HFP device associated with this stats
 * @param num_decoded_frames number of decoded frames
 * @param packet_loss_ratio ratio of packet loss frames
 * @param codec_type codec type of the packet (mSBC=2, LC3=3)
 * @param codec_id codec ID of the packet (mSBC=2, LC3=3)
 */
void LogMetricHfpPacketLossStats(
    const hci::Address& address,
    int num_decoded_frames,
    double packet_loss_ratio,
    uint16_t codec_type);
    uint16_t codec_id);

/**
 * Log read RSSI result
+18 −9
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use crate::ClientContext;
use crate::{console_red, console_yellow, print_error, print_info};
use bt_topshim::btif::{BtBondState, BtPropertyType, BtSspVariant, BtStatus, Uuid128Bit};
use bt_topshim::profiles::gatt::{AdvertisingStatus, GattStatus, LePhy};
use bt_topshim::profiles::hfp::HfpCodecId;
use bt_topshim::profiles::sdp::BtSdpRecord;
use btstack::bluetooth::{
    BluetoothDevice, IBluetooth, IBluetoothCallback, IBluetoothConnectionCallback,
@@ -1345,7 +1346,7 @@ impl IBluetoothMediaCallback for MediaCallback {
    fn on_hfp_debug_dump(
        &mut self,
        active: bool,
        wbs: bool,
        codec_id: u16,
        total_num_decoded_frames: i32,
        pkt_loss_ratio: f64,
        begin_ts: u64,
@@ -1356,7 +1357,9 @@ impl IBluetoothMediaCallback for MediaCallback {
        // Invoke run_callback so that the callback can be handled through
        // ForegroundActions::RunCallback in main.rs.
        self.context.lock().unwrap().run_callback(Box::new(move |_context| {
            let wbs_dump = if active && wbs {
            let is_wbs = codec_id == HfpCodecId::MSBC as u16;
            let is_swb = codec_id == HfpCodecId::LC3 as u16;
            let dump = if active && (is_wbs || is_swb) {
                let mut to_split_binary = pkt_status_in_binary.clone();
                let mut wrapped_binary = String::new();
                while to_split_binary.len() > BINARY_PACKET_STATUS_WRAP {
@@ -1366,9 +1369,8 @@ impl IBluetoothMediaCallback for MediaCallback {
                    to_split_binary = remaining;
                }
                wrapped_binary.push_str(&to_split_binary);

                format!(
                    "\n--------WBS packet loss--------\n\
                    "\n--------{} packet loss--------\n\
                       Decoded Packets: {}, Packet Loss Ratio: {} \n\
                       {} [begin]\n\
                       {} [end]\n\
@@ -1376,6 +1378,7 @@ impl IBluetoothMediaCallback for MediaCallback {
                       {}\n\
                       In binary format:\n\
                       {}",
                    if is_wbs { "WBS" } else { "SWB" },
                    total_num_decoded_frames,
                    pkt_loss_ratio,
                    timestamp_to_string(begin_ts),
@@ -1393,8 +1396,14 @@ impl IBluetoothMediaCallback for MediaCallback {
                     {}
                     ",
                if active { "active" } else { "inactive" },
                if wbs { "mSBC" } else { "CVSD" },
                wbs_dump
                if is_wbs {
                    "mSBC"
                } else if is_swb {
                    "LC3"
                } else {
                    "CVSD"
                },
                dump
            );
        }));
    }
+1 −1
Original line number Diff line number Diff line
@@ -2636,7 +2636,7 @@ impl IBluetoothMediaCallback for IBluetoothMediaCallbackDBus {
    fn on_hfp_debug_dump(
        &mut self,
        active: bool,
        wbs: bool,
        codec_id: u16,
        total_num_decoded_frames: i32,
        pkt_loss_ratio: f64,
        begin_ts: u64,
Loading