OSDN Git Service

libstagefright: Check for duration > 0 to avoid divide-by-zero exception
authorAjay Dudani <adudani@codeaurora.org>
Thu, 23 May 2013 05:16:33 +0000 (22:16 -0700)
committerVineeta Srivastava <vsrivastava@google.com>
Wed, 29 May 2013 00:22:36 +0000 (17:22 -0700)
Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6

media/libstagefright/AwesomePlayer.cpp

index bd28118..6c197e2 100644 (file)
@@ -597,7 +597,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;