DO NOT MERGE ANYWHERE Revert "fix possible overflow in effect wrappers." am: 9cebd7cfba  -s ours am: cf2f811d75  -s ours am: a1cba19136  -s ours
am: 62e7493876  -s ours

* commit '62e7493876a9b8db0a4e1930ce24d3f1a8f32cb8':
  DO NOT MERGE ANYWHERE Revert "fix possible overflow in effect wrappers."
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 15506ef..3cd0b0e 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -65,8 +65,6 @@
 
 #define USE_SURFACE_ALLOC 1
 #define FRAME_DROP_FREQ 0
-#define PROPERTY_OFFLOAD_HIWATERMARK "audio.offload.hiwatermark"
-#define PROPERTY_OFFLOAD_LOWATERMARK "audio.offload.lowatermark"
 
 namespace android {
 
@@ -74,8 +72,7 @@
 static int64_t kHighWaterMarkUs = 5000000ll;  // 5secs
 static const size_t kLowWaterMarkBytes = 40000;
 static const size_t kHighWaterMarkBytes = 200000;
-static size_t kOffloadLowWaterMarkBytes = kLowWaterMarkBytes;
-static size_t kOffloadHighWaterMarkBytes = kHighWaterMarkBytes;
+
 // maximum time in paused state when offloading audio decompression. When elapsed, the AudioPlayer
 // is destroyed to allow the audio DSP to power down.
 static int64_t kOffloadPauseMaxUs = 10000000ll;
@@ -641,11 +638,6 @@
 
     mMediaRenderingStartGeneration = 0;
     mStartGeneration = 0;
-
-    kOffloadLowWaterMarkBytes =
-        property_get_int32(PROPERTY_OFFLOAD_LOWATERMARK, kLowWaterMarkBytes);
-    kOffloadHighWaterMarkBytes =
-        property_get_int32(PROPERTY_OFFLOAD_HIWATERMARK, kHighWaterMarkBytes);
 }
 
 void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) {
@@ -736,7 +728,6 @@
         size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
         bool eos = (finalStatus != OK);
 
-        ALOGV("cachedDataRemaining = %zu b, eos=%d", cachedDataRemaining, eos);
         if (eos) {
             if (finalStatus == ERROR_END_OF_STREAM) {
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
@@ -747,42 +738,36 @@
             }
         } else {
             bool eos2;
-            bool knownDuration = false;
             int64_t cachedDurationUs;
             if (getCachedDuration_l(&cachedDurationUs, &eos2) && mDurationUs > 0) {
-                knownDuration = true;
                 int percentage = 100.0 * (double)cachedDurationUs / mDurationUs;
                 if (percentage > 100) {
                     percentage = 100;
                 }
 
                 notifyListener_l(MEDIA_BUFFERING_UPDATE, percentage);
-            }
-            if (!knownDuration || mOffloadAudio) {
-                // If we don't know the bitrate/duration of the stream, or are offloading
-                // decode, use absolute size limits to maintain the cache.
+            } else {
+                // We don't know the bitrate/duration of the stream, use absolute size
+                // limits to maintain the cache.
 
-                size_t lowWatermark =
-                        mOffloadAudio ? kOffloadLowWaterMarkBytes : kLowWaterMarkBytes;
-                size_t highWatermark =
-                        mOffloadAudio ? kOffloadHighWaterMarkBytes : kHighWaterMarkBytes;
-
-                if ((mFlags & PLAYING) && !eos && (cachedDataRemaining < lowWatermark)) {
-                    ALOGI("cache is running low (< %zu) , pausing.", lowWatermark);
+                if ((mFlags & PLAYING) && !eos
+                        && (cachedDataRemaining < kLowWaterMarkBytes)) {
+                    ALOGI("cache is running low (< %zu) , pausing.",
+                         kLowWaterMarkBytes);
                     modifyFlags(CACHE_UNDERRUN, SET);
                     pause_l();
                     ensureCacheIsFetching_l();
                     sendCacheStats();
                     notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START);
-                } else if (eos || cachedDataRemaining > highWatermark) {
+                } else if (eos || cachedDataRemaining > kHighWaterMarkBytes) {
                     if (mFlags & CACHE_UNDERRUN) {
                         ALOGI("cache has filled up (> %zu), resuming.",
-                             highWatermark);
+                             kHighWaterMarkBytes);
                         modifyFlags(CACHE_UNDERRUN, CLEAR);
                         play_l();
                     } else if (mFlags & PREPARING) {
                         ALOGV("cache has filled up (> %zu), prepare is done",
-                             highWatermark);
+                             kHighWaterMarkBytes);
                         finishAsyncPrepare_l();
                     }
                 }
@@ -816,7 +801,7 @@
 
     int64_t cachedDurationUs;
     bool eos;
-    if (!mOffloadAudio && getCachedDuration_l(&cachedDurationUs, &eos)) {
+    if (getCachedDuration_l(&cachedDurationUs, &eos)) {
         ALOGV("cachedDurationUs = %.2f secs, eos=%d",
              cachedDurationUs / 1E6, eos);
 
@@ -843,8 +828,7 @@
         }
     }
 
-    if ( ((mFlags & PLAYING) && !eos) ||
-         (mFlags & (PREPARING | CACHE_UNDERRUN)) ) {
+    if (mFlags & (PLAYING | PREPARING | CACHE_UNDERRUN)) {
         postBufferingEvent_l();
     }
 }