Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/gpu/arc_video_accelerator.h

Issue 1945543002: Use explicit flush for ArcVideoAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address posciak's comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ 5 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_
6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ 6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_
7 7
8 #include "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
11 namespace arc { 11 namespace arc {
12 12
13 enum HalPixelFormatExtension { 13 enum HalPixelFormatExtension {
14 // The pixel formats defined in Android but are used here. They are defined 14 // The pixel formats defined in Android but are used here. They are defined
15 // in "system/core/include/system/graphics.h" 15 // in "system/core/include/system/graphics.h"
16 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, 16 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23,
17 17
18 // The following formats are not defined in Android, but used in 18 // The following formats are not defined in Android, but used in
19 // ArcVideoAccelerator to identify the input format. 19 // ArcVideoAccelerator to identify the input format.
20 HAL_PIXEL_FORMAT_H264 = 0x34363248, 20 HAL_PIXEL_FORMAT_H264 = 0x34363248,
21 HAL_PIXEL_FORMAT_VP8 = 0x00385056, 21 HAL_PIXEL_FORMAT_VP8 = 0x00385056,
22 }; 22 };
23 23
24 enum PortType { 24 enum PortType {
25 PORT_INPUT = 0, 25 PORT_INPUT = 0,
26 PORT_OUTPUT = 1, 26 PORT_OUTPUT = 1,
27 PORT_COUNT = 2, 27 PORT_COUNT = 2,
28 }; 28 };
29 29
30 enum BufferFlag {
31 BUFFER_FLAG_EOS = 1 << 0,
32 };
33
34 struct BufferMetadata { 30 struct BufferMetadata {
35 int64_t timestamp = 0; // in microseconds 31 int64_t timestamp = 0; // in microseconds
36 uint32_t flags = 0; // Flags defined in BufferFlag.
37 uint32_t bytes_used = 0; 32 uint32_t bytes_used = 0;
38 }; 33 };
39 34
40 struct VideoFormat { 35 struct VideoFormat {
41 uint32_t pixel_format = 0; 36 uint32_t pixel_format = 0;
42 uint32_t buffer_size = 0; 37 uint32_t buffer_size = 0;
43 38
44 // Minimum number of buffers required to decode/encode the stream. 39 // Minimum number of buffers required to decode/encode the stream.
45 uint32_t min_num_buffers = 0; 40 uint32_t min_num_buffers = 0;
46 uint32_t coded_width = 0; 41 uint32_t coded_width = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 virtual void OnBufferDone(PortType port, 89 virtual void OnBufferDone(PortType port,
95 uint32_t index, 90 uint32_t index,
96 const BufferMetadata& metadata) = 0; 91 const BufferMetadata& metadata) = 0;
97 92
98 // Called when the output format has changed or the output format 93 // Called when the output format has changed or the output format
99 // becomes available at beginning of the stream after initial parsing. 94 // becomes available at beginning of the stream after initial parsing.
100 virtual void OnOutputFormatChanged(const VideoFormat& format) = 0; 95 virtual void OnOutputFormatChanged(const VideoFormat& format) = 0;
101 96
102 // Called as a completion notification for Reset(). 97 // Called as a completion notification for Reset().
103 virtual void OnResetDone() = 0; 98 virtual void OnResetDone() = 0;
99
100 // Called as a completion notification for Flush().
101 virtual void OnFlushDone() = 0;
104 }; 102 };
105 103
106 // Initializes the ArcVideoAccelerator with specific configuration. This 104 // Initializes the ArcVideoAccelerator with specific configuration. This
107 // must be called before any other methods. This call is synchronous and 105 // must be called before any other methods. This call is synchronous and
108 // returns true iff initialization is successful. 106 // returns true iff initialization is successful.
109 virtual bool Initialize(const Config& config, Client* client) = 0; 107 virtual bool Initialize(const Config& config, Client* client) = 0;
110 108
111 // Assigns a shared memory to be used for the accelerator at the specified 109 // Assigns a shared memory to be used for the accelerator at the specified
112 // port and index. A buffer must be successfully bound before it can be passed 110 // port and index. A buffer must be successfully bound before it can be passed
113 // to the accelerator via UseBuffer(). Already bound buffers may be reused 111 // to the accelerator via UseBuffer(). Already bound buffers may be reused
(...skipping 21 matching lines...) Expand all
135 133
136 // Sets the number of output buffers. When it fails, Client::OnError() will 134 // Sets the number of output buffers. When it fails, Client::OnError() will
137 // be called. 135 // be called.
138 virtual void SetNumberOfOutputBuffers(size_t number) = 0; 136 virtual void SetNumberOfOutputBuffers(size_t number) = 0;
139 137
140 // Resets the accelerator. When it is done, Client::OnResetDone() will 138 // Resets the accelerator. When it is done, Client::OnResetDone() will
141 // be called. Afterwards, all buffers won't be accessed by the accelerator 139 // be called. Afterwards, all buffers won't be accessed by the accelerator
142 // and there won't be more callbacks. 140 // and there won't be more callbacks.
143 virtual void Reset() = 0; 141 virtual void Reset() = 0;
144 142
143 // Flushes the accelerator. After all the output buffers pending decode have
144 // been returned to client by OnBufferDone(), Client::OnFlushDone() will be
145 // called.
146 virtual void Flush() = 0;
147
145 virtual ~ArcVideoAccelerator() {} 148 virtual ~ArcVideoAccelerator() {}
146 }; 149 };
147 150
148 } // namespace arc 151 } // namespace arc
149 } // namespace chromeos 152 } // namespace chromeos
150 153
151 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ 154 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698