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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 1560953002: Implement fallback from WMPI to WMPA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only include MediaCodecUtil on Android. 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 | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 4a1f4f74fde973229147c86413149cdc6101554c..6139ce961480cb68903d26bb6678f6f97bdad820 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -34,6 +34,7 @@
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
+#include "media/base/android/media_codec_util.h"
#include "media/base/android/media_common_android.h"
#include "media/base/android/media_player_android.h"
#include "media/base/bind_to_current_loop.h"
@@ -1928,29 +1929,9 @@ void WebMediaPlayerAndroid::enterFullscreen() {
suppress_deleting_texture_ = false;
}
-// Test whether the path of a URL ends with '.m3u8'.
-static bool IsHLSPath(const GURL& url) {
- if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile())
- return false;
-
- std::string path = url.path();
- return base::EndsWith(path, ".m3u8", base::CompareCase::INSENSITIVE_ASCII);
-}
-
-// Predict whether NuPlayer will use HTTPLiveSource.
-static bool IsHLSURL(const GURL& url) {
- if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile())
- return false;
-
- std::string spec = url.spec();
- if (base::EndsWith(spec, ".m3u8", base::CompareCase::INSENSITIVE_ASCII))
- return true;
- return (spec.find("m3u8") != std::string::npos);
-}
-
bool WebMediaPlayerAndroid::IsHLSStream() const {
const GURL& url = redirected_url_.is_empty() ? url_ : redirected_url_;
- return IsHLSURL(url);
+ return media::MediaCodecUtil::IsHLSURL(url);
}
void WebMediaPlayerAndroid::ReportHLSMetrics() const {
@@ -1965,8 +1946,8 @@ void WebMediaPlayerAndroid::ReportHLSMetrics() const {
}
// Assuming that |is_hls| is the ground truth, test predictions.
- bool is_hls_path = IsHLSPath(url_);
- bool is_hls_url = IsHLSURL(url_);
+ bool is_hls_path = media::MediaCodecUtil::IsHLSPath(url_);
+ bool is_hls_url = media::MediaCodecUtil::IsHLSURL(url_);
MediaTypePredictionResult result = PREDICTION_RESULT_ALL_INCORRECT;
if (is_hls_path == is_hls && is_hls_url == is_hls) {
result = PREDICTION_RESULT_ALL_CORRECT;
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698