How To Stop (incognito) URL Suppression When Running HLS Streams Within Google-TV Sony 3.2 Android Programs

1.7k Views Asked by At

EDIT: as per my comments below I have been able to extend my testing to other Honeycomb 3.2 and ICS devices. In all cases the URL's are, in fact, appearing and thus allowing me to validate the adaptive streaming. This, therefore, is an issue with only the Sony Blueray (which, at the time, was my only adaptive streaming supporting device). Since this isn't an issue with 3.2+ OS but with only one manufacturer device it is not an issue with adaptive streaming testing and I can withdraw this request for support.

I'm having an issue with URL's blocked and suppressed in locat/DDMS. What I"m trying to do is verify my HLS adaptive streaming is really adapting. How I planned to do this is monitor the logcat and watch the segments being picked up. The issue I have is that the URLs are suppressed so I can't see what's going on. Here's a snippet from what I see in Logcat.

05-15 14:05:03.499: D/AVAPIMediaPlayer(247): AVAPIMediaPlayer constructed
05-15 14:05:03.503: D/AVAPIMediaPlayer(247): initCheck called
05-15 14:05:03.503: D/AVAPIMediaPlayer(247): SetDataSource <BLOCKED>
05-15 14:05:03.503: D/AVAPIMediaPlayer(247): surfaceChangedCallback: call setVideoRectangle this 0x66901738, x 480, y 180, w 1440, h 680
05-15 14:05:03.507: D/AVAPIMediaPlayer(247): Create player core for mime type video/mp2t
05-15 14:05:03.507: D/AVSettingsBridge(247): prepare, handle:c560b6c8f9, type:0
05-15 14:05:03.507: I/AVSettingsBridge(247): IAVSettingsBridgeImpl::registerCb, map size:0->1
05-15 14:05:03.511: I/LiveSession(247): onConnect <URL suppressed>
05-15 14:05:03.511: I/NuHTTPDataSource(247): connect to <URL suppressed> @0

Now I quickly traced these back to the chrome framework and the incognito mode. Some framework sources: http://androidxref.com/source/s?defs=kFlagIncognito&project=frameworks.

81     if (!(mFlags & kFlagIncognito)) {
 82         LOG_PRI(ANDROID_LOG_INFO, LOG_TAG, "connect to %s @%lld", uri, offset);
 83     } else {
 84         LOG_PRI(ANDROID_LOG_INFO, LOG_TAG,
 85                 "connect to <URL suppressed> @%lld", offset);

I also picked up a reference in Android 3.0 "The browser includes new features that let users navigate and organize more efficiently. Multiple tabs replace browser windows and a new “incognito” mode allows anonymous browsing".

What I figure is perhaps it's going into incognito mode by default?

Now, I'm not a coder, just struggling with code that was dropped in my lap, but it dawned on me that somewhere in setDataSource(Context context, Uri uri) or associated HTTP Headers there's probably a tag/flag that can be set to turn incognito on or off. And that seasoned Android programmers would probably be able to figure it out quickly.

Can anyone help?

I have additional references below if it helps.


Reference in our code:

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent receivedIntent = this.getIntent();
    receivedIntent = this.getIntent();
    String title = receivedIntent.getExtras().getString("label");
    String subtitle = receivedIntent.getExtras().getString("subtitle");
    String description = receivedIntent.getExtras().getString("description");
    String URI = receivedIntent.getExtras().getString("URI");
    String imagePrefix = receivedIntent.getExtras().getString("imagePrefix");
    setContentView(R.layout.video_page);

    String fileName = Environment.getExternalStorageDirectory().toString() + "/CamaroPit/" + imagePrefix  + ".mp4";
    File file = new File(fileName);
    if (!file.exists()) {
        fileName = Environment.getExternalStorageDirectory().toString() + "/CamaroPit/alschevrolet.mp4";
    }

    Log.d("GTV", "Video to play: " + fileName);
    TextView textTitle = (TextView) findViewById(R.id.video_page_title);
    textTitle.setText(title);
    TextView textSubtitle = (TextView) findViewById(R.id.video_page_subtitle);
    if (subtitle.equals("subtitle")) {
        subtitle = "Check out \""+ title + "\" and really get a feel for your Camaro.";
    }
    textSubtitle.setText(subtitle);
    TextView textDescription = (TextView) findViewById(R.id.video_page_description);
    textDescription.setText(description);
    this.getWindow().setFormat(PixelFormat.TRANSPARENT);
    final VideoView vView = (VideoView) findViewById(R.id.page_view);
    vView.setMediaController(new MediaController(this));
    vView.setVideoURI(Uri.parse(URI));
    vView.requestFocus();      
}

 item.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
    final VideoView vView = (VideoView) GTVHomeScreenSetup.this.homeScreen.findViewById(R.id.gtv_video_view);
    MediaController mC = new MediaController(GTVHomeScreenSetup.this.homeScreen);
    vView.setMediaController(mC);
    mC.setAnchorView(vView);

    VideoData clickedVideo = currentVideoList.get(item.position);

    vView.setVideoURI(Uri.parse(homeScreen.getVideoURI(clickedVideo, cPath)));
    vView.start();

    item.requestFocus();
    for (ImageItemView item : GTVHomeScreenSetup.this.imageItems) {
        item.unSelect();
    }
    item.select();

Additional References from frameworks:

PS: it wouldn't let me post the hyperlinks as hyperlinks.

// HTTPBase.h (http://androidxref.com/source/xref/frameworks/base/media/libstagefright/include/HTTPBase.h)

 28 struct HTTPBase : public DataSource {
 29     enum Flags {
 30         // Don't log any URLs.
 31         kFlagIncognito = 1
 32     };

// HTTPLiveSource.h (http://androidxref.com/source/xref/frameworks/base/media/libmediaplayerservice/nuplayer/HTTPLiveSource.h)

        struct NuPlayer::HTTPLiveSource : public NuPlayer::Source {
 30     HTTPLiveSource(
 31             const char *url,
 32             const KeyedVector<String8, String8> *headers,
 33             bool uidValid = false,
 34             uid_t uid = 0);
 35 
 36     virtual void start();
 37 
 38     virtual status_t feedMoreTSData();
 39 
 40     virtual sp<MetaData> getFormat(bool audio);
 41     virtual status_t dequeueAccessUnit(bool audio, sp<ABuffer> *accessUnit);
 42 
 43     virtual status_t getDuration(int64_t *durationUs);
 44     virtual status_t seekTo(int64_t seekTimeUs);
 45     virtual bool isSeekable();
 46 
 47 protected:
 48     virtual ~HTTPLiveSource();
  51     enum Flags {
 52         // Don't log any URLs.
 53         kFlagIncognito = 1,
 54     };
 55 
 56     AString mURL;
 57     KeyedVector<String8, String8> mExtraHeaders;
 58     bool mUIDValid;
 59     uid_t mUID;
 60     uint32_t mFlags;

//HTTPLiveSession.h (http://androidxref.com/source/xref/frameworks/base/media/libstagefright/include/LiveSession.h#36)

 33 struct LiveSession : public AHandler {
 34     enum Flags {
 35         // Don't log any URLs.
 36         kFlagIncognito = 1,
 37     };
 38     LiveSession(uint32_t flags = 0, bool uidValid = false, uid_t uid = 0);

AwesomePlayer 140 INCOGNITO = 0x8000,

PreviewPlayerBase.h 132 INCOGNITO = 32768,

//PreviewPlayerBase.cpp (http://androidxref.com/source/xref/frameworks/media/libvideoeditor/lvpp/PreviewPlayerBase.cpp)

247 status_t PreviewPlayerBase::setDataSource_l(
248         const char *uri, const KeyedVector<String8, String8> *headers) {
249     reset_l();
250 
251     mUri = uri;
252 
253     if (headers) {
254         mUriHeaders = *headers;
255 
256         ssize_t index = mUriHeaders.indexOfKey(String8("x-hide-urls-from-log"));
257         if (index >= 0) {
258             // Browser is in "incognito" mode, suppress logging URLs.
259 
260             // This isn't something that should be passed to the server.
261             mUriHeaders.removeItemsAt(index);
262 
263             mFlags |= INCOGNITO;
264         }
265     }
266 
267     if (!(mFlags & INCOGNITO)) {
268         LOGI("setDataSource_l('%s')", mUri.string());
269     } else {
270         LOGI("setDataSource_l(URL suppressed)");
271     }
272 
273     // The actual work will be done during preparation in the call to
274     // ::finishSetDataSource_l to avoid blocking the calling thread in
275     // setDataSource for any significant time.
276 
277     return OK;
278 }
279  




 30 struct ChromiumHTTPDataSource : public HTTPBase {
 31     ChromiumHTTPDataSource(uint32_t flags = 0);
 32 
 33     virtual status_t connect(
 34             const char *uri,
 35             const KeyedVector<String8, String8> *headers = NULL,
 36             off64_t offset = 0);
 37 
 38     virtual void disconnect();
 39 
 40     virtual status_t initCheck() const;
 41 
 42     virtual ssize_t readAt(off64_t offset, void *data, size_t size);
 43     virtual status_t getSize(off64_t *size);
 44     virtual uint32_t flags();
2

There are 2 best solutions below

4
On

We typically use M0n0wall. Just download, burn a DVD, boot from it on a 2-ported PC. One to the net, the other to your Google TV. You can then throttle the network how ever you wish.

0
On

As the problem is isolated to a single manufacturer device it is no longer preventing adaptive streaming. In fact, should the Sony BLueray fail to adapt the video streaming this could still be an issue but one that would need to be forwarded to Sony. Thank all for their time.