diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-09 20:44:26 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-13 13:16:01 -0800 |
commit | 6dde130280d6ead297170211b005cc809e7f7bde (patch) | |
tree | a2053b10d736cadc85ce1adfe18d6256875da325 /media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp | |
parent | fb9765480b10aaf39ac82149abe28d1805e1fe92 (diff) | |
download | frameworks_av-6dde130280d6ead297170211b005cc809e7f7bde.zip frameworks_av-6dde130280d6ead297170211b005cc809e7f7bde.tar.gz frameworks_av-6dde130280d6ead297170211b005cc809e7f7bde.tar.bz2 |
stagefright: Resurrect PCM offload
* Forward-port the open-source code from L which was moved to closed-source
in M. This is being done out of necessity- the architecture chosen by
Qualcomm is not optimal and doesn't work well with a singular
codebase which attempts to service a large number of devices.
* This patch brings in the code to support PCM offload (AudioFlinger
bypass). This allows for playback of high resolution clips without
decimation stages, and enables reduced power consumption for audio
pipelines which take advantage of the Hexagon DSP (effects).
Change-Id: I0ef15fc3df538ab723f3c12ce0ed71d0e607c99e
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp index 937936d..0b50d0d 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp @@ -53,7 +53,8 @@ NuPlayer::DecoderPassThrough::DecoderPassThrough( mPendingAudioErr(OK), mPendingBuffersToDrain(0), mCachedBytes(0), - mComponentName("pass through decoder") { + mComponentName("pass through decoder"), + mPCMFormat(AUDIO_FORMAT_INVALID) { ALOGW_IF(renderer == NULL, "expect a non-NULL renderer"); } @@ -75,6 +76,15 @@ void NuPlayer::DecoderPassThrough::onConfigure(const sp<AMessage> &format) { // The audio sink is already opened before the PassThrough decoder is created. // Opening again might be relevant if decoder is instantiated after shutdown and // format is different. + sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */); + if (AVNuUtils::get()->isRAWFormat(audioMeta)) { + mPCMFormat = AVNuUtils::get()->getKeyPCMFormat(audioMeta); + if (mPCMFormat != AUDIO_FORMAT_INVALID) { + AVNuUtils::get()->setPCMFormat(format, mPCMFormat); + AVNuUtils::get()->updateAudioBitWidth(mPCMFormat, format); + } + } + status_t err = mRenderer->openAudioSink( format, true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE /* flags */, NULL /* isOffloaded */, mSource->isStreaming()); |