Merge "MediaPlayerService: fix AudioSink latency" into ics-mr1
This commit is contained in:
@@ -320,7 +320,7 @@ status_t MediaPlayerService::AudioOutput::dump(int fd, const Vector<String16>& a
|
||||
mStreamType, mLeftVolume, mRightVolume);
|
||||
result.append(buffer);
|
||||
snprintf(buffer, 255, " msec per frame(%f), latency (%d)\n",
|
||||
mMsecsPerFrame, mLatency);
|
||||
mMsecsPerFrame, (mTrack != 0) ? mTrack->latency() : -1);
|
||||
result.append(buffer);
|
||||
snprintf(buffer, 255, " aux effect id(%d), send level (%f)\n",
|
||||
mAuxEffectId, mSendLevel);
|
||||
@@ -1265,7 +1265,6 @@ MediaPlayerService::AudioOutput::AudioOutput(int sessionId)
|
||||
mStreamType = AUDIO_STREAM_MUSIC;
|
||||
mLeftVolume = 1.0;
|
||||
mRightVolume = 1.0;
|
||||
mLatency = 0;
|
||||
mMsecsPerFrame = 0;
|
||||
mAuxEffectId = 0;
|
||||
mSendLevel = 0.0;
|
||||
@@ -1324,7 +1323,8 @@ ssize_t MediaPlayerService::AudioOutput::frameSize() const
|
||||
|
||||
uint32_t MediaPlayerService::AudioOutput::latency () const
|
||||
{
|
||||
return mLatency;
|
||||
if (mTrack == 0) return 0;
|
||||
return mTrack->latency();
|
||||
}
|
||||
|
||||
float MediaPlayerService::AudioOutput::msecsPerFrame() const
|
||||
@@ -1403,7 +1403,6 @@ status_t MediaPlayerService::AudioOutput::open(
|
||||
t->setVolume(mLeftVolume, mRightVolume);
|
||||
|
||||
mMsecsPerFrame = 1.e3 / (float) sampleRate;
|
||||
mLatency = t->latency();
|
||||
mTrack = t;
|
||||
|
||||
t->setAuxEffectSendLevel(mSendLevel);
|
||||
|
||||
@@ -112,7 +112,6 @@ class MediaPlayerService : public BnMediaPlayerService
|
||||
float mLeftVolume;
|
||||
float mRightVolume;
|
||||
float mMsecsPerFrame;
|
||||
uint32_t mLatency;
|
||||
int mSessionId;
|
||||
float mSendLevel;
|
||||
int mAuxEffectId;
|
||||
|
||||
@@ -408,6 +408,12 @@ size_t AudioPlayer::fillBuffer(void *data, size_t size) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (mAudioSink != NULL) {
|
||||
mLatencyUs = (int64_t)mAudioSink->latency() * 1000;
|
||||
} else {
|
||||
mLatencyUs = (int64_t)mAudioTrack->latency() * 1000;
|
||||
}
|
||||
|
||||
CHECK(mInputBuffer->meta_data()->findInt64(
|
||||
kKeyTime, &mPositionTimeMediaUs));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user