diff options
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() { |