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/AudioStreamInternal.h b/media/libaaudio/src/client/AudioStreamInternal.h
index 899d455..47024c0 100644
--- a/media/libaaudio/src/client/AudioStreamInternal.h
+++ b/media/libaaudio/src/client/AudioStreamInternal.h
@@ -18,7 +18,6 @@
#define ANDROID_AAUDIO_AUDIO_STREAM_INTERNAL_H
#include <stdint.h>
-#include <media/PlayerBase.h>
#include <aaudio/AAudio.h>
#include "binding/IAAudioService.h"
@@ -36,7 +35,7 @@
namespace aaudio {
// A stream that talks to the AAudioService or directly to a HAL.
-class AudioStreamInternal : public AudioStream, public android::PlayerBase {
+class AudioStreamInternal : public AudioStream {
public:
AudioStreamInternal(AAudioServiceInterface &serviceInterface, bool inService);
@@ -85,9 +84,6 @@
// Calculate timeout based on framesPerBurst
int64_t calculateReasonableTimeout();
- //PlayerBase virtuals
- virtual void destroy();
-
aaudio_result_t startClient(const android::AudioClient& client,
audio_port_handle_t *clientHandle);
@@ -138,14 +134,6 @@
// Calculate timeout for an operation involving framesPerOperation.
int64_t calculateReasonableTimeout(int32_t framesPerOperation);
- void doSetVolume();
-
- //PlayerBase virtuals
- virtual status_t playerStart();
- virtual status_t playerPause();
- virtual status_t playerStop();
- virtual status_t playerSetVolume();
-
aaudio_format_t mDeviceFormat = AAUDIO_FORMAT_UNSPECIFIED;
IsochronousClockModel mClockModel; // timing model for chasing the HAL
@@ -156,9 +144,6 @@
int32_t mFramesPerBurst; // frames per HAL transfer
int32_t mXRunCount = 0; // how many underrun events?
- LinearRamp mVolumeRamp;
- float mStreamVolume;
-
// Offset from underlying frame position.
int64_t mFramesOffsetFromService = 0; // offset for timestamps
@@ -174,6 +159,8 @@
AtomicRequestor mNeedCatchUp; // Ask read() or write() to sync on first timestamp.
+ float mStreamVolume = 1.0f;
+
private:
/*
* Asynchronous write with data conversion.
@@ -196,7 +183,6 @@
EndpointDescriptor mEndpointDescriptor; // buffer description with resolved addresses
int64_t mServiceLatencyNanos = 0;
-
};
} /* namespace aaudio */