summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/aacenc/src
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2011-04-21 12:59:07 +0300
committerMartin Storsjo <martin@martin.st>2012-01-31 10:35:49 +0200
commit3989d5c21ce6d1f3492c9e5484d610d5d66abd9e (patch)
tree6bf67686d7d4443ccd248cc462aa1a76e36a36b3 /media/libstagefright/codecs/aacenc/src
parent5e9afe434d8207fb0af6e191cca671ab74cfe878 (diff)
downloadframeworks_av-3989d5c21ce6d1f3492c9e5484d610d5d66abd9e.zip
frameworks_av-3989d5c21ce6d1f3492c9e5484d610d5d66abd9e.tar.gz
frameworks_av-3989d5c21ce6d1f3492c9e5484d610d5d66abd9e.tar.bz2
stagefright aacenc: Safeguard against overwriting bits
Previously, if bits above the lowest noBitsToWrite were set, they would be ORed into the previous cache word, setting unrelated bits erroneously. This doesn't noticeably affect the performance of the codec as a whole. Change-Id: Ie9935533c4299b8f07cb14485f039a9be9c84016
Diffstat (limited to 'media/libstagefright/codecs/aacenc/src')
-rw-r--r--media/libstagefright/codecs/aacenc/src/bitbuffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/aacenc/src/bitbuffer.c b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
index a706893..0ce93d3 100644
--- a/media/libstagefright/codecs/aacenc/src/bitbuffer.c
+++ b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
@@ -152,6 +152,7 @@ Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
wBitPos = hBitBuf->wBitPos;
wBitPos += noBitsToWrite;
+ writeValue &= ~(0xffffffff << noBitsToWrite); // Mask out everything except the lowest noBitsToWrite bits
writeValue <<= 32 - wBitPos;
writeValue |= hBitBuf->cache;