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

Side by Side Diff: content/common/gpu/media/dxva_video_decode_accelerator.h

Issue 540043003: Don't dismiss picture buffers on rez change until they are available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment fix Created 6 years, 3 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 (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 CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <d3d9.h> 8 #include <d3d9.h>
9 // Work around bug in this header by disabling the relevant warning for it. 9 // Work around bug in this header by disabling the relevant warning for it.
10 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h -in-win8-sdk-triggers-c4201-with-w4 10 // https://connect.microsoft.com/VisualStudio/feedback/details/911260/dxva2api-h -in-win8-sdk-triggers-c4201-with-w4
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // Helper for handling the Decode operation. 144 // Helper for handling the Decode operation.
145 void DecodeInternal(const base::win::ScopedComPtr<IMFSample>& input_sample); 145 void DecodeInternal(const base::win::ScopedComPtr<IMFSample>& input_sample);
146 146
147 // Handles mid stream resolution changes. 147 // Handles mid stream resolution changes.
148 void HandleResolutionChanged(int width, int height); 148 void HandleResolutionChanged(int width, int height);
149 149
150 struct DXVAPictureBuffer; 150 struct DXVAPictureBuffer;
151 typedef std::map<int32, linked_ptr<DXVAPictureBuffer> > OutputBuffers; 151 typedef std::map<int32, linked_ptr<DXVAPictureBuffer> > OutputBuffers;
152 152
153 // Tells the client to dismiss the stale picture buffers passed in. 153 // Tells the client to dismiss the stale picture buffers passed in.
154 void DismissStaleBuffers(const OutputBuffers& picture_buffers); 154 void DismissStaleBuffers();
155 155
156 // To expose client callbacks from VideoDecodeAccelerator. 156 // To expose client callbacks from VideoDecodeAccelerator.
157 media::VideoDecodeAccelerator::Client* client_; 157 media::VideoDecodeAccelerator::Client* client_;
158 158
159 base::win::ScopedComPtr<IMFTransform> decoder_; 159 base::win::ScopedComPtr<IMFTransform> decoder_;
160 160
161 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_; 161 base::win::ScopedComPtr<IDirect3D9Ex> d3d9_;
162 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_; 162 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_;
163 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_; 163 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_;
164 base::win::ScopedComPtr<IDirect3DQuery9> query_; 164 base::win::ScopedComPtr<IDirect3DQuery9> query_;
(...skipping 24 matching lines...) Expand all
189 189
190 typedef std::list<PendingSampleInfo> PendingOutputSamples; 190 typedef std::list<PendingSampleInfo> PendingOutputSamples;
191 191
192 // List of decoded output samples. 192 // List of decoded output samples.
193 PendingOutputSamples pending_output_samples_; 193 PendingOutputSamples pending_output_samples_;
194 194
195 // This map maintains the picture buffers passed the client for decoding. 195 // This map maintains the picture buffers passed the client for decoding.
196 // The key is the picture buffer id. 196 // The key is the picture buffer id.
197 OutputBuffers output_picture_buffers_; 197 OutputBuffers output_picture_buffers_;
198 198
199 // After a resolution change there may be a few output buffers which have yet
200 // to be displayed so they cannot be dismissed immediately. We move them from
201 // |output_picture_buffers_| to this map so they may be dismissed once they
202 // become available.
203 OutputBuffers stale_output_picture_buffers_;
204
199 // Set to true if we requested picture slots from the client. 205 // Set to true if we requested picture slots from the client.
200 bool pictures_requested_; 206 bool pictures_requested_;
201 207
202 // Counter which holds the number of input packets before a successful 208 // Counter which holds the number of input packets before a successful
203 // decode. 209 // decode.
204 int inputs_before_decode_; 210 int inputs_before_decode_;
205 211
206 // List of input samples waiting to be processed. 212 // List of input samples waiting to be processed.
207 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs; 213 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs;
208 PendingInputs pending_input_buffers_; 214 PendingInputs pending_input_buffers_;
209 215
210 // Callback to set the correct gl context. 216 // Callback to set the correct gl context.
211 base::Callback<bool(void)> make_context_current_; 217 base::Callback<bool(void)> make_context_current_;
212 218
213 // WeakPtrFactory for posting tasks back to |this|. 219 // WeakPtrFactory for posting tasks back to |this|.
214 base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_; 220 base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
215 }; 221 };
216 222
217 } // namespace content 223 } // namespace content
218 224
219 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 225 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698