diff options
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/DataSource.cpp | 17 | ||||
-rw-r--r-- | media/libstagefright/MediaExtractor.cpp | 6 |
2 files changed, 18 insertions, 5 deletions
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp index 3d8688f..b833f9e 100644 --- a/media/libstagefright/DataSource.cpp +++ b/media/libstagefright/DataSource.cpp @@ -136,6 +136,7 @@ bool DataSource::gSniffersRegistered = false; bool DataSource::sniff( String8 *mimeType, float *confidence, sp<AMessage> *meta) { + *mimeType = ""; *confidence = 0.0f; meta->clear(); @@ -147,11 +148,18 @@ bool DataSource::sniff( } } + String8 newMimeType; + if (mimeType != NULL) { + newMimeType.setTo(*mimeType); + } + float newConfidence = *confidence; + for (List<SnifferFunc>::iterator it = gSniffers.begin(); it != gSniffers.end(); ++it) { - String8 newMimeType; - float newConfidence; - sp<AMessage> newMeta; + int64_t sniffStart = ALooper::GetNowUs(); + String8 newMimeType = *mimeType; + float newConfidence = *confidence; + sp<AMessage> newMeta = *meta; if ((*it)(this, &newMimeType, &newConfidence, &newMeta)) { if (newConfidence > *confidence) { *mimeType = newMimeType; @@ -159,6 +167,9 @@ bool DataSource::sniff( *meta = newMeta; } } + ALOGV("Sniffer (%p) completed in %.2f ms (mime=%s confidence=%.2f", + this, ((float)(ALooper::GetNowUs() - sniffStart) / 1000.0f), + mimeType == NULL ? NULL : (*mimeType).string(), *confidence); } return *confidence > 0.0; diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp index ac6decdb6..8c63de2 100644 --- a/media/libstagefright/MediaExtractor.cpp +++ b/media/libstagefright/MediaExtractor.cpp @@ -63,6 +63,7 @@ sp<MediaExtractor> MediaExtractor::Create( String8 tmp; if (mime == NULL) { + int64_t sniffStart = ALooper::GetNowUs(); float confidence; if (!source->sniff(&tmp, &confidence, &meta)) { ALOGV("FAILED to autodetect media content."); @@ -71,8 +72,9 @@ sp<MediaExtractor> MediaExtractor::Create( } mime = tmp.string(); - ALOGV("Autodetected media content as '%s' with confidence %.2f", - mime, confidence); + ALOGV("Autodetected media content as '%s' with confidence %.2f (%.2f ms)", + mime, confidence, + ((float)(ALooper::GetNowUs() - sniffStart) / 1000.0f)); } else if (prevMeta != NULL) { meta = *prevMeta; } |