mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
audio: Move StreamContext ownership out from StreamCommonImpl
Upcoming implementations of the streams of the primary module will need to change the underlying stream type depending on the current connected device. The stream context must persist, thus its life time must be bound to the IStreamIn/Out implementation. Move the StreamContext instance under ownership of StreamIn/Out. Add StreamCommonImpl::onClose so that the owner of the context may know when it is safe to reset it. Re-arrange the order of the arguments when creating a stream so that the context always comes first. Bug: 264712385 Test: atest VtsHalAudioCoreTargetTest Change-Id: Iaf13d4bc3a53cbfc27264d3abd1f6c417ece3941
This commit is contained in:
@@ -68,22 +68,22 @@ ndk::ScopedAStatus ModuleUsb::setMicMute(bool in_mute __unused) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ModuleUsb::createInputStream(const SinkMetadata& sinkMetadata,
|
||||
StreamContext&& context,
|
||||
ndk::ScopedAStatus ModuleUsb::createInputStream(StreamContext&& context,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
const std::vector<MicrophoneInfo>& microphones,
|
||||
std::shared_ptr<StreamIn>* result) {
|
||||
return createStreamInstance<StreamInUsb>(result, sinkMetadata, std::move(context), microphones);
|
||||
return createStreamInstance<StreamInUsb>(result, std::move(context), sinkMetadata, microphones);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ModuleUsb::createOutputStream(const SourceMetadata& sourceMetadata,
|
||||
StreamContext&& context,
|
||||
ndk::ScopedAStatus ModuleUsb::createOutputStream(StreamContext&& context,
|
||||
const SourceMetadata& sourceMetadata,
|
||||
const std::optional<AudioOffloadInfo>& offloadInfo,
|
||||
std::shared_ptr<StreamOut>* result) {
|
||||
if (offloadInfo.has_value()) {
|
||||
LOG(ERROR) << __func__ << ": offload is not supported";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
return createStreamInstance<StreamOutUsb>(result, sourceMetadata, std::move(context),
|
||||
return createStreamInstance<StreamOutUsb>(result, std::move(context), sourceMetadata,
|
||||
offloadInfo);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user