summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-02-16 11:48:33 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-02-16 11:48:33 -0800
commitcf06dd0a8a4321ea640e7d1ebe5dffcd69324a04 (patch)
tree0cfd0573e6787a9e1bdc79e09427bc363340e611 /media
parentbb50863c07c763ad50f723954cfc4401759e448a (diff)
parentbc8342721d9e32cac624587e8e5c64372ceaff18 (diff)
downloadframeworks_base-cf06dd0a8a4321ea640e7d1ebe5dffcd69324a04.zip
frameworks_base-cf06dd0a8a4321ea640e7d1ebe5dffcd69324a04.tar.gz
frameworks_base-cf06dd0a8a4321ea640e7d1ebe5dffcd69324a04.tar.bz2
Merge "The AMRSource failed to properly release a media buffer in case of error."
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/AMRExtractor.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/media/libstagefright/AMRExtractor.cpp b/media/libstagefright/AMRExtractor.cpp
index 3193d5e..2a16d26 100644
--- a/media/libstagefright/AMRExtractor.cpp
+++ b/media/libstagefright/AMRExtractor.cpp
@@ -225,27 +225,32 @@ status_t AMRSource::read(
return ERROR_IO;
}
- MediaBuffer *buffer;
- status_t err = mGroup->acquire_buffer(&buffer);
- if (err != OK) {
- return err;
- }
-
if (header & 0x83) {
// Padding bits must be 0.
+ LOGE("padding bits must be 0, header is 0x%02x", header);
+
return ERROR_MALFORMED;
}
unsigned FT = (header >> 3) & 0x0f;
if (FT > 8 || (!mIsWide && FT > 7)) {
+
+ LOGE("illegal AMR frame type %d", FT);
+
return ERROR_MALFORMED;
}
size_t frameSize = getFrameSize(mIsWide, FT);
CHECK_EQ(frameSize, mFrameSize);
+ MediaBuffer *buffer;
+ status_t err = mGroup->acquire_buffer(&buffer);
+ if (err != OK) {
+ return err;
+ }
+
n = mDataSource->readAt(mOffset, buffer->data(), frameSize);
if (n != (ssize_t)frameSize) {