summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
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) {