diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2015-03-30 17:59:47 -0700 |
---|---|---|
committer | Ronghua Wu <ronghuawu@google.com> | 2015-04-02 15:49:10 -0700 |
commit | 8b63533e6aaff121378878998925c57dbe9a9e16 (patch) | |
tree | 1c4a4f96b9983991d39938eec2eb9a1a55110591 /media | |
parent | 5c86635f1ce78210ebb7f6de96b94a01d2ad9b7d (diff) | |
download | frameworks_av-8b63533e6aaff121378878998925c57dbe9a9e16.zip frameworks_av-8b63533e6aaff121378878998925c57dbe9a9e16.tar.gz frameworks_av-8b63533e6aaff121378878998925c57dbe9a9e16.tar.bz2 |
nuplayer: Has video hint for offload
Send a hint indicating whether the clip being played has a video stream
from NuPlayer to NuPlayerDecoderPassThrough. This hint is used to open the audio
sink with the correct offload config. Currently, NuPlayerDecoderPassthrough
always calls openAudioSink with hasVideo set to false causing an unnecessary
recreation of AudioTrack.
Change-Id: I7bc6c73818b65f9237a6e606721b7d48e1d807b9
CRs-Fixed: 811510
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index f4d3794..2f9f33c 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1239,6 +1239,8 @@ status_t NuPlayer::instantiateDecoder(bool audio, sp<DecoderBase> *decoder) { notify->setInt32("generation", mAudioDecoderGeneration); if (mOffloadAudio) { + const bool hasVideo = (mSource->getFormat(false /*audio */) != NULL); + format->setInt32("has-video", hasVideo); *decoder = new DecoderPassThrough(notify, mSource, mRenderer); } else { *decoder = new Decoder(notify, mSource, mRenderer); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp index 29b4c26..563de5e 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp @@ -74,11 +74,14 @@ void NuPlayer::DecoderPassThrough::onConfigure(const sp<AMessage> &format) { onRequestInputBuffers(); + int32_t hasVideo = 0; + format->findInt32("has-video", &hasVideo); + // 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. status_t err = mRenderer->openAudioSink( - format, true /* offloadOnly */, false /* hasVideo */, + format, true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE /* flags */, NULL /* isOffloaded */); if (err != OK) { handleError(err); |