summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Writer.cpp
diff options
context:
space:
mode:
authorShalaj Jain <shalajj@codeaurora.org>2015-10-21 19:01:59 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-26 18:18:15 -0700
commit85ad714b38516807efe40d67da406208d72b0dd0 (patch)
tree11c47f7fcb8a1190f58d44775e05a1d47199eb50 /media/libstagefright/MPEG4Writer.cpp
parent04fdb627d164cc81c8fa2830db1b20cf1261aea4 (diff)
downloadframeworks_av-85ad714b38516807efe40d67da406208d72b0dd0.zip
frameworks_av-85ad714b38516807efe40d67da406208d72b0dd0.tar.gz
frameworks_av-85ad714b38516807efe40d67da406208d72b0dd0.tar.bz2
stagefright: Return error for wrong buffer index in MediaCodec
Return error if the index passed by client is incorrect rather than returning OK with null buffer. Also add a null buffer check in MPEG4Writer as it shouldn't rely on the source returning the correct error code, just as a precaution. Change-Id: Iaefcd57a545ec3ce4ec0b8d4220bdf41377ff798
Diffstat (limited to 'media/libstagefright/MPEG4Writer.cpp')
-rw-r--r--media/libstagefright/MPEG4Writer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 94f40b4..c370260 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -2231,7 +2231,9 @@ status_t MPEG4Writer::Track::threadEntry() {
MediaBuffer *buffer;
const char *trackName = mIsAudio ? "Audio" : "Video";
while (!mDone && (err = mSource->read(&buffer)) == OK) {
- if (buffer->range_length() == 0) {
+ if (buffer == NULL) {
+ continue;
+ } else if (buffer->range_length() == 0) {
buffer->release();
buffer = NULL;
++nZeroLengthFrames;