diff options
author | Jaesung Chung <jaesung@google.com> | 2015-05-18 15:57:32 +0900 |
---|---|---|
committer | Jaesung Chung <jaesung@google.com> | 2015-05-20 13:33:22 +0900 |
commit | 12a3d2f50dc52d8d05f5d0e932445f368248f520 (patch) | |
tree | b23423129ec38047b5e9e4ceeaca4220fa931018 /media/libstagefright/mpeg2ts | |
parent | 4a95e69406aa2e9896d865962d6d947ebbdac6fc (diff) | |
download | frameworks_av-12a3d2f50dc52d8d05f5d0e932445f368248f520.zip frameworks_av-12a3d2f50dc52d8d05f5d0e932445f368248f520.tar.gz frameworks_av-12a3d2f50dc52d8d05f5d0e932445f368248f520.tar.bz2 |
mpeg2ts: MPEG2TSExtractor detects A/V streams until timed out
Bug: 20433028
Change-Id: I6145eae8d64ad9150477a8ac52545e68768c75eb
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r-- | media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp index f5c33cf..3a8e2ab 100644 --- a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp +++ b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp @@ -22,6 +22,7 @@ #include "include/NuCachedSource2.h" #include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/foundation/ALooper.h> #include <media/stagefright/DataSource.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> @@ -164,7 +165,7 @@ sp<MetaData> MPEG2TSExtractor::getMetaData() { void MPEG2TSExtractor::init() { bool haveAudio = false; bool haveVideo = false; - int numPacketsParsed = 0; + int64_t startTime = ALooper::GetNowUs(); while (feedMore() == OK) { if (haveAudio && haveVideo) { @@ -192,12 +193,14 @@ void MPEG2TSExtractor::init() { } } - if (++numPacketsParsed > 10000) { + // Wait only for 2 seconds to detect audio/video streams. + if (ALooper::GetNowUs() - startTime > 2000000ll) { break; } } - ALOGI("haveAudio=%d, haveVideo=%d", haveAudio, haveVideo); + ALOGI("haveAudio=%d, haveVideo=%d, elaspedTime=%lld", + haveAudio, haveVideo, ALooper::GetNowUs() - startTime); } status_t MPEG2TSExtractor::feedMore() { |