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

Commit 6908ee8e authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Automerger Merge Worker
Browse files

Merge "Fix the stereo microphone cache issue" am: 8f665669 am: ae0fc3f5

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

Change-Id: Iaf71b67c13601fdf5e3868bb7f4189aa18661ac3
parents 385035ff ae0fc3f5
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -2134,6 +2134,12 @@ class LeAudioClientImpl : public LeAudioClient {
    }
  }

  void CleanCachedMicrophoneData() {
    cached_channel_data_.clear();
    cached_channel_timestamp_ = 0;
    cached_channel_is_left_ = false;
  }

  void SendAudioData(uint8_t* data, uint16_t size, uint16_t cis_conn_hdl,
                     uint32_t timestamp) {
    /* Get only one channel for MONO microphone */
@@ -2226,9 +2232,9 @@ class LeAudioClientImpl : public LeAudioClient {
                        &pcm_data_decoded, nullptr);
      return;
    }

    /* both devices are connected */
    if (cached_channel_timestamp_ == 0) {

    if (cached_channel_timestamp_ == 0 && cached_channel_data_.empty()) {
      /* First packet received, cache it. We need both channel data to send it
       * to AF. */
      cached_channel_data_ = pcm_data_decoded;
@@ -2252,7 +2258,7 @@ class LeAudioClientImpl : public LeAudioClient {
                            &pcm_data_decoded, &cached_channel_data_);
        }

        cached_channel_timestamp_ = 0;
        CleanCachedMicrophoneData();
        return;
      }

@@ -2416,7 +2422,8 @@ class LeAudioClientImpl : public LeAudioClient {
    uint16_t remote_delay_ms =
        group->GetRemoteDelay(le_audio::types::kLeAudioDirectionSource);

    cached_channel_timestamp_ = 0;
    CleanCachedMicrophoneData();

    if (CodecManager::GetInstance()->GetCodecLocation() ==
        le_audio::types::CodecLocation::HOST) {
      if (lc3_decoder_left_mem) {