| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/android/media_codec_util.h" | 5 #include "media/base/android/media_codec_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // "OMX.google" prefix is always used for SW decoders, so that's what we | 171 // "OMX.google" prefix is always used for SW decoders, so that's what we |
| 172 // use. "OMX.SEC.*" codec is Samsung software implementation - report it | 172 // use. "OMX.SEC.*" codec is Samsung software implementation - report it |
| 173 // as unaccelerated as well. | 173 // as unaccelerated as well. |
| 174 return base::StartsWith(codec_name, "OMX.google.", | 174 return base::StartsWith(codec_name, "OMX.google.", |
| 175 base::CompareCase::SENSITIVE) || | 175 base::CompareCase::SENSITIVE) || |
| 176 base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE); | 176 base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE); |
| 177 } | 177 } |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 bool MediaCodecUtil::IsHLSPath(const GURL& url) { | 180 bool MediaCodecUtil::IsHLSPath(const GURL& url) { |
| 181 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) | 181 return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) && |
| 182 return false; | 182 base::EndsWith(url.path(), ".m3u8", |
| 183 | 183 base::CompareCase::INSENSITIVE_ASCII); |
| 184 std::string path = url.path(); | |
| 185 return base::EndsWith(path, ".m3u8", base::CompareCase::INSENSITIVE_ASCII); | |
| 186 } | 184 } |
| 187 | 185 |
| 188 // static | 186 // static |
| 189 bool MediaCodecUtil::IsHLSURL(const GURL& url) { | 187 bool MediaCodecUtil::IsHLSURL(const GURL& url) { |
| 190 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) | 188 return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) && |
| 191 return false; | 189 url.spec().find("m3u8") != std::string::npos; |
| 192 | |
| 193 std::string spec = url.spec(); | |
| 194 if (base::EndsWith(spec, ".m3u8", base::CompareCase::INSENSITIVE_ASCII)) | |
| 195 return true; | |
| 196 | |
| 197 return (spec.find("m3u8") != std::string::npos); | |
| 198 } | 190 } |
| 199 | 191 |
| 200 // static | 192 // static |
| 201 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { | 193 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { |
| 202 return RegisterNativesImpl(env); | 194 return RegisterNativesImpl(env); |
| 203 } | 195 } |
| 204 | 196 |
| 205 // static | 197 // static |
| 206 bool MediaCodecUtil::IsVp8DecoderAvailable() { | 198 bool MediaCodecUtil::IsVp8DecoderAvailable() { |
| 207 return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kVp8MimeType); | 199 return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kVp8MimeType); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 if (base::StartsWith(model, model_prefixes[i], | 231 if (base::StartsWith(model, model_prefixes[i], |
| 240 base::CompareCase::INSENSITIVE_ASCII)) { | 232 base::CompareCase::INSENSITIVE_ASCII)) { |
| 241 return false; | 233 return false; |
| 242 } | 234 } |
| 243 } | 235 } |
| 244 | 236 |
| 245 return true; | 237 return true; |
| 246 } | 238 } |
| 247 | 239 |
| 248 } // namespace media | 240 } // namespace media |
| OLD | NEW |