| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // "OMX.google" prefix is always used for SW decoders, so that's what we | 169 // "OMX.google" prefix is always used for SW decoders, so that's what we |
| 170 // use. "OMX.SEC.*" codec is Samsung software implementation - report it | 170 // use. "OMX.SEC.*" codec is Samsung software implementation - report it |
| 171 // as unaccelerated as well. | 171 // as unaccelerated as well. |
| 172 return base::StartsWith(codec_name, "OMX.google.", | 172 return base::StartsWith(codec_name, "OMX.google.", |
| 173 base::CompareCase::SENSITIVE) || | 173 base::CompareCase::SENSITIVE) || |
| 174 base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE); | 174 base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // static | 177 // static |
| 178 bool MediaCodecUtil::IsHLSPath(const GURL& url) { | 178 bool MediaCodecUtil::IsHLSPath(const GURL& url) { |
| 179 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) | 179 return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) && |
| 180 return false; | 180 base::EndsWith(url.path(), ".m3u8", |
| 181 | 181 base::CompareCase::INSENSITIVE_ASCII); |
| 182 std::string path = url.path(); | |
| 183 return base::EndsWith(path, ".m3u8", base::CompareCase::INSENSITIVE_ASCII); | |
| 184 } | 182 } |
| 185 | 183 |
| 186 // static | 184 // static |
| 187 bool MediaCodecUtil::IsHLSURL(const GURL& url) { | 185 bool MediaCodecUtil::IsHLSURL(const GURL& url) { |
| 188 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) | 186 return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsFile()) && |
| 189 return false; | 187 url.spec().find("m3u8") != std::string::npos; |
| 190 | |
| 191 std::string spec = url.spec(); | |
| 192 if (base::EndsWith(spec, ".m3u8", base::CompareCase::INSENSITIVE_ASCII)) | |
| 193 return true; | |
| 194 | |
| 195 return (spec.find("m3u8") != std::string::npos); | |
| 196 } | 188 } |
| 197 | 189 |
| 198 // static | 190 // static |
| 199 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { | 191 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { |
| 200 return RegisterNativesImpl(env); | 192 return RegisterNativesImpl(env); |
| 201 } | 193 } |
| 202 | 194 |
| 203 // static | 195 // static |
| 204 bool MediaCodecUtil::IsVp8DecoderAvailable() { | 196 bool MediaCodecUtil::IsVp8DecoderAvailable() { |
| 205 return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kVp8MimeType); | 197 return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kVp8MimeType); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 if (base::StartsWith(model, model_prefixes[i], | 229 if (base::StartsWith(model, model_prefixes[i], |
| 238 base::CompareCase::INSENSITIVE_ASCII)) { | 230 base::CompareCase::INSENSITIVE_ASCII)) { |
| 239 return false; | 231 return false; |
| 240 } | 232 } |
| 241 } | 233 } |
| 242 | 234 |
| 243 return true; | 235 return true; |
| 244 } | 236 } |
| 245 | 237 |
| 246 } // namespace media | 238 } // namespace media |
| OLD | NEW |