shithub: openh264

Download patch

ref: 47d6ac3b5786f273c4bc9c49d38eac49dabb4022
parent: bf33bde15defd14765cd00c5d0742338f0bd96bd
author: huade <huashi@cisco.com>
date: Wed Aug 19 05:05:15 EDT 2015

bug-fixed----left length of destination buffer for writing slice bs

--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -764,7 +764,7 @@
         WelsUnloadNalForSlice (pSliceBs);
 
         int32_t iLeftBufferSize = (iSliceIdx > 0) ?
-                                  (pSliceBs->uiSize - (int32_t) (pSliceBs->sBsWrite.pCurBuf - pSliceBs->sBsWrite.pStartBuf))
+                                  (pSliceBs->uiSize - pSliceBs->uiBsPos)
                                   : (pEncPEncCtx->iFrameBsSize - pEncPEncCtx->iPosBsBuffer);
         iReturn = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs,
                                 &pSliceBs->iNalLen[0],
@@ -883,7 +883,7 @@
             pEncPEncCtx->iPosBsBuffer += iSliceSize;
           } else {
             iReturn = WriteSliceBs (pEncPEncCtx, pSliceBs->pBs, &pSliceBs->iNalLen[0],
-                                    pSliceBs->uiSize - (int32_t) (pSliceBs->sBsWrite.pCurBuf - pSliceBs->sBsWrite.pStartBuf),
+                                    pSliceBs->uiSize - pSliceBs->uiBsPos,
                                     iSliceIdx, iSliceSize);
             if (ENC_RETURN_SUCCESS != iReturn) {
               uiThrdRet = iReturn;