Merge "Make sure to finish the preparation phase even EOS occurs before we consider the cache to be completely filled up." into gingerbread
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 3975866..040e27d 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -484,6 +484,10 @@
 
         if (eos) {
             notifyListener_l(MEDIA_BUFFERING_UPDATE, 100);
+            if (mFlags & PREPARING) {
+                LOGV("cache has reached EOS, prepare is done.");
+                finishAsyncPrepare_l();
+            }
         } else {
             off_t size;
             if (mDurationUs >= 0 && mCachedSource->getSize(&size) == OK) {