Loading services/audioflinger/AudioFlinger.cpp +9 −8 Original line number Diff line number Diff line Loading @@ -2841,6 +2841,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac // at the identical fast mixer slot within the same normal mix cycle, // is impossible because the slot isn't marked available until the end of each cycle. int j = track->mFastIndex; ALOG_ASSERT(0 < j && j < (int)FastMixerState::kMaxFastTracks); ALOG_ASSERT(!(mFastTrackAvailMask & (1 << j))); FastTrack *fastTrack = &state->mFastTracks[j]; // Determine whether the track is currently in underrun condition, Loading Loading @@ -4295,6 +4297,13 @@ AudioFlinger::PlaybackThread::Track::Track( // NOTE: audio_track_cblk_t::frameSize for 8 bit PCM data is based on a sample size of // 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(uint8_t); // to avoid leaking a track name, do not allocate one unless there is an mCblk mName = thread->getTrackName_l((audio_channel_mask_t)channelMask); if (mName < 0) { ALOGE("no more track names available"); return; } // only allocate a fast track index if we were able to allocate a normal track name if (flags & IAudioFlinger::TRACK_FAST) { mCblk->flags |= CBLK_FAST; // atomic op not needed yet ALOG_ASSERT(thread->mFastTrackAvailMask != 0); Loading @@ -4309,14 +4318,6 @@ AudioFlinger::PlaybackThread::Track::Track( mObservedUnderruns = thread->getFastTrackUnderruns(i); thread->mFastTrackAvailMask &= ~(1 << i); } // to avoid leaking a track name, do not allocate one unless there is an mCblk mName = thread->getTrackName_l((audio_channel_mask_t)channelMask); if (mName < 0) { ALOGE("no more track names available"); // FIXME bug - if sufficient fast track indices, but insufficient normal mixer names, // then we leak a fast track index. Should swap these two sections, or better yet // only allocate a normal mixer name for normal tracks. } } ALOGV("Track constructor name %d, calling pid %d", mName, IPCThreadState::self()->getCallingPid()); } Loading services/audioflinger/AudioFlinger.h +2 −1 Original line number Diff line number Diff line Loading @@ -778,6 +778,7 @@ private: int mName; // track name on the normal mixer, // allocated statically at track creation time, // and is even allocated (though unused) for fast tracks // FIXME don't allocate track name for fast tracks int16_t *mMainBuffer; int32_t *mAuxBuffer; int mAuxEffectId; Loading @@ -789,7 +790,7 @@ private: // The following fields are only for fast tracks, and should be in a subclass int mFastIndex; // index within FastMixerState::mFastTracks[]; // either mFastIndex == -1 // either mFastIndex == -1 if not isFastTrack() // or 0 < mFastIndex < FastMixerState::kMaxFast because // index 0 is reserved for normal mixer's submix; // index is allocated statically at track creation time Loading Loading
services/audioflinger/AudioFlinger.cpp +9 −8 Original line number Diff line number Diff line Loading @@ -2841,6 +2841,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac // at the identical fast mixer slot within the same normal mix cycle, // is impossible because the slot isn't marked available until the end of each cycle. int j = track->mFastIndex; ALOG_ASSERT(0 < j && j < (int)FastMixerState::kMaxFastTracks); ALOG_ASSERT(!(mFastTrackAvailMask & (1 << j))); FastTrack *fastTrack = &state->mFastTracks[j]; // Determine whether the track is currently in underrun condition, Loading Loading @@ -4295,6 +4297,13 @@ AudioFlinger::PlaybackThread::Track::Track( // NOTE: audio_track_cblk_t::frameSize for 8 bit PCM data is based on a sample size of // 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(uint8_t); // to avoid leaking a track name, do not allocate one unless there is an mCblk mName = thread->getTrackName_l((audio_channel_mask_t)channelMask); if (mName < 0) { ALOGE("no more track names available"); return; } // only allocate a fast track index if we were able to allocate a normal track name if (flags & IAudioFlinger::TRACK_FAST) { mCblk->flags |= CBLK_FAST; // atomic op not needed yet ALOG_ASSERT(thread->mFastTrackAvailMask != 0); Loading @@ -4309,14 +4318,6 @@ AudioFlinger::PlaybackThread::Track::Track( mObservedUnderruns = thread->getFastTrackUnderruns(i); thread->mFastTrackAvailMask &= ~(1 << i); } // to avoid leaking a track name, do not allocate one unless there is an mCblk mName = thread->getTrackName_l((audio_channel_mask_t)channelMask); if (mName < 0) { ALOGE("no more track names available"); // FIXME bug - if sufficient fast track indices, but insufficient normal mixer names, // then we leak a fast track index. Should swap these two sections, or better yet // only allocate a normal mixer name for normal tracks. } } ALOGV("Track constructor name %d, calling pid %d", mName, IPCThreadState::self()->getCallingPid()); } Loading
services/audioflinger/AudioFlinger.h +2 −1 Original line number Diff line number Diff line Loading @@ -778,6 +778,7 @@ private: int mName; // track name on the normal mixer, // allocated statically at track creation time, // and is even allocated (though unused) for fast tracks // FIXME don't allocate track name for fast tracks int16_t *mMainBuffer; int32_t *mAuxBuffer; int mAuxEffectId; Loading @@ -789,7 +790,7 @@ private: // The following fields are only for fast tracks, and should be in a subclass int mFastIndex; // index within FastMixerState::mFastTracks[]; // either mFastIndex == -1 // either mFastIndex == -1 if not isFastTrack() // or 0 < mFastIndex < FastMixerState::kMaxFast because // index 0 is reserved for normal mixer's submix; // index is allocated statically at track creation time Loading