Include the returned IAudio{Track,Record} in response parcelable
In preparation to AIDLizing IAudioFlinger, having two return values is
inconvenient. It is also not consistent with most other methods, which
mostly return status_t. This change puts the returned
IAudio{Track,Record} in the response parcelable instead of having them
as separate return values.
Test: Audio-related CTS tests from CtsMediaTestCases
Change-Id: I97cbec21ca936b4e00e5caa06760ce00922739e8
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 67938bc..8c53c5b 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -1608,9 +1608,7 @@
input.opPackageName = mOpPackageName;
media::CreateTrackResponse response;
- sp<media::IAudioTrack> track = audioFlinger->createTrack(VALUE_OR_FATAL(input.toAidl()),
- response,
- &status);
+ status = audioFlinger->createTrack(VALUE_OR_FATAL(input.toAidl()), response);
IAudioFlinger::CreateTrackOutput output = VALUE_OR_FATAL(
IAudioFlinger::CreateTrackOutput::fromAidl(
response));
@@ -1623,7 +1621,7 @@
}
goto exit;
}
- ALOG_ASSERT(track != 0);
+ ALOG_ASSERT(output.audioTrack != 0);
mFrameCount = output.frameCount;
mNotificationFramesAct = (uint32_t)output.notificationFrameCount;
@@ -1646,7 +1644,7 @@
// FIXME compare to AudioRecord
std::optional<media::SharedFileRegion> sfr;
- track->getCblk(&sfr);
+ output.audioTrack->getCblk(&sfr);
sp<IMemory> iMem = VALUE_OR_FATAL(aidl2legacy_NullableSharedFileRegion_IMemory(sfr));
if (iMem == 0) {
ALOGE("%s(%d): Could not get control block", __func__, mPortId);
@@ -1668,7 +1666,7 @@
IInterface::asBinder(mAudioTrack)->unlinkToDeath(mDeathNotifier, this);
mDeathNotifier.clear();
}
- mAudioTrack = track;
+ mAudioTrack = output.audioTrack;
mCblkMemory = iMem;
IPCThreadState::self()->flushCommands();