Revert "AudioFlinger: Control volume using Port ID"
This reverts commit 55b2a0fdcf59ad7ef9d5c39feafdcfdf49adc72d.
Reason for revert: b/356164780
Change-Id: I8ffa2a3ef93f66379418344ee680b8c624843366
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 83116dc..f5f11cc 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -715,8 +715,7 @@
size_t frameCountToBeReady,
float speed,
bool isSpatialized,
- bool isBitPerfect,
- float volume) {
+ bool isBitPerfect) {
return sp<Track>::make(thread,
client,
streamType,
@@ -737,8 +736,7 @@
frameCountToBeReady,
speed,
isSpatialized,
- isBitPerfect,
- volume);
+ isBitPerfect);
}
// Track constructor must be called with AudioFlinger::mLock and ThreadBase::mLock held
@@ -763,8 +761,7 @@
size_t frameCountToBeReady,
float speed,
bool isSpatialized,
- bool isBitPerfect,
- float volume)
+ bool isBitPerfect)
: TrackBase(thread, client, attr, sampleRate, format, channelMask, frameCount,
// TODO: Using unsecurePointer() has some associated security pitfalls
// (see declaration for details).
@@ -800,8 +797,7 @@
mFlags(flags),
mSpeed(speed),
mIsSpatialized(isSpatialized),
- mIsBitPerfect(isBitPerfect),
- mVolume(volume)
+ mIsBitPerfect(isBitPerfect)
{
// client == 0 implies sharedBuffer == 0
ALOG_ASSERT(!(client == 0 && sharedBuffer != 0));
@@ -846,10 +842,6 @@
mFastIndex = i;
thread->fastTrackAvailMask_l() &= ~(1 << i);
}
- if (attr.usage == AUDIO_USAGE_CALL_ASSISTANT || attr.usage == AUDIO_USAGE_VIRTUAL_SOURCE) {
- // Audio patch and call assistant volume are always max
- mVolume = 1.0f;
- }
mServerLatencySupported = checkServerLatencySupported(format, flags);
#ifdef TEE_SINK
@@ -931,7 +923,7 @@
result.appendFormat("Type Id Active Client Session Port Id S Flags "
" Format Chn mask SRate "
"ST Usg CT "
- " G db L dB R dB VS dB PortVol dB "
+ " G db L dB R dB VS dB "
" Server FrmCnt FrmRdy F Underruns Flushed BitPerfect InternalMute"
"%s\n",
isServerLatencySupported() ? " Latency" : "");
@@ -1017,7 +1009,7 @@
result.appendFormat("%7s %6u %7u %7u %2s 0x%03X "
"%08X %08X %6u "
"%2u %3x %2x "
- "%5.2g %5.2g %5.2g %5.2g%c %11.2g "
+ "%5.2g %5.2g %5.2g %5.2g%c "
"%08X %6zu%c %6zu %c %9u%c %7u %10s %12s",
active ? "yes" : "no",
(mClient == 0) ? getpid() : mClient->pid(),
@@ -1039,7 +1031,6 @@
20.0 * log10(float_from_gain(gain_minifloat_unpack_right(vlr))),
20.0 * log10(vsVolume.first), // VolumeShaper(s) total volume
vsVolume.second ? 'A' : ' ', // if any VolumeShapers active
- 20.0 * log10(mVolume),
mCblk->mServer,
bufferSizeInFrames,
@@ -2200,13 +2191,14 @@
size_t frameCount,
const AttributionSourceState& attributionSource)
: Track(playbackThread, NULL, AUDIO_STREAM_PATCH,
- audio_attributes_t{ .usage = AUDIO_USAGE_VIRTUAL_SOURCE } /* for volume init only */,
+ audio_attributes_t{} /* currently unused for output track */,
sampleRate, format, channelMask, frameCount,
nullptr /* buffer */, (size_t)0 /* bufferSize */, nullptr /* sharedBuffer */,
AUDIO_SESSION_NONE, getpid(), attributionSource, AUDIO_OUTPUT_FLAG_NONE,
TYPE_OUTPUT),
mActive(false), mSourceThread(sourceThread)
{
+
if (mCblk != NULL) {
mOutBuffer.frameCount = 0;
playbackThread->addOutputTrack_l(this);
@@ -3490,8 +3482,7 @@
bool isOut,
const android::content::AttributionSourceState& attributionSource,
pid_t creatorPid,
- audio_port_handle_t portId,
- float volume)
+ audio_port_handle_t portId)
{
return sp<MmapTrack>::make(
thread,
@@ -3503,8 +3494,7 @@
isOut,
attributionSource,
creatorPid,
- portId,
- volume);
+ portId);
}
MmapTrack::MmapTrack(IAfThreadBase* thread,
@@ -3516,8 +3506,7 @@
bool isOut,
const AttributionSourceState& attributionSource,
pid_t creatorPid,
- audio_port_handle_t portId,
- float volume)
+ audio_port_handle_t portId)
: TrackBase(thread, NULL, attr, sampleRate, format,
channelMask, (size_t)0 /* frameCount */,
nullptr /* buffer */, (size_t)0 /* bufferSize */,
@@ -3528,15 +3517,10 @@
TYPE_DEFAULT, portId,
std::string(AMEDIAMETRICS_KEY_PREFIX_AUDIO_MMAP) + std::to_string(portId)),
mPid(VALUE_OR_FATAL(aidl2legacy_int32_t_uid_t(attributionSource.pid))),
- mSilenced(false), mSilencedNotified(false), mVolume(volume)
+ mSilenced(false), mSilencedNotified(false)
{
// Once this item is logged by the server, the client can add properties.
mTrackMetrics.logConstructor(creatorPid, uid(), id());
- if (isOut && (attr.usage == AUDIO_USAGE_CALL_ASSISTANT
- || attr.usage == AUDIO_USAGE_VIRTUAL_SOURCE)) {
- // Audio patch and call assistant volume are always max
- mVolume = 1.0f;
- }
}
MmapTrack::~MmapTrack()
@@ -3615,8 +3599,8 @@
void MmapTrack::appendDumpHeader(String8& result) const
{
- result.appendFormat("Client Session Port Id Format Chn mask SRate Flags %s %s\n",
- isOut() ? "Usg CT": "Source", isOut() ? "PortVol dB" : "");
+ result.appendFormat("Client Session Port Id Format Chn mask SRate Flags %s\n",
+ isOut() ? "Usg CT": "Source");
}
void MmapTrack::appendDump(String8& result, bool active __unused) const
@@ -3631,7 +3615,6 @@
mAttr.flags);
if (isOut()) {
result.appendFormat("%3x %2x", mAttr.usage, mAttr.content_type);
- result.appendFormat("%11.2g", 20.0 * log10(mVolume));
} else {
result.appendFormat("%6x", mAttr.source);
}