Merge cherrypicks of [4714135, 4714136, 4714137, 4714216, 4714295, 4714354, 4714355, 4714296, 4714297, 4714298, 4714299, 4714300, 4714301, 4714302, 4714374, 4714375, 4714356, 4714394, 4714395, 4714396] into pi-dr1-release

Change-Id: I09f0782bc1ca0186bec5d70a99487a85a647c73f
diff --git a/media/sfplugin/CCodec.cpp b/media/sfplugin/CCodec.cpp
index 0f86a2b..04df714 100644
--- a/media/sfplugin/CCodec.cpp
+++ b/media/sfplugin/CCodec.cpp
@@ -1400,7 +1400,7 @@
         }
         case kWhatConfigure: {
             // C2Component::commit_sm() should return within 5ms.
-            setDeadline(now, 50ms, "configure");
+            setDeadline(now, 250ms, "configure");
             sp<AMessage> format;
             CHECK(msg->findMessage("format", &format));
             configure(format);
diff --git a/media/sfplugin/CCodecBufferChannel.cpp b/media/sfplugin/CCodecBufferChannel.cpp
index 786c6fd..c6720f2 100644
--- a/media/sfplugin/CCodecBufferChannel.cpp
+++ b/media/sfplugin/CCodecBufferChannel.cpp
@@ -1287,6 +1287,11 @@
     int64_t timeUs;
     CHECK(buffer->meta()->findInt64("timeUs", &timeUs));
 
+    if (mInputMetEos) {
+        ALOGD("[%s] buffers after EOS ignored (%lld us)", mName, (long long)timeUs);
+        return OK;
+    }
+
     int32_t flags = 0;
     int32_t tmp = 0;
     bool eos = false;