diff options
author | Andreas Huber <andih@google.com> | 2012-04-11 11:52:03 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-04-11 12:46:12 -0700 |
commit | f4b7d94062c896dca565d849c6188cd3489be257 (patch) | |
tree | b3bc6b1b2bc3641417e018a3235d144b1f8b285b | |
parent | b3eb2b7e0ad11bc03344e10cc5204bdb71f0686e (diff) | |
download | frameworks_av-f4b7d94062c896dca565d849c6188cd3489be257.zip frameworks_av-f4b7d94062c896dca565d849c6188cd3489be257.tar.gz frameworks_av-f4b7d94062c896dca565d849c6188cd3489be257.tar.bz2 |
Better error logging during meta data retrieval. Fixed the stagefright
commandline tool to open the file to extract thumbnails from itself since
mediaserver may not have permission to open files.
Change-Id: Iabe16b3248e9bb0f266b0866a8d2ccba2ab7d2a8
related-to-bug: 6321237
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 13 | ||||
-rw-r--r-- | media/libstagefright/FileSource.cpp | 2 | ||||
-rw-r--r-- | media/libstagefright/StagefrightMetadataRetriever.cpp | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index d70c862..6a5b45f 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -775,7 +775,18 @@ int main(int argc, char **argv) { const char *filename = argv[k]; bool failed = true; - CHECK_EQ(retriever->setDataSource(filename), (status_t)OK); + + int fd = open(filename, O_RDONLY | O_LARGEFILE); + CHECK_GE(fd, 0); + + off64_t fileSize = lseek64(fd, 0, SEEK_END); + CHECK_GE(fileSize, 0ll); + + CHECK_EQ(retriever->setDataSource(fd, 0, fileSize), (status_t)OK); + + close(fd); + fd = -1; + sp<IMemory> mem = retriever->getFrameAtTime(-1, MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC); diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index 07ec265..a7ca3da 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -38,6 +38,8 @@ FileSource::FileSource(const char *filename) if (mFd >= 0) { mLength = lseek64(mFd, 0, SEEK_END); + } else { + ALOGE("Failed to open file '%s'. (%s)", filename, strerror(errno)); } } diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 35f9c1f..fee557d 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -61,12 +61,15 @@ status_t StagefrightMetadataRetriever::setDataSource( mSource = DataSource::CreateFromURI(uri, headers); if (mSource == NULL) { + ALOGE("Unable to create data source for '%s'.", uri); return UNKNOWN_ERROR; } mExtractor = MediaExtractor::Create(mSource); if (mExtractor == NULL) { + ALOGE("Unable to instantiate an extractor for '%s'.", uri); + mSource.clear(); return UNKNOWN_ERROR; |