summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-02-24 14:49:10 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-02-24 14:49:10 -0800
commit827b55c5f3409b68ef57816208220d8804693e44 (patch)
tree65876f2b881d52f6a3fec94564a0baf0d0802627 /media/libstagefright
parent72feaa5df1f7b15b18e30592653dc511dc0b8c51 (diff)
parent7314fa17093d514199fedcb55ac41136a1b31cb3 (diff)
downloadframeworks_av-827b55c5f3409b68ef57816208220d8804693e44.zip
frameworks_av-827b55c5f3409b68ef57816208220d8804693e44.tar.gz
frameworks_av-827b55c5f3409b68ef57816208220d8804693e44.tar.bz2
Merge "Suppress the logging of URLs when in incognito mode."
Diffstat (limited to 'media/libstagefright')
-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
6 files changed, 55 insertions, 10 deletions
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;