use dedicated looper for GenericSource

- handle setVideoSurface in deferred action, and return
  to client immediately

- handle GenericSource's prepareAsync on its own looper,
  instead of sharing looper with NuPlayer

- let HTTPLiveSource share looper with LiveSession, instead
  of NuPlayer

- remove reflector in RTSPSource

Bug: 16892748
Change-Id: I1aed557320052012065f5a90adbcb03c238da988
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
index c713d39..a003c81 100644
--- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
@@ -62,17 +62,24 @@
 NuPlayer::HTTPLiveSource::~HTTPLiveSource() {
     if (mLiveSession != NULL) {
         mLiveSession->disconnect();
-        mLiveSession.clear();
 
+        mLiveLooper->unregisterHandler(mLiveSession->id());
+        mLiveLooper->unregisterHandler(id());
         mLiveLooper->stop();
+
+        mLiveSession.clear();
         mLiveLooper.clear();
     }
 }
 
 void NuPlayer::HTTPLiveSource::prepareAsync() {
-    mLiveLooper = new ALooper;
-    mLiveLooper->setName("http live");
-    mLiveLooper->start();
+    if (mLiveLooper == NULL) {
+        mLiveLooper = new ALooper;
+        mLiveLooper->setName("http live");
+        mLiveLooper->start();
+
+        mLiveLooper->registerHandler(this);
+    }
 
     sp<AMessage> notify = new AMessage(kWhatSessionNotify, id());