OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 6 #define CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <queue> | 11 #include <queue> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "gpu/command_buffer/common/mailbox.h" | 17 #include "gpu/command_buffer/common/mailbox.h" |
18 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
19 #include "media/video/video_decode_accelerator.h" | 19 #include "media/video/video_decode_accelerator.h" |
20 #include "ppapi/c/pp_codecs.h" | 20 #include "ppapi/c/pp_codecs.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class SingleThreadTaskRunner; | 23 class SingleThreadTaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace cc_blink { | |
27 class ContextProviderWebContext; | |
28 } | |
29 | |
30 namespace gpu { | 26 namespace gpu { |
31 namespace gles2 { | 27 namespace gles2 { |
32 class GLES2Interface; | 28 class GLES2Interface; |
33 } | 29 } |
34 } | 30 } |
35 | 31 |
36 namespace media { | 32 namespace media { |
37 class DecoderBuffer; | 33 class DecoderBuffer; |
38 } | 34 } |
39 | 35 |
40 namespace content { | 36 namespace content { |
41 | 37 |
| 38 class ContextProviderCommandBuffer; |
42 class PepperVideoDecoderHost; | 39 class PepperVideoDecoderHost; |
43 | 40 |
44 // This class is a shim to wrap a media::VideoDecoder so that it can be used | 41 // This class is a shim to wrap a media::VideoDecoder so that it can be used |
45 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. | 42 // by PepperVideoDecoderHost in place of a media::VideoDecodeAccelerator. |
46 // This class should be constructed, used, and destructed on the main (render) | 43 // This class should be constructed, used, and destructed on the main (render) |
47 // thread. | 44 // thread. |
48 class VideoDecoderShim : public media::VideoDecodeAccelerator { | 45 class VideoDecoderShim : public media::VideoDecodeAccelerator { |
49 public: | 46 public: |
50 VideoDecoderShim(PepperVideoDecoderHost* host, uint32_t texture_pool_size); | 47 VideoDecoderShim(PepperVideoDecoderHost* host, uint32_t texture_pool_size); |
51 ~VideoDecoderShim() override; | 48 ~VideoDecoderShim() override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void DeleteTexture(uint32_t texture_id); | 80 void DeleteTexture(uint32_t texture_id); |
84 // Call this whenever we change GL state that the plugin relies on, such as | 81 // Call this whenever we change GL state that the plugin relies on, such as |
85 // creating picture textures. | 82 // creating picture textures. |
86 void FlushCommandBuffer(); | 83 void FlushCommandBuffer(); |
87 | 84 |
88 std::unique_ptr<DecoderImpl> decoder_impl_; | 85 std::unique_ptr<DecoderImpl> decoder_impl_; |
89 State state_; | 86 State state_; |
90 | 87 |
91 PepperVideoDecoderHost* host_; | 88 PepperVideoDecoderHost* host_; |
92 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
93 scoped_refptr<cc_blink::ContextProviderWebContext> context_provider_; | 90 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
94 | 91 |
95 // The current decoded frame size. | 92 // The current decoded frame size. |
96 gfx::Size texture_size_; | 93 gfx::Size texture_size_; |
97 // Map that takes the plugin's GL texture id to the renderer's GL texture id. | 94 // Map that takes the plugin's GL texture id to the renderer's GL texture id. |
98 typedef base::hash_map<uint32_t, uint32_t> TextureIdMap; | 95 typedef base::hash_map<uint32_t, uint32_t> TextureIdMap; |
99 TextureIdMap texture_id_map_; | 96 TextureIdMap texture_id_map_; |
100 // Available textures (these are plugin ids.) | 97 // Available textures (these are plugin ids.) |
101 typedef base::hash_set<uint32_t> TextureIdSet; | 98 typedef base::hash_set<uint32_t> TextureIdSet; |
102 TextureIdSet available_textures_; | 99 TextureIdSet available_textures_; |
103 // Track textures that are no longer needed (these are plugin ids.) | 100 // Track textures that are no longer needed (these are plugin ids.) |
(...skipping 17 matching lines...) Expand all Loading... |
121 std::unique_ptr<YUVConverter> yuv_converter_; | 118 std::unique_ptr<YUVConverter> yuv_converter_; |
122 | 119 |
123 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; | 120 base::WeakPtrFactory<VideoDecoderShim> weak_ptr_factory_; |
124 | 121 |
125 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); | 122 DISALLOW_COPY_AND_ASSIGN(VideoDecoderShim); |
126 }; | 123 }; |
127 | 124 |
128 } // namespace content | 125 } // namespace content |
129 | 126 |
130 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ | 127 #endif // CONTENT_RENDERER_PEPPER_VIDEO_DECODER_SHIM_H_ |
OLD | NEW |