summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/mp3dec
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2015-05-31 21:31:02 -0700
committerAndy Hung <hunga@google.com>2015-06-30 14:08:50 -0700
commitc015b84e5d6f5d1e116d71bfbd3bd8edc3b06511 (patch)
treeb38d79696d20027094f4ccc4d30f7e116bd26b0f /media/libstagefright/codecs/mp3dec
parentad949cd4ca52d19ea5e7a5c5dce84d1410fe5244 (diff)
downloadframeworks_av-c015b84e5d6f5d1e116d71bfbd3bd8edc3b06511.zip
frameworks_av-c015b84e5d6f5d1e116d71bfbd3bd8edc3b06511.tar.gz
frameworks_av-c015b84e5d6f5d1e116d71bfbd3bd8edc3b06511.tar.bz2
Fix SoftMP3 divide by 0
Bug: 21525346 Change-Id: I19f1ec0f4e9571bd6aeb26efbcba5f16dc664e47
Diffstat (limited to 'media/libstagefright/codecs/mp3dec')
-rw-r--r--media/libstagefright/codecs/mp3dec/SoftMP3.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index 5396022..f743b1c 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -283,6 +283,11 @@ void SoftMP3::onQueueFilled(OMX_U32 /* portIndex */) {
} else {
// This is recoverable, just ignore the current frame and
// play silence instead.
+
+ // TODO: should we skip silence (and consume input data)
+ // if mIsFirst is true as we may not have a valid
+ // mConfig->samplingRate and mConfig->num_channels?
+ ALOGV_IF(mIsFirst, "insufficient data for first frame, sending silence");
memset(outHeader->pBuffer,
0,
mConfig->outputFrameSize * sizeof(int16_t));
@@ -317,8 +322,7 @@ void SoftMP3::onQueueFilled(OMX_U32 /* portIndex */) {
}
outHeader->nTimeStamp =
- mAnchorTimeUs
- + (mNumFramesOutput * 1000000ll) / mConfig->samplingRate;
+ mAnchorTimeUs + (mNumFramesOutput * 1000000ll) / mSamplingRate;
if (inHeader) {
CHECK_GE(inHeader->nFilledLen, mConfig->inputBufferUsedLength);