Optimaz libmix encoder in async mode.
BZ: 30377
Before vaSyncSurface(frame N), vaEndPicture(frame N-1) should be invoked,
which prevents TopazSC from entering D0i3 while there is upcomming encoding request.
Signed-off-by: Elaine Wang <elaine.wang@intel.com>
Change-Id: I9d91d778eb83d555c37ea4a7d9e379afaf29db63
Reviewed-on: http://android.intel.com:8080/43342
Reviewed-by: Wang, Elaine <elaine.wang@intel.com>
Reviewed-by: Yuan, Shengquan <shengquan.yuan@intel.com>
Reviewed-by: Tao, Tao Q <tao.q.tao@intel.com>
Reviewed-by: Ding, Haitao <haitao.ding@intel.com>
Tested-by: Ding, Haitao <haitao.ding@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 7a3b6a8..7f7584e 100644
--- a/videoencoder/VideoEncoderBase.cpp
+++ b/videoencoder/VideoEncoderBase.cpp
@@ -462,10 +462,8 @@
ret = sendEncodeCommand();
CHECK_ENCODE_STATUS_RETURN("sendEncodeCommand");
- if ((mComParams.rcMode == VA_RC_NONE) || mFirstFrame) {
- vaStatus = vaEndPicture(mVADisplay, mVAContext);
- CHECK_VA_STATUS_RETURN("vaEndPicture");
- }
+ vaStatus = vaEndPicture(mVADisplay, mVAContext);
+ CHECK_VA_STATUS_RETURN("vaEndPicture");
LOG_V( "vaEndPicture\n");
@@ -488,12 +486,6 @@
vaStatus = vaMapBuffer (mVADisplay, mOutCodedBuffer, (void **)&buf);
vaStatus = vaUnmapBuffer(mVADisplay, mOutCodedBuffer);
- if (!((mComParams.rcMode == VA_RC_NONE) || mFirstFrame)) {
- vaStatus = vaEndPicture(mVADisplay, mVAContext);
- CHECK_VA_STATUS_RETURN("vaEndPicture");
-
- }
-
if (mFirstFrame) {
vaStatus = vaBeginPicture(mVADisplay, mVAContext, mCurFrame->surface);
CHECK_VA_STATUS_RETURN("vaBeginPicture");
@@ -509,7 +501,7 @@
// Query the status of current surface
VASurfaceStatus vaSurfaceStatus;
- vaStatus = vaQuerySurfaceStatus(mVADisplay, mCurFrame->surface, &vaSurfaceStatus);
+ vaStatus = vaQuerySurfaceStatus(mVADisplay, mLastFrame->surface, &vaSurfaceStatus);
CHECK_VA_STATUS_RETURN("vaQuerySurfaceStatus");
mPicSkipped = vaSurfaceStatus & VASurfaceSkipped;