Merge "Don't allow using or allocating a buffer after the first state transition" into klp-dev am: 922ad6183e am: 0893c50bcf
am: 59bc7f77f8

Change-Id: I133f8566b649821e06cfb21a95b20f84eb839219
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 926557b..7345ced 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -651,6 +651,12 @@
     // We do not support metadata mode changes past buffer allocation
     mSailed = true;
 
+    if (!mSailed) {
+        ALOGE("b/35467458");
+        android_errorWriteLog(0x534e4554, "35467458");
+        return BAD_VALUE;
+    }
+
     // metadata buffers are not connected cross process
     BufferMeta *buffer_meta;
     bool isMeta = mUsingMetadata[portIndex];
@@ -915,6 +921,12 @@
     // We do not support metadata mode changes past buffer allocation
     mSailed = true;
 
+    if (!mSailed) {
+        ALOGE("b/35467458");
+        android_errorWriteLog(0x534e4554, "35467458");
+        return BAD_VALUE;
+    }
+
     BufferMeta *buffer_meta = new BufferMeta(size, portIndex);
 
     OMX_BUFFERHEADERTYPE *header;
@@ -958,6 +970,12 @@
     // We do not support metadata mode changes past buffer allocation
     mSailed = true;
 
+    if (!mSailed) {
+        ALOGE("b/35467458");
+        android_errorWriteLog(0x534e4554, "35467458");
+        return BAD_VALUE;
+    }
+
     // metadata buffers are not connected cross process
     bool isMeta = mUsingMetadata[portIndex];
     bool copy = !(crossProcess && isMeta);