From 8b71241ce7353731ab75322c46e090ee35014a33 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 27 Apr 2012 09:33:24 -0700 Subject: Fix mono gapless playback for decoders that output stereo The old AAC decoder always outputs stereo, even for mono source material, so we need to use the number of channels of the output when calculating the number of bytes to skip, not the number of channels in the source. This makes OMXCodec skip the right amount of data, and prevents NuPlayer from writing half a frame and then asserting when the AudioSink doesn't accept it. Also move use of the SkipCutBuffer from NuPlayer to ACodec, so that it also works when using the new Java APIs, and make SkipCutBuffer derive from RefBase. b/774846 Change-Id: I34df9fea3e6730617eae559afaa556f4085ef0a0 --- media/libstagefright/NuMediaExtractor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'media/libstagefright/NuMediaExtractor.cpp') diff --git a/media/libstagefright/NuMediaExtractor.cpp b/media/libstagefright/NuMediaExtractor.cpp index 78b2469..d6075cd 100644 --- a/media/libstagefright/NuMediaExtractor.cpp +++ b/media/libstagefright/NuMediaExtractor.cpp @@ -220,6 +220,15 @@ status_t NuMediaExtractor::getTrackFormat( msg->setInt32("channel-count", numChannels); msg->setInt32("sample-rate", sampleRate); + int32_t delay = 0; + if (meta->findInt32(kKeyEncoderDelay, &delay)) { + msg->setInt32("encoder-delay", delay); + } + int32_t padding = 0; + if (meta->findInt32(kKeyEncoderPadding, &padding)) { + msg->setInt32("encoder-padding", padding); + } + int32_t isADTS; if (meta->findInt32(kKeyIsADTS, &isADTS)) { msg->setInt32("is-adts", true); -- cgit v1.1