Loading media/libmediaplayerservice/MediaPlayerService.cpp +47 −38 Original line number Diff line number Diff line Loading @@ -1542,6 +1542,43 @@ status_t MediaPlayerService::AudioOutput::open( } } AudioTrack *t; CallbackData *newcbd = NULL; if (mCallback != NULL) { newcbd = new CallbackData(this); t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, CallbackWrapper, newcbd, 0, // notification frames mSessionId); } else { t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, NULL, NULL, 0, mSessionId); } if ((t == 0) || (t->initCheck() != NO_ERROR)) { ALOGE("Unable to create audio track"); delete t; delete newcbd; return NO_INIT; } if (mRecycledTrack) { // check if the existing track can be reused as-is, or if a new track needs to be created. Loading @@ -1553,11 +1590,14 @@ status_t MediaPlayerService::AudioOutput::open( reuse = false; } else if ((mRecycledTrack->getSampleRate() != sampleRate) || (mRecycledTrack->channelCount() != channelCount) || (mRecycledTrack->frameCount() != frameCount)) { ALOGV("samplerate, channelcount or framecount differ"); (mRecycledTrack->frameCount() != t->frameCount())) { ALOGV("samplerate, channelcount or framecount differ: %d/%d Hz, %d/%d ch, %d/%d frames", mRecycledTrack->getSampleRate(), sampleRate, mRecycledTrack->channelCount(), channelCount, mRecycledTrack->frameCount(), t->frameCount()); reuse = false; } if (flags != mFlags) { ALOGV("output flags differ"); } else if (flags != mFlags) { ALOGV("output flags differ %08x/%08x", flags, mFlags); reuse = false; } if (reuse) { Loading @@ -1568,6 +1608,8 @@ status_t MediaPlayerService::AudioOutput::open( if (mCallbackData != NULL) { mCallbackData->setOutput(this); } delete t; delete newcbd; return OK; } Loading @@ -1584,40 +1626,7 @@ status_t MediaPlayerService::AudioOutput::open( close(); } AudioTrack *t; if (mCallback != NULL) { mCallbackData = new CallbackData(this); t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, CallbackWrapper, mCallbackData, 0, // notification frames mSessionId); } else { t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, NULL, NULL, 0, mSessionId); } if ((t == 0) || (t->initCheck() != NO_ERROR)) { ALOGE("Unable to create audio track"); delete t; return NO_INIT; } mCallbackData = newcbd; ALOGV("setVolume"); t->setVolume(mLeftVolume, mRightVolume); Loading Loading
media/libmediaplayerservice/MediaPlayerService.cpp +47 −38 Original line number Diff line number Diff line Loading @@ -1542,6 +1542,43 @@ status_t MediaPlayerService::AudioOutput::open( } } AudioTrack *t; CallbackData *newcbd = NULL; if (mCallback != NULL) { newcbd = new CallbackData(this); t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, CallbackWrapper, newcbd, 0, // notification frames mSessionId); } else { t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, NULL, NULL, 0, mSessionId); } if ((t == 0) || (t->initCheck() != NO_ERROR)) { ALOGE("Unable to create audio track"); delete t; delete newcbd; return NO_INIT; } if (mRecycledTrack) { // check if the existing track can be reused as-is, or if a new track needs to be created. Loading @@ -1553,11 +1590,14 @@ status_t MediaPlayerService::AudioOutput::open( reuse = false; } else if ((mRecycledTrack->getSampleRate() != sampleRate) || (mRecycledTrack->channelCount() != channelCount) || (mRecycledTrack->frameCount() != frameCount)) { ALOGV("samplerate, channelcount or framecount differ"); (mRecycledTrack->frameCount() != t->frameCount())) { ALOGV("samplerate, channelcount or framecount differ: %d/%d Hz, %d/%d ch, %d/%d frames", mRecycledTrack->getSampleRate(), sampleRate, mRecycledTrack->channelCount(), channelCount, mRecycledTrack->frameCount(), t->frameCount()); reuse = false; } if (flags != mFlags) { ALOGV("output flags differ"); } else if (flags != mFlags) { ALOGV("output flags differ %08x/%08x", flags, mFlags); reuse = false; } if (reuse) { Loading @@ -1568,6 +1608,8 @@ status_t MediaPlayerService::AudioOutput::open( if (mCallbackData != NULL) { mCallbackData->setOutput(this); } delete t; delete newcbd; return OK; } Loading @@ -1584,40 +1626,7 @@ status_t MediaPlayerService::AudioOutput::open( close(); } AudioTrack *t; if (mCallback != NULL) { mCallbackData = new CallbackData(this); t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, CallbackWrapper, mCallbackData, 0, // notification frames mSessionId); } else { t = new AudioTrack( mStreamType, sampleRate, format, channelMask, frameCount, flags, NULL, NULL, 0, mSessionId); } if ((t == 0) || (t->initCheck() != NO_ERROR)) { ALOGE("Unable to create audio track"); delete t; return NO_INIT; } mCallbackData = newcbd; ALOGV("setVolume"); t->setVolume(mLeftVolume, mRightVolume); Loading