summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-28 01:59:36 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-28 02:19:26 -0800
commit020adf202a6a485808a686566cb10e7549ac4cf1 (patch)
treecf2f4c129b38412ff0893228382e18fd3742b754
parent4adc18316df05e7a4c3bd246774fa66d72b1ced9 (diff)
downloadframeworks_av-020adf202a6a485808a686566cb10e7549ac4cf1.zip
frameworks_av-020adf202a6a485808a686566cb10e7549ac4cf1.tar.gz
frameworks_av-020adf202a6a485808a686566cb10e7549ac4cf1.tar.bz2
nuplayer: Pass along the sniffed metadata from GenericSource
* When the extended sniffer detects a file type that only it can handle, it will set a flag in the metadata. In some cases, an extractor exists in Android already for the filetype however it may be known to fail or we may want different behavior. * This flag is checked in MediaExtractor, but GenericSource does a little dance in order to stack DataSources for DRM and was throwing out this metadata (it's not really used by AOSP), so the desired behavior was not seen for some cases. * Add a new optional argument when creating the MediaExtractor to pass in the metadata from the original sniff so that the extended extractor is used where necessary for streaming formats. * This fixes FLAC offload with Tidal. Change-Id: I7d6b875346ce63b60cd3c37572b779665bfe217c
-rw-r--r--include/media/stagefright/MediaExtractor.h2
-rw-r--r--media/libmediaplayerservice/nuplayer/GenericSource.cpp8
-rw-r--r--media/libstagefright/MediaExtractor.cpp5
3 files changed, 9 insertions, 6 deletions
diff --git a/include/media/stagefright/MediaExtractor.h b/include/media/stagefright/MediaExtractor.h
index 2f2057f..e83defa 100644
--- a/include/media/stagefright/MediaExtractor.h
+++ b/include/media/stagefright/MediaExtractor.h
@@ -42,7 +42,7 @@ public:
static sp<MediaExtractor> Create(
const sp<DataSource> &source, const char *mime = NULL,
- const uint32_t flags = 0);
+ const uint32_t flags = 0, const sp<AMessage> *meta = NULL);
virtual size_t countTracks() = 0;
virtual sp<MediaSource> getTrack(size_t index) = 0;
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index e380f0a..beda8bd 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -141,14 +141,14 @@ status_t NuPlayer::GenericSource::initFromDataSource() {
sp<MediaExtractor> extractor;
String8 mimeType;
float confidence;
- sp<AMessage> dummy;
+ sp<AMessage> meta;
bool isWidevineStreaming = false;
CHECK(mDataSource != NULL);
if (mIsWidevine) {
isWidevineStreaming = SniffWVM(
- mDataSource, &mimeType, &confidence, &dummy);
+ mDataSource, &mimeType, &confidence, &meta);
if (!isWidevineStreaming ||
strcasecmp(
mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM)) {
@@ -161,7 +161,7 @@ status_t NuPlayer::GenericSource::initFromDataSource() {
Mutex::Autolock _l(mSourceLock);
dataSource = mDataSource;
}
- if (!dataSource->sniff(&mimeType, &confidence, &dummy)) {
+ if (!dataSource->sniff(&mimeType, &confidence, &meta)) {
return UNKNOWN_ERROR;
}
isWidevineStreaming = !strcasecmp(
@@ -186,7 +186,7 @@ status_t NuPlayer::GenericSource::initFromDataSource() {
#endif
extractor = MediaExtractor::Create(mDataSource,
mimeType.isEmpty() ? NULL : mimeType.string(),
- mIsStreaming ? 0 : flags);
+ mIsStreaming ? 0 : flags, &meta);
}
if (extractor == NULL) {
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp
index ef0524a..ac6decdb6 100644
--- a/media/libstagefright/MediaExtractor.cpp
+++ b/media/libstagefright/MediaExtractor.cpp
@@ -57,7 +57,8 @@ uint32_t MediaExtractor::flags() const {
// static
sp<MediaExtractor> MediaExtractor::Create(
const sp<DataSource> &source, const char *mime,
- const uint32_t flags) {
+ const uint32_t flags, const sp<AMessage> *prevMeta) {
+
sp<AMessage> meta;
String8 tmp;
@@ -72,6 +73,8 @@ sp<MediaExtractor> MediaExtractor::Create(
mime = tmp.string();
ALOGV("Autodetected media content as '%s' with confidence %.2f",
mime, confidence);
+ } else if (prevMeta != NULL) {
+ meta = *prevMeta;
}
bool isDrm = false;