summaryrefslogtreecommitdiffstats
path: root/libvideoeditor
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-06-29 18:39:46 -0700
committerJames Dong <jdong@google.com>2012-06-29 18:40:10 -0700
commit53f69c194d7ae8105b4c6d0c9901eb96281c7bf9 (patch)
tree2292ebb04e8aa5f4851a37122c090373c9a75788 /libvideoeditor
parenta0108697f86d8625eb7ad3f13e422427fe7573ca (diff)
downloadframeworks_av-53f69c194d7ae8105b4c6d0c9901eb96281c7bf9.zip
frameworks_av-53f69c194d7ae8105b4c6d0c9901eb96281c7bf9.tar.gz
frameworks_av-53f69c194d7ae8105b4c6d0c9901eb96281c7bf9.tar.bz2
Fixed a video editor crash due to "divided by 0"
The crash was because the video sample was too short and has 0 duration (or a single frame video). This patch is just simply not to support 0 duration video for editing. Change-Id: I2c7ff78b1e884a4d3a5051f87cdbeeb5dc3078a6 related-to-bug: 6670656
Diffstat (limited to 'libvideoeditor')
-rwxr-xr-xlibvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
index 5026073..f735c0b 100755
--- a/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
+++ b/libvideoeditor/vss/stagefrightshells/src/VideoEditor3gpReader.cpp
@@ -1483,11 +1483,15 @@ M4OSA_ERR VideoEditor3gpReader_getNextStreamHandler(M4OSA_Context context,
(int32_t*)&(pVideoStreamHandler->m_videoHeight));
(*pStreamHandler) = (M4_StreamHandler*)(pVideoStreamHandler);
- meta->findInt64(kKeyDuration,
- (int64_t*)&(Duration));
- ((*pStreamHandler)->m_duration) =
- (int32_t)((Duration)/1000); // conversion to mS
+ meta->findInt64(kKeyDuration, (int64_t*)&(Duration));
+ ((*pStreamHandler)->m_duration) = (int32_t)((Duration)/1000); // conversion to mS
pC->mMaxDuration = ((*pStreamHandler)->m_duration);
+ if (pC->mMaxDuration == 0) {
+ ALOGE("Video is too short: %lld Us", Duration);
+ delete pVideoStreamHandler;
+ pVideoStreamHandler = NULL;
+ return M4ERR_PARAMETER;
+ }
ALOGV("VideoEditor3gpReader_getNextStreamHandler m_duration %d",
(*pStreamHandler)->m_duration);