diff options
author | James Dong <jdong@google.com> | 2012-08-09 18:58:01 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2012-08-09 19:01:45 -0700 |
commit | fa514f007bd144eb99cdd68f2fe5302a4508db28 (patch) | |
tree | f9926f2b11d287a4cbb8812d437cca5c79c51830 /media/libstagefright/AMRWriter.cpp | |
parent | 0d27c65ddb5c968baa6db0c26e80f5c451bc52bc (diff) | |
download | frameworks_av-fa514f007bd144eb99cdd68f2fe5302a4508db28.zip frameworks_av-fa514f007bd144eb99cdd68f2fe5302a4508db28.tar.gz frameworks_av-fa514f007bd144eb99cdd68f2fe5302a4508db28.tar.bz2 |
Handle malformed raw AAC/AMR writer better
Change-Id: I196fe196c26b83be09fcd54174ceb4e135073c2b
Diffstat (limited to 'media/libstagefright/AMRWriter.cpp')
-rw-r--r-- | media/libstagefright/AMRWriter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp index 15a7143..8d5eec8 100644 --- a/media/libstagefright/AMRWriter.cpp +++ b/media/libstagefright/AMRWriter.cpp @@ -254,11 +254,14 @@ status_t AMRWriter::threadFunc() { if (n < (ssize_t)buffer->range_length()) { buffer->release(); buffer = NULL; + err = ERROR_IO; + break; + } + if (err != OK) { break; } - // XXX: How to tell it is stopped prematurely? if (stoppedPrematurely) { stoppedPrematurely = false; } @@ -267,8 +270,8 @@ status_t AMRWriter::threadFunc() { buffer = NULL; } - if (stoppedPrematurely) { - notify(MEDIA_RECORDER_EVENT_INFO, MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS, UNKNOWN_ERROR); + if ((err == OK || err == ERROR_END_OF_STREAM) && stoppedPrematurely) { + err = ERROR_MALFORMED; } close(mFd); |