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

Side by Side Diff: chrome/renderer/media/gles2_video_decode_context.h

Issue 3335014: Added FakeGlVideoDecodeEngine to exercise the IPC protocol for hardware video decoding (Closed)
Patch Set: compile man... Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ 5 #ifndef CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_
6 #define CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ 6 #define CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_
7 7
8 #include "base/message_loop.h"
8 #include "media/video/video_decode_context.h" 9 #include "media/video/video_decode_context.h"
9 10
10 namespace WebKit { 11 namespace ggl {
11 class WebGLES2Context; 12 class Context;
12 } // namespace WebKit 13 } // namespace ggl
13 14
14 // FUNCTIONS 15 // FUNCTIONS
15 // 16 //
16 // This is a class that provides a video decode context using a GLES2 backend. 17 // This is a class that provides a video decode context using a ggl::Context
17 // It provides resources for a VideoDecodeEngine to store decoded video frames 18 // backend.
18 // in the GLES2 context. 19 //
20 // It provides resources for a VideoDecodeEngine to store decoded video frames.
19 // 21 //
20 // This class is aware of the command buffer implementation of GLES2 inside the 22 // This class is aware of the command buffer implementation of GLES2 inside the
21 // Chrome renderer and keeps a reference of ggl::Context. It might use GLES2 23 // Chrome renderer and keeps a reference of ggl::Context. It might use GLES2
22 // commands specific to Chrome's renderer process to provide needed resources. 24 // commands specific to Chrome's renderer process to provide needed resources.
23 // 25 //
24 // There are two different kinds of video frame storage provided by this class: 26 // There are two different kinds of video frame storage provided by this class:
25 // 1. Memory mapped YUV textures (aka software decoding mode). 27 // 1. Memory mapped YUV textures (aka software decoding mode).
26 // Each video frame allocated is backed by 3 luminance textures carrying 28 // Each video frame allocated is backed by 3 luminance textures carrying
27 // the Y, U and V planes. 29 // the Y, U and V planes.
28 // 30 //
(...skipping 14 matching lines...) Expand all
43 // 45 //
44 // 2. RGBA texture (aka hardware decoding mode). 46 // 2. RGBA texture (aka hardware decoding mode).
45 // In this mode of operation each video frame is backed by a RGBA texture. 47 // In this mode of operation each video frame is backed by a RGBA texture.
46 // This is used only when hardware video decoding is used. The texture needs 48 // This is used only when hardware video decoding is used. The texture needs
47 // to be generated and allocated inside the renderer process first. This 49 // to be generated and allocated inside the renderer process first. This
48 // will establish a translation between texture ID in the renderer process 50 // will establish a translation between texture ID in the renderer process
49 // and the GPU process. 51 // and the GPU process.
50 // 52 //
51 // The texture ID generated is used by IpcVideoDecodeEngine only to be sent 53 // The texture ID generated is used by IpcVideoDecodeEngine only to be sent
52 // the GPU process. Inside the GPU process the texture ID is translated to 54 // the GPU process. Inside the GPU process the texture ID is translated to
53 // a real texture ID inside the actual GLES context. The real texture ID is 55 // a real texture ID inside the actual context. The real texture ID is then
54 // then assigned to the hardware video decoder for storing the video frame. 56 // assigned to the hardware video decoder for storing the video frame.
55 // 57 //
56 // WebKit will see the video frame as a normal RGBA texture and perform 58 // WebKit will see the video frame as a normal RGBA texture and perform
57 // necessary render operations. 59 // necessary render operations.
58 // 60 //
59 // In both operation modes, the objective is to have WebKit see the video frames 61 // In both operation modes, the objective is to have WebKit see the video frames
60 // as regular textures. 62 // as regular textures.
61 // 63 //
62 // THREAD SEMANTICS 64 // THREAD SEMANTICS
63 // 65 //
64 // This class is accessed on two threads, namely the Render Thread and the 66 // This class is accessed on two threads, namely the Render Thread and the
(...skipping 11 matching lines...) Expand all
76 // only in software decoding mode. 78 // only in software decoding mode.
77 kMemoryMappedYuvTextures, 79 kMemoryMappedYuvTextures,
78 80
79 // This video decode context provides RBGA textures as storage. This is 81 // This video decode context provides RBGA textures as storage. This is
80 // used in hardware decoding mode. 82 // used in hardware decoding mode.
81 kRgbaTextures, 83 kRgbaTextures,
82 }; 84 };
83 85
84 //-------------------------------------------------------------------------- 86 //--------------------------------------------------------------------------
85 // Render Thread 87 // Render Thread
86 Gles2VideoDecodeContext(StorageType type, 88 Gles2VideoDecodeContext(StorageType type, ggl::Context* context);
87 WebKit::WebGLES2Context* gles2context);
88 89
89 // TODO(hclam): Need to figure out which thread destroys this object. 90 // TODO(hclam): Need to figure out which thread destroys this object.
90 virtual ~Gles2VideoDecodeContext(); 91 virtual ~Gles2VideoDecodeContext();
91 92
92 //-------------------------------------------------------------------------- 93 //--------------------------------------------------------------------------
93 // Video Decoder Thread 94 // Video Decoder Thread
94 95
95 // media::VideoDecodeContext implementation. 96 // media::VideoDecodeContext implementation.
96 virtual void* GetDevice(); 97 virtual void* GetDevice();
97 virtual void AllocateVideoFrames(int n, size_t width, size_t height, 98 virtual void AllocateVideoFrames(int n, size_t width, size_t height,
98 AllocationCompleteCallback* callback); 99 AllocationCompleteCallback* callback);
99 virtual void ReleaseVideoFrames(int n, media::VideoFrame* frames); 100 virtual void ReleaseVideoFrames(int n, media::VideoFrame* frames);
100 virtual void Destroy(DestructionCompleteCallback* callback); 101 virtual void Destroy(DestructionCompleteCallback* callback);
101 102
102 //-------------------------------------------------------------------------- 103 //--------------------------------------------------------------------------
103 // Any thread 104 // Any thread
104 // Accessor of the current mode of this decode context. 105 // Accessor of the current mode of this decode context.
105 bool IsMemoryMapped() const { return type_ == kMemoryMappedYuvTextures; } 106 bool IsMemoryMapped() const { return type_ == kMemoryMappedYuvTextures; }
106 107
107 private: 108 private:
109 // Message loop that this object lives on. This is the message loop that
110 // this object is created.
111 MessageLoop* message_loop_;
112
108 // Type of storage provided by this class. 113 // Type of storage provided by this class.
109 StorageType type_; 114 StorageType type_;
110 115
111 // TODO(hclam): We should keep a ggl::Context instead. 116 // Pointer to the GLES2 context.
112 WebKit::WebGLES2Context* context_; 117 ggl::Context* context_;
113 118
114 DISALLOW_COPY_AND_ASSIGN(Gles2VideoDecodeContext); 119 DISALLOW_COPY_AND_ASSIGN(Gles2VideoDecodeContext);
115 }; 120 };
116 121
117 #endif // CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_ 122 #endif // CHROME_RENDERER_MEDIA_GLES2_VIDEO_DECODE_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698