| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 WebMediaPlayer::MediaKeyException e = | 1491 WebMediaPlayer::MediaKeyException e = |
| 1492 GenerateKeyRequestInternal(ascii_key_system, init_data, init_data_length); | 1492 GenerateKeyRequestInternal(ascii_key_system, init_data, init_data_length); |
| 1493 ReportMediaKeyExceptionToUMA("generateKeyRequest", ascii_key_system, e); | 1493 ReportMediaKeyExceptionToUMA("generateKeyRequest", ascii_key_system, e); |
| 1494 return e; | 1494 return e; |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 // Guess the type of |init_data|. This is only used to handle some corner cases | 1497 // Guess the type of |init_data|. This is only used to handle some corner cases |
| 1498 // so we keep it as simple as possible without breaking major use cases. | 1498 // so we keep it as simple as possible without breaking major use cases. |
| 1499 static std::string GuessInitDataType(const unsigned char* init_data, | 1499 static std::string GuessInitDataType(const unsigned char* init_data, |
| 1500 unsigned init_data_length) { | 1500 unsigned init_data_length) { |
| 1501 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. | 1501 // Most WebM files use KeyId of 16 bytes. CENC init data is always >16 bytes. |
| 1502 if (init_data_length == 16) | 1502 if (init_data_length == 16) |
| 1503 return "video/webm"; | 1503 return "webm"; |
| 1504 | 1504 |
| 1505 return "video/mp4"; | 1505 return "cenc"; |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 // TODO(xhwang): Report an error when there is encrypted stream but EME is | 1508 // TODO(xhwang): Report an error when there is encrypted stream but EME is |
| 1509 // not enabled. Currently the player just doesn't start and waits for | 1509 // not enabled. Currently the player just doesn't start and waits for |
| 1510 // ever. | 1510 // ever. |
| 1511 WebMediaPlayer::MediaKeyException | 1511 WebMediaPlayer::MediaKeyException |
| 1512 WebMediaPlayerAndroid::GenerateKeyRequestInternal( | 1512 WebMediaPlayerAndroid::GenerateKeyRequestInternal( |
| 1513 const std::string& key_system, | 1513 const std::string& key_system, |
| 1514 const unsigned char* init_data, | 1514 const unsigned char* init_data, |
| 1515 unsigned init_data_length) { | 1515 unsigned init_data_length) { |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 | 1829 |
| 1830 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1830 bool WebMediaPlayerAndroid::IsHLSStream() const { |
| 1831 std::string mime; | 1831 std::string mime; |
| 1832 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1832 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
| 1833 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1833 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
| 1834 return false; | 1834 return false; |
| 1835 return !mime.compare("application/x-mpegurl"); | 1835 return !mime.compare("application/x-mpegurl"); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 } // namespace content | 1838 } // namespace content |
| OLD | NEW |