summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/mpeg2ts
diff options
context:
space:
mode:
authorJaesung Chung <jaesung@google.com>2015-05-22 04:45:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-22 04:45:14 +0000
commit4a98dab613da4d9bc9b93da9de43a815da49febc (patch)
treea434d3506758a0a88ca79c07e7fa172b5ca9f63f /media/libstagefright/mpeg2ts
parent70b2313318aaf245d185b6ddb188606608bdf7c9 (diff)
parent12a3d2f50dc52d8d05f5d0e932445f368248f520 (diff)
downloadframeworks_av-4a98dab613da4d9bc9b93da9de43a815da49febc.zip
frameworks_av-4a98dab613da4d9bc9b93da9de43a815da49febc.tar.gz
frameworks_av-4a98dab613da4d9bc9b93da9de43a815da49febc.tar.bz2
Merge "mpeg2ts: MPEG2TSExtractor detects A/V streams until timed out" into mnc-dev
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() {