diff options
author | Satya Krishna Pindiproli <satyak@codeaurora.org> | 2015-09-30 16:32:12 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-10-06 21:31:01 -0700 |
commit | 43a345e28b64d6eb63f4d5bb1fa5b7d67c5ce26f (patch) | |
tree | 8d2d431a1c06e4c4573960352442681dd9bb4387 /media/libmedia/AudioTrack.cpp | |
parent | b3f0834aa448d6b4bf8dbddaff4fbcefa3ede422 (diff) | |
download | frameworks_av-43a345e28b64d6eb63f4d5bb1fa5b7d67c5ce26f.zip frameworks_av-43a345e28b64d6eb63f4d5bb1fa5b7d67c5ce26f.tar.gz frameworks_av-43a345e28b64d6eb63f4d5bb1fa5b7d67c5ce26f.tar.bz2 |
libmedia: return error if getRenderPosition fails
Currently, if the call getRenderPosition() fails, no error
is propagated to the caller. As the handling is already
present in NuPlayerRenderer, return an error if the call fails.
CRs-Fixed: 912730
Change-Id: I01e3348ffd696ce781287451b9a9478b50037ade
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index f46b66e..2d9fcf7 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -999,14 +999,18 @@ status_t AudioTrack::getPosition(uint32_t *position) return NO_ERROR; } - if (AVMediaUtils::get()->AudioTrackGetPosition(this, position) == NO_ERROR) { + if (AVMediaUtils::get()->AudioTrackIsPcmOffloaded(mFormat) && + AVMediaUtils::get()->AudioTrackGetPosition(this, position) == NO_ERROR) { return NO_ERROR; } if (mOutput != AUDIO_IO_HANDLE_NONE) { uint32_t halFrames; // actually unused - (void) AudioSystem::getRenderPosition(mOutput, &halFrames, &dspFrames); - // FIXME: on getRenderPosition() error, we return OK with frame position 0. + status_t status = AudioSystem::getRenderPosition(mOutput, &halFrames, &dspFrames); + if (status != NO_ERROR) { + ALOGW("failed to getRenderPosition for offload session status %d", status); + return INVALID_OPERATION; + } } // FIXME: dspFrames may not be zero in (mState == STATE_STOPPED || mState == STATE_FLUSHED) // due to hardware latency. We leave this behavior for now. |