summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/libmediaplayerservice/StagefrightPlayer.cpp1
-rw-r--r--media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp7
-rw-r--r--media/libmediaplayerservice/nuplayer/HTTPLiveSource.h7
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp12
-rw-r--r--media/libstagefright/AwesomePlayer.cpp19
-rw-r--r--media/libstagefright/NuHTTPDataSource.cpp11
-rw-r--r--media/libstagefright/httplive/LiveSession.cpp17
-rw-r--r--media/libstagefright/include/AwesomePlayer.h2
-rw-r--r--media/libstagefright/include/LiveSession.h8
-rw-r--r--media/libstagefright/include/NuHTTPDataSource.h8
10 files changed, 77 insertions, 15 deletions
diff --git a/media/libmediaplayerservice/StagefrightPlayer.cpp b/media/libmediaplayerservice/StagefrightPlayer.cpp
index fdb4754..e277121 100644
--- a/media/libmediaplayerservice/StagefrightPlayer.cpp
+++ b/media/libmediaplayerservice/StagefrightPlayer.cpp
@@ -33,7 +33,6 @@ status_t StagefrightPlayer::initCheck() {
status_t StagefrightPlayer::setDataSource(
const char *url, const KeyedVector<String8, String8> *headers) {
- LOGI("setDataSource('%s')", url);
return mPlayer->setDataSource(url, headers);
}
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
index 6bf6dd3..b3314be 100644
--- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp
@@ -33,8 +33,9 @@
namespace android {
-NuPlayer::HTTPLiveSource::HTTPLiveSource(const char *url)
+NuPlayer::HTTPLiveSource::HTTPLiveSource(const char *url, uint32_t flags)
: mURL(url),
+ mFlags(flags),
mEOS(false),
mOffset(0) {
}
@@ -49,7 +50,9 @@ void NuPlayer::HTTPLiveSource::start() {
mLiveLooper->setName("http live");
mLiveLooper->start();
- mLiveSession = new LiveSession;
+ mLiveSession = new LiveSession(
+ (mFlags & kFlagIncognito) ? LiveSession::kFlagIncognito : 0);
+
mLiveLooper->registerHandler(mLiveSession);
mLiveSession->connect(mURL.c_str());
diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h
index f3f539a..a8ce7f4 100644
--- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h
+++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h
@@ -27,7 +27,11 @@ struct ATSParser;
struct LiveSession;
struct NuPlayer::HTTPLiveSource : public NuPlayer::Source {
- HTTPLiveSource(const char *url);
+ enum Flags {
+ // Don't log any URLs.
+ kFlagIncognito = 1,
+ };
+ HTTPLiveSource(const char *url, uint32_t flags = 0);
virtual void start();
@@ -46,6 +50,7 @@ protected:
private:
AString mURL;
+ uint32_t mFlags;
bool mEOS;
off64_t mOffset;
sp<ALooper> mLiveLooper;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 48b517e..474c056 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -72,7 +72,17 @@ void NuPlayer::setDataSource(
const char *url, const KeyedVector<String8, String8> *headers) {
sp<AMessage> msg = new AMessage(kWhatSetDataSource, id());
- msg->setObject("source", new HTTPLiveSource(url));
+ uint32_t flags = 0;
+
+ if (headers) {
+ ssize_t index = headers->indexOfKey(String8("x-hide-urls-from-log"));
+
+ if (index >= 0) {
+ flags |= HTTPLiveSource::kFlagIncognito;
+ }
+ }
+
+ msg->setObject("source", new HTTPLiveSource(url, flags));
msg->post();
}
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 36623f6..bcf5a12 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -247,6 +247,22 @@ status_t AwesomePlayer::setDataSource_l(
if (headers) {
mUriHeaders = *headers;
+
+ ssize_t index = mUriHeaders.indexOfKey(String8("x-hide-urls-from-log"));
+ if (index >= 0) {
+ // Browser is in "incognito" mode, suppress logging URLs.
+
+ // This isn't something that should be passed to the server.
+ mUriHeaders.removeItemsAt(index);
+
+ mFlags |= INCOGNITO;
+ }
+ }
+
+ if (!(mFlags & INCOGNITO)) {
+ LOGI("setDataSource_l('%s')", mUri.string());
+ } else {
+ LOGI("setDataSource_l(URL suppressed)");
}
// The actual work will be done during preparation in the call to
@@ -1538,7 +1554,8 @@ status_t AwesomePlayer::finishSetDataSource_l() {
if (!strncasecmp("http://", mUri.string(), 7)
|| !strncasecmp("https://", mUri.string(), 8)) {
- mConnectingDataSource = new NuHTTPDataSource;
+ mConnectingDataSource = new NuHTTPDataSource(
+ (mFlags & INCOGNITO) ? NuHTTPDataSource::kFlagIncognito : 0);
mLock.unlock();
status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders);
diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp
index e39fab3..dbbf3b4 100644
--- a/media/libstagefright/NuHTTPDataSource.cpp
+++ b/media/libstagefright/NuHTTPDataSource.cpp
@@ -71,8 +71,9 @@ static bool ParseURL(
return true;
}
-NuHTTPDataSource::NuHTTPDataSource()
- : mState(DISCONNECTED),
+NuHTTPDataSource::NuHTTPDataSource(uint32_t flags)
+ : mFlags(flags),
+ mState(DISCONNECTED),
mPort(0),
mHTTPS(false),
mOffset(0),
@@ -138,7 +139,11 @@ status_t NuHTTPDataSource::connect(
bool https,
const String8 &headers,
off64_t offset) {
- LOGI("connect to %s:%u%s @%lld", host, port, path, offset);
+ if (!(mFlags & kFlagIncognito)) {
+ LOGI("connect to %s:%u%s @%lld", host, port, path, offset);
+ } else {
+ LOGI("connect to <URL suppressed> @%lld", offset);
+ }
bool needsToReconnect = true;
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index ee845a3..f0cd6a0 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -41,9 +41,14 @@ namespace android {
const int64_t LiveSession::kMaxPlaylistAgeUs = 15000000ll;
-LiveSession::LiveSession()
- : mDataSource(new LiveDataSource),
- mHTTPDataSource(new NuHTTPDataSource),
+LiveSession::LiveSession(uint32_t flags)
+ : mFlags(flags),
+ mDataSource(new LiveDataSource),
+ mHTTPDataSource(
+ new NuHTTPDataSource(
+ (mFlags & kFlagIncognito)
+ ? NuHTTPDataSource::kFlagIncognito
+ : 0)),
mPrevBandwidthIndex(-1),
mLastPlaylistFetchTimeUs(-1),
mSeqNumber(-1),
@@ -139,7 +144,11 @@ void LiveSession::onConnect(const sp<AMessage> &msg) {
AString url;
CHECK(msg->findString("url", &url));
- LOGI("onConnect '%s'", url.c_str());
+ if (!(mFlags & kFlagIncognito)) {
+ LOGI("onConnect '%s'", url.c_str());
+ } else {
+ LOGI("onConnect <URL suppressed>");
+ }
mMasterURL = url;
diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h
index 0e36492..5824b6c 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -124,6 +124,8 @@ private:
AUDIO_RUNNING = 8192,
AUDIOPLAYER_STARTED = 16384,
+
+ INCOGNITO = 32768,
};
mutable Mutex mLock;
diff --git a/media/libstagefright/include/LiveSession.h b/media/libstagefright/include/LiveSession.h
index f1188c4..3fe5d4e 100644
--- a/media/libstagefright/include/LiveSession.h
+++ b/media/libstagefright/include/LiveSession.h
@@ -29,7 +29,11 @@ struct M3UParser;
struct NuHTTPDataSource;
struct LiveSession : public AHandler {
- LiveSession();
+ enum Flags {
+ // Don't log any URLs.
+ kFlagIncognito = 1,
+ };
+ LiveSession(uint32_t flags = 0);
sp<DataSource> getDataSource();
@@ -67,6 +71,8 @@ private:
unsigned long mBandwidth;
};
+ uint32_t mFlags;
+
sp<LiveDataSource> mDataSource;
sp<NuHTTPDataSource> mHTTPDataSource;
diff --git a/media/libstagefright/include/NuHTTPDataSource.h b/media/libstagefright/include/NuHTTPDataSource.h
index 3918434..082b589 100644
--- a/media/libstagefright/include/NuHTTPDataSource.h
+++ b/media/libstagefright/include/NuHTTPDataSource.h
@@ -12,7 +12,11 @@
namespace android {
struct NuHTTPDataSource : public DataSource {
- NuHTTPDataSource();
+ enum Flags {
+ // Don't log any URLs.
+ kFlagIncognito = 1
+ };
+ NuHTTPDataSource(uint32_t flags = 0);
status_t connect(
const char *uri,
@@ -52,6 +56,8 @@ private:
Mutex mLock;
+ uint32_t mFlags;
+
State mState;
String8 mHost;