Merge change I729c3938 into eclair-mr2

* changes:
  Insert a small delay after submitting to surface flinger and before returning the buffer to the decoder.
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index e19830b..ff7e34a 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -90,7 +90,6 @@
         kRequiresFlushCompleteEmulation      = 16,
         kRequiresAllocateBufferOnOutputPorts = 32,
         kRequiresFlushBeforeShutdown         = 64,
-        kAlwaysAllocateOutputWithPadding     = 128,
     };
 
     struct BufferInfo {
diff --git a/include/private/ui/SharedBufferStack.h b/include/private/ui/SharedBufferStack.h
index f6824d9..bbc1822 100644
--- a/include/private/ui/SharedBufferStack.h
+++ b/include/private/ui/SharedBufferStack.h
@@ -289,6 +289,7 @@
     void setStatus(status_t status);
     status_t reallocate();
     status_t assertReallocate(int buffer);
+    int32_t getQueuedCount() const;
     
     Region getDirtyRegion(int buffer) const;
 
diff --git a/include/private/ui/SurfaceFlingerSynchro.h b/include/private/ui/SurfaceFlingerSynchro.h
deleted file mode 100644
index 7386d33..0000000
--- a/include/private/ui/SurfaceFlingerSynchro.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef ANDROID_SURFACE_FLINGER_SYNCHRO_H
-#define ANDROID_SURFACE_FLINGER_SYNCHRO_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <utils/Errors.h>
-#include <ui/ISurfaceComposer.h>
-
-namespace android {
-
-class SurfaceFlinger;
-
-class SurfaceFlingerSynchro
-{
-public:
-                // client constructor
-                SurfaceFlingerSynchro(const sp<ISurfaceComposer>& flinger);
-                ~SurfaceFlingerSynchro();
-    
-                // signal surfaceflinger for some work
-    status_t    signal();
-    
-private:
-    friend class SurfaceFlinger;
-    sp<ISurfaceComposer> mSurfaceComposer;
-};
-
-}; // namespace android
-
-#endif // ANDROID_SURFACE_FLINGER_SYNCHRO_H
-
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 26c6a9e..cd9c991 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -219,11 +219,6 @@
     if (!strcmp(componentName, "OMX.TI.AAC.decode")) {
         quirks |= kNeedsFlushBeforeDisable;
         quirks |= kRequiresFlushCompleteEmulation;
-
-        // The following is currently necessary for proper shutdown
-        // behaviour, but NOT enabled by default in order to make the
-        // bug reproducible...
-        // quirks |= kRequiresFlushBeforeShutdown;
     }
     if (!strncmp(componentName, "OMX.qcom.video.encoder.", 23)) {
         quirks |= kRequiresLoadedToIdleAfterAllocation;
@@ -245,15 +240,6 @@
         quirks |= kRequiresAllocateBufferOnOutputPorts;
     }
 
-    if (!strcmp(componentName, "OMX.qcom.video.decoder.avc")) {
-        // This decoder misreports the required output buffer size if
-        // the content in question is not a multiple-16 width/height.
-
-        // XXX Not enabled by default to make the bug reproducible by
-        // the vendor.
-        // quirks |= kAlwaysAllocateOutputWithPadding;
-    }
-
     sp<OMXCodec> codec = new OMXCodec(
             omx, node, quirks, createEncoder, mime, componentName,
             source);
@@ -848,25 +834,6 @@
         return err;
     }
 
-    if ((portIndex == kPortIndexOutput)
-            && (mQuirks & kAlwaysAllocateOutputWithPadding)) {
-        CHECK_EQ(def.eDomain, OMX_PortDomainVideo);
-        const OMX_VIDEO_PORTDEFINITIONTYPE *videoDef = &def.format.video;
-        CHECK_EQ(videoDef->eColorFormat, OMX_QCOM_COLOR_FormatYVU420SemiPlanar);
-
-        OMX_U32 width = (videoDef->nFrameWidth + 15) & ~0x0f;
-        OMX_U32 height = (videoDef->nFrameHeight + 15) & ~0x0f;
-
-        size_t newBufferSize = (width * height * 3) / 2;
-        CHECK(newBufferSize >= def.nBufferSize);
-        if (newBufferSize > def.nBufferSize) {
-            CODEC_LOGV("Rounding up output buffersize from %ld to %ld "
-                       "to accomodate multiple-of-16 alignment.",
-                       def.nBufferSize, newBufferSize);
-        }
-        def.nBufferSize = newBufferSize;
-    }
-
     size_t totalSize = def.nBufferCountActual * def.nBufferSize;
     mDealer[portIndex] = new MemoryDealer(totalSize);