disable NULL checking in setUpstreamBuffer since upstream buffers may be sufaces, all informations are stored in surface.

BZ: 46678

libmix encoder shall ignore bufAttrib if upstream buffers are surfaces

Change-Id: Ib0be7dbc1a1c951fa9ca72f0f72d9209fe875fcb
Signed-off-by: Zhao Liang <leo.zhao@intel.com>
Reviewed-on: http://android.intel.com:8080/63523
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: Wang, Elaine <elaine.wang@intel.com>
Reviewed-by: Tao, Tao Q <tao.q.tao@intel.com>
Reviewed-by: Feng, Wei <wei.feng@intel.com>
Reviewed-by: Wang, Lili A <lili.a.wang@intel.com>
Reviewed-by: Shi, PingX <pingx.shi@intel.com>
Tested-by: Shi, PingX <pingx.shi@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/videoencoder/VideoEncoderBase.cpp b/videoencoder/VideoEncoderBase.cpp
index 91f9331..5af1aaa 100644
--- a/videoencoder/VideoEncoderBase.cpp
+++ b/videoencoder/VideoEncoderBase.cpp
@@ -1428,11 +1428,6 @@
         return ENCODE_FAIL;
     }
 
-    if (upStreamBuffer->bufAttrib == NULL) {
-        LOG_E ("Buffer Attrib doesn't set by client, return error");
-        return ENCODE_INVALID_PARAMS;
-    }
-
     for(unsigned int i=0; i < upStreamBuffer->bufCnt; i++) {
         if (findSurfaceMapByValue(mSrcSurfaceMapList, upStreamBuffer->bufList[i]) != NULL)  //already mapped
             continue;
@@ -1445,11 +1440,13 @@
         map->vinfo.mode = (MemMode)upStreamBuffer->bufferMode;
         map->vinfo.handle = (uint32_t)upStreamBuffer->display;
         map->vinfo.size = 0;
-        map->vinfo.width = upStreamBuffer->bufAttrib->realWidth;
-        map->vinfo.height = upStreamBuffer->bufAttrib->realHeight;
-        map->vinfo.lumaStride = upStreamBuffer->bufAttrib->lumaStride;
-        map->vinfo.chromStride = upStreamBuffer->bufAttrib->chromStride;
-        map->vinfo.format = upStreamBuffer->bufAttrib->format;
+        if (upStreamBuffer->bufAttrib) {
+            map->vinfo.width = upStreamBuffer->bufAttrib->realWidth;
+            map->vinfo.height = upStreamBuffer->bufAttrib->realHeight;
+            map->vinfo.lumaStride = upStreamBuffer->bufAttrib->lumaStride;
+            map->vinfo.chromStride = upStreamBuffer->bufAttrib->chromStride;
+            map->vinfo.format = upStreamBuffer->bufAttrib->format;
+        }
         map->vinfo.s3dformat = 0xFFFFFFFF;
         map->added = false;
         map->next = NULL;