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

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

Issue 23125014: Run VDA::Decode on GPU IO thread if VDA supports it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a separate MessageFilter for GVDA Created 7 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 // This file contains an implementation of VideoDecoderAccelerator 5 // This file contains an implementation of VideoDecoderAccelerator
6 // that utilizes hardware video decoder present on Intel CPUs. 6 // that utilizes hardware video decoder present on Intel CPUs.
7 7
8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
10 10
(...skipping 28 matching lines...) Expand all
39 // Threading/life-cycle: this object is created & destroyed on the GPU 39 // Threading/life-cycle: this object is created & destroyed on the GPU
40 // ChildThread. A few methods on it are called on the decoder thread which is 40 // ChildThread. A few methods on it are called on the decoder thread which is
41 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread 41 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread
42 // can assume |*this| is still alive. See |weak_this_| below for more details. 42 // can assume |*this| is still alive. See |weak_this_| below for more details.
43 class CONTENT_EXPORT VaapiVideoDecodeAccelerator : 43 class CONTENT_EXPORT VaapiVideoDecodeAccelerator :
44 public media::VideoDecodeAccelerator { 44 public media::VideoDecodeAccelerator {
45 public: 45 public:
46 VaapiVideoDecodeAccelerator( 46 VaapiVideoDecodeAccelerator(
47 Display* x_display, GLXContext glx_context, 47 Display* x_display, GLXContext glx_context,
48 Client* client, 48 Client* client,
49 const base::Callback<bool(void)>& make_context_current); 49 const base::Callback<bool(void)>& make_context_current,
50 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
50 virtual ~VaapiVideoDecodeAccelerator(); 51 virtual ~VaapiVideoDecodeAccelerator();
51 52
52 // media::VideoDecodeAccelerator implementation. 53 // media::VideoDecodeAccelerator implementation.
53 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; 54 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE;
54 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 55 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
55 virtual void AssignPictureBuffers( 56 virtual void AssignPictureBuffers(
56 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 57 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
57 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 58 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
58 virtual void Flush() OVERRIDE; 59 virtual void Flush() OVERRIDE;
59 virtual void Reset() OVERRIDE; 60 virtual void Reset() OVERRIDE;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // If we don't have any available TFPPictures at the time when the decoder 223 // If we don't have any available TFPPictures at the time when the decoder
223 // requests output, we'll store the request on pending_output_cbs_ queue for 224 // requests output, we'll store the request on pending_output_cbs_ queue for
224 // later and run it once the client gives us more textures 225 // later and run it once the client gives us more textures
225 // via ReusePictureBuffer(). 226 // via ReusePictureBuffer().
226 typedef base::Callback<void(TFPPicture*)> OutputCB; 227 typedef base::Callback<void(TFPPicture*)> OutputCB;
227 std::queue<OutputCB> pending_output_cbs_; 228 std::queue<OutputCB> pending_output_cbs_;
228 229
229 // ChildThread's message loop 230 // ChildThread's message loop
230 base::MessageLoop* message_loop_; 231 base::MessageLoop* message_loop_;
231 232
233 // IO message loop proxy
234 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
235
232 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder 236 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder
233 // thread back to the ChildThread. Because the decoder thread is a member of 237 // thread back to the ChildThread. Because the decoder thread is a member of
234 // this class, any task running on the decoder thread is guaranteed that this 238 // this class, any task running on the decoder thread is guaranteed that this
235 // object is still alive. As a result, tasks posted from ChildThread to 239 // object is still alive. As a result, tasks posted from ChildThread to
236 // decoder thread should use base::Unretained(this), and tasks posted from the 240 // decoder thread should use base::Unretained(this), and tasks posted from the
237 // decoder thread to the ChildThread should use |weak_this_|. 241 // decoder thread to the ChildThread should use |weak_this_|.
238 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_; 242 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_;
239 243
240 // To expose client callbacks from VideoDecodeAccelerator. 244 // To expose client callbacks from VideoDecodeAccelerator.
241 // NOTE: all calls to these objects *MUST* be executed on message_loop_. 245 // NOTE: all calls to these objects *MUST* be executed on message_loop_.
(...skipping 21 matching lines...) Expand all
263 // Last requested number/resolution of output picture buffers. 267 // Last requested number/resolution of output picture buffers.
264 size_t requested_num_pics_; 268 size_t requested_num_pics_;
265 gfx::Size requested_pic_size_; 269 gfx::Size requested_pic_size_;
266 270
267 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); 271 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator);
268 }; 272 };
269 273
270 } // namespace content 274 } // namespace content
271 275
272 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 276 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698