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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
media / gpu / windows / d3d11_status.h [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_WINDOWS_D3D11_STATUS_H_
#define MEDIA_GPU_WINDOWS_D3D11_STATUS_H_
#include <wrl/client.h>
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "media/base/status.h"
namespace media {
enum class D3D11StatusCode : StatusCodeType {
kOk = 0,
kFailedToGetAngleDevice = 1,
kUnsupportedFeatureLevel = 2,
kFailedToGetVideoDevice = 3,
kFailedToGetDeviceContext = 4,
kFailedToInitializeGPUProcess = 5,
kDecoderFailedDecode = 6,
kDecoderUnsupportedProfile = 7,
kDecoderUnsupportedCodec = 8,
kDecoderUnsupportedConfig = 9,
kDecoderCreationFailed = 10,
kMakeContextCurrentFailed = 11,
kCreateTextureSelectorFailed = 12,
kQueryID3D11MultithreadFailed = 13,
kGetDecoderConfigCountFailed = 14,
kGetDecoderConfigFailed = 15,
kProcessTextureFailed = 16,
kUnsupportedTextureFormatForBind = 17,
kCreateDecoderOutputViewFailed = 18,
kAllocateTextureForCopyingWrapperFailed = 19,
kCreateDecoderOutputTextureFailed = 20,
kCreateVideoProcessorInputViewFailed = 21,
kVideoProcessorBltFailed = 22,
kCreateVideoProcessorOutputViewFailed = 23,
kCreateVideoProcessorFailed = 24,
kQueryVideoContextFailed = 25,
kAcceleratorFlushFailed = 26,
kTryAgainNotSupported = 27,
kCryptoConfigFailed = 28,
kDecoderBeginFrameFailed = 29,
kGetPicParamBufferFailed = 30,
kReleasePicParamBufferFailed = 31,
kGetBitstreamBufferFailed = 32,
kReleaseBitstreamBufferFailed = 33,
kGetSliceControlBufferFailed = 34,
kReleaseSliceControlBufferFailed = 35,
kDecoderEndFrameFailed = 36,
kSubmitDecoderBuffersFailed = 37,
kGetQuantBufferFailed = 38,
kReleaseQuantBufferFailed = 39,
kBitstreamBufferSliceTooBig = 40,
kCreateSharedImageFailed = 41,
kGetKeyedMutexFailed = 42,
kAcquireKeyedMutexFailed = 43,
kReleaseKeyedMutexFailed = 44,
kCreateSharedHandleFailed = 45,
kProduceVideoDecodeImageRepresentationFailed = 46,
kVideoDecodeImageRepresentationBeginScopedWriteAccessFailed = 47,
kGetCommandBufferHelperFailed = 48,
kDecoderGetCreationParametersFailed = 49,
kGetDeviceFailed = 50,
kCreateFenceFailed = 51,
kFenceSignalFailed = 52,
kWaitForFenceFailed = 53,
};
struct D3D11StatusTraits {
using Codes = D3D11StatusCode;
static constexpr StatusGroupType Group() { return "D3D11Status"; }
static void OnCreateFrom(TypedStatus<D3D11StatusTraits>* s, HRESULT hresult) {
// Store it as a string for easy human consumption.
std::stringstream hresult_str_repr;
hresult_str_repr << std::hex << hresult;
s->WithData("hresult", hresult_str_repr.str());
// Store it as an integer for easy machine consumption.
s->WithData("hresult_raw", static_cast<int32_t>(hresult));
// Store the system error that might have been generated, if it's an
// allowable string.
std::string sys_err = logging::SystemErrorCodeToString(hresult);
if (base::IsStringUTF8AllowingNoncharacters(sys_err))
s->WithData("hresult_msg", sys_err);
}
};
using D3D11Status = TypedStatus<D3D11StatusTraits>;
} // namespace media
#endif // MEDIA_GPU_WINDOWS_D3D11_STATUS_H_