am f23f7257: Merge "Fix for 5477832 Movie Studio crash when trying to import the attached h263 file." into ics-mr0

* commit 'f23f725773de1eb394655e657cd12f95f6250b3d':
  Fix for 5477832 Movie Studio crash when trying to import the attached h263 file.
diff --git a/lvpp/PreviewPlayer.cpp b/lvpp/PreviewPlayer.cpp
index 1330c7f..349e9c2 100755
--- a/lvpp/PreviewPlayer.cpp
+++ b/lvpp/PreviewPlayer.cpp
@@ -21,7 +21,6 @@
 
 #include <dlfcn.h>
 
-#include "include/ARTSPController.h"
 #include "PreviewPlayer.h"
 #include "DummyAudioSource.h"
 #include "DummyVideoSource.h"
diff --git a/lvpp/PreviewPlayerBase.cpp b/lvpp/PreviewPlayerBase.cpp
index 3f75fb9..aed26ef 100644
--- a/lvpp/PreviewPlayerBase.cpp
+++ b/lvpp/PreviewPlayerBase.cpp
@@ -22,7 +22,6 @@
 
 #include <dlfcn.h>
 
-#include "include/ARTSPController.h"
 #include "PreviewPlayerBase.h"
 #include "AudioPlayerBase.h"
 #include "include/SoftwareRenderer.h"
@@ -49,9 +48,6 @@
 #include <gui/SurfaceTextureClient.h>
 #include <surfaceflinger/ISurfaceComposer.h>
 
-#include <media/stagefright/foundation/ALooper.h>
-#include <media/stagefright/foundation/AMessage.h>
-
 #include <cutils/properties.h>
 
 #define USE_SURFACE_ALLOC 1
@@ -60,7 +56,6 @@
 
 static int64_t kLowWaterMarkUs = 2000000ll;  // 2secs
 static int64_t kHighWaterMarkUs = 10000000ll;  // 10secs
-static int64_t kHighWaterMarkRTSPUs = 4000000ll;  // 4secs
 static const size_t kLowWaterMarkBytes = 40000;
 static const size_t kHighWaterMarkBytes = 200000;
 
@@ -429,9 +424,6 @@
         if (mConnectingDataSource != NULL) {
             LOGI("interrupting the connection process");
             mConnectingDataSource->disconnect();
-        } else if (mConnectingRTSPController != NULL) {
-            LOGI("interrupting the connection process");
-            mConnectingRTSPController->disconnect();
         }
 
         if (mFlags & PREPARING_CONNECTED) {
@@ -471,11 +463,6 @@
 
     mVideoRenderer.clear();
 
-    if (mRTSPController != NULL) {
-        mRTSPController->disconnect();
-        mRTSPController.clear();
-    }
-
     if (mVideoSource != NULL) {
         shutdownVideoDecoder_l();
     }
@@ -531,10 +518,7 @@
 bool PreviewPlayerBase::getCachedDuration_l(int64_t *durationUs, bool *eos) {
     int64_t bitrate;
 
-    if (mRTSPController != NULL) {
-        *durationUs = mRTSPController->getQueueDurationUs(eos);
-        return true;
-    } else if (mCachedSource != NULL && getBitrate(&bitrate)) {
+    if (mCachedSource != NULL && getBitrate(&bitrate)) {
         status_t finalStatus;
         size_t cachedDataRemaining = mCachedSource->approxDataRemaining(&finalStatus);
         *durationUs = cachedDataRemaining * 8000000ll / bitrate;
@@ -640,9 +624,6 @@
         LOGV("cachedDurationUs = %.2f secs, eos=%d",
              cachedDurationUs / 1E6, eos);
 
-        int64_t highWaterMarkUs =
-            (mRTSPController != NULL) ? kHighWaterMarkRTSPUs : kHighWaterMarkUs;
-
         if ((mFlags & PLAYING) && !eos
                 && (cachedDurationUs < kLowWaterMarkUs)) {
             LOGI("cache is running low (%.2f secs) , pausing.",
@@ -651,7 +632,7 @@
             pause_l();
             ensureCacheIsFetching_l();
             notifyListener_l(MEDIA_INFO, MEDIA_INFO_BUFFERING_START);
-        } else if (eos || cachedDurationUs > highWaterMarkUs) {
+        } else if (eos || cachedDurationUs > kHighWaterMarkUs) {
             if (mFlags & CACHE_UNDERRUN) {
                 LOGI("cache has filled up (%.2f secs), resuming.",
                      cachedDurationUs / 1E6);
@@ -1099,10 +1080,7 @@
 }
 
 status_t PreviewPlayerBase::getPosition(int64_t *positionUs) {
-    if (mRTSPController != NULL) {
-        *positionUs = mRTSPController->getNormalPlayTimeUs();
-    }
-    else if (mSeeking != NO_SEEK) {
+    if (mSeeking != NO_SEEK) {
         *positionUs = mSeekTimeUs;
     } else if (mVideoSource != NULL
             && (mAudioPlayer == NULL || !(mFlags & VIDEO_AT_EOS))) {
@@ -1126,22 +1104,7 @@
     return OK;
 }
 
-// static
-void PreviewPlayerBase::OnRTSPSeekDoneWrapper(void *cookie) {
-    static_cast<PreviewPlayerBase *>(cookie)->onRTSPSeekDone();
-}
-
-void PreviewPlayerBase::onRTSPSeekDone() {
-    notifyListener_l(MEDIA_SEEK_COMPLETE);
-    mSeekNotificationSent = true;
-}
-
 status_t PreviewPlayerBase::seekTo_l(int64_t timeUs) {
-    if (mRTSPController != NULL) {
-        mRTSPController->seekAsync(timeUs, OnRTSPSeekDoneWrapper, this);
-        return OK;
-    }
-
     if (mFlags & CACHE_UNDERRUN) {
         mFlags &= ~CACHE_UNDERRUN;
         play_l();
@@ -1510,7 +1473,6 @@
         int64_t latenessUs = nowUs - timeUs;
 
         if (latenessUs > 500000ll
-                && mRTSPController == NULL
                 && mAudioPlayer != NULL
                 && mAudioPlayer->getMediaTimeMapping(
                     &realTimeUs, &mediaTimeUs)) {
@@ -1765,30 +1727,6 @@
             LOGI("Prepare cancelled while waiting for initial cache fill.");
             return UNKNOWN_ERROR;
         }
-    } else if (!strncasecmp("rtsp://", mUri.string(), 7)) {
-        if (mLooper == NULL) {
-            mLooper = new ALooper;
-            mLooper->setName("rtsp");
-            mLooper->start();
-        }
-        mRTSPController = new ARTSPController(mLooper);
-        mConnectingRTSPController = mRTSPController;
-
-        mLock.unlock();
-        status_t err = mRTSPController->connect(mUri.string());
-        mLock.lock();
-
-        mConnectingRTSPController.clear();
-
-        LOGI("ARTSPController::connect returned %d", err);
-
-        if (err != OK) {
-            mRTSPController.clear();
-            return err;
-        }
-
-        sp<MediaExtractor> extractor = mRTSPController.get();
-        return setDataSource_l(extractor);
     } else {
         dataSource = DataSource::CreateFromURI(mUri.string(), &mUriHeaders);
     }
@@ -1873,7 +1811,7 @@
 
     mFlags |= PREPARING_CONNECTED;
 
-    if (mCachedSource != NULL || mRTSPController != NULL) {
+    if (mCachedSource != NULL) {
         postBufferingEvent_l();
     } else {
         finishAsyncPrepare_l();
diff --git a/lvpp/PreviewPlayerBase.h b/lvpp/PreviewPlayerBase.h
index 954d8fc..bb5c3d3 100644
--- a/lvpp/PreviewPlayerBase.h
+++ b/lvpp/PreviewPlayerBase.h
@@ -39,9 +39,6 @@
 struct NuCachedSource2;
 struct ISurfaceTexture;
 
-struct ALooper;
-struct ARTSPController;
-
 class DrmManagerClinet;
 class DecryptHandle;
 
@@ -215,10 +212,6 @@
     sp<HTTPBase> mConnectingDataSource;
     sp<NuCachedSource2> mCachedSource;
 
-    sp<ALooper> mLooper;
-    sp<ARTSPController> mRTSPController;
-    sp<ARTSPController> mConnectingRTSPController;
-
     DrmManagerClient *mDrmManagerClient;
     sp<DecryptHandle> mDecryptHandle;
 
@@ -266,9 +259,6 @@
 
     static bool ContinuePreparation(void *cookie);
 
-    static void OnRTSPSeekDoneWrapper(void *cookie);
-    void onRTSPSeekDone();
-
     bool getBitrate(int64_t *bitrate);
 
     void finishSeekIfNecessary(int64_t videoTimeUs);