blob: 536395a8b313d0843abc12e40cd110f2b536990f [file] [log] [blame]
Phil Burk204a1632017-01-03 17:23:43 -08001/*
2 * Copyright 2016 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
Phil Burkfbf031e2017-10-12 15:58:31 -070017#define LOG_TAG "AAudioStreamRequest"
Phil Burkc0c70e32017-02-09 13:18:38 -080018//#define LOG_NDEBUG 0
19#include <utils/Log.h>
20
Phil Burk204a1632017-01-03 17:23:43 -080021#include <stdint.h>
22
23#include <sys/mman.h>
Phil Burk204a1632017-01-03 17:23:43 -080024
Phil Burka4eb0d82017-04-12 15:44:06 -070025#include <aaudio/AAudio.h>
Phil Burk204a1632017-01-03 17:23:43 -080026
Phil Burk5ed503c2017-02-01 09:38:15 -080027#include "binding/AAudioStreamConfiguration.h"
28#include "binding/AAudioStreamRequest.h"
Phil Burk204a1632017-01-03 17:23:43 -080029
Phil Burk5ed503c2017-02-01 09:38:15 -080030using namespace aaudio;
Phil Burk204a1632017-01-03 17:23:43 -080031
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070032AAudioStreamRequest::AAudioStreamRequest(const StreamRequest& parcelable) :
33 mConfiguration(std::move(parcelable.params)),
34 mUserId(parcelable.userId),
35 mProcessId(parcelable.processId),
36 mSharingModeMatchRequired(parcelable.sharingModeMatchRequired),
37 mInService(parcelable.inService) {
38 static_assert(sizeof(mUserId) == sizeof(parcelable.userId));
39 static_assert(sizeof(mProcessId) == sizeof(parcelable.processId));
Phil Burk204a1632017-01-03 17:23:43 -080040}
41
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070042StreamRequest AAudioStreamRequest::parcelable() const {
43 StreamRequest result;
44 result.params = std::move(mConfiguration).parcelable();
45 result.userId = mUserId;
46 result.processId = mProcessId;
47 result.sharingModeMatchRequired = mSharingModeMatchRequired;
48 result.inService = mInService;
49 return result;
Phil Burk204a1632017-01-03 17:23:43 -080050}
51
Phil Burkc0c70e32017-02-09 13:18:38 -080052aaudio_result_t AAudioStreamRequest::validate() const {
Phil Burk204a1632017-01-03 17:23:43 -080053 return mConfiguration.validate();
54}
55
Phil Burkc0c70e32017-02-09 13:18:38 -080056void AAudioStreamRequest::dump() const {
Phil Burkfbf031e2017-10-12 15:58:31 -070057 ALOGD("mUserId = %d", mUserId);
58 ALOGD("mProcessId = %d", mProcessId);
59 ALOGD("mSharingModeMatchRequired = %d", mSharingModeMatchRequired);
60 ALOGD("mInService = %d", mInService);
Phil Burk204a1632017-01-03 17:23:43 -080061 mConfiguration.dump();
62}