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

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

Issue 1639963002: AndroidVideoDecodeAccelerator can now render to a SurfaceView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sandersd's comments Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 15 matching lines...) Expand all
26 class AVDACodecImage; 26 class AVDACodecImage;
27 class AVDASharedState; 27 class AVDASharedState;
28 28
29 // A BackingStrategy implementation that defers releasing codec buffers until 29 // A BackingStrategy implementation that defers releasing codec buffers until
30 // a PictureBuffer's texture is used to draw, then draws using the surface 30 // a PictureBuffer's texture is used to draw, then draws using the surface
31 // texture's front buffer rather than a copy. To do this, it uses a GLImage 31 // texture's front buffer rather than a copy. To do this, it uses a GLImage
32 // implementation to talk to MediaCodec. 32 // implementation to talk to MediaCodec.
33 class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy 33 class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy
34 : public AndroidVideoDecodeAccelerator::BackingStrategy { 34 : public AndroidVideoDecodeAccelerator::BackingStrategy {
35 public: 35 public:
36 AndroidDeferredRenderingBackingStrategy(); 36 AndroidDeferredRenderingBackingStrategy(AVDAStateProvider* state_provider);
dcheng 2016/02/02 07:37:26 Ditto: explicit
watk 2016/02/02 19:56:45 Done.
37 ~AndroidDeferredRenderingBackingStrategy() override; 37 ~AndroidDeferredRenderingBackingStrategy() override;
38 38
39 // AndroidVideoDecodeAccelerator::BackingStrategy 39 // AndroidVideoDecodeAccelerator::BackingStrategy
40 void Initialize(AVDAStateProvider*) override; 40 gfx::ScopedJavaSurface Initialize(int surface_view_id) override;
41 void Cleanup(bool have_context, 41 void Cleanup(bool have_context,
42 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; 42 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override;
43 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture() const override;
43 uint32_t GetTextureTarget() const override; 44 uint32_t GetTextureTarget() const override;
44 scoped_refptr<gfx::SurfaceTexture> CreateSurfaceTexture() override;
45 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, 45 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index,
46 const media::PictureBuffer&) override; 46 const media::PictureBuffer&) override;
47 void AssignOnePictureBuffer(const media::PictureBuffer&) override; 47 void AssignOnePictureBuffer(const media::PictureBuffer&) override;
48 void ReuseOnePictureBuffer(const media::PictureBuffer&) override; 48 void ReuseOnePictureBuffer(const media::PictureBuffer&) override;
49 void DismissOnePictureBuffer(const media::PictureBuffer&) override; 49 void DismissOnePictureBuffer(const media::PictureBuffer&) override;
50 void CodecChanged( 50 void CodecChanged(
51 media::VideoCodecBridge*, 51 media::VideoCodecBridge*,
52 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; 52 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override;
53 void OnFrameAvailable() override; 53 void OnFrameAvailable() override;
54 bool ArePicturesOverlayable() override;
54 55
55 private: 56 private:
56 // Release any codec buffer that is associated with the given picture buffer 57 // Release any codec buffer that is associated with the given picture buffer
57 // back to the codec. It is okay if there is no such buffer. 58 // back to the codec. It is okay if there is no such buffer.
58 void ReleaseCodecBufferForPicture(const media::PictureBuffer& picture_buffer); 59 void ReleaseCodecBufferForPicture(const media::PictureBuffer& picture_buffer);
59 60
60 // Return the TextureRef for a given PictureBuffer's texture. 61 // Return the TextureRef for a given PictureBuffer's texture.
61 gpu::gles2::TextureRef* GetTextureForPicture(const media::PictureBuffer&); 62 gpu::gles2::TextureRef* GetTextureForPicture(const media::PictureBuffer&);
62 63
63 // Return the AVDACodecImage for a given PictureBuffer's texture. 64 // Return the AVDACodecImage for a given PictureBuffer's texture.
64 AVDACodecImage* GetImageForPicture(const media::PictureBuffer&); 65 AVDACodecImage* GetImageForPicture(const media::PictureBuffer&);
65 void SetImageForPicture(const media::PictureBuffer& picture_buffer, 66 void SetImageForPicture(const media::PictureBuffer& picture_buffer,
66 const scoped_refptr<gl::GLImage>& image); 67 const scoped_refptr<gl::GLImage>& image);
67 68
68 scoped_refptr<AVDASharedState> shared_state_; 69 scoped_refptr<AVDASharedState> shared_state_;
69 70
70 AVDAStateProvider* state_provider_; 71 AVDAStateProvider* state_provider_;
71 72
73 // The SurfaceTexture to render to. Non-null after Initialize() if
74 // we're not rendering to a SurfaceView.
72 scoped_refptr<gfx::SurfaceTexture> surface_texture_; 75 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
73 76
74 media::VideoCodecBridge* media_codec_; 77 media::VideoCodecBridge* media_codec_;
75 78
76 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); 79 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy);
77 }; 80 };
78 81
79 } // namespace content 82 } // namespace content
80 83
81 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_ 84 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698