Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 1 | /* |
| 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 Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 17 | #define LOG_TAG "AAudioStreamRequest" |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 18 | //#define LOG_NDEBUG 0 |
| 19 | #include <utils/Log.h> |
| 20 | |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 21 | #include <stdint.h> |
| 22 | |
| 23 | #include <sys/mman.h> |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 24 | |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 25 | #include <aaudio/AAudio.h> |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 26 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 27 | #include "binding/AAudioStreamConfiguration.h" |
| 28 | #include "binding/AAudioStreamRequest.h" |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 29 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 30 | using namespace aaudio; |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 31 | |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 32 | AAudioStreamRequest::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 Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 40 | } |
| 41 | |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 42 | StreamRequest 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 Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 52 | aaudio_result_t AAudioStreamRequest::validate() const { |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 53 | return mConfiguration.validate(); |
| 54 | } |
| 55 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 56 | void AAudioStreamRequest::dump() const { |
Phil Burk | fbf031e | 2017-10-12 15:58:31 -0700 | [diff] [blame] | 57 | ALOGD("mUserId = %d", mUserId); |
| 58 | ALOGD("mProcessId = %d", mProcessId); |
| 59 | ALOGD("mSharingModeMatchRequired = %d", mSharingModeMatchRequired); |
| 60 | ALOGD("mInService = %d", mInService); |
Phil Burk | 204a163 | 2017-01-03 17:23:43 -0800 | [diff] [blame] | 61 | mConfiguration.dump(); |
| 62 | } |