summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-29 03:48:19 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-29 05:03:24 -0800
commit8ca3dfd881424650951d1d72ee8809367b1c3d96 (patch)
treefe31c282698cab6797ec97e245f3abbe6c55817f /media/libmediaplayerservice
parentb19f3604b0abc7d3b835acb11c8dbc37fee8fe3d (diff)
downloadframeworks_av-8ca3dfd881424650951d1d72ee8809367b1c3d96.zip
frameworks_av-8ca3dfd881424650951d1d72ee8809367b1c3d96.tar.gz
frameworks_av-8ca3dfd881424650951d1d72ee8809367b1c3d96.tar.bz2
nuplayer: Enable PCM offload for any source
* Use the raw PCM format to perform the early open of the audio sink. This ensures that the renderer will do the same. * Fill in stubs for timestamp and position calculation. This fixes underruns and other issues. Change-Id: I8d761e523194cc12f387b4b2aa1594536e56da01
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index ee63a6e..c87208c 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1488,16 +1488,22 @@ void NuPlayer::postScanSources() {
void NuPlayer::tryOpenAudioSinkForOffload(const sp<AMessage> &format, bool hasVideo) {
// Note: This is called early in NuPlayer to determine whether offloading
// is possible; otherwise the decoders call the renderer openAudioSink directly.
-
+ sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */);
+ sp<AMessage> pcmFormat;
+ if (mOffloadDecodedPCM) {
+ sp<MetaData> pcm = AVNuUtils::get()->createPCMMetaFromSource(audioMeta);
+ audioMeta = pcm;
+ convertMetaDataToMessage(pcm, &pcmFormat);
+ }
status_t err = mRenderer->openAudioSink(
- format, true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE, &mOffloadAudio, mSource->isStreaming());
+ mOffloadDecodedPCM ? pcmFormat : format,
+ true /* offloadOnly */, hasVideo, AUDIO_OUTPUT_FLAG_NONE,
+ &mOffloadAudio, mSource->isStreaming());
if (err != OK) {
// Any failure we turn off mOffloadAudio.
mOffloadAudio = false;
mOffloadDecodedPCM = false;
} else if (mOffloadAudio) {
- sp<MetaData> audioMeta =
- mSource->getFormatMeta(true /* audio */);
sendMetaDataToHal(mAudioSink, audioMeta);
}
}