summaryrefslogtreecommitdiffstats
path: root/fdk-aac/libFDK/src/FDK_bitbuffer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-06-01 14:42:00 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-06-01 14:42:00 +0200
commite0835d4cbde8e3b61b0c965afcd41f8f4b7ac121 (patch)
treef49619fc806249da71afaf2ac14f99e088d24153 /fdk-aac/libFDK/src/FDK_bitbuffer.cpp
parent5ad4acef6721a67b8156cd6f7b45ad59849ca09b (diff)
downloadODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.tar.gz
ODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.tar.bz2
ODR-AudioEnc-e0835d4cbde8e3b61b0c965afcd41f8f4b7ac121.zip
Update fdk to v2.0.2
Diffstat (limited to 'fdk-aac/libFDK/src/FDK_bitbuffer.cpp')
-rw-r--r--fdk-aac/libFDK/src/FDK_bitbuffer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/fdk-aac/libFDK/src/FDK_bitbuffer.cpp b/fdk-aac/libFDK/src/FDK_bitbuffer.cpp
index 98905ea..9b7f5b8 100644
--- a/fdk-aac/libFDK/src/FDK_bitbuffer.cpp
+++ b/fdk-aac/libFDK/src/FDK_bitbuffer.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -368,7 +368,10 @@ void FDK_Feed(HANDLE_FDK_BITBUF hBitBuf, const UCHAR *RESTRICT inputBuffer,
UINT bTotal = 0;
- UINT bToRead = (hBitBuf->bufBits - hBitBuf->ValidBits) >> 3;
+ UINT bToRead =
+ fMin(hBitBuf->bufBits,
+ (UINT)fMax(0, ((INT)hBitBuf->bufBits - (INT)hBitBuf->ValidBits))) >>
+ 3;
UINT noOfBytes =
fMin(bToRead,
*bytesValid); //(bToRead < *bytesValid) ? bToRead : *bytesValid ;
@@ -384,7 +387,7 @@ void FDK_Feed(HANDLE_FDK_BITBUF hBitBuf, const UCHAR *RESTRICT inputBuffer,
bToRead * sizeof(UCHAR));
/* add noOfBits to number of valid bits in buffer */
- hBitBuf->ValidBits += bToRead << 3;
+ hBitBuf->ValidBits = (UINT)((INT)hBitBuf->ValidBits + (INT)(bToRead << 3));
bTotal += bToRead;
inputBuffer += bToRead;