1 /*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <cmath>
18
19 #define LOG_TAG "AHAL_Stream"
20 #include <android-base/logging.h>
21 #include <audio_utils/clock.h>
22
23 #include "core-impl/Module.h"
24 #include "core-impl/StreamStub.h"
25
26 using aidl::android::hardware::audio::common::SinkMetadata;
27 using aidl::android::hardware::audio::common::SourceMetadata;
28 using aidl::android::media::audio::common::AudioDevice;
29 using aidl::android::media::audio::common::AudioOffloadInfo;
30 using aidl::android::media::audio::common::MicrophoneInfo;
31
32 namespace aidl::android::hardware::audio::core {
33
StreamStub(StreamContext * context,const Metadata & metadata)34 StreamStub::StreamStub(StreamContext* context, const Metadata& metadata)
35 : StreamCommonImpl(context, metadata), DriverStubImpl(getContext()) {}
36
~StreamStub()37 StreamStub::~StreamStub() {
38 cleanupWorker();
39 }
40
StreamInStub(StreamContext && context,const SinkMetadata & sinkMetadata,const std::vector<MicrophoneInfo> & microphones)41 StreamInStub::StreamInStub(StreamContext&& context, const SinkMetadata& sinkMetadata,
42 const std::vector<MicrophoneInfo>& microphones)
43 : StreamIn(std::move(context), microphones), StreamStub(&mContextInstance, sinkMetadata) {}
44
StreamOutStub(StreamContext && context,const SourceMetadata & sourceMetadata,const std::optional<AudioOffloadInfo> & offloadInfo)45 StreamOutStub::StreamOutStub(StreamContext&& context, const SourceMetadata& sourceMetadata,
46 const std::optional<AudioOffloadInfo>& offloadInfo)
47 : StreamOut(std::move(context), offloadInfo), StreamStub(&mContextInstance, sourceMetadata) {}
48
49 } // namespace aidl::android::hardware::audio::core
50