mm-video-v4l2: vdec: Handle empty EOS buffer

Input buffer queued with EOS flag may have 0 filled-length.
Ignore checks for pBuffer-sanity and continue to signal
EOS.

Bug: 21659665

Change-Id: I2d0e09ffe37e73b1799fd41a869cdf0372277ecf
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index 81782db..643e2d9 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -4547,6 +4547,7 @@
     unsigned nBufIndex = 0;
     OMX_ERRORTYPE ret = OMX_ErrorNone;
     encoder_media_buffer_type *media_buffer;
+    private_handle_t *handle = NULL;
     DEBUG_PRINT_LOW("ETBProxyOpaque: buffer[%p]", buffer);
 
     if (buffer == NULL) {
@@ -4560,13 +4561,15 @@
         return OMX_ErrorBadParameter;
     }
     media_buffer = (encoder_media_buffer_type *)buffer->pBuffer;
-    if (!media_buffer || !media_buffer->meta_handle) {
+    if ((!media_buffer || !media_buffer->meta_handle) &&
+            !(buffer->nFlags & OMX_BUFFERFLAG_EOS)) {
         DEBUG_PRINT_ERROR("Incorrect Buffer queued media buffer = %p",
             media_buffer);
         m_pCallbacks.EmptyBufferDone(hComp, m_app_data, buffer);
         return OMX_ErrorBadParameter;
+    } else if (media_buffer) {
+        handle = (private_handle_t *)media_buffer->meta_handle;
     }
-    private_handle_t *handle = (private_handle_t *)media_buffer->meta_handle;
 
     /*Enable following code once private handle color format is
       updated correctly*/