summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-02-09 10:20:00 -0800
committerAndreas Huber <andih@google.com>2010-02-09 14:21:44 -0800
commitc017cfcc24dd63c7efde5747a6ed2d4053788abc (patch)
treed3dcf3e72687fa75f845f73231fa2bf2cbbe7374
parent26bae54d7a3d04215eba34c62c349f1be6ab1493 (diff)
downloadframeworks_av-c017cfcc24dd63c7efde5747a6ed2d4053788abc.zip
frameworks_av-c017cfcc24dd63c7efde5747a6ed2d4053788abc.tar.gz
frameworks_av-c017cfcc24dd63c7efde5747a6ed2d4053788abc.tar.bz2
If the codec's input buffer size is too small to accomodate the buffer read from the source, report and error instead of asserting.
-rw-r--r--media/libstagefright/OMXCodec.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 7c7c9e2..c6c6f21 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -139,6 +139,7 @@ static const CodecInfo kEncoderInfo[] = {
#define CODEC_LOGI(x, ...) LOGI("[%s] "x, mComponentName, ##__VA_ARGS__)
#define CODEC_LOGV(x, ...) LOGV("[%s] "x, mComponentName, ##__VA_ARGS__)
+#define CODEC_LOGE(x, ...) LOGE("[%s] "x, mComponentName, ##__VA_ARGS__)
struct OMXCodecObserver : public BnOMXObserver {
OMXCodecObserver() {
@@ -1931,10 +1932,17 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
srcLength = srcBuffer->range_length();
if (info->mSize < srcLength) {
- LOGE("info->mSize = %d, srcLength = %d",
+ CODEC_LOGE(
+ "Codec's input buffers are too small to accomodate "
+ "buffer read from source (info->mSize = %d, srcLength = %d)",
info->mSize, srcLength);
+
+ srcBuffer->release();
+ srcBuffer = NULL;
+
+ setState(ERROR);
+ return;
}
- CHECK(info->mSize >= srcLength);
memcpy(info->mData,
(const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(),
srcLength);