From 7c5abbb0e1b20df4b265a08a8560899f637f9b44 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Mon, 15 Apr 2013 12:06:18 -0700 Subject: Fix AAC decoder reconfiguration The recent flush() changed made the codec behave differently after a reconfigure. Now we reset its state properly again. b/8543366 Change-Id: I8807b5ab02249b43fc1cf315d4e8d4ceb3f9b298 --- media/libstagefright/codecs/aacdec/SoftAAC2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp index 8ba2afb..536cfde 100644 --- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp +++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp @@ -592,6 +592,12 @@ void SoftAAC2::drainDecoder() { void SoftAAC2::onReset() { drainDecoder(); + // reset the "configured" state + mInputBufferCount = 0; + mNumSamplesOutput = 0; + // To make the codec behave the same before and after a reset, we need to invalidate the + // streaminfo struct. This does that: + mStreamInfo->sampleRate = 0; } void SoftAAC2::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) { -- cgit v1.1