Loading media/libmedia/AudioTrack.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -866,7 +866,8 @@ status_t AudioTrack::createTrack_l( ALOGV("createTrack_l() output %d afLatency %d", output, afLatency); // The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where // n = 1 fast track; nBuffering is ignored // n = 1 fast track with single buffering; nBuffering is ignored // n = 2 fast track with double buffering // n = 2 normal track, no sample rate conversion // n = 3 normal track, with sample rate conversion // (pessimistic; some non-1:1 conversion ratios don't actually need triple-buffering) Loading Loading @@ -1006,9 +1007,11 @@ status_t AudioTrack::createTrack_l( ALOGV("AUDIO_OUTPUT_FLAG_FAST successful; frameCount %u", frameCount); mAwaitBoost = true; if (sharedBuffer == 0) { // double-buffering is not required for fast tracks, due to tighter scheduling if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount) { mNotificationFramesAct = frameCount; // Theoretically double-buffering is not required for fast tracks, // due to tighter scheduling. But in practice, to accommodate kernels with // scheduling jitter, and apps with computation jitter, we use double-buffering. if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount/nBuffering) { mNotificationFramesAct = frameCount/nBuffering; } } } else { Loading services/audioflinger/Threads.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -135,12 +135,12 @@ static const int kPriorityFastMixer = 3; // IAudioFlinger::createTrack() reports back to client the total size of shared memory area // for the track. The client then sub-divides this into smaller buffers for its use. // Currently the client uses double-buffering by default, but doesn't tell us about that. // So for now we just assume that client is double-buffered. // FIXME It would be better for client to tell AudioFlinger whether it wants double-buffering or // N-buffering, so AudioFlinger could allocate the right amount of memory. // Currently the client uses N-buffering by default, but doesn't tell us about the value of N. // So for now we just assume that client is double-buffered for fast tracks. // FIXME It would be better for client to tell AudioFlinger the value of N, // so AudioFlinger could allocate the right amount of memory. // See the client's minBufCount and mNotificationFramesAct calculations for details. static const int kFastTrackMultiplier = 1; static const int kFastTrackMultiplier = 2; // ---------------------------------------------------------------------------- Loading Loading @@ -1210,7 +1210,7 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac ( (tid != -1) && ((frameCount == 0) || (frameCount >= (mFrameCount * kFastTrackMultiplier))) (frameCount >= mFrameCount)) ) ) && // PCM data Loading Loading @@ -4687,7 +4687,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR ( (tid != -1) && ((frameCount == 0) || (frameCount >= (mFrameCount * kFastTrackMultiplier))) (frameCount >= mFrameCount)) ) && // FIXME when record supports non-PCM data, also check for audio_is_linear_pcm(format) // mono or stereo Loading Loading
media/libmedia/AudioTrack.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -866,7 +866,8 @@ status_t AudioTrack::createTrack_l( ALOGV("createTrack_l() output %d afLatency %d", output, afLatency); // The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where // n = 1 fast track; nBuffering is ignored // n = 1 fast track with single buffering; nBuffering is ignored // n = 2 fast track with double buffering // n = 2 normal track, no sample rate conversion // n = 3 normal track, with sample rate conversion // (pessimistic; some non-1:1 conversion ratios don't actually need triple-buffering) Loading Loading @@ -1006,9 +1007,11 @@ status_t AudioTrack::createTrack_l( ALOGV("AUDIO_OUTPUT_FLAG_FAST successful; frameCount %u", frameCount); mAwaitBoost = true; if (sharedBuffer == 0) { // double-buffering is not required for fast tracks, due to tighter scheduling if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount) { mNotificationFramesAct = frameCount; // Theoretically double-buffering is not required for fast tracks, // due to tighter scheduling. But in practice, to accommodate kernels with // scheduling jitter, and apps with computation jitter, we use double-buffering. if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount/nBuffering) { mNotificationFramesAct = frameCount/nBuffering; } } } else { Loading
services/audioflinger/Threads.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -135,12 +135,12 @@ static const int kPriorityFastMixer = 3; // IAudioFlinger::createTrack() reports back to client the total size of shared memory area // for the track. The client then sub-divides this into smaller buffers for its use. // Currently the client uses double-buffering by default, but doesn't tell us about that. // So for now we just assume that client is double-buffered. // FIXME It would be better for client to tell AudioFlinger whether it wants double-buffering or // N-buffering, so AudioFlinger could allocate the right amount of memory. // Currently the client uses N-buffering by default, but doesn't tell us about the value of N. // So for now we just assume that client is double-buffered for fast tracks. // FIXME It would be better for client to tell AudioFlinger the value of N, // so AudioFlinger could allocate the right amount of memory. // See the client's minBufCount and mNotificationFramesAct calculations for details. static const int kFastTrackMultiplier = 1; static const int kFastTrackMultiplier = 2; // ---------------------------------------------------------------------------- Loading Loading @@ -1210,7 +1210,7 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac ( (tid != -1) && ((frameCount == 0) || (frameCount >= (mFrameCount * kFastTrackMultiplier))) (frameCount >= mFrameCount)) ) ) && // PCM data Loading Loading @@ -4687,7 +4687,7 @@ sp<AudioFlinger::RecordThread::RecordTrack> AudioFlinger::RecordThread::createR ( (tid != -1) && ((frameCount == 0) || (frameCount >= (mFrameCount * kFastTrackMultiplier))) (frameCount >= mFrameCount)) ) && // FIXME when record supports non-PCM data, also check for audio_is_linear_pcm(format) // mono or stereo Loading