From 4b3a49e3a9ced6e63adab08acc5b720f8feddefa Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Thu, 29 Nov 2012 13:38:14 -0800 Subject: [PATCH] AudioTrack::mute() is unused so remove it If ever needed again, it could be implemented on client side by forcing a track volume of 0. Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269 --- include/media/AudioTrack.h | 10 +--------- include/media/IAudioTrack.h | 5 ----- media/libmedia/AudioTrack.cpp | 11 ++--------- media/libmedia/IAudioTrack.cpp | 15 +-------------- services/audioflinger/AudioFlinger.h | 1 - services/audioflinger/PlaybackTracks.h | 7 ------- services/audioflinger/Threads.cpp | 9 +++------ services/audioflinger/Tracks.cpp | 15 ++------------- 8 files changed, 9 insertions(+), 64 deletions(-) diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index d5cd28ad0c..fe46a2224d 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -258,12 +258,6 @@ public: */ void pause(); - /* Mute or unmute this track. - * While muted, the callback, if set, is still called. - */ - void mute(bool); - bool muted() const { return mMuted; } - /* Set volume for this track, mostly used for games' sound effects * left and right volumes. Levels must be >= 0.0 and <= 1.0. * This is the older API. New applications should use setVolume(float) when possible. @@ -524,9 +518,7 @@ protected: audio_format_t mFormat; // as requested by client, not forced to 16-bit audio_stream_type_t mStreamType; - uint8_t mChannelCount; - uint8_t mMuted; - uint8_t mReserved; + uint32_t mChannelCount; audio_channel_mask_t mChannelMask; // mFrameSize is equal to mFrameSizeAF for non-PCM or 16-bit PCM data. diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h index 9e0e38961a..144be0e454 100644 --- a/include/media/IAudioTrack.h +++ b/include/media/IAudioTrack.h @@ -54,11 +54,6 @@ public: */ virtual void flush() = 0; - /* Mute or unmute this track. - * While muted, the callback, if set, is still called. - */ - virtual void mute(bool) = 0; - /* Pause a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will continue to be processed, unless/until flush() is called. diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 04634336a0..f5641e0690 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -304,7 +304,6 @@ status_t AudioTrack::set( } mSharedBuffer = sharedBuffer; - mMuted = false; mActive = false; mUserData = user; mLoopCount = 0; @@ -453,12 +452,6 @@ void AudioTrack::pause() } } -void AudioTrack::mute(bool e) -{ - mAudioTrack->mute(e); - mMuted = e; -} - status_t AudioTrack::setVolume(float left, float right) { if (left < 0.0f || left > 1.0f || right < 0.0f || right > 1.0f) { @@ -1424,8 +1417,8 @@ status_t AudioTrack::dump(int fd, const Vector& args) const snprintf(buffer, 255, " format(%d), channel count(%d), frame count(%d)\n", mFormat, mChannelCount, mFrameCount); result.append(buffer); - snprintf(buffer, 255, " sample rate(%u), status(%d), muted(%d)\n", - (cblk == 0) ? 0 : cblk->sampleRate, mStatus, mMuted); + snprintf(buffer, 255, " sample rate(%u), status(%d)\n", + (cblk == 0) ? 0 : cblk->sampleRate, mStatus); result.append(buffer); snprintf(buffer, 255, " active(%d), latency (%d)\n", mActive, mLatency); result.append(buffer); diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp index 867d1a51fe..e92f8aa539 100644 --- a/media/libmedia/IAudioTrack.cpp +++ b/media/libmedia/IAudioTrack.cpp @@ -33,7 +33,7 @@ enum { START, STOP, FLUSH, - MUTE, + RESERVED, // was MUTE PAUSE, ATTACH_AUX_EFFECT, ALLOCATE_TIMED_BUFFER, @@ -88,14 +88,6 @@ public: remote()->transact(FLUSH, data, &reply); } - virtual void mute(bool e) - { - Parcel data, reply; - data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); - data.writeInt32(e); - remote()->transact(MUTE, data, &reply); - } - virtual void pause() { Parcel data, reply; @@ -192,11 +184,6 @@ status_t BnAudioTrack::onTransact( flush(); return NO_ERROR; } break; - case MUTE: { - CHECK_INTERFACE(IAudioTrack, data, reply); - mute( data.readInt32() ); - return NO_ERROR; - } break; case PAUSE: { CHECK_INTERFACE(IAudioTrack, data, reply); pause(); diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 46a8e0f9b4..6d3f0a10d6 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -385,7 +385,6 @@ private: virtual status_t start(); virtual void stop(); virtual void flush(); - virtual void mute(bool); virtual void pause(); virtual status_t attachAuxEffect(int effectId); virtual status_t allocateTimedBuffer(size_t size, diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h index b898924da0..37e39a0a61 100644 --- a/services/audioflinger/PlaybackTracks.h +++ b/services/audioflinger/PlaybackTracks.h @@ -44,7 +44,6 @@ public: void flush(); void destroy(); - void mute(bool); int name() const { return mName; } audio_stream_type_t streamType() const { @@ -78,7 +77,6 @@ protected: virtual size_t framesReady() const; - bool isMuted() const { return mMute; } bool isPausing() const { return mState == PAUSING; } @@ -111,11 +109,6 @@ public: protected: - // written by Track::mute() called by binder thread(s), without a mutex or barrier. - // read by Track::isMuted() called by playback thread, also without a mutex or barrier. - // The lack of mutex or barrier is safe because the mute status is only used by itself. - bool mMute; - // FILLED state is used for suppressing volume ramp at begin of playing enum {FS_INVALID, FS_FILLING, FS_FILLED, FS_ACTIVE}; mutable uint8_t mFillingUpStatus; diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index fd64395cd0..a285e6cba6 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -2544,8 +2544,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac } // cache the combined master volume and stream type volume for fast mixer; this // lacks any synchronization or barrier so VolumeProvider may read a stale value - track->mCachedVolume = track->isMuted() ? - 0 : masterVolume * mStreamTypes[track->streamType()].volume; + track->mCachedVolume = masterVolume * mStreamTypes[track->streamType()].volume; ++fastTracks; } else { // was it previously active? @@ -2637,8 +2636,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac // compute volume for this track uint32_t vl, vr, va; - if (track->isMuted() || track->isPausing() || - mStreamTypes[track->streamType()].mute) { + if (track->isPausing() || mStreamTypes[track->streamType()].mute) { vl = vr = va = 0; if (track->isPausing()) { track->setPaused(); @@ -3139,8 +3137,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep // compute volume for this track float left, right; - if (track->isMuted() || mMasterMute || track->isPausing() || - mStreamTypes[track->streamType()].mute) { + if (mMasterMute || track->isPausing() || mStreamTypes[track->streamType()].mute) { left = right = 0; if (track->isPausing()) { track->setPaused(); diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index 2c6ba8b43d..e8ca5ee7e0 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -248,10 +248,6 @@ void AudioFlinger::TrackHandle::flush() { mTrack->flush(); } -void AudioFlinger::TrackHandle::mute(bool e) { - mTrack->mute(e); -} - void AudioFlinger::TrackHandle::pause() { mTrack->pause(); } @@ -315,7 +311,6 @@ AudioFlinger::PlaybackThread::Track::Track( IAudioFlinger::track_flags_t flags) : TrackBase(thread, client, sampleRate, format, channelMask, frameCount, sharedBuffer, sessionId), - mMute(false), mFillingUpStatus(FS_INVALID), // mRetryCount initialized later when needed mSharedBuffer(sharedBuffer), @@ -397,7 +392,7 @@ void AudioFlinger::PlaybackThread::Track::destroy() /*static*/ void AudioFlinger::PlaybackThread::Track::appendDumpHeader(String8& result) { - result.append(" Name Client Type Fmt Chn mask Session StpCnt fCount S M F SRate " + result.append(" Name Client Type Fmt Chn mask Session StpCnt fCount S F SRate " "L dB R dB Server User Main buf Aux Buf Flags Underruns\n"); } @@ -461,7 +456,7 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) nowInUnderrun = '?'; break; } - snprintf(&buffer[7], size-7, " %6d %4u %3u 0x%08x %7u %6u %6u %1c %1d %1d %5u %5.2g %5.2g " + snprintf(&buffer[7], size-7, " %6d %4u %3u 0x%08x %7u %6u %6u %1c %1d %5u %5.2g %5.2g " "0x%08x 0x%08x 0x%08x 0x%08x %#5x %9u%c\n", (mClient == 0) ? getpid_cached : mClient->pid(), mStreamType, @@ -471,7 +466,6 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) mStepCount, mFrameCount, stateChar, - mMute, mFillingUpStatus, mCblk->sampleRate, 20.0 * log10((vlr & 0xFFFF) / 4096.0), @@ -708,11 +702,6 @@ void AudioFlinger::PlaybackThread::Track::reset() } } -void AudioFlinger::PlaybackThread::Track::mute(bool muted) -{ - mMute = muted; -} - status_t AudioFlinger::PlaybackThread::Track::attachAuxEffect(int EffectId) { status_t status = DEAD_OBJECT; -- 2.11.0