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

Commit 438f4877 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Use new LC3 encoder API

Test: compilation
Bug: 150670922
Change-Id: I38c03ac958b8d2c75206a693cb55ef284dbe5b93
parent 1fdc954d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -1869,9 +1869,9 @@ class LeAudioClientImpl : public LeAudioClient {
    bool mono = (left_cis_handle == 0) || (right_cis_handle == 0);
    if (!mono) {
      lc3_encode(lc3_encoder_left, (const int16_t*)data.data(), 2,
                 chan_left_enc.data(), chan_left_enc.size());
                 chan_left_enc.size(), chan_left_enc.data());
      lc3_encode(lc3_encoder_right, ((const int16_t*)data.data()) + 1, 2,
                 chan_right_enc.data(), chan_right_enc.size());
                 chan_right_enc.size(), chan_right_enc.data());
    } else {
      std::vector<int16_t> chan_left;
      std::vector<int16_t> chan_right;
@@ -1879,12 +1879,12 @@ class LeAudioClientImpl : public LeAudioClient {

      if (left_cis_handle) {
        lc3_encode(lc3_encoder_left, (const int16_t*)chan_left.data(), 1,
                   chan_left_enc.data(), chan_left_enc.size());
                   chan_left_enc.size(), chan_left_enc.data());
      }

      if (right_cis_handle) {
        lc3_encode(lc3_encoder_right, (const int16_t*)chan_right.data(), 1,
                   chan_right_enc.data(), chan_right_enc.size());
                   chan_right_enc.size(), chan_right_enc.data());
      }
    }

@@ -1924,7 +1924,7 @@ class LeAudioClientImpl : public LeAudioClient {
      get_mono_stream(data, chan_mono);

      lc3_encode(lc3_encoder_left, (const int16_t*)chan_mono.data(), 1,
                 chan_encoded.data(), byte_count);
                 byte_count, chan_encoded.data());

    } else {
      std::vector<int16_t> chan_left;
@@ -1932,9 +1932,9 @@ class LeAudioClientImpl : public LeAudioClient {
      get_left_and_right_stream(data, chan_left, chan_right, false);

      lc3_encode(lc3_encoder_left, (const int16_t*)chan_left.data(), 1,
                 chan_encoded.data(), byte_count);
                 byte_count, chan_encoded.data());
      lc3_encode(lc3_encoder_right, (const int16_t*)chan_right.data(), 1,
                 chan_encoded.data() + byte_count, byte_count);
                 byte_count, chan_encoded.data() + byte_count);
    }

    /* Send data to the controller */
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {

  std::vector<uint8_t> output(output_byte_count);
  lc3_encode(lc3_encoder, (const int16_t*)input_frames.data(), 1,
                     output.data(), output.size());
                     output.size(), output.data());

  free(lc3_encoder_mem);
  lc3_encoder_mem = nullptr;