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

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

Issue 826663002: Support multiple video decoders and encoders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use callback function for decoders Created 5 years, 11 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_GPU_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 27
28 class GpuVideoDecodeAccelerator 28 class GpuVideoDecodeAccelerator
29 : public IPC::Listener, 29 : public IPC::Listener,
30 public IPC::Sender, 30 public IPC::Sender,
31 public media::VideoDecodeAccelerator::Client, 31 public media::VideoDecodeAccelerator::Client,
32 public GpuCommandBufferStub::DestructionObserver { 32 public GpuCommandBufferStub::DestructionObserver {
33 public: 33 public:
34 typedef base::Callback<scoped_ptr<media::VideoDecodeAccelerator>(void)>
Pawel Osciak 2014/12/31 07:55:59 This could be private?
henryhsu 2014/12/31 08:47:53 Done.
35 CreateVDACb;
36
34 // Each of the arguments to the constructor must outlive this object. 37 // Each of the arguments to the constructor must outlive this object.
35 // |stub->decoder()| will be made current around any operation that touches 38 // |stub->decoder()| will be made current around any operation that touches
36 // the underlying VDA so that it can make GL calls safely. 39 // the underlying VDA so that it can make GL calls safely.
37 GpuVideoDecodeAccelerator( 40 GpuVideoDecodeAccelerator(
38 int32 host_route_id, 41 int32 host_route_id,
39 GpuCommandBufferStub* stub, 42 GpuCommandBufferStub* stub,
40 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); 43 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
41 44
42 // IPC::Listener implementation. 45 // IPC::Listener implementation.
43 bool OnMessageReceived(const IPC::Message& message) override; 46 bool OnMessageReceived(const IPC::Message& message) override;
44 47
45 // media::VideoDecodeAccelerator::Client implementation. 48 // media::VideoDecodeAccelerator::Client implementation.
46 void ProvidePictureBuffers(uint32 requested_num_of_buffers, 49 void ProvidePictureBuffers(uint32 requested_num_of_buffers,
47 const gfx::Size& dimensions, 50 const gfx::Size& dimensions,
48 uint32 texture_target) override; 51 uint32 texture_target) override;
49 void DismissPictureBuffer(int32 picture_buffer_id) override; 52 void DismissPictureBuffer(int32 picture_buffer_id) override;
50 void PictureReady(const media::Picture& picture) override; 53 void PictureReady(const media::Picture& picture) override;
51 void NotifyError(media::VideoDecodeAccelerator::Error error) override; 54 void NotifyError(media::VideoDecodeAccelerator::Error error) override;
52 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; 55 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override;
53 void NotifyFlushDone() override; 56 void NotifyFlushDone() override;
54 void NotifyResetDone() override; 57 void NotifyResetDone() override;
55 58
56 // GpuCommandBufferStub::DestructionObserver implementation. 59 // GpuCommandBufferStub::DestructionObserver implementation.
57 void OnWillDestroyStub() override; 60 void OnWillDestroyStub() override;
58 61
59 // Function to delegate sending to actual sender. 62 // Function to delegate sending to actual sender.
60 bool Send(IPC::Message* message) override; 63 bool Send(IPC::Message* message) override;
61 64
62 // Initialize the accelerator with the given profile and send the 65 // Prepare all appropriate platform-specific VDAs and initialize VDAs with
Pawel Osciak 2014/12/31 07:55:59 The final effect is only one initialized VDA, perh
henryhsu 2014/12/31 08:47:53 Done.
63 // |init_done_msg| when done. 66 // |profile|. Send the |init_done_msg| when done. filter_ is passed to
67 // GpuCommandBufferStube channel only if we can decode on IO thread.
64 void Initialize(const media::VideoCodecProfile profile, 68 void Initialize(const media::VideoCodecProfile profile,
65 IPC::Message* init_done_msg); 69 IPC::Message* init_done_msg);
66 70
67 private: 71 private:
68 class MessageFilter; 72 class MessageFilter;
69 73
74 // Create the appropriate platform-specific VDA callback functions.
Pawel Osciak 2014/12/31 07:55:59 Return a set of VDA Create callback functions appl
henryhsu 2014/12/31 08:47:53 Done.
75 std::vector<CreateVDACb> CreateDecoderCbs();
76 // Create DXVA VDA.
Pawel Osciak 2014/12/31 07:55:59 These comments are probably unnecessary, method na
henryhsu 2014/12/31 08:47:53 Done.
77 scoped_ptr<media::VideoDecodeAccelerator> CreateDXVADecoder();
Pawel Osciak 2014/12/31 07:55:59 Could we please s/Decoder/VDA/ everywhere?
henryhsu 2014/12/31 08:47:53 Done.
78 // Create V4L2 VDA.
79 scoped_ptr<media::VideoDecodeAccelerator> CreateV4L2Decoder();
80 // Create Vaapi VDA.
81 scoped_ptr<media::VideoDecodeAccelerator> CreateVaapiDecoder();
82 // Create VT VDA.
83 scoped_ptr<media::VideoDecodeAccelerator> CreateVTDecoder();
84 // Create Android VDA.
85 scoped_ptr<media::VideoDecodeAccelerator> CreateAndroidDecoder();
86 // Create Ozone VDA.
87 scoped_ptr<media::VideoDecodeAccelerator> CreateOzoneDecoder();
88
70 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. 89 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there.
71 ~GpuVideoDecodeAccelerator() override; 90 ~GpuVideoDecodeAccelerator() override;
72 91
73 // Handlers for IPC messages. 92 // Handlers for IPC messages.
74 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); 93 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size);
75 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, 94 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids,
76 const std::vector<uint32>& texture_ids); 95 const std::vector<uint32>& texture_ids);
77 void OnReusePictureBuffer(int32 picture_buffer_id); 96 void OnReusePictureBuffer(int32 picture_buffer_id);
78 void OnFlush(); 97 void OnFlush();
79 void OnReset(); 98 void OnReset();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 151
133 // A map from picture buffer ID to TextureRef that have not been cleared. 152 // A map from picture buffer ID to TextureRef that have not been cleared.
134 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; 153 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_;
135 154
136 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); 155 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
137 }; 156 };
138 157
139 } // namespace content 158 } // namespace content
140 159
141 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 160 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698