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

Commit beb39b87 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add OPUS support property check."

parents 5346a3bc 7041d24d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -598,6 +598,9 @@ bool A2dpCodecs::init() {
  LOG_INFO("%s", __func__);
  std::lock_guard<std::recursive_mutex> lock(codec_mutex_);

  bool opus_enabled =
      osi_property_get_bool("persist.bluetooth.opus.enabled", false);

  for (int i = BTAV_A2DP_CODEC_INDEX_MIN; i < BTAV_A2DP_CODEC_INDEX_MAX; i++) {
    btav_a2dp_codec_index_t codec_index =
        static_cast<btav_a2dp_codec_index_t>(i);
@@ -610,6 +613,13 @@ bool A2dpCodecs::init() {
      codec_priority = cp_iter->second;
    }

    // If OPUS is not supported it is disabled
    if (codec_index == BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS && !opus_enabled) {
      codec_priority = BTAV_A2DP_CODEC_PRIORITY_DISABLED;
      LOG_INFO("%s: OPUS codec disabled, updated priority to %d", __func__,
               codec_priority);
    }

    A2dpCodecConfig* codec_config =
        A2dpCodecConfig::createCodec(codec_index, codec_priority);
    if (codec_config == nullptr) continue;