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

Side by Side Diff: media/video/video_decode_accelerator.h

Issue 1816203003: Add an additional VDA::Flush() mode to return all allocated buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 6 #define MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // When set to ALLOCATE, the VDA is expected to allocate backing memory 107 // When set to ALLOCATE, the VDA is expected to allocate backing memory
108 // for PictureBuffers at the time of AssignPictureBuffers() call. 108 // for PictureBuffers at the time of AssignPictureBuffers() call.
109 // When set to IMPORT, the VDA will not allocate, but after receiving 109 // When set to IMPORT, the VDA will not allocate, but after receiving
110 // AssignPictureBuffers() call, it will expect a call to 110 // AssignPictureBuffers() call, it will expect a call to
111 // ImportBufferForPicture() for each PictureBuffer before use. 111 // ImportBufferForPicture() for each PictureBuffer before use.
112 enum class OutputMode { 112 enum class OutputMode {
113 ALLOCATE, 113 ALLOCATE,
114 IMPORT, 114 IMPORT,
115 }; 115 };
116 116
117 // Specifies how the VDA should behave on VDA::Flush().
118 //
119 // - KEEP_OUTPUT_BUFFERS: the VDA may retain PictureBuffers that did not
120 // contain any decoded pictures at the end of flush for later use. In this
121 // mode, VDA returns via PictureReady() only the Pictures containing any
122 // remaining frames, decoded and/or released as a part of the flush, and
123 // ends the flush sequence by posting NotifyFlushDone().
124 //
125 // - RETURN_OUTPUT_BUFFERS: the VDA must return all PictureBuffers via
126 // PictureReady() before posting NotifyFlushDone(), including buffers not
Owen Lin 2016/04/13 09:21:39 Actually, the whole VideoDecodeAccelerator runs in
Pawel Osciak 2016/04/14 02:14:01 That's true, however VDA is also an IPC interface
Owen Lin 2016/04/14 02:57:17 I see. You're right, I only think about the the us
127 // containing decoded frames (if any). Buffers not containing any decoded
128 // data must have bitstream_buffer_id set to -1.
129 // Note: buffers returned to the VDA by the Client via ReusePictureBuffer()
130 // after NotifyFlushDone() is posted by the VDA (even if NotifyFlushDone()
131 // has not yet been serviced by the Client) can be kept by the VDA and
132 // reused after flush.
133 enum class FlushMode {
134 KEEP_OUTPUT_BUFFERS,
135 RETURN_OUTPUT_BUFFERS,
136 };
137
117 Config() = default; 138 Config() = default;
118 Config(VideoCodecProfile profile); 139 Config(VideoCodecProfile profile);
119 Config(const VideoDecoderConfig& video_decoder_config); 140 Config(const VideoDecoderConfig& video_decoder_config);
120 141
121 std::string AsHumanReadableString() const; 142 std::string AsHumanReadableString() const;
122 143
123 // |profile| combines the information about the codec and its profile. 144 // |profile| combines the information about the codec and its profile.
124 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; 145 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
125 146
126 // The flag indicating whether the stream is encrypted. 147 // The flag indicating whether the stream is encrypted.
127 bool is_encrypted = false; 148 bool is_encrypted = false;
128 149
129 // The flag indicating whether the client supports deferred initialization 150 // The flag indicating whether the client supports deferred initialization
130 // or not. 151 // or not.
131 bool is_deferred_initialization_allowed = false; 152 bool is_deferred_initialization_allowed = false;
132 153
133 // An optional graphics surface that the VDA should render to. For setting 154 // An optional graphics surface that the VDA should render to. For setting
134 // an output SurfaceView on Android. It's only valid when not equal to 155 // an output SurfaceView on Android. It's only valid when not equal to
135 // |kNoSurfaceID|. 156 // |kNoSurfaceID|.
136 int surface_id = kNoSurfaceID; 157 int surface_id = kNoSurfaceID;
137 158
138 // Coded size of the video frame hint, subject to change. 159 // Coded size of the video frame hint, subject to change.
139 gfx::Size initial_expected_coded_size; 160 gfx::Size initial_expected_coded_size;
140 161
141 OutputMode output_mode = OutputMode::ALLOCATE; 162 OutputMode output_mode = OutputMode::ALLOCATE;
163
164 FlushMode flush_mode = FlushMode::KEEP_OUTPUT_BUFFERS;
142 }; 165 };
143 166
144 // Interface for collaborating with picture interface to provide memory for 167 // Interface for collaborating with picture interface to provide memory for
145 // output picture and blitting them. These callbacks will not be made unless 168 // output picture and blitting them. These callbacks will not be made unless
146 // Initialize() has returned successfully. 169 // Initialize() has returned successfully.
147 // This interface is extended by the various layers that relay messages back 170 // This interface is extended by the various layers that relay messages back
148 // to the plugin, through the PPP_VideoDecoder_Dev interface the plugin 171 // to the plugin, through the PPP_VideoDecoder_Dev interface the plugin
149 // implements. 172 // implements.
150 class MEDIA_EXPORT Client { 173 class MEDIA_EXPORT Client {
151 public: 174 public:
(...skipping 11 matching lines...) Expand all
163 // larger than the value requested. 186 // larger than the value requested.
164 virtual void ProvidePictureBuffers(uint32_t requested_num_of_buffers, 187 virtual void ProvidePictureBuffers(uint32_t requested_num_of_buffers,
165 uint32_t textures_per_buffer, 188 uint32_t textures_per_buffer,
166 const gfx::Size& dimensions, 189 const gfx::Size& dimensions,
167 uint32_t texture_target) = 0; 190 uint32_t texture_target) = 0;
168 191
169 // Callback to dismiss picture buffer that was assigned earlier. 192 // Callback to dismiss picture buffer that was assigned earlier.
170 virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0; 193 virtual void DismissPictureBuffer(int32_t picture_buffer_id) = 0;
171 194
172 // Callback to deliver decoded pictures ready to be displayed. 195 // Callback to deliver decoded pictures ready to be displayed.
196 // If picture.bitstream_buffer_id is set to -1, the buffer does not contain
197 // any decoded data, but is being returned as a part of Flush().
173 virtual void PictureReady(const Picture& picture) = 0; 198 virtual void PictureReady(const Picture& picture) = 0;
174 199
175 // Callback to notify that decoded has decoded the end of the current 200 // Callback to notify that decoded has decoded the end of the current
176 // bitstream buffer. 201 // bitstream buffer.
177 virtual void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) = 0; 202 virtual void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) = 0;
178 203
179 // Flush completion callback. 204 // Flush completion callback.
180 virtual void NotifyFlushDone() = 0; 205 virtual void NotifyFlushDone() = 0;
181 206
182 // Reset completion callback. 207 // Reset completion callback.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // for each buffer that has been processed so that decoder may know onto which 286 // for each buffer that has been processed so that decoder may know onto which
262 // picture buffers it can write the output to. 287 // picture buffers it can write the output to.
263 // 288 //
264 // Parameters: 289 // Parameters:
265 // |picture_buffer_id| id of the picture buffer that is to be reused. 290 // |picture_buffer_id| id of the picture buffer that is to be reused.
266 virtual void ReusePictureBuffer(int32_t picture_buffer_id) = 0; 291 virtual void ReusePictureBuffer(int32_t picture_buffer_id) = 0;
267 292
268 // Flushes the decoder: all pending inputs will be decoded and pictures handed 293 // Flushes the decoder: all pending inputs will be decoded and pictures handed
269 // back to the client, followed by NotifyFlushDone() being called on the 294 // back to the client, followed by NotifyFlushDone() being called on the
270 // client. Can be used to implement "end of stream" notification. 295 // client. Can be used to implement "end of stream" notification.
296 // Exact behavior of Flush() depends on the selected FlushMode, set in the
297 // Config passed to Initialize().
271 virtual void Flush() = 0; 298 virtual void Flush() = 0;
272 299
273 // Resets the decoder: all pending inputs are dropped immediately and the 300 // Resets the decoder: all pending inputs are dropped immediately and the
274 // decoder returned to a state ready for further Decode()s, followed by 301 // decoder returned to a state ready for further Decode()s, followed by
275 // NotifyResetDone() being called on the client. Can be used to implement 302 // NotifyResetDone() being called on the client. Can be used to implement
276 // "seek". 303 // "seek".
277 virtual void Reset() = 0; 304 virtual void Reset() = 0;
278 305
279 // Destroys the decoder: all pending inputs are dropped immediately and the 306 // Destroys the decoder: all pending inputs are dropped immediately and the
280 // component is freed. This call may asynchornously free system resources, 307 // component is freed. This call may asynchornously free system resources,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator> 365 // Specialize std::default_delete so that scoped_ptr<VideoDecodeAccelerator>
339 // uses "Destroy()" instead of trying to use the destructor. 366 // uses "Destroy()" instead of trying to use the destructor.
340 template <> 367 template <>
341 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> { 368 struct MEDIA_EXPORT default_delete<media::VideoDecodeAccelerator> {
342 void operator()(media::VideoDecodeAccelerator* vda) const; 369 void operator()(media::VideoDecodeAccelerator* vda) const;
343 }; 370 };
344 371
345 } // namespace std 372 } // namespace std
346 373
347 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_ 374 #endif // MEDIA_VIDEO_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/vt_video_decode_accelerator_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698