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

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

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de Rebase. Created 6 years, 9 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 | Annotate | Revision Log
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 // 39 //
40 // Threading/life-cycle: this object is created & destroyed on the GPU 40 // Threading/life-cycle: this object is created & destroyed on the GPU
41 // ChildThread. A few methods on it are called on the decoder thread which is 41 // ChildThread. A few methods on it are called on the decoder thread which is
42 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread 42 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread
43 // can assume |*this| is still alive. See |weak_this_| below for more details. 43 // can assume |*this| is still alive. See |weak_this_| below for more details.
44 class CONTENT_EXPORT VaapiVideoDecodeAccelerator 44 class CONTENT_EXPORT VaapiVideoDecodeAccelerator
45 : public VideoDecodeAcceleratorImpl { 45 : public VideoDecodeAcceleratorImpl {
46 public: 46 public:
47 VaapiVideoDecodeAccelerator( 47 VaapiVideoDecodeAccelerator(
48 Display* x_display, 48 Display* x_display,
49 Client* client,
50 const base::Callback<bool(void)>& make_context_current); 49 const base::Callback<bool(void)>& make_context_current);
51 virtual ~VaapiVideoDecodeAccelerator(); 50 virtual ~VaapiVideoDecodeAccelerator();
52 51
53 // media::VideoDecodeAccelerator implementation. 52 // media::VideoDecodeAccelerator implementation.
54 virtual bool Initialize(media::VideoCodecProfile profile) OVERRIDE; 53 virtual bool Initialize(media::VideoCodecProfile profile,
54 Client* client) OVERRIDE;
55 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 55 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
56 virtual void AssignPictureBuffers( 56 virtual void AssignPictureBuffers(
57 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 57 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
58 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 58 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
59 virtual void Flush() OVERRIDE; 59 virtual void Flush() OVERRIDE;
60 virtual void Reset() OVERRIDE; 60 virtual void Reset() OVERRIDE;
61 virtual void Destroy() OVERRIDE; 61 virtual void Destroy() OVERRIDE;
62 62
63 private: 63 private:
64 // Notify the client that an error has occurred and decoding cannot continue. 64 // Notify the client that an error has occurred and decoding cannot continue.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // object is still alive. As a result, tasks posted from ChildThread to 232 // object is still alive. As a result, tasks posted from ChildThread to
233 // decoder thread should use base::Unretained(this), and tasks posted from the 233 // decoder thread should use base::Unretained(this), and tasks posted from the
234 // decoder thread to the ChildThread should use |weak_this_|. 234 // decoder thread to the ChildThread should use |weak_this_|.
235 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_; 235 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_;
236 236
237 // Callback used when creating VASurface objects. 237 // Callback used when creating VASurface objects.
238 VASurface::ReleaseCB va_surface_release_cb_; 238 VASurface::ReleaseCB va_surface_release_cb_;
239 239
240 // To expose client callbacks from VideoDecodeAccelerator. 240 // To expose client callbacks from VideoDecodeAccelerator.
241 // NOTE: all calls to these objects *MUST* be executed on message_loop_. 241 // NOTE: all calls to these objects *MUST* be executed on message_loop_.
242 base::WeakPtrFactory<Client> client_ptr_factory_; 242 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_;
243 base::WeakPtr<Client> client_; 243 base::WeakPtr<Client> client_;
244 244
245 scoped_ptr<VaapiWrapper> vaapi_wrapper_; 245 scoped_ptr<VaapiWrapper> vaapi_wrapper_;
246 246
247 // Comes after vaapi_wrapper_ to ensure its destructor is executed before 247 // Comes after vaapi_wrapper_ to ensure its destructor is executed before
248 // vaapi_wrapper_ is destroyed. 248 // vaapi_wrapper_ is destroyed.
249 scoped_ptr<VaapiH264Decoder> decoder_; 249 scoped_ptr<VaapiH264Decoder> decoder_;
250 base::Thread decoder_thread_; 250 base::Thread decoder_thread_;
251 // Use this to post tasks to |decoder_thread_| instead of 251 // Use this to post tasks to |decoder_thread_| instead of
252 // |decoder_thread_.message_loop()| because the latter will be NULL once 252 // |decoder_thread_.message_loop()| because the latter will be NULL once
(...skipping 14 matching lines...) Expand all
267 // Last requested number/resolution of output picture buffers. 267 // Last requested number/resolution of output picture buffers.
268 size_t requested_num_pics_; 268 size_t requested_num_pics_;
269 gfx::Size requested_pic_size_; 269 gfx::Size requested_pic_size_;
270 270
271 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); 271 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator);
272 }; 272 };
273 273
274 } // namespace content 274 } // namespace content
275 275
276 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ 276 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.cc ('k') | content/common/gpu/media/vaapi_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698