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

Commit bd4abaed authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Gerrit Code Review
Browse files

Merge "leaudio: Handle double StartStream request from the AudioHal" into main

parents 309f76d0 5e078cbd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -69,6 +69,12 @@ LeAudioTransport::LeAudioTransport(void (*flush)(void),
      start_request_state_(StartRequestState::IDLE){};

BluetoothAudioCtrlAck LeAudioTransport::StartRequest(bool is_low_latency) {
  // Check if operation is pending already
  if (GetStartRequestState() == StartRequestState::PENDING_AFTER_RESUME) {
    LOG_INFO("Start request is already pending. Ignore the request");
    return BluetoothAudioCtrlAck::PENDING;
  }

  SetStartRequestState(StartRequestState::PENDING_BEFORE_RESUME);
  if (stream_cb_.on_resume_(true)) {
    auto expected = StartRequestState::CONFIRMED;
+2 −2
Original line number Diff line number Diff line
@@ -3971,7 +3971,8 @@ class LeAudioClientImpl : public LeAudioClient {
        break;
      case AudioState::READY_TO_START:
        LOG_ERROR(
            " called in wrong state. \n audio_receiver_state: %s \n"
            "called in wrong state, ignoring double start request. \n "
            "audio_receiver_state: %s \n"
            "audio_sender_state: %s \n isPendingConfiguration: %s \n "
            "Reconfiguring to %s",
            ToString(audio_receiver_state_).c_str(),
@@ -3979,7 +3980,6 @@ class LeAudioClientImpl : public LeAudioClient {
            (group->IsPendingConfiguration() ? "true" : "false"),
            ToString(configuration_context_type_).c_str());
        group->PrintDebugState();
        CancelStreamingRequest();
        break;
      case AudioState::READY_TO_RELEASE:
        switch (audio_receiver_state_) {
+8 −2
Original line number Diff line number Diff line
@@ -3770,9 +3770,10 @@ TEST_F(UnicastTest, DoubleResumeFromAF) {
  Mock::VerifyAndClearExpectations(&mock_audio_hal_client_callbacks_);
  Mock::VerifyAndClearExpectations(&mock_le_audio_source_hal_client_);

  LocalAudioSourceResume(false, true);
  // Additional resume shall be ignored.
  LocalAudioSourceResume(false, false);

  EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(1);
  EXPECT_CALL(mock_state_machine_, StopStream(_)).Times(0);

  do_in_main_thread(
      FROM_HERE,
@@ -3785,6 +3786,11 @@ TEST_F(UnicastTest, DoubleResumeFromAF) {
          group_id, base::Unretained(state_machine_callbacks_)));
  SyncOnMainLoop();
  Mock::VerifyAndClearExpectations(&mock_state_machine_);

  // Verify Data transfer on one audio source cis
  constexpr uint8_t cis_count_out = 1;
  constexpr uint8_t cis_count_in = 0;
  TestAudioDataTransfer(group_id, cis_count_out, cis_count_in, 1920);
}

TEST_F(UnicastTest, RemoveNodeWhileStreaming) {