Support "pausing" of MediaSources with the effect that they no longer pull on their upstream source until a subsequent read-with-seek.

Change-Id: Ie4153a10ab36c1135f5fcfb572958129d886bcc3
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 14682af..6be41b4 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1145,7 +1145,8 @@
       mNoMoreOutputData(false),
       mOutputPortSettingsHaveChanged(false),
       mSeekTimeUs(-1),
-      mLeftOverBuffer(NULL) {
+      mLeftOverBuffer(NULL),
+      mPaused(false) {
     mPortStatus[kPortIndexInput] = ENABLED;
     mPortStatus[kPortIndexOutput] = ENABLED;
 
@@ -1735,6 +1736,9 @@
                     CODEC_LOGV("Finished flushing both ports, now continuing from"
                          " seek-time.");
 
+                    // We implicitly resume pulling on our upstream source.
+                    mPaused = false;
+
                     drainInputBuffers();
                     fillOutputBuffers();
                 }
@@ -2034,6 +2038,10 @@
         return;
     }
 
+    if (mPaused) {
+        return;
+    }
+
     status_t err;
 
     bool signalEOS = false;
@@ -2554,6 +2562,7 @@
     mOutputPortSettingsHaveChanged = false;
     mSeekTimeUs = -1;
     mFilledBuffers.clear();
+    mPaused = false;
 
     return init();
 }
@@ -2660,6 +2669,7 @@
             // There's no reason to trigger the code below, there's
             // nothing to flush yet.
             seeking = false;
+            mPaused = false;
         }
 
         drainInputBuffers();
@@ -3220,6 +3230,14 @@
     }
 }
 
+status_t OMXCodec::pause() {
+    Mutex::Autolock autoLock(mLock);
+
+    mPaused = true;
+
+    return OK;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 
 status_t QueryCodecs(