diff options
author | James Dong <jdong@google.com> | 2010-02-05 12:05:42 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-02-05 12:05:42 -0800 |
commit | 9446c5046872e8ae44120d4057ae724875aba1a4 (patch) | |
tree | 58a95fe37adc5051fc967af6f2ca7b82f0319842 /cmds | |
parent | 7722abe2591026e7db8910afa0431602723fc1e0 (diff) | |
parent | e4cfcb82a86e1546474c3fd25101ab561063a1bd (diff) | |
download | frameworks_base-9446c5046872e8ae44120d4057ae724875aba1a4.zip frameworks_base-9446c5046872e8ae44120d4057ae724875aba1a4.tar.gz frameworks_base-9446c5046872e8ae44120d4057ae724875aba1a4.tar.bz2 |
Merge "When the extractor is not able to be created successfully, don't crash"
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/stagefright/record.cpp | 3 | ||||
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp index 2ec0b70..845c854 100644 --- a/cmds/stagefright/record.cpp +++ b/cmds/stagefright/record.cpp @@ -106,6 +106,9 @@ sp<MediaSource> createSource(const char *filename) { sp<MediaExtractor> extractor = MediaExtractor::Create(new FileSource(filename)); + if (extractor == NULL) { + return NULL; + } size_t num_tracks = extractor->countTracks(); diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index e65cdf1..f7cb227 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -431,6 +431,10 @@ int main(int argc, char **argv) { mediaSource = new JPEGSource(dataSource); } else { sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource); + if (extractor == NULL) { + fprintf(stderr, "could not create data source\n"); + return -1; + } size_t numTracks = extractor->countTracks(); |