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

Side by Side Diff: media/gpu/dxva_picture_buffer_win.h

Issue 2495753002: Reenable idle suspension of media elements on Windows. (Closed)
Patch Set: add comment Created 4 years, 1 month 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
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/gpu/dxva_picture_buffer_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ 5 #ifndef MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_
6 #define MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ 6 #define MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_
7 7
8 #include <d3d11.h> 8 #include <d3d11.h>
9 #include <d3d9.h> 9 #include <d3d9.h>
10 #include <mfidl.h> 10 #include <mfidl.h>
11 11
12 #include <memory> 12 #include <memory>
13 13
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/win/scoped_comptr.h" 15 #include "base/win/scoped_comptr.h"
16 #include "media/video/picture.h" 16 #include "media/video/picture.h"
17 #include "third_party/angle/include/EGL/egl.h" 17 #include "third_party/angle/include/EGL/egl.h"
18 #include "third_party/angle/include/EGL/eglext.h" 18 #include "third_party/angle/include/EGL/eglext.h"
19 #include "ui/gl/gl_fence.h" 19 #include "ui/gl/gl_fence.h"
20 #include "ui/gl/gl_image.h"
20 21
21 interface IMFSample; 22 interface IMFSample;
22 23
23 namespace media { 24 namespace media {
24 class DXVAVideoDecodeAccelerator; 25 class DXVAVideoDecodeAccelerator;
25 26
26 // Maintains information about a DXVA picture buffer, i.e. whether it is 27 // Maintains information about a DXVA picture buffer, i.e. whether it is
27 // available for rendering, the texture information, etc. 28 // available for rendering, the texture information, etc.
28 class DXVAPictureBuffer { 29 class DXVAPictureBuffer {
29 public: 30 public:
(...skipping 16 matching lines...) Expand all
46 int input_buffer_id); 47 int input_buffer_id);
47 48
48 bool available() const { return state_ == UNUSED; } 49 bool available() const { return state_ == UNUSED; }
49 State state() const { return state_; } 50 State state() const { return state_; }
50 51
51 int id() const { return picture_buffer_.id(); } 52 int id() const { return picture_buffer_.id(); }
52 53
53 gfx::Size size() const { return picture_buffer_.size(); } 54 gfx::Size size() const { return picture_buffer_.size(); }
54 void set_bound(); 55 void set_bound();
55 56
57 scoped_refptr<gl::GLImage> gl_image() { return gl_image_; }
58
56 const gfx::ColorSpace& color_space() const { return color_space_; } 59 const gfx::ColorSpace& color_space() const { return color_space_; }
57 void set_color_space(const gfx::ColorSpace& color_space) { 60 void set_color_space(const gfx::ColorSpace& color_space) {
58 color_space_ = color_space; 61 color_space_ = color_space;
59 } 62 }
60 63
61 bool waiting_to_reuse() const { return state_ == WAITING_TO_REUSE; } 64 bool waiting_to_reuse() const { return state_ == WAITING_TO_REUSE; }
62 virtual gl::GLFence* reuse_fence(); 65 virtual gl::GLFence* reuse_fence();
63 66
64 // Called when the source surface |src_surface| is copied to the destination 67 // Called when the source surface |src_surface| is copied to the destination
65 // |dest_surface| 68 // |dest_surface|
66 virtual bool CopySurfaceComplete(IDirect3DSurface9* src_surface, 69 virtual bool CopySurfaceComplete(IDirect3DSurface9* src_surface,
67 IDirect3DSurface9* dest_surface); 70 IDirect3DSurface9* dest_surface);
68 virtual bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample); 71 virtual bool BindSampleToTexture(base::win::ScopedComPtr<IMFSample> sample);
69 72
70 protected: 73 protected:
71 explicit DXVAPictureBuffer(const PictureBuffer& buffer); 74 explicit DXVAPictureBuffer(const PictureBuffer& buffer);
72 75
73 State state_ = UNUSED; 76 State state_ = UNUSED;
74 PictureBuffer picture_buffer_; 77 PictureBuffer picture_buffer_;
75 gfx::ColorSpace color_space_; 78 gfx::ColorSpace color_space_;
79 scoped_refptr<gl::GLImage> gl_image_;
76 80
77 DISALLOW_COPY_AND_ASSIGN(DXVAPictureBuffer); 81 DISALLOW_COPY_AND_ASSIGN(DXVAPictureBuffer);
78 }; 82 };
79 83
80 // Copies the video result into an RGBA EGL pbuffer. 84 // Copies the video result into an RGBA EGL pbuffer.
81 class PbufferPictureBuffer : public DXVAPictureBuffer { 85 class PbufferPictureBuffer : public DXVAPictureBuffer {
82 public: 86 public:
83 explicit PbufferPictureBuffer(const PictureBuffer& buffer); 87 explicit PbufferPictureBuffer(const PictureBuffer& buffer);
84 ~PbufferPictureBuffer() override; 88 ~PbufferPictureBuffer() override;
85 89
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // the decoder. 186 // the decoder.
183 base::win::ScopedComPtr<ID3D11Texture2D> decoder_copy_texture_; 187 base::win::ScopedComPtr<ID3D11Texture2D> decoder_copy_texture_;
184 188
185 // This is the last value that was used to release the keyed mutex. 189 // This is the last value that was used to release the keyed mutex.
186 uint64_t keyed_mutex_value_ = 0; 190 uint64_t keyed_mutex_value_ = 0;
187 }; 191 };
188 192
189 } // namespace media 193 } // namespace media
190 194
191 #endif // MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_ 195 #endif // MEDIA_GPU_DXVA_PICTURE_BUFFER_WIN_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/gpu/dxva_picture_buffer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698