Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3777)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java

Issue 1922093002: [MediaFling] Fix timestamp issue in remote media playback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java
index dc10f6f68bf163b2c4166327d7f42ce2360592c9..b68099c38758da0d287639002af25f3f6d9166f1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java
@@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
+import android.os.SystemClock;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaItemMetadata;
import android.support.v7.media.MediaItemStatus;
@@ -665,7 +666,14 @@ public class DefaultMediaRouteController extends AbstractMediaRouteController {
// update the position using the remote player's position
// duration can possibly be -1 if it's unknown, so cap to 0
long position = Math.min(Math.max(itemStatus.getContentPosition(), 0), duration);
- long timestamp = itemStatus.getTimestamp();
+ // TODO(zqzhang): The GMS core currently uses SystemClock.uptimeMillis() as
+ // timestamp, which does not conform to the MediaRouter support library docs. See
+ // b/28378525 and
+ // http://developer.android.com/reference/android/support/v7/media/MediaItemStatus.html#getTimestamp().
+ // Override the timestamp with elapsedRealtime() by assuming the delay between the
+ // GMS core produces the MediaItemStatus and the code reaches here is short enough.
+ // long timestamp = itemStatus.getTimestamp();
+ long timestamp = SystemClock.elapsedRealtime();
notifyDurationUpdated(duration);
notifyPositionUpdated(position);
mPositionExtrapolator.onPositionInfoUpdated(duration, position, timestamp);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698