Loading services/audioflinger/Threads.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -2703,7 +2703,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac } for (size_t i=0 ; i<count ; i++) { sp<Track> t = mActiveTracks[i].promote(); const sp<Track> t = mActiveTracks[i].promote(); if (t == 0) { continue; } Loading Loading @@ -2872,11 +2872,12 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac // hence the test on (mMixerStatus == MIXER_TRACKS_READY) meaning the track was mixed // during last round size_t desiredFrames; if (t->sampleRate() == mSampleRate) { uint32_t sr = track->sampleRate(); if (sr == mSampleRate) { desiredFrames = mNormalFrameCount; } else { // +1 for rounding and +1 for additional sample needed for interpolation desiredFrames = (mNormalFrameCount * t->sampleRate()) / mSampleRate + 1 + 1; desiredFrames = (mNormalFrameCount * sr) / mSampleRate + 1 + 1; // add frames already consumed but not yet released by the resampler // because cblk->framesReady() will include these frames desiredFrames += mAudioMixer->getUnreleasedFrames(track->name()); Loading services/audioflinger/Tracks.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1172,10 +1172,12 @@ status_t AudioFlinger::PlaybackThread::TimedTrack::getNextBuffer( } } uint32_t sr = sampleRate(); // adjust the head buffer's PTS to reflect the portion of the head buffer // that has already been consumed int64_t effectivePTS = headLocalPTS + ((head.position() / mFrameSize) * mLocalTimeFreq / sampleRate()); ((head.position() / mFrameSize) * mLocalTimeFreq / sr); // Calculate the delta in samples between the head of the input buffer // queue and the start of the next output buffer that will be written. Loading Loading @@ -1207,7 +1209,7 @@ status_t AudioFlinger::PlaybackThread::TimedTrack::getNextBuffer( // the current output position is within this threshold, then we will // concatenate the next input samples to the previous output const int64_t kSampleContinuityThreshold = (static_cast<int64_t>(sampleRate()) << 32) / 250; (static_cast<int64_t>(sr) << 32) / 250; // if this is the first buffer of audio that we're emitting from this track // then it should be almost exactly on time. Loading Loading
services/audioflinger/Threads.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -2703,7 +2703,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac } for (size_t i=0 ; i<count ; i++) { sp<Track> t = mActiveTracks[i].promote(); const sp<Track> t = mActiveTracks[i].promote(); if (t == 0) { continue; } Loading Loading @@ -2872,11 +2872,12 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac // hence the test on (mMixerStatus == MIXER_TRACKS_READY) meaning the track was mixed // during last round size_t desiredFrames; if (t->sampleRate() == mSampleRate) { uint32_t sr = track->sampleRate(); if (sr == mSampleRate) { desiredFrames = mNormalFrameCount; } else { // +1 for rounding and +1 for additional sample needed for interpolation desiredFrames = (mNormalFrameCount * t->sampleRate()) / mSampleRate + 1 + 1; desiredFrames = (mNormalFrameCount * sr) / mSampleRate + 1 + 1; // add frames already consumed but not yet released by the resampler // because cblk->framesReady() will include these frames desiredFrames += mAudioMixer->getUnreleasedFrames(track->name()); Loading
services/audioflinger/Tracks.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -1172,10 +1172,12 @@ status_t AudioFlinger::PlaybackThread::TimedTrack::getNextBuffer( } } uint32_t sr = sampleRate(); // adjust the head buffer's PTS to reflect the portion of the head buffer // that has already been consumed int64_t effectivePTS = headLocalPTS + ((head.position() / mFrameSize) * mLocalTimeFreq / sampleRate()); ((head.position() / mFrameSize) * mLocalTimeFreq / sr); // Calculate the delta in samples between the head of the input buffer // queue and the start of the next output buffer that will be written. Loading Loading @@ -1207,7 +1209,7 @@ status_t AudioFlinger::PlaybackThread::TimedTrack::getNextBuffer( // the current output position is within this threshold, then we will // concatenate the next input samples to the previous output const int64_t kSampleContinuityThreshold = (static_cast<int64_t>(sampleRate()) << 32) / 250; (static_cast<int64_t>(sr) << 32) / 250; // if this is the first buffer of audio that we're emitting from this track // then it should be almost exactly on time. Loading