summaryrefslogtreecommitdiff
path: root/chromium/media/base/media_util.cc
blob: 501574d330162bc735a8d1d7e1a25b083e10727d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "media/base/media_util.h"

#include "base/metrics/histogram_macros.h"
#include "media/base/encryption_pattern.h"

namespace media {

namespace {

// Reported to UMA server. Do not renumber or reuse values.
enum class MediaVideoHeight {
  k360_OrLower,
  k480,
  k720,
  k1080,
  k1440,
  k2160_OrHigher,
  kMaxValue = k2160_OrHigher,
};

MediaVideoHeight GetMediaVideoHeight(int height) {
  if (height <= 400)
    return MediaVideoHeight::k360_OrLower;
  if (height <= 600)
    return MediaVideoHeight::k480;
  if (height <= 900)
    return MediaVideoHeight::k720;
  if (height <= 1260)
    return MediaVideoHeight::k1080;
  if (height <= 1800)
    return MediaVideoHeight::k1440;
  return MediaVideoHeight::k2160_OrHigher;
}

}  // namespace

std::vector<uint8_t> EmptyExtraData() {
  return std::vector<uint8_t>();
}

EncryptionScheme Unencrypted() {
  return EncryptionScheme();
}

EncryptionScheme AesCtrEncryptionScheme() {
  return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR,
                          EncryptionPattern());
}

void ReportPepperVideoDecoderOutputPictureCountHW(int height) {
  UMA_HISTOGRAM_ENUMERATION("Media.PepperVideoDecoderOutputPictureCount.HW",
                            GetMediaVideoHeight(height));
}

void ReportPepperVideoDecoderOutputPictureCountSW(int height) {
  UMA_HISTOGRAM_ENUMERATION("Media.PepperVideoDecoderOutputPictureCount.SW",
                            GetMediaVideoHeight(height));
}

}  // namespace media