diff options
author | Sunil Shah <sunil.shah@sonyericsson.com> | 2011-04-19 12:33:44 +0200 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-01 15:27:23 -0800 |
commit | bc585fb49598eaa9b5d6fd888519eb2873310599 (patch) | |
tree | 5a1aff2fc4820e10376ed2b046a82de5564a9288 | |
parent | e19236dec2d616ecd39ccecb65f29e9c1310a682 (diff) | |
download | frameworks_av-bc585fb49598eaa9b5d6fd888519eb2873310599.zip frameworks_av-bc585fb49598eaa9b5d6fd888519eb2873310599.tar.gz frameworks_av-bc585fb49598eaa9b5d6fd888519eb2873310599.tar.bz2 |
Handle malformed audio packets received during RTSP stream switching
During RTSP stream switching (for example channel switching in a
Mobile TV application) we occasionally receive packets that
don't contain valid data, so we cannot remove LATM framing (as per
the MPEG4 Audio Assembler). This fix allows the frame remover
to exit gracefully (instead of crashing), when such frames are
encountered, and as a consequence, Mobile TV apps can change
channels properly.
Change-Id: Ie4c3d2766c87b43f31624192de96bc47180ca514
-rw-r--r-- | media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp b/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp index d239e7b..4302aee 100644 --- a/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp +++ b/media/libstagefright/rtsp/AMPEG4AudioAssembler.cpp @@ -379,7 +379,10 @@ sp<ABuffer> AMPEG4AudioAssembler::removeLATMFraming(const sp<ABuffer> &buffer) { unsigned muxSlotLengthBytes = 0; unsigned tmp; do { - CHECK_LT(offset, buffer->size()); + if (offset >= buffer->size()) { + ALOGW("Malformed buffer received"); + return out; + } tmp = ptr[offset++]; muxSlotLengthBytes += tmp; } while (tmp == 0xff); |