chcunningham | 9812dd8 | 2015-10-20 01:42:09 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "media/base/media_util.h" |
| 6 | |
Dan Sanders | 96732f5 | 2018-11-07 00:53:46 | [diff] [blame] | 7 | #include "base/metrics/histogram_macros.h" |
John Rummell | 25a00c7 | 2018-03-20 18:01:30 | [diff] [blame] | 8 | #include "media/base/encryption_pattern.h" |
| 9 | |
chcunningham | 9812dd8 | 2015-10-20 01:42:09 | [diff] [blame] | 10 | namespace media { |
| 11 | |
Dan Sanders | 96732f5 | 2018-11-07 00:53:46 | [diff] [blame] | 12 | namespace { |
| 13 | |
| 14 | // Reported to UMA server. Do not renumber or reuse values. |
| 15 | enum class MediaVideoHeight { |
| 16 | k360_OrLower, |
| 17 | k480, |
| 18 | k720, |
| 19 | k1080, |
| 20 | k1440, |
| 21 | k2160_OrHigher, |
| 22 | kMaxValue = k2160_OrHigher, |
| 23 | }; |
| 24 | |
| 25 | MediaVideoHeight GetMediaVideoHeight(int height) { |
| 26 | if (height <= 400) |
| 27 | return MediaVideoHeight::k360_OrLower; |
| 28 | if (height <= 600) |
| 29 | return MediaVideoHeight::k480; |
| 30 | if (height <= 900) |
| 31 | return MediaVideoHeight::k720; |
| 32 | if (height <= 1260) |
| 33 | return MediaVideoHeight::k1080; |
| 34 | if (height <= 1800) |
| 35 | return MediaVideoHeight::k1440; |
| 36 | return MediaVideoHeight::k2160_OrHigher; |
| 37 | } |
| 38 | |
| 39 | } // namespace |
| 40 | |
chcunningham | 9812dd8 | 2015-10-20 01:42:09 | [diff] [blame] | 41 | std::vector<uint8_t> EmptyExtraData() { |
| 42 | return std::vector<uint8_t>(); |
| 43 | } |
| 44 | |
dougsteed | 8d5275f | 2016-03-12 00:04:30 | [diff] [blame] | 45 | EncryptionScheme Unencrypted() { |
| 46 | return EncryptionScheme(); |
| 47 | } |
| 48 | |
| 49 | EncryptionScheme AesCtrEncryptionScheme() { |
| 50 | return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, |
John Rummell | 25a00c7 | 2018-03-20 18:01:30 | [diff] [blame] | 51 | EncryptionPattern()); |
dougsteed | 8d5275f | 2016-03-12 00:04:30 | [diff] [blame] | 52 | } |
| 53 | |
Dan Sanders | 96732f5 | 2018-11-07 00:53:46 | [diff] [blame] | 54 | void ReportPepperVideoDecoderOutputPictureCountHW(int height) { |
| 55 | UMA_HISTOGRAM_ENUMERATION("Media.PepperVideoDecoderOutputPictureCount.HW", |
| 56 | GetMediaVideoHeight(height)); |
| 57 | } |
| 58 | |
| 59 | void ReportPepperVideoDecoderOutputPictureCountSW(int height) { |
| 60 | UMA_HISTOGRAM_ENUMERATION("Media.PepperVideoDecoderOutputPictureCount.SW", |
| 61 | GetMediaVideoHeight(height)); |
| 62 | } |
| 63 | |
chcunningham | 9812dd8 | 2015-10-20 01:42:09 | [diff] [blame] | 64 | } // namespace media |