//-----------------------------------------------------------------------------
-/**
- * pre-condition: AudioPlayer has SLPrefetchStatusItf initialized
- * post-condition:
- * - ap->mPrefetchStatus.mStatus == status
- * - the prefetch status callback, if any, has been notified if a change occurred
- *
- */
-void audioPlayer_dispatch_prefetchStatus_lockPrefetch(CAudioPlayer *ap, SLuint32 status,
- bool needToLock) {
- slPrefetchCallback prefetchCallback = NULL;
- void * prefetchContext = NULL;
-
- if (needToLock) {
- interface_lock_exclusive(&ap->mPrefetchStatus);
- }
- // status change?
- if (ap->mPrefetchStatus.mStatus != status) {
- ap->mPrefetchStatus.mStatus = status;
- // callback or no callback?
- if (ap->mPrefetchStatus.mCallbackEventsMask & SL_PREFETCHEVENT_STATUSCHANGE) {
- prefetchCallback = ap->mPrefetchStatus.mCallback;
- prefetchContext = ap->mPrefetchStatus.mContext;
- }
- }
- if (needToLock) {
- interface_unlock_exclusive(&ap->mPrefetchStatus);
- }
-
- // callback with no lock held
- if (NULL != prefetchCallback) {
- (*prefetchCallback)(&ap->mPrefetchStatus.mItf, prefetchContext, status);
- }
-}
-
-
-//-----------------------------------------------------------------------------
SLresult audioPlayer_setStreamType(CAudioPlayer* ap, SLint32 type) {
SLresult result = SL_RESULT_SUCCESS;
SL_LOGV("type %d", type);
return 0;
}
- ssize_t readSize = 0;
+ ssize_t readSize;
slAndroidBufferQueueCallback callback = NULL;
- void* pBufferContext, *pBufferData, *callbackPContext = NULL;
- AdvancedBufferHeader *oldFront = NULL;
- uint32_t dataSize, dataUsed = 0;
+ void* pBufferContext, *pBufferData, *callbackPContext;
+ uint32_t dataSize, dataUsed;
interface_lock_exclusive(mAndroidBufferQueueSource);
} else {
assert(mAndroidBufferQueueSource->mFront != mAndroidBufferQueueSource->mRear);
- oldFront = mAndroidBufferQueueSource->mFront;
+ AdvancedBufferHeader *oldFront = mAndroidBufferQueueSource->mFront;
AdvancedBufferHeader *newFront = &oldFront[1];
// where to read from
//--------------------------------------------------
// Event handlers
-void AudioToCbRenderer::onPrepare() {
- SL_LOGD("AudioToCbRenderer::onPrepare()");
- AudioSfDecoder::onPrepare();
- SL_LOGD("AudioToCbRenderer::onPrepare() done, mStateFlags=0x%x", mStateFlags);
-}
-
void AudioToCbRenderer::onRender() {
SL_LOGV("AudioToCbRenderer::onRender");
protected:
// Async event handlers (called from GenericPlayer's event loop)
- virtual void onPrepare();
virtual void onRender();
// overridden from AudioSfDecoder
// we are not ready to accept a seek command at this time, retry later
msg->post(DEFAULT_COMMAND_DELAY_FOR_REPOST_US);
} else {
- if (msg->findInt64(WHATPARAM_SEEK_SEEKTIME_MS, &timeMsec) && (mPlayer != 0)) {
+ if (mPlayer != 0) {
mStateFlags |= kFlagSeeking;
mSeekTimeMsec = (int32_t)timeMsec;
if (OK != mPlayer->seekTo(timeMsec)) {