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

Commit 93ab1789 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Fix sending audio data to TWS style earbuds

This fix sending audio to single device which
is having 2 CISes enabled.

Bug: 235264422
Test: test audio stream to TWS style earbuds
Change-Id: I3a93d34476679adff4f5f6d0d003c00e09589372
(cherry picked from commit f85a7c8c)
Merged-In: I3a93d34476679adff4f5f6d0d003c00e09589372
parent 581a7d6c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -2042,7 +2042,7 @@ class LeAudioClientImpl : public LeAudioClient {
    return mono_out;
  }

  void PrepareAndSendToTwoDevices(
  void PrepareAndSendToTwoCises(
      const std::vector<uint8_t>& data,
      struct le_audio::stream_configuration* stream_conf) {
    uint16_t byte_count = stream_conf->sink_octets_per_codec_frame;
@@ -2112,7 +2112,7 @@ class LeAudioClientImpl : public LeAudioClient {
          right_cis_handle, chan_right_enc.data(), chan_right_enc.size());
  }

  void PrepareAndSendToSingleDevice(
  void PrepareAndSendToSingleCis(
      const std::vector<uint8_t>& data,
      struct le_audio::stream_configuration* stream_conf) {
    int num_channels = stream_conf->sink_num_of_channels;
@@ -2295,9 +2295,12 @@ class LeAudioClientImpl : public LeAudioClient {
    }

    if (stream_conf.sink_num_of_devices == 2) {
      PrepareAndSendToTwoDevices(data, &stream_conf);
      PrepareAndSendToTwoCises(data, &stream_conf);
    } else if (stream_conf.sink_streams.size() == 2 ) {
      /* Streaming to one device but 2 CISes */
      PrepareAndSendToTwoCises(data, &stream_conf);
    } else {
      PrepareAndSendToSingleDevice(data, &stream_conf);
      PrepareAndSendToSingleCis(data, &stream_conf);
    }
  }