diff options
-rw-r--r-- | media/libstagefright/DataSource.cpp | 35 | ||||
-rw-r--r-- | media/libstagefright/MediaExtractor.cpp | 20 |
2 files changed, 5 insertions, 50 deletions
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp index 8b49d18..3d8688f 100644 --- a/media/libstagefright/DataSource.cpp +++ b/media/libstagefright/DataSource.cpp @@ -131,19 +131,11 @@ status_t DataSource::getSize(off64_t *size) { Mutex DataSource::gSnifferMutex; List<DataSource::SnifferFunc> DataSource::gSniffers; -List<DataSource::SnifferFunc> DataSource::gExtraSniffers; bool DataSource::gSniffersRegistered = false; bool DataSource::sniff( String8 *mimeType, float *confidence, sp<AMessage> *meta) { - bool forceExtraSniffers = false; - - if (*confidence == 3.14f) { - // Magic value, as set by MediaExtractor when a video container looks incomplete - forceExtraSniffers = true; - } - *mimeType = ""; *confidence = 0.0f; meta->clear(); @@ -169,23 +161,6 @@ bool DataSource::sniff( } } - /* Only do the deeper sniffers if the results are null or in doubt */ - if (mimeType->length() == 0 || *confidence < 0.21f || forceExtraSniffers) { - for (List<SnifferFunc>::iterator it = gExtraSniffers.begin(); - it != gExtraSniffers.end(); ++it) { - String8 newMimeType; - float newConfidence; - sp<AMessage> newMeta; - if ((*it)(this, &newMimeType, &newConfidence, &newMeta)) { - if (newConfidence > *confidence) { - *mimeType = newMimeType; - *confidence = newConfidence; - *meta = newMeta; - } - } - } - } - return *confidence > 0.0; } @@ -210,14 +185,7 @@ void DataSource::RegisterSnifferPlugin() { getExtractorPlugin(plugin); } if (plugin->sniff) { - for (List<SnifferFunc>::iterator it = gExtraSniffers.begin(); - it != gExtraSniffers.end(); ++it) { - if (*it == plugin->sniff) { - return; - } - } - - gExtraSniffers.push_back(plugin->sniff); + RegisterSniffer_l(plugin->sniff); } } @@ -248,6 +216,7 @@ void DataSource::RegisterDefaultSniffers() { && (!strcmp(value, "1") || !strcasecmp(value, "true"))) { RegisterSniffer_l(SniffDRM); } + gSniffersRegistered = true; } diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp index fc96e2f..ef0524a 100644 --- a/media/libstagefright/MediaExtractor.cpp +++ b/media/libstagefright/MediaExtractor.cpp @@ -60,15 +60,9 @@ sp<MediaExtractor> MediaExtractor::Create( const uint32_t flags) { sp<AMessage> meta; - bool secondPass = false; - String8 tmp; -retry: - if (secondPass || mime == NULL) { + if (mime == NULL) { float confidence; - if (secondPass) { - confidence = 3.14f; - } if (!source->sniff(&tmp, &confidence, &meta)) { ALOGV("FAILED to autodetect media content."); @@ -102,9 +96,10 @@ retry: } } - sp<MediaExtractor> ret = NULL; + sp<MediaExtractor> ret; AString extractorName; if ((ret = AVFactory::get()->createExtendedExtractor(source, mime, meta, flags)) != NULL) { + ALOGI("Using extended extractor"); } else if (meta.get() && meta->findString("extended-extractor-use", &extractorName) && sPlugin.create) { ALOGI("Use extended extractor for the special mime(%s) or codec", mime); @@ -149,15 +144,6 @@ retry: } } - if (ret != NULL) { - - if (!secondPass && ( ret->countTracks() == 0 || - (!strncasecmp("video/", mime, 6) && ret->countTracks() < 2) ) ) { - secondPass = true; - goto retry; - } - } - return ret; } |