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

Commit 9e53b50f authored by Qasim Javed's avatar Qasim Javed
Browse files

Disable OPUS codec when using A2DP HIDL HAL.

On bramble and likely other phones that use A2DP HIDL HAL, when
connected to Pixel Buds Pro, we try to select the OPUS codec as it is
the preferred codec for Pixel Buds Pro. However, since OPUS support was
added to Android after A2DP HIDL HAL freeze, we get an error from the
HIDL HAL.

While initializing codecs, check if we are using the A2DP HIDL HAL and
disable OPUS codec if that is true.

Bug: 254231581
Tag: #refactor
Test: Manually tested using barbet which also has using the A2DP HIDL
HAL
Ignore-AOSP-First: OPUS codec support does not exist on AOSP yet

Change-Id: I1bf9d7a6121d6d6d13098ee38bebb363e444ebaf
parent 616d44b4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -145,6 +145,16 @@ void set_audio_low_latency_mode_allowed(bool allowed) {
  }
}

// Check if OPUS codec is supported
bool is_opus_supported() {
  // OPUS codec was added after HIDL HAL was frozen
  if (HalVersionManager::GetHalTransport() ==
      BluetoothAudioHalTransport::AIDL) {
    return true;
  }
  return false;
}

}  // namespace a2dp
}  // namespace audio
}  // namespace bluetooth
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ size_t read(uint8_t* p_buf, uint32_t len);
// Update A2DP delay report to BluetoothAudio HAL
void set_remote_delay(uint16_t delay_report);

// Check whether OPUS is supported
bool is_opus_supported();

}  // namespace a2dp
}  // namespace audio
}  // namespace bluetooth
+3 −0
Original line number Diff line number Diff line
@@ -272,6 +272,9 @@ size_t read(uint8_t* p_buf, uint32_t len) {
  return bytes_read;
}

// Check if OPUS codec is supported
bool is_opus_supported() { return true; }

}  // namespace a2dp
}  // namespace audio
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ struct PresentationPosition {
// Invoked by audio server to check audio presentation position periodically.
PresentationPosition GetPresentationPosition();

bool is_opus_supported();

}  // namespace a2dp
}  // namespace audio
}  // namespace bluetooth
+3 −0
Original line number Diff line number Diff line
@@ -618,6 +618,9 @@ cc_test {
        "fluoride_defaults",
        "mts_defaults",
    ],
    cflags: [
        "-DUNIT_TESTS",
    ],
    test_suites: ["device-tests"],
    host_supported: true,
    test_options: {
Loading