summaryrefslogtreecommitdiff
path: root/chromium/media/gpu/android/device_info.cc
blob: cdf0395dba80d8f8e3f56abedecca19a3f6f0698 (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
65
66
67
68
69
// Copyright 2017 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/gpu/android/device_info.h"

#include "base/android/build_info.h"
#include "media/base/android/media_codec_util.h"

namespace media {

DeviceInfo* DeviceInfo::GetInstance() {
  static DeviceInfo* info = new DeviceInfo();
  return info;
}

int DeviceInfo::SdkVersion() {
  static const int result = base::android::BuildInfo::GetInstance()->sdk_int();
  return result;
}

bool DeviceInfo::IsVp8DecoderAvailable() {
  static const bool result = MediaCodecUtil::IsVp8DecoderAvailable();
  return result;
}

bool DeviceInfo::IsVp9DecoderAvailable() {
  static const bool result = MediaCodecUtil::IsVp9DecoderAvailable();
  return result;
}

bool DeviceInfo::IsAv1DecoderAvailable() {
  static const bool result = MediaCodecUtil::IsAv1DecoderAvailable();
  return result;
}

bool DeviceInfo::IsDecoderKnownUnaccelerated(VideoCodec codec) {
  return MediaCodecUtil::IsKnownUnaccelerated(codec,
                                              MediaCodecDirection::DECODER);
}

bool DeviceInfo::IsSetOutputSurfaceSupported() {
  static const bool result = MediaCodecUtil::IsSetOutputSurfaceSupported();
  return result;
}

bool DeviceInfo::SupportsOverlaySurfaces() {
  static const bool result = MediaCodecUtil::IsSurfaceViewOutputSupported();
  return result;
}

bool DeviceInfo::CodecNeedsFlushWorkaround(MediaCodecBridge* codec) {
  return MediaCodecUtil::CodecNeedsFlushWorkaround(codec);
}

bool DeviceInfo::IsAsyncApiSupported() {
  // Technically the base setCallback() API is available in L, but we
  // need the version which accepts a Handler which is in M... but
  // in M there's a MediaCodec bug that's not fixed until N :|
  // https://crbug.com/873094 https://crbug.com/610523
  return SdkVersion() >= base::android::SDK_VERSION_NOUGAT;
}

bool DeviceInfo::AddSupportedCodecProfileLevels(
    std::vector<CodecProfileLevel>* result) {
  return MediaCodecUtil::AddSupportedCodecProfileLevels(result);
}

}  // namespace media