summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvivek mehta <mvivek@codeaurora.org>2013-02-12 16:41:00 -0800
committerSteve Kondik <shade@chemlab.org>2013-02-19 11:15:13 -0800
commit1bf291a765608ea51db743389e01e98d9a5a8bf8 (patch)
treec29cd5d18f8acf2c1d351060d62c5822ee50ab7a
parent390e2b19c3bdbacfdf59afdbad1a6818c5f1ed0c (diff)
downloadframeworks_av-1bf291a765608ea51db743389e01e98d9a5a8bf8.zip
frameworks_av-1bf291a765608ea51db743389e01e98d9a5a8bf8.tar.gz
frameworks_av-1bf291a765608ea51db743389e01e98d9a5a8bf8.tar.bz2
libstagefright: Check for duration > 0 to avoid DivideByZero crash
- duration = 0 can cause divide by zero and for this clip duration is indiacted as 0. - check for duration > 0 rather than duration >= 0 Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6 CRs-Fixed: 451855
-rw-r--r--media/libstagefright/AwesomePlayer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 7d077f5..6dc18f8 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -638,7 +638,7 @@ void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) {
bool AwesomePlayer::getBitrate(int64_t *bitrate) {
off64_t size;
- if (mDurationUs >= 0 && mCachedSource != NULL
+ if (mDurationUs > 0 && mCachedSource != NULL
&& mCachedSource->getSize(&size) == OK) {
*bitrate = size * 8000000ll / mDurationUs; // in bits/sec
return true;