aaudio: fix problems with PlayerBase and ref counting
CTS test was crashing because of a multiple inheritance
problem involving PlayerBase.
We now implement separate PlayerBase class that sits between
AudioStream and the system.
Bug: 65450109
Test: CTS nativemedia/aaudio
Change-Id: I424663acc1eeacc9544769991495cb48f4110359
diff --git a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
index f2e40a2..1e02eee 100644
--- a/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
+++ b/media/libaaudio/src/client/AudioStreamInternalPlay.cpp
@@ -49,7 +49,7 @@
mClockModel.stop(AudioClock::getNanoseconds());
setState(AAUDIO_STREAM_STATE_PAUSING);
mAtomicTimestamp.clear();
- return AAudioConvert_androidToAAudioResult(pauseWithStatus());
+ return mServiceInterface.pauseStream(mServiceStreamHandle);
}
aaudio_result_t AudioStreamInternalPlay::requestPause()
@@ -290,7 +290,6 @@
return framesWritten;
}
-
int64_t AudioStreamInternalPlay::getFramesRead()
{
int64_t framesReadHardware;
@@ -364,3 +363,10 @@
result, (int) isActive());
return NULL;
}
+
+//------------------------------------------------------------------------------
+// Implementation of PlayerBase
+status_t AudioStreamInternalPlay::doSetVolume() {
+ mVolumeRamp.setTarget(mStreamVolume * getDuckAndMuteVolume());
+ return android::NO_ERROR;
+}