Remove legacy omx_message variables

Remove platform_private and data_ptr from omx_message.
These were used for legacy deferred buffer creation.
See OMXCodec quirks: kDefersOutputBufferAllocation and
kRequiresAllocateBufferOnOutputPorts.

Change-Id: I94da56bc64f3b46ee1276e93d67b36c1662e2eaf
Signed-off-by: Andy Hung <hunga@google.com>
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index f6f9e7a..176f72d 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -184,8 +184,6 @@
             OMX_U32 range_length;
             OMX_U32 flags;
             OMX_TICKS timestamp;
-            OMX_PTR platform_private;
-            OMX_PTR data_ptr;
         } extended_buffer_data;
 
     } u;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 5bca317..537d9de 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -100,12 +100,6 @@
                 msg->setInt64(
                         "timestamp",
                         omx_msg.u.extended_buffer_data.timestamp);
-                msg->setPointer(
-                        "platform_private",
-                        omx_msg.u.extended_buffer_data.platform_private);
-                msg->setPointer(
-                        "data_ptr",
-                        omx_msg.u.extended_buffer_data.data_ptr);
                 break;
             }
 
@@ -160,9 +154,7 @@
             IOMX::buffer_id bufferID,
             size_t rangeOffset, size_t rangeLength,
             OMX_U32 flags,
-            int64_t timeUs,
-            void *platformPrivate,
-            void *dataPtr);
+            int64_t timeUs);
 
     void getMoreInputDataIfPossible();
 
@@ -3228,23 +3220,17 @@
 
             int32_t rangeOffset, rangeLength, flags;
             int64_t timeUs;
-            void *platformPrivate;
-            void *dataPtr;
 
             CHECK(msg->findInt32("range_offset", &rangeOffset));
             CHECK(msg->findInt32("range_length", &rangeLength));
             CHECK(msg->findInt32("flags", &flags));
             CHECK(msg->findInt64("timestamp", &timeUs));
-            CHECK(msg->findPointer("platform_private", &platformPrivate));
-            CHECK(msg->findPointer("data_ptr", &dataPtr));
 
             return onOMXFillBufferDone(
                     bufferID,
                     (size_t)rangeOffset, (size_t)rangeLength,
                     (OMX_U32)flags,
-                    timeUs,
-                    platformPrivate,
-                    dataPtr);
+                    timeUs);
         }
 
         default:
@@ -3543,9 +3529,7 @@
         IOMX::buffer_id bufferID,
         size_t rangeOffset, size_t rangeLength,
         OMX_U32 flags,
-        int64_t timeUs,
-        void * /* platformPrivate */,
-        void * /* dataPtr */) {
+        int64_t timeUs) {
     ALOGV("[%s] onOMXFillBufferDone %p time %lld us, flags = 0x%08lx",
          mCodec->mComponentName.c_str(), bufferID, timeUs, flags);
 
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index a879656..9a7f3db 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1627,15 +1627,15 @@
         info.mMediaBuffer = NULL;
 
         if (portIndex == kPortIndexOutput) {
-            if (!(mOMXLivesLocally
-                        && (mQuirks & kRequiresAllocateBufferOnOutputPorts)
-                        && (mQuirks & kDefersOutputBufferAllocation))) {
-                // If the node does not fill in the buffer ptr at this time,
-                // we will defer creating the MediaBuffer until receiving
-                // the first FILL_BUFFER_DONE notification instead.
-                info.mMediaBuffer = new MediaBuffer(info.mData, info.mSize);
-                info.mMediaBuffer->setObserver(this);
-            }
+            // Fail deferred MediaBuffer creation until FILL_BUFFER_DONE;
+            // this legacy mode is no longer supported.
+            LOG_ALWAYS_FATAL_IF((mOMXLivesLocally
+                    && (mQuirks & kRequiresAllocateBufferOnOutputPorts)
+                    && (mQuirks & kDefersOutputBufferAllocation)),
+                    "allocateBuffersOnPort cannot defer buffer allocation");
+
+            info.mMediaBuffer = new MediaBuffer(info.mData, info.mSize);
+            info.mMediaBuffer->setObserver(this);
         }
 
         mPortBuffers[portIndex].push(info);
@@ -2234,22 +2234,6 @@
             } else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) {
                 CHECK_EQ((int)mPortStatus[kPortIndexOutput], (int)ENABLED);
 
-                if (info->mMediaBuffer == NULL) {
-                    CHECK(mOMXLivesLocally);
-                    CHECK(mQuirks & kRequiresAllocateBufferOnOutputPorts);
-                    CHECK(mQuirks & kDefersOutputBufferAllocation);
-
-                    // The qcom video decoders on Nexus don't actually allocate
-                    // output buffer memory on a call to OMX_AllocateBuffer
-                    // the "pBuffer" member of the OMX_BUFFERHEADERTYPE
-                    // structure is only filled in later.
-
-                    info->mMediaBuffer = new MediaBuffer(
-                            msg.u.extended_buffer_data.data_ptr,
-                            info->mSize);
-                    info->mMediaBuffer->setObserver(this);
-                }
-
                 MediaBuffer *buffer = info->mMediaBuffer;
                 bool isGraphicBuffer = buffer->graphicBuffer() != NULL;
 
@@ -2285,10 +2269,6 @@
                 }
 
                 buffer->meta_data()->setPointer(
-                        kKeyPlatformPrivate,
-                        msg.u.extended_buffer_data.platform_private);
-
-                buffer->meta_data()->setPointer(
                         kKeyBufferID,
                         msg.u.extended_buffer_data.buffer);
 
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 74076c6..b62d5f5 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -470,8 +470,6 @@
     msg.u.extended_buffer_data.range_length = pBuffer->nFilledLen;
     msg.u.extended_buffer_data.flags = pBuffer->nFlags;
     msg.u.extended_buffer_data.timestamp = pBuffer->nTimeStamp;
-    msg.u.extended_buffer_data.platform_private = pBuffer->pPlatformPrivate;
-    msg.u.extended_buffer_data.data_ptr = pBuffer->pBuffer;
 
     findDispatcher(node)->post(msg);