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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java

Issue 1626283002: Use MediaMetadataRetriever.setDataSource(Context, Uri) for "content" scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java b/content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java
index f7b7cd3a4503f34883bff2209fd0bde8ba8d4f9c..8a79d4d03e0d1c6c5245a75758b996a4a837b58f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/MediaResourceGetter.java
@@ -10,6 +10,7 @@ import android.content.pm.PackageManager;
import android.media.MediaMetadataRetriever;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
@@ -228,6 +229,15 @@ class MediaResourceGetter {
return false;
}
}
+ if (scheme.equals("content")) {
+ try {
+ configure(context, Uri.parse(uri.toString()));
+ return true;
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Error configuring data source: %s", e.getMessage());
qinmin 2016/01/25 18:58:56 nit: you can simply do Log.e(TAG, "Error configuri
horo 2016/01/25 22:58:41 Done.
+ return false;
+ }
+ }
if (uri.getPath() != null && uri.getPath().endsWith(".m3u8")) {
// MediaMetadataRetriever does not work with HLS correctly.
return false;
@@ -397,6 +407,10 @@ class MediaResourceGetter {
mRetriever.setDataSource(path);
}
+ void configure(Context context, Uri uri) {
+ mRetriever.setDataSource(context, uri);
+ }
+
@VisibleForTesting
String extractMetadata(int key) {
return mRetriever.extractMetadata(key);
« 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