diff options
author | Preetam Singh Ranawat <apranawat@codeaurora.org> | 2015-07-23 08:59:47 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:24:28 -0600 |
commit | fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0 (patch) | |
tree | 13b03bf4eb20ffbf7740e96078f218c63fe6652a /media/libmedia/AudioTrack.cpp | |
parent | ab9bb1594982ad1affed948711d6f487e1c90271 (diff) | |
download | frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.zip frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.tar.gz frameworks_av-fd42e7afbe43eca5ab6835f8b2720b7e0e8302e0.tar.bz2 |
AVCustomizations: Enable 16 and 24 bit PCM offload.
-create extended decoder and renderer
-add change to pass bit width and format info to renderer.
-add change for PCM conversions
-add changes for time calucation
Conflicts:
media/libmediaplayerservice/nuplayer/NuPlayer.cpp
Change-Id: I3363140fad441a7746884076c40b46e777f2e06e
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rwxr-xr-x[-rw-r--r--] | media/libmedia/AudioTrack.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index f9eb496..fa24415 100644..100755 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -30,6 +30,7 @@ #include <media/IAudioFlinger.h> #include <media/AudioPolicyHelper.h> #include <media/AudioResamplerPublic.h> +#include "media/AVMediaExtensions.h" #define WAIT_PERIOD_MS 10 #define WAIT_STREAM_END_TIMEOUT_SEC 120 @@ -992,6 +993,10 @@ status_t AudioTrack::getPosition(uint32_t *position) return NO_ERROR; } + if (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); @@ -2223,14 +2228,21 @@ status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp) } } - // The presented frame count must always lag behind the consumed frame count. - // To avoid a race, read the presented frames first. This ensures that presented <= consumed. - status_t status = mAudioTrack->getTimestamp(timestamp); - if (status != NO_ERROR) { - ALOGV_IF(status != WOULD_BLOCK, "getTimestamp error:%#x", status); - return status; + status_t status = UNKNOWN_ERROR; + //do not call Timestamp if its PCM offloaded + if (!AVMediaUtils::get()->AudioTrackIsPcmOffloaded(mFormat)) { + // The presented frame count must always lag behind the consumed frame count. + // To avoid a race, read the presented frames first. This ensures that presented <= consumed. + + status = mAudioTrack->getTimestamp(timestamp); + if (status != NO_ERROR) { + ALOGV_IF(status != WOULD_BLOCK, "getTimestamp error:%#x", status); + return status; + } + } - if (isOffloadedOrDirect_l()) { + + if (isOffloadedOrDirect_l() && !AVMediaUtils::get()->AudioTrackIsPcmOffloaded(mFormat)) { if (isOffloaded_l() && (mState == STATE_PAUSED || mState == STATE_PAUSED_STOPPING)) { // use cached paused position in case another offloaded track is running. timestamp.mPosition = mPausedPosition; @@ -2288,6 +2300,11 @@ status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp) } } else { // Update the mapping between local consumed (mPosition) and server consumed (mServer) + + if (AVMediaUtils::get()->AudioTrackGetTimestamp(this, timestamp) == NO_ERROR) { + return NO_ERROR; + } + (void) updateAndGetPosition_l(); // Server consumed (mServer) and presented both use the same server time base, // and server consumed is always >= presented. |