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

Commit 5cde687f authored by Chen Chen's avatar Chen Chen Committed by Gerrit Code Review
Browse files

Merge "SpatialAudio: Set low latency allowed signal at startSession The logic...

Merge "SpatialAudio: Set low latency allowed signal at startSession The logic is that to send FREE and LOW_LATENCY to audio at startSession, if bt receives setLowLatencyModeAllowed(true) before start session. If the parameter false, or bt doesn't receive the signal at all, then bt sends FREE to audio."
parents 0f7d4191 c92270e1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ package android.hardware.bluetooth.audio;
@VintfStability
interface IBluetoothAudioProvider {
  void endSession();
  android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
  android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig, in android.hardware.bluetooth.audio.LatencyMode[] supportedLatencyModes);
  void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
  void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status);
  void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
+5 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.bluetooth.audio;
import android.hardware.bluetooth.audio.AudioConfiguration;
import android.hardware.bluetooth.audio.BluetoothAudioStatus;
import android.hardware.bluetooth.audio.IBluetoothAudioPort;
import android.hardware.bluetooth.audio.LatencyMode;
import android.hardware.common.fmq.MQDescriptor;
import android.hardware.common.fmq.SynchronizedReadWrite;

@@ -50,6 +51,8 @@ interface IBluetoothAudioProvider {
     *    device. The PCM parameters are set if software based encoding,
     *    otherwise the correct codec configuration is used for hardware
     *    encoding.
     * @param supportedLatencyModes latency modes supported by the active
     * remote device
     *
     * @return The fast message queue for audio data from/to this
     *    provider. Audio data will be in PCM format as specified by the
@@ -57,8 +60,8 @@ interface IBluetoothAudioProvider {
     *    from/to hardware or on failure
     */
    MQDescriptor<byte, SynchronizedReadWrite> startSession(
            in IBluetoothAudioPort hostIf, in AudioConfiguration audioConfig);

            in IBluetoothAudioPort hostIf, in AudioConfiguration audioConfig,
            in LatencyMode[] supportedLatencyModes);
    /**
     * Callback for IBluetoothAudioPort.startStream()
     *
+6 −3
Original line number Diff line number Diff line
@@ -38,7 +38,10 @@ bool A2dpOffloadAudioProvider::isValid(const SessionType& session_type) {

ndk::ScopedAStatus A2dpOffloadAudioProvider::startSession(
    const std::shared_ptr<IBluetoothAudioPort>& host_if,
    const AudioConfiguration& audio_config, DataMQDesc* _aidl_return) {
    const AudioConfiguration& audio_config,
    const std::vector<LatencyMode>& latency_modes,
    DataMQDesc* _aidl_return) {
  latency_modes_ = latency_modes;
  if (audio_config.getTag() != AudioConfiguration::a2dpConfig) {
    LOG(WARNING) << __func__ << " - Invalid Audio Configuration="
                 << audio_config.toString();
@@ -52,8 +55,8 @@ ndk::ScopedAStatus A2dpOffloadAudioProvider::startSession(
    *_aidl_return = DataMQDesc();
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
  }
  return BluetoothAudioProvider::startSession(host_if, audio_config,
                                              _aidl_return);
  return BluetoothAudioProvider::startSession(
      host_if, audio_config, latency_modes, _aidl_return);
}

ndk::ScopedAStatus A2dpOffloadAudioProvider::onSessionReady(
+3 −1
Original line number Diff line number Diff line
@@ -32,7 +32,9 @@ class A2dpOffloadAudioProvider : public BluetoothAudioProvider {

  ndk::ScopedAStatus startSession(
      const std::shared_ptr<IBluetoothAudioPort>& host_if,
      const AudioConfiguration& audio_config, DataMQDesc* _aidl_return);
      const AudioConfiguration& audio_config,
      const std::vector<LatencyMode>& latency_modes,
      DataMQDesc* _aidl_return);

 private:
  ndk::ScopedAStatus onSessionReady(DataMQDesc* _aidl_return) override;
+6 −3
Original line number Diff line number Diff line
@@ -61,7 +61,10 @@ bool A2dpSoftwareAudioProvider::isValid(const SessionType& sessionType) {

ndk::ScopedAStatus A2dpSoftwareAudioProvider::startSession(
    const std::shared_ptr<IBluetoothAudioPort>& host_if,
    const AudioConfiguration& audio_config, DataMQDesc* _aidl_return) {
    const AudioConfiguration& audio_config,
    const std::vector<LatencyMode>& latency_modes,
    DataMQDesc* _aidl_return) {
  latency_modes_ = latency_modes;
  if (audio_config.getTag() != AudioConfiguration::pcmConfig) {
    LOG(WARNING) << __func__ << " - Invalid Audio Configuration="
                 << audio_config.toString();
@@ -77,8 +80,8 @@ ndk::ScopedAStatus A2dpSoftwareAudioProvider::startSession(
    return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
  }

  return BluetoothAudioProvider::startSession(host_if, audio_config,
                                              _aidl_return);
  return BluetoothAudioProvider::startSession(
      host_if, audio_config, latency_modes, _aidl_return);
}

ndk::ScopedAStatus A2dpSoftwareAudioProvider::onSessionReady(
Loading