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

Commit f61559e5 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Automerger Merge Worker
Browse files

leaudio: Extract helper function to print audio configuration am: ca6a502c am: aaffae65

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

Change-Id: Ie049b6ac0e38e07efe7213ad3b827c9b4368b30a
parents 02400729 aaffae65
Loading
Loading
Loading
Loading
+25 −18
Original line number Diff line number Diff line
@@ -2223,30 +2223,37 @@ class LeAudioClientImpl : public LeAudioClient {
    ClientAudioIntefraceRelease();
  }

  void printCurrentStreamConfiguration(int fd) {
  void printSingleConfiguration(int fd, LeAudioCodecConfiguration* conf,
                                bool print_audio_state, bool sender = false) {
    std::stringstream stream;
    auto conf = &current_source_codec_config;
    if (print_audio_state) {
      if (sender) {
        stream << "   audio sender state: " << audio_sender_state_ << "\n";
      } else {
        stream << "   audio receiver state: " << audio_receiver_state_ << "\n";
      }
    }

    stream << "   num_channels: " << +conf->num_channels << "\n"
           << "   sample rate: " << +conf->sample_rate << "\n"
           << "   bits pers sample: " << +conf->bits_per_sample << "\n"
           << "   data_interval_us: " << +conf->data_interval_us << "\n";

    dprintf(fd, "%s", stream.str().c_str());
  }

    stream << " Speaker codec config "
           << "\n";
  void printCurrentStreamConfiguration(int fd) {
    auto conf = &current_source_codec_config;
    dprintf(fd, " Speaker codec config \n");
    if (conf) {
      stream << "   audio sender state: " << audio_sender_state_ << "\n"
             << "   num_channels " << +conf->num_channels << "\n"
             << "   sample rate " << +conf->sample_rate << "\n"
             << "   bits pers sample " << +conf->bits_per_sample << "\n"
             << "   data_interval_us " << +conf->data_interval_us << "\n";
    }
    stream << " Microphone codec config"
           << "\n";
      printSingleConfiguration(fd, conf, false);
    }

    dprintf(fd, " Microphone codec config \n");
    conf = &current_sink_codec_config;
    if (conf) {
      stream << "   audio receiver state: " << audio_receiver_state_ << "\n"
             << "   num_channels " << +conf->num_channels << "\n"
             << "   sample rate " << +conf->sample_rate << "\n"
             << "   bits pers sample " << +conf->bits_per_sample << "\n"
             << "   data_interval_us " << +conf->data_interval_us << "\n";
      printSingleConfiguration(fd, conf, true, false);
    }
    dprintf(fd, "%s", stream.str().c_str());
  }

  void Dump(int fd) {