Use vaSyncSurface for sync instead of vaMapBuffer(codedBuffer,XXX)

BZ: 175321

Change-Id: I16d2f080ab22e74437fbdafc80dced2b77950df5
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
diff --git a/videoencoder/VideoEncoderBase.cpp b/videoencoder/VideoEncoderBase.cpp
index 284ab52..99c2606 100644
--- a/videoencoder/VideoEncoderBase.cpp
+++ b/videoencoder/VideoEncoderBase.cpp
@@ -454,10 +454,10 @@
             mOutCodedBuffer = mCurOutputTask->coded_buffer;
 
             // Check frame skip
-            // Need map buffer before calling query surface below to get the right skip frame flag for current frame
+            // Need encoding to be completed before calling query surface below to
+            // get the right skip frame flag for current frame
             // It is a requirement of video driver
-            vaStatus = vaMapBuffer (mVADisplay, mOutCodedBuffer, (void **)&buf);
-            vaStatus = vaUnmapBuffer(mVADisplay, mOutCodedBuffer);
+            vaSyncSurface(mVADisplay, mCurOutputTask->enc_surface);
 
             vaStatus = vaQuerySurfaceStatus(mVADisplay, mCurOutputTask->enc_surface,  &vaSurfaceStatus);
             CHECK_VA_STATUS_RETURN("vaQuerySurfaceStatus");