Merge "Better diagnostics in the stagefright commandline tool, support for playing sine-tones using a filename of "sine:[samplingrate]", i.e. sine:44100. Support for playing audio through to the speakers by using "-o" in addition to "-a"." into froyo
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 2bc8139..b14a03c 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -1239,7 +1239,19 @@
     Mutex::Autolock autoLock(mLock);
 
     if (mSuspensionState != NULL) {
-        return INVALID_OPERATION;
+        if (mLastVideoBuffer == NULL) {
+            //go into here if video is suspended again
+            //after resuming without being played between
+            //them
+            SuspensionState *state = mSuspensionState;
+            mSuspensionState = NULL;
+            reset_l();
+            mSuspensionState = state;
+            return OK;
+        }
+
+        delete mSuspensionState;
+        mSuspensionState = NULL;
     }
 
     if (mFlags & PREPARING) {
@@ -1344,7 +1356,7 @@
         play_l();
     }
 
-    delete state;
+    mSuspensionState = state;
     state = NULL;
 
     return OK;
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index b9d6fbc..873c2aa 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -3040,7 +3040,7 @@
             continue;
         }
 
-        OMXCodec::setComponentRole(omx, node, queryDecoders, mime);
+        OMXCodec::setComponentRole(omx, node, !queryDecoders, mime);
 
         results->push();
         CodecCapabilities *caps = &results->editItemAt(results->size() - 1);