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
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 @@
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);