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

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

Issue 8510039: Initial implementation of the DXVA 2.0 H.264 hardware decoder for pepper for Windows. The decodin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 FYI the CL description describes omx_v_d_a_test as
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_COMMON_GPU_MEDIA_DVX_VIDEO_DECODE_ACCELERATOR_H_
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 s/DVX/DXVA/ (here and in the other 2 related lines
ananta 2011/12/13 23:29:15 Done.
6 #define CONTENT_COMMON_GPU_MEDIA_DVX_VIDEO_DECODE_ACCELERATOR_H_
7
8 #include <d3d9.h>
9 #include <dxva2api.h>
10 #include <map>
11 #include <mfidl.h>
12 #include <vector>
13
14 #include "base/message_loop_proxy.h"
15 #include "base/win/scoped_comptr.h"
16 #include "media/video/video_decode_accelerator.h"
17 #include "third_party/angle/include/EGL/egl.h"
18 #include "third_party/angle/include/EGL/eglext.h"
19
20 interface IMFSample;
21 interface IDirect3DSurface9;
22
23 // Class to provide a DXVA 2.0 based accelerator behind VideoDecodeAccelerator
Ami GONE FROM CHROMIUM 2011/12/13 16:44:06 Is this really DXVA2.0 or is it MF? I know *nothi
ananta 2011/12/13 23:29:15 Fixed the comment. Thanks for pointing this out.
Ami GONE FROM CHROMIUM 2011/12/16 07:38:54 So you're saying this really is DXVA2.0-specific,
24 // interface.
25 // This class lives on a single thread and DCHECKs that it is never accessed
26 // from any other.
27 class DXVAVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
28 public:
29 typedef enum {
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 FWIW this is C++; you can say enum State { ... };
ananta 2011/12/13 23:29:15 Done.
30 kUninitialized, // un-initialized.
31 kNormal, // normal playing state.
32 kResetting, // upon received Reset(), before ResetDone()
33 kEosDrain, // upon input EOS received.
34 kStopped, // upon output EOS received.
35 } State;
36
37 // Does not take ownership of |client| which must outlive |*this|.
38 explicit DXVAVideoDecodeAccelerator(
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 explicit unneeded (unless you drop renderer_proces
ananta 2011/12/13 23:29:15 Done.
39 media::VideoDecodeAccelerator::Client* client,
40 base::ProcessHandle renderer_process);
41 virtual ~DXVAVideoDecodeAccelerator();
42
43 // media::VideoDecodeAccelerator implementation.
44 bool Initialize(Profile profile) OVERRIDE;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 OVERRIDE requires 'virtual' (or else the clang bot
ananta 2011/12/13 23:29:15 Done.
45 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
46 virtual void AssignPictureBuffers(
47 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
48 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
49 void Flush() OVERRIDE;
50 void Reset() OVERRIDE;
51 void Destroy() OVERRIDE;
52
53 private:
54 bool CreateD3DDevManager();
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 There's a real dearth of commentary here. I think
55 bool InitDecoder();
56 bool CheckDecoderDxvaSupport();
57 bool SetDecoderMediaTypes();
58 bool SetDecoderInputMediaType();
59 bool SetDecoderOutputMediaType(const GUID& subtype);
60 bool SendMFTMessage(MFT_MESSAGE_TYPE msg, int32 param);
61 bool GetStreamsInfoAndBufferReqs();
62 bool DoDecode();
63 bool ProcessOutputSample(IMFSample* sample);
64 bool CopyOutputSampleDataToPictureBuffer(IDirect3DSurface9* dest_surface,
65 media::PictureBuffer buffer,
66 int32 input_buffer_id);
67 void ProcessPendingSamples();
68
69 private:
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 You already said private: at l.53 above.
ananta 2011/12/13 23:29:15 I added this because this section has member varia
70 base::MessageLoopProxy* message_loop_;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 I think this is only used to assert being on the c
ananta 2011/12/13 23:29:15 Done.
71 // To expose client callbacks from VideoDecodeAccelerator.
72 // NOTE: all calls to this object *MUST* be executed in message_loop_.
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 Can drop comment this if the class becomes NonThre
ananta 2011/12/13 23:29:15 Done.
73 media::VideoDecodeAccelerator::Client* client_;
74
75 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_;
76 base::win::ScopedComPtr<IDirect3DDeviceManager9> device_manager_;
77 base::win::ScopedComPtr<IMFTransform> decoder_;
78
79 UINT32 surface_width_;
80 UINT32 surface_height_;
81
82 // Current state of the decoder.
83 State state_;
84
85 MFT_INPUT_STREAM_INFO input_stream_info_;
86 MFT_OUTPUT_STREAM_INFO output_stream_info_;
87
88 // Contains information about a decoded sample.
89 struct PendingSampleInfo {
90 base::win::ScopedComPtr<IDirect3DSurface9> surface;
91 int32 input_buffer_id;
92 };
93
94 typedef std::vector<PendingSampleInfo>
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 Single line
ananta 2011/12/13 23:29:15 Done.
95 PendingOutputSamples;
96
97 // List of output samples for rendering.
98 PendingOutputSamples pending_output_samples_;
99
100 // Maintains information about a DXVA picture buffer, i.e. whether it is
101 // available for rendering, the texture information, etc.
102 struct DXVAPictureBuffer {
103 DXVAPictureBuffer()
104 : picture_buffer(0, gfx::Size(), 0) {
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 ctor definition belongs out-of-line in the .cc fil
105 available = false;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 Why not initializer-list this one too?
ananta 2011/12/13 23:29:15 Done.
106 }
107 bool available;
108 media::PictureBuffer picture_buffer;
109 };
110
111 typedef std::map<int32, DXVAPictureBuffer> OutputBuffers;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 doco the key.
ananta 2011/12/13 23:29:15 Done.
112 OutputBuffers available_pictures_;
Ami GONE FROM CHROMIUM 2011/12/13 16:44:06 This is a poor name considering some of its elemen
ananta 2011/12/13 23:29:15 Changed to output_picture_buffers_
113
114 // Set to true if we requested picture slots from the plugin.
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 s/plugin/client/
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 s/slots/buffers/
ananta 2011/12/13 23:29:15 Done.
115 bool pictures_requested_;
116
117 // Contains the list of input buffer ids which map to frame time from the
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 I don't understand this comment (or how the vector
ananta 2011/12/13 23:29:15 Vector not needed as you mentioned in the cc file.
118 // plugin.
119 std::vector<int32> input_buffer_frame_times_;
120
121 // Handle to the renderer process.
122 base::ProcessHandle renderer_process_;
123
124 uint32 dev_manager_reset_token_;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 Can this not be a local variable in the (only) fun
ananta 2011/12/13 23:29:15 Please see Al Patrick's comment in the initial sna
125
126 #if !defined(NDEBUG)
127 uint32 decode_start_time_;
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 This smells like something that must have a generi
ananta 2011/12/13 23:29:15 Will take a look at this.
ananta 2011/12/14 23:56:52 Fixed. We now use the ETW trace macros for Windows
128 int inputs_before_decode_;
129 #endif // !defined(NDEBUG)
130 };
Ami GONE FROM CHROMIUM 2011/12/13 07:24:56 DISALLOW_?
ananta 2011/12/13 23:29:15 Done.
131
132 #endif // CONTENT_COMMON_GPU_MEDIA_DVX_VIDEO_DECODE_ACCELERATOR_H_
133
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698