Revert "mm-video-v4l2: vidc: venc: Update color conversion decision"

This reverts commit d265a5dd03b00d726dfad5ccaa0e95939ef7ab91.

Update color-conversion flag only if there is an update in
color-format. Updating the flag unconditionally from client thread
will cause message thread to read inconsistent values.
Also, Gralloc handle in ETB is valid only when the filled Len is non zero.
Hence, verifying color format and updating color conversion variable
only if buffer has valid handle.

Bug: 24015376
Change-Id: Ib7e097c45503dc01dd65283950b3dc0c187f1b96
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 51fc3bc..7f0482f 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -4571,11 +4571,14 @@
         handle = (private_handle_t *)media_buffer->meta_handle;
     }
 
-    /*Enable following code once private handle color format is
-      updated correctly*/
-    mUsesColorConversion = true;
-
     if (buffer->nFilledLen > 0 && handle) {
+        /*Enable following code once private handle color format is
+            updated correctly*/
+        if (handle->format == HAL_PIXEL_FORMAT_RGBA_8888)
+            mUsesColorConversion = true;
+        else
+            mUsesColorConversion = false;
+
         if (c2d_opened && handle->format != c2d_conv.get_src_format()) {
             c2d_conv.close();
             c2d_opened = false;
@@ -4597,12 +4600,10 @@
                 if (!dev_set_format(handle->format))
                     DEBUG_PRINT_ERROR("cannot set color format for RGBA8888");
 #endif
-            } else if (handle->format == HAL_PIXEL_FORMAT_NV12_ENCODEABLE &&
-                    handle->format != QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m) {
-                mUsesColorConversion = false;
-            } else {
+            } else if (handle->format != HAL_PIXEL_FORMAT_NV12_ENCODEABLE &&
+                    handle->format != QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m &&
+                    handle->format != QOMX_COLOR_FormatYVU420SemiPlanar) {
                 DEBUG_PRINT_ERROR("Incorrect color format");
-                mUsesColorConversion = false;
                 m_pCallbacks.EmptyBufferDone(hComp,m_app_data,buffer);
                 return OMX_ErrorBadParameter;
             }