OLD | NEW |
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 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
12 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 13 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
13 | 14 |
14 namespace gl { | 15 namespace gl { |
15 class GLImage; | 16 class GLImage; |
16 } | 17 } |
17 | 18 |
18 namespace gpu { | 19 namespace gpu { |
(...skipping 14 matching lines...) Expand all Loading... |
33 // implementation to talk to MediaCodec. | 34 // implementation to talk to MediaCodec. |
34 class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy | 35 class CONTENT_EXPORT AndroidDeferredRenderingBackingStrategy |
35 : public AndroidVideoDecodeAccelerator::BackingStrategy { | 36 : public AndroidVideoDecodeAccelerator::BackingStrategy { |
36 public: | 37 public: |
37 explicit AndroidDeferredRenderingBackingStrategy( | 38 explicit AndroidDeferredRenderingBackingStrategy( |
38 AVDAStateProvider* state_provider); | 39 AVDAStateProvider* state_provider); |
39 ~AndroidDeferredRenderingBackingStrategy() override; | 40 ~AndroidDeferredRenderingBackingStrategy() override; |
40 | 41 |
41 // AndroidVideoDecodeAccelerator::BackingStrategy | 42 // AndroidVideoDecodeAccelerator::BackingStrategy |
42 gfx::ScopedJavaSurface Initialize(int surface_view_id) override; | 43 gfx::ScopedJavaSurface Initialize(int surface_view_id) override; |
43 void Cleanup(bool have_context, | 44 void Cleanup( |
44 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; | 45 bool have_context, |
| 46 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; |
45 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture() const override; | 47 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture() const override; |
46 uint32_t GetTextureTarget() const override; | 48 uint32_t GetTextureTarget() const override; |
47 gfx::Size GetPictureBufferSize() const override; | 49 gfx::Size GetPictureBufferSize() const override; |
48 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, | 50 void UseCodecBufferForPictureBuffer( |
49 const media::PictureBuffer&) override; | 51 int32_t codec_buffer_index, |
| 52 const media::PictureBuffer& picture_buffer) override; |
50 void AssignOnePictureBuffer(const media::PictureBuffer&, bool) override; | 53 void AssignOnePictureBuffer(const media::PictureBuffer&, bool) override; |
51 void ReuseOnePictureBuffer(const media::PictureBuffer&) override; | 54 void ReuseOnePictureBuffer( |
52 void CodecChanged(media::VideoCodecBridge*) override; | 55 const media::PictureBuffer& picture_buffer) override; |
| 56 void MaybeRenderEarly() override; |
| 57 void CodecChanged(media::VideoCodecBridge* codec) override; |
53 void ReleaseCodecBuffers( | 58 void ReleaseCodecBuffers( |
54 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; | 59 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; |
55 void OnFrameAvailable() override; | 60 void OnFrameAvailable() override; |
56 bool ArePicturesOverlayable() override; | 61 bool ArePicturesOverlayable() override; |
57 void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, | 62 void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, |
58 const gfx::Size& new_size) override; | 63 const gfx::Size& new_size) override; |
59 | 64 |
60 private: | 65 private: |
61 // Release any codec buffer that is associated with the given picture buffer | 66 // Release any codec buffer that is associated with the given picture buffer |
62 // back to the codec. It is okay if there is no such buffer. | 67 // back to the codec. It is okay if there is no such buffer. |
(...skipping 24 matching lines...) Expand all Loading... |
87 scoped_refptr<AVDASharedState> shared_state_; | 92 scoped_refptr<AVDASharedState> shared_state_; |
88 | 93 |
89 AVDAStateProvider* state_provider_; | 94 AVDAStateProvider* state_provider_; |
90 | 95 |
91 // The SurfaceTexture to render to. Non-null after Initialize() if | 96 // The SurfaceTexture to render to. Non-null after Initialize() if |
92 // we're not rendering to a SurfaceView. | 97 // we're not rendering to a SurfaceView. |
93 scoped_refptr<gfx::SurfaceTexture> surface_texture_; | 98 scoped_refptr<gfx::SurfaceTexture> surface_texture_; |
94 | 99 |
95 media::VideoCodecBridge* media_codec_; | 100 media::VideoCodecBridge* media_codec_; |
96 | 101 |
| 102 // Picture buffer IDs that are out for display. Stored in order of frames as |
| 103 // they are returned from the decoder. |
| 104 std::vector<int32_t> pictures_out_for_display_; |
| 105 |
97 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); | 106 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); |
98 }; | 107 }; |
99 | 108 |
100 } // namespace content | 109 } // namespace content |
101 | 110 |
102 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_
H_ | 111 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_
H_ |
OLD | NEW |