summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-11-26 02:10:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-11-26 02:10:18 +0000
commit90892d1be84776f59a619ea4ef9ce51be5828ff8 (patch)
tree5c66eaa8374e5153ff7c8a5677d44a2a821002e1 /media
parent11e715589e0f3f96389d0eedab677369da680fd4 (diff)
parent465127fa3dfba81d8ad2a164ba6036478f71c8a6 (diff)
downloadframeworks_av-90892d1be84776f59a619ea4ef9ce51be5828ff8.zip
frameworks_av-90892d1be84776f59a619ea4ef9ce51be5828ff8.tar.gz
frameworks_av-90892d1be84776f59a619ea4ef9ce51be5828ff8.tar.bz2
Merge "Fix SIGABRT when playing mp4 file"
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index d0b6185..13e22d6 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -963,6 +963,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);
}