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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 WebMediaPlayer::MediaKeyException e = | 1476 WebMediaPlayer::MediaKeyException e = |
1477 GenerateKeyRequestInternal(ascii_key_system, init_data, init_data_length); | 1477 GenerateKeyRequestInternal(ascii_key_system, init_data, init_data_length); |
1478 ReportMediaKeyExceptionToUMA("generateKeyRequest", ascii_key_system, e); | 1478 ReportMediaKeyExceptionToUMA("generateKeyRequest", ascii_key_system, e); |
1479 return e; | 1479 return e; |
1480 } | 1480 } |
1481 | 1481 |
1482 // Guess the type of |init_data|. This is only used to handle some corner cases | 1482 // Guess the type of |init_data|. This is only used to handle some corner cases |
1483 // so we keep it as simple as possible without breaking major use cases. | 1483 // so we keep it as simple as possible without breaking major use cases. |
1484 static std::string GuessInitDataType(const unsigned char* init_data, | 1484 static std::string GuessInitDataType(const unsigned char* init_data, |
1485 unsigned init_data_length) { | 1485 unsigned init_data_length) { |
1486 // Most WebM files use KeyId of 16 bytes. CENC init data is always >16 bytes. | 1486 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. |
1487 if (init_data_length == 16) | 1487 if (init_data_length == 16) |
1488 return "webm"; | 1488 return "video/webm"; |
1489 | 1489 |
1490 return "cenc"; | 1490 return "video/mp4"; |
1491 } | 1491 } |
1492 | 1492 |
1493 // TODO(xhwang): Report an error when there is encrypted stream but EME is | 1493 // TODO(xhwang): Report an error when there is encrypted stream but EME is |
1494 // not enabled. Currently the player just doesn't start and waits for | 1494 // not enabled. Currently the player just doesn't start and waits for |
1495 // ever. | 1495 // ever. |
1496 WebMediaPlayer::MediaKeyException | 1496 WebMediaPlayer::MediaKeyException |
1497 WebMediaPlayerAndroid::GenerateKeyRequestInternal( | 1497 WebMediaPlayerAndroid::GenerateKeyRequestInternal( |
1498 const std::string& key_system, | 1498 const std::string& key_system, |
1499 const unsigned char* init_data, | 1499 const unsigned char* init_data, |
1500 unsigned init_data_length) { | 1500 unsigned init_data_length) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 | 1814 |
1815 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1815 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1816 std::string mime; | 1816 std::string mime; |
1817 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1817 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1818 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1818 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1819 return false; | 1819 return false; |
1820 return !mime.compare("application/x-mpegurl"); | 1820 return !mime.compare("application/x-mpegurl"); |
1821 } | 1821 } |
1822 | 1822 |
1823 } // namespace content | 1823 } // namespace content |
OLD | NEW |