summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/mpeg2ts
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/mpeg2ts')
-rw-r--r--media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
index 287cae8..1c06c78 100644
--- a/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
+++ b/media/libstagefright/mpeg2ts/MPEG2TSExtractor.cpp
@@ -23,6 +23,7 @@
#include <media/stagefright/foundation/ABuffer.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>
@@ -144,7 +145,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) {
@@ -178,7 +179,8 @@ void MPEG2TSExtractor::init() {
}
}
- if (++numPacketsParsed > 10000) {
+ // Wait only for 2 seconds to detect audio/video streams.
+ if (ALooper::GetNowUs() - startTime > 2000000ll) {
break;
}
}
@@ -232,7 +234,8 @@ void MPEG2TSExtractor::init() {
}
}
- ALOGI("haveAudio=%d, haveVideo=%d", haveAudio, haveVideo);
+ ALOGI("haveAudio=%d, haveVideo=%d, elaspedTime=%lld",
+ haveAudio, haveVideo, ALooper::GetNowUs() - startTime);
}
status_t MPEG2TSExtractor::feedMore() {