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

Commit f639b397 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "leaudio: set user configured codec_frames_blocks_per_sdu" am: 0dc7b9cc

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1989868

Change-Id: Ieff8c64fd4cee89749e210cbd6ae092c2a4b1073
parents 906493e4 0dc7b9cc
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ struct AudioSetConfigurationProviderJson {
    uint8_t frame_duration = 0;
    uint32_t audio_channel_allocation = 0;
    uint16_t octets_per_codec_frame = 0;
    uint8_t codec_frames_blocks_per_sdu = 0;

    auto param = LookupCodecSpecificParam(
        flat_codec_specific_params,
@@ -173,10 +174,23 @@ struct AudioSetConfigurationProviderJson {
      STREAM_TO_UINT16(octets_per_codec_frame, ptr);
    }

    param = LookupCodecSpecificParam(
        flat_codec_specific_params,
        bluetooth::le_audio::
            CodecSpecificLtvGenericTypes_SUPPORTED_CODEC_FRAME_BLOCKS_PER_SDU);
    if (param) {
      ASSERT_LOG((param->compound_value()->value()->size() == 1),
                 " Invalid compound value length %d",
                 param->compound_value()->value()->size());
      auto ptr = param->compound_value()->value()->data();
      STREAM_TO_UINT8(codec_frames_blocks_per_sdu, ptr);
    }

    codec.config = types::LeAudioLc3Config({
        .sampling_frequency = sampling_frequency,
        .frame_duration = frame_duration,
        .octets_per_codec_frame = octets_per_codec_frame,
        .codec_frames_blocks_per_sdu = codec_frames_blocks_per_sdu,
        .channel_count =
            (uint8_t)std::bitset<32>(audio_channel_allocation).count(),
        .audio_channel_allocation = audio_channel_allocation,