diff options
author | Marco Nelissen <marcone@google.com> | 2013-11-25 08:39:56 -0800 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-03-06 17:42:21 -0800 |
commit | be1195a6d5e6dd4299da344cf9905dd6a12dc4ef (patch) | |
tree | b7bdb8e6224689ad2a745699d5c16e59df93e02e /media/libstagefright | |
parent | 880413f7923ec77467243e15dc34d4af4f8064f9 (diff) | |
download | frameworks_av-be1195a6d5e6dd4299da344cf9905dd6a12dc4ef.zip frameworks_av-be1195a6d5e6dd4299da344cf9905dd6a12dc4ef.tar.gz frameworks_av-be1195a6d5e6dd4299da344cf9905dd6a12dc4ef.tar.bz2 |
Fix SIGABRT when playing mp4 file
If the track duration was shorter than the segment duration, the calculated
encoder padding would be negative, resulting in a crash.
b/11823061
https://code.google.com/p/android/issues/detail?id=62610
Change-Id: I3989ad88caea38d212b61355c15aec13382c6116
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 6f51c39..9f95212 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -960,6 +960,12 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { mLastTrack->meta->setInt32(kKeyEncoderDelay, delay); int64_t paddingus = duration - (segment_duration + media_time); + if (paddingus < 0) { + // track duration from media header (which is what kKeyDuration is) might + // be slightly shorter than the segment duration, which would make the + // padding negative. Clamp to zero. + paddingus = 0; + } int64_t paddingsamples = (paddingus * samplerate + 500000) / 1000000; mLastTrack->meta->setInt32(kKeyEncoderPadding, paddingsamples); } |