mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Spatial Audio: Add setLatencyMode and setCodecType API with empty
implementation Bug: 216832331 Test: build Tag: #feature Change-Id: I0ccfee39d1f86da81b50f0757de87b6645baacf8
This commit is contained in:
@@ -40,4 +40,6 @@ interface IBluetoothAudioPort {
|
||||
void suspendStream();
|
||||
void updateSourceMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata);
|
||||
void updateSinkMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata);
|
||||
void setLatencyMode(in android.hardware.bluetooth.audio.LatencyMode latencyMode);
|
||||
void setCodecType(in android.hardware.bluetooth.audio.CodecType codecType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.bluetooth.audio;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum LatencyMode {
|
||||
UNKNOWN = 0,
|
||||
LOW_LATENCY = 1,
|
||||
FREE = 2,
|
||||
}
|
||||
@@ -18,6 +18,8 @@ package android.hardware.bluetooth.audio;
|
||||
|
||||
import android.hardware.audio.common.SinkMetadata;
|
||||
import android.hardware.audio.common.SourceMetadata;
|
||||
import android.hardware.bluetooth.audio.CodecType;
|
||||
import android.hardware.bluetooth.audio.LatencyMode;
|
||||
import android.hardware.bluetooth.audio.PresentationPosition;
|
||||
|
||||
/**
|
||||
@@ -78,4 +80,18 @@ interface IBluetoothAudioPort {
|
||||
* @param sinkMetadata as passed from Audio Framework
|
||||
*/
|
||||
void updateSinkMetadata(in SinkMetadata sinkMetadata);
|
||||
|
||||
/**
|
||||
* Called when latency mode is changed.
|
||||
*
|
||||
* @param latencyMode latency mode from audio
|
||||
*/
|
||||
void setLatencyMode(in LatencyMode latencyMode);
|
||||
|
||||
/**
|
||||
* Called when codec type is changed.
|
||||
*
|
||||
* @param codecType codec type from audio
|
||||
*/
|
||||
void setCodecType(in CodecType codecType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.bluetooth.audio;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="int")
|
||||
enum LatencyMode {
|
||||
UNKNOWN,
|
||||
LOW_LATENCY,
|
||||
FREE,
|
||||
}
|
||||
@@ -508,6 +508,36 @@ void BluetoothAudioSession::UpdateSinkMetadata(
|
||||
}
|
||||
}
|
||||
|
||||
void BluetoothAudioSession::SetLatencyMode(LatencyMode latency_mode) {
|
||||
std::lock_guard<std::recursive_mutex> guard(mutex_);
|
||||
if (!IsSessionReady()) {
|
||||
LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
|
||||
<< " has NO session";
|
||||
return;
|
||||
}
|
||||
|
||||
auto hal_retval = stack_iface_->setLatencyMode(latency_mode);
|
||||
if (!hal_retval.isOk()) {
|
||||
LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
|
||||
<< toString(session_type_) << " failed";
|
||||
}
|
||||
}
|
||||
|
||||
void BluetoothAudioSession::SetCodecType(CodecType codec_type) {
|
||||
std::lock_guard<std::recursive_mutex> guard(mutex_);
|
||||
if (!IsSessionReady()) {
|
||||
LOG(DEBUG) << __func__ << " - SessionType=" << toString(session_type_)
|
||||
<< " has NO session";
|
||||
return;
|
||||
}
|
||||
|
||||
auto hal_retval = stack_iface_->setCodecType(codec_type);
|
||||
if (!hal_retval.isOk()) {
|
||||
LOG(WARNING) << __func__ << " - IBluetoothAudioPort SessionType="
|
||||
<< toString(session_type_) << " failed";
|
||||
}
|
||||
}
|
||||
|
||||
bool BluetoothAudioSession::IsAidlAvailable() {
|
||||
if (is_aidl_checked) return is_aidl_available;
|
||||
is_aidl_available =
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <aidl/android/hardware/audio/common/SourceMetadata.h>
|
||||
#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.h>
|
||||
#include <aidl/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.h>
|
||||
#include <aidl/android/hardware/bluetooth/audio/LatencyMode.h>
|
||||
#include <aidl/android/hardware/bluetooth/audio/SessionType.h>
|
||||
#include <fmq/AidlMessageQueue.h>
|
||||
#include <hardware/audio.h>
|
||||
@@ -164,6 +165,8 @@ class BluetoothAudioSession {
|
||||
bool GetPresentationPosition(PresentationPosition& presentation_position);
|
||||
void UpdateSourceMetadata(const struct source_metadata& source_metadata);
|
||||
void UpdateSinkMetadata(const struct sink_metadata& sink_metadata);
|
||||
void SetLatencyMode(LatencyMode latency_mode);
|
||||
void SetCodecType(CodecType codec_type);
|
||||
|
||||
// The control function writes stream to FMQ
|
||||
size_t OutWritePcmData(const void* buffer, size_t bytes);
|
||||
|
||||
Reference in New Issue
Block a user