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

Commit 6afd0d3a authored by Hans Månsson's avatar Hans Månsson Committed by John Eckerdal
Browse files

audio_hal/aidl: Don't fallback to SW encoding when HW is supported

The following commit:

 29d38ad3 Add support for Opus in BT Audio HAL

Added
BTAV_A2DP_CODEC_INDEX_SOURCE_LC3
BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS
BTAV_A2DP_CODEC_INDEX_SINK_OPUS
to the available codecs.

This causes UpdateOffloadingCapabilities to return early with failure
when handling BTAV_A2DP_CODEC_INDEX_SOURCE_LC3 which casues fallback
to SW encoding even when other codecs than lc3 is available for HW
offloading. Also add case for BTAV_A2DP_CODEC_INDEX_SINK_OPUS for
completeness.

The following can be observed in the log:
[ERROR:codec_status_aidl.cc(558)] UpdateOffloadingCapabilities: Unknown codec_type=5

Test: See issue
Bug: 266208838
Change-Id: I7b145a6f74a3540ca2083630afb97fcc154c841d
parent 069a7c41
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -541,6 +541,11 @@ bool UpdateOffloadingCapabilities(
      case BTAV_A2DP_CODEC_INDEX_SOURCE_LDAC:
        codec_type_set.insert(CodecType::LDAC);
        break;
      case BTAV_A2DP_CODEC_INDEX_SOURCE_LC3:
        LOG(WARNING) << __func__
                     << ": Ignore source codec_type=" << preference.codec_type
                     << ", not implemented";
        break;
      case BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS:
        codec_type_set.insert(CodecType::OPUS);
        break;
@@ -549,6 +554,8 @@ bool UpdateOffloadingCapabilities(
      case BTAV_A2DP_CODEC_INDEX_SINK_AAC:
        [[fallthrough]];
      case BTAV_A2DP_CODEC_INDEX_SINK_LDAC:
        [[fallthrough]];
      case BTAV_A2DP_CODEC_INDEX_SINK_OPUS:
        LOG(WARNING) << __func__
                     << ": Ignore sink codec_type=" << preference.codec_type;
        break;