diff options
author | Glenn Kasten <gkasten@google.com> | 2013-07-12 12:59:20 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-07-30 09:50:48 -0700 |
commit | d054c32443a493513ab63529b0c8b1aca290278c (patch) | |
tree | fc68ba259ded1dd4960bee2938a9bcc7c599c9a3 | |
parent | 96f60d8f04432a1ed503b3e24d5736d28c63c9a2 (diff) | |
download | frameworks_av-d054c32443a493513ab63529b0c8b1aca290278c.zip frameworks_av-d054c32443a493513ab63529b0c8b1aca290278c.tar.gz frameworks_av-d054c32443a493513ab63529b0c8b1aca290278c.tar.bz2 |
Move control block mName to createTrack() output
This is part of a series of CLs to clean up the shared memory
control block, by removing any fields that don't have to be there.
Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
-rw-r--r-- | include/media/AudioTrack.h | 1 | ||||
-rw-r--r-- | include/media/IAudioFlinger.h | 4 | ||||
-rw-r--r-- | include/private/media/AudioTrackShared.h | 4 | ||||
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 5 | ||||
-rw-r--r-- | media/libmedia/AudioTrackShared.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 6 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 4 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 1 | ||||
-rw-r--r-- | services/audioflinger/PlaybackTracks.h | 1 | ||||
-rw-r--r-- | services/audioflinger/Tracks.cpp | 2 |
10 files changed, 21 insertions, 9 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index da13a7f..523bd32 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -726,6 +726,7 @@ protected: sp<AudioTrackClientProxy> mProxy; // primary owner of the memory bool mInUnderrun; // whether track is currently in underrun state + String8 mName; // server's name for this IAudioTrack private: class DeathNotifier : public IBinder::DeathRecipient { diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index de45aa8..82aae62 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -67,6 +67,10 @@ public: audio_io_handle_t output, pid_t tid, // -1 means unused, otherwise must be valid non-0 int *sessionId, + // input: ignored + // output: server's description of IAudioTrack for display in logs. + // Don't attempt to parse, as the format could change. + String8& name, status_t *status) = 0; virtual sp<IAudioRecord> openRecord( diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h index c5d8145..6d778dd 100644 --- a/include/private/media/AudioTrackShared.h +++ b/include/private/media/AudioTrackShared.h @@ -122,11 +122,9 @@ private: // client write-only, server read-only uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0 - uint8_t mPad2; // unused + uint16_t mPad2; // unused public: - // read-only for client, server writes once at initialization and is then read-only - uint8_t mName; // normal tracks: track name, fast tracks: track index volatile int32_t mFlags; // combinations of CBLK_* diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 64a59be..dd0ec73 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -953,6 +953,7 @@ status_t AudioTrack::createTrack_l( output, tid, &mSessionId, + mName, &status); if (track == 0) { @@ -1183,8 +1184,8 @@ void AudioTrack::releaseBuffer(Buffer* audioBuffer) if (mState == STATE_ACTIVE) { audio_track_cblk_t* cblk = mCblk; if (android_atomic_and(~CBLK_DISABLED, &cblk->mFlags) & CBLK_DISABLED) { - ALOGW("releaseBuffer() track %p name=%#x disabled due to previous underrun, restarting", - this, cblk->mName); + ALOGW("releaseBuffer() track %p name=%s disabled due to previous underrun, restarting", + this, mName.string()); // FIXME ignoring status mAudioTrack->start(); } diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libmedia/AudioTrackShared.cpp index 5015b8d..3b7616f 100644 --- a/media/libmedia/AudioTrackShared.cpp +++ b/media/libmedia/AudioTrackShared.cpp @@ -27,7 +27,7 @@ namespace android { audio_track_cblk_t::audio_track_cblk_t() : mServer(0), frameCount_(0), mFutex(0), mMinimum(0), - mVolumeLR(0x10001000), mSampleRate(0), mSendLevel(0), mName(0), mFlags(0) + mVolumeLR(0x10001000), mSampleRate(0), mSendLevel(0), mFlags(0) { memset(&u, 0, sizeof(u)); } diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index c670936..c6e43e7 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -95,6 +95,7 @@ public: audio_io_handle_t output, pid_t tid, int *sessionId, + String8& name, status_t *status) { Parcel data, reply; @@ -127,6 +128,7 @@ public: if (sessionId != NULL) { *sessionId = lSessionId; } + name = reply.readString8(); lStatus = reply.readInt32(); track = interface_cast<IAudioTrack>(reply.readStrongBinder()); } @@ -735,12 +737,14 @@ status_t BnAudioFlinger::onTransact( audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); pid_t tid = (pid_t) data.readInt32(); int sessionId = data.readInt32(); + String8 name; status_t status; sp<IAudioTrack> track = createTrack( (audio_stream_type_t) streamType, sampleRate, format, - channelMask, frameCount, &flags, buffer, output, tid, &sessionId, &status); + channelMask, frameCount, &flags, buffer, output, tid, &sessionId, name, &status); reply->writeInt32(flags); reply->writeInt32(sessionId); + reply->writeString8(name); reply->writeInt32(status); reply->writeStrongBinder(track->asBinder()); return NO_ERROR; diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index d510641..1ae51ca 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -436,6 +436,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( audio_io_handle_t output, pid_t tid, int *sessionId, + String8& name, status_t *status) { sp<PlaybackThread::Track> track; @@ -524,6 +525,9 @@ sp<IAudioTrack> AudioFlinger::createTrack( } } if (lStatus == NO_ERROR) { + // s for server's pid, n for normal mixer name, f for fast index + name = String8::format("s:%d;n:%d;f:%d", getpid_cached, track->name() - AudioMixer::TRACK0, + track->fastIndex()); trackHandle = new TrackHandle(track); } else { // remove local strong reference to Client before deleting the Track so that the Client diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index eee5da5..d99b779 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -108,6 +108,7 @@ public: audio_io_handle_t output, pid_t tid, int *sessionId, + String8& name, status_t *status); virtual sp<IAudioRecord> openRecord( diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h index 8b7433c..628f5af 100644 --- a/services/audioflinger/PlaybackTracks.h +++ b/services/audioflinger/PlaybackTracks.h @@ -106,6 +106,7 @@ public: bool isInvalid() const { return mIsInvalid; } virtual bool isTimedTrack() const { return false; } bool isFastTrack() const { return (mFlags & IAudioFlinger::TRACK_FAST) != 0; } + int fastIndex() const { return mFastIndex; } protected: diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index 58af204..1f75468 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -333,7 +333,6 @@ AudioFlinger::PlaybackThread::Track::Track( mServerProxy = mAudioTrackServerProxy; // to avoid leaking a track name, do not allocate one unless there is an mCblk mName = thread->getTrackName_l(channelMask, sessionId); - mCblk->mName = mName; if (mName < 0) { ALOGE("no more track names available"); return; @@ -349,7 +348,6 @@ AudioFlinger::PlaybackThread::Track::Track( // this means we are potentially denying other more important fast tracks from // being created. It would be better to allocate the index dynamically. mFastIndex = i; - mCblk->mName = i; // Read the initial underruns because this field is never cleared by the fast mixer mObservedUnderruns = thread->getFastTrackUnderruns(i); thread->mFastTrackAvailMask &= ~(1 << i); |