OSDN Git Service

AudioTrack::mute() is unused so remove it
authorGlenn Kasten <gkasten@google.com>
Thu, 29 Nov 2012 21:38:14 +0000 (13:38 -0800)
committerGlenn Kasten <gkasten@google.com>
Mon, 3 Dec 2012 17:57:37 +0000 (09:57 -0800)
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
include/media/IAudioTrack.h
media/libmedia/AudioTrack.cpp
media/libmedia/IAudioTrack.cpp
services/audioflinger/AudioFlinger.h
services/audioflinger/PlaybackTracks.h
services/audioflinger/Threads.cpp
services/audioflinger/Tracks.cpp

index d5cd28a..fe46a22 100644 (file)
@@ -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.
index 9e0e389..144be0e 100644 (file)
@@ -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.
index 0463433..f5641e0 100644 (file)
@@ -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<String16>& 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);
index 867d1a5..e92f8aa 100644 (file)
@@ -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();
index 46a8e0f..6d3f0a1 100644 (file)
@@ -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,
index b898924..37e39a0 100644 (file)
@@ -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;
index fd64395..a285e6c 100644 (file)
@@ -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();
index 2c6ba8b..e8ca5ee 100644 (file)
@@ -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 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;