OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_ | |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_ | |
7 | |
8 #include <map> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/containers/hash_tables.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/scoped_vector.h" | |
16 #include "content/common/content_export.h" | |
17 #include "gpu/command_buffer/common/mailbox.h" | |
18 #include "media/video/video_decode_accelerator.h" | |
19 #include "ppapi/c/pp_codecs.h" | |
20 #include "ppapi/host/host_message_context.h" | |
21 #include "ppapi/host/resource_host.h" | |
22 #include "ppapi/proxy/resource_message_params.h" | |
23 | |
24 namespace base { | |
25 class SharedMemory; | |
26 } | |
27 | |
28 namespace content { | |
29 | |
30 class PPB_Graphics3D_Impl; | |
31 class RendererPpapiHost; | |
32 class RenderViewImpl; | |
33 | |
34 class CONTENT_EXPORT PepperVideoDecoderHost | |
35 : public ppapi::host::ResourceHost, | |
36 public media::VideoDecodeAccelerator::Client { | |
37 public: | |
38 PepperVideoDecoderHost(RendererPpapiHost* host, | |
39 PP_Instance instance, | |
40 PP_Resource resource); | |
41 virtual ~PepperVideoDecoderHost(); | |
42 | |
43 private: | |
44 struct PendingDecode { | |
45 PendingDecode(uint32_t shm_id, | |
46 const ppapi::host::ReplyMessageContext& reply_context); | |
47 ~PendingDecode(); | |
48 | |
49 uint32_t shm_id; | |
50 ppapi::host::ReplyMessageContext reply_context; | |
51 }; | |
52 | |
53 virtual int32_t OnResourceMessageReceived( | |
54 const IPC::Message& msg, | |
55 ppapi::host::HostMessageContext* context) OVERRIDE; | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
is nice to include for each batch of OVERRIDEs a c
dmichael (off chromium)
2014/05/28 21:00:02
IMO, methods should always be protected at the hig
bbudge
2014/05/29 00:03:34
Added comment.
| |
56 | |
57 // media::VideoDecodeAccelerator::Client implementation. | |
58 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | |
59 const gfx::Size& dimensions, | |
60 uint32 texture_target) OVERRIDE; | |
61 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | |
62 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | |
63 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; | |
64 virtual void NotifyFlushDone() OVERRIDE; | |
65 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | |
66 virtual void NotifyResetDone() OVERRIDE; | |
67 | |
68 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, | |
69 const ppapi::HostResource& graphics_context, | |
70 PP_VideoProfile profile, | |
71 bool allow_software_fallback); | |
72 int32_t OnHostMsgGetShm(ppapi::host::HostMessageContext* context, | |
73 uint32_t shm_id, | |
74 uint32_t shm_size); | |
75 int32_t OnHostMsgDecode(ppapi::host::HostMessageContext* context, | |
76 uint32_t shm_id, | |
77 uint32_t size); | |
78 int32_t OnHostMsgAssignTextures(ppapi::host::HostMessageContext* context, | |
79 const PP_Size& size, | |
80 const std::vector<uint32_t>& texture_ids); | |
81 int32_t OnHostMsgRecyclePicture(ppapi::host::HostMessageContext* context, | |
82 uint32_t picture_id); | |
83 int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context); | |
84 int32_t OnHostMsgReset(ppapi::host::HostMessageContext* context); | |
85 | |
86 void DoDecode(ppapi::host::HostMessageContext* context, | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
Short method, single caller, and no doco make me w
bbudge
2014/05/29 00:03:34
Yeah, left over from an earlier CL. Removed.
| |
87 uint32_t shm_id, | |
88 uint32_t size); | |
89 void RequestTextures(uint32 num_textures, | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
ditto but more so.
bbudge
2014/05/29 00:03:34
Done.
| |
90 const gfx::Size& dimensions, | |
91 uint32 texture_target); | |
92 | |
93 // Non-owning pointer. | |
94 RendererPpapiHost* renderer_ppapi_host_; | |
95 | |
96 scoped_ptr<media::VideoDecodeAccelerator> decoder_; | |
97 | |
98 scoped_refptr<PPB_Graphics3D_Impl> graphics3d_; | |
99 ScopedVector<base::SharedMemory> shm_buffers_; | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
I think it's the case that the shm_id variable tha
bbudge
2014/05/29 00:03:34
Done.
| |
100 | |
101 // Tracks buffers that are in use by the decoder. | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
Not clear what the contents of the vector are (and
bbudge
2014/05/29 00:03:34
Yes, this is parallel to shm_buffers_. I'm trying
| |
102 std::vector<uint8_t> shm_buffer_busy_; | |
103 // Number of Decode calls made so far, to generate a uid for each decode. | |
104 // This number will overflow after 414 days, assuming 60Hz video. | |
Ami GONE FROM CHROMIUM
2014/05/28 20:50:56
I think this sentence is saying "This code will tr
bbudge
2014/05/29 00:03:34
These pass through the decoder as int32_t's so tha
| |
105 int32_t num_decodes_; | |
106 // Maps decode uid to PendingDecode info. | |
107 typedef base::hash_map<int32_t, PendingDecode> PendingDecodeMap; | |
108 PendingDecodeMap pending_decodes_; | |
109 | |
110 ppapi::host::ReplyMessageContext flush_reply_context_; | |
111 ppapi::host::ReplyMessageContext reset_reply_context_; | |
112 | |
113 bool initialized_; | |
114 | |
115 DISALLOW_COPY_AND_ASSIGN(PepperVideoDecoderHost); | |
116 }; | |
117 | |
118 } // namespace content | |
119 | |
120 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_DECODER_HOST_H_ | |
OLD | NEW |