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

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

Issue 1963773003: Merge to M51: Various fixes to prevent playback hang on MotoX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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 #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
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( 55 const media::PictureBuffer& picture_buffer) override;
53 media::VideoCodecBridge*, 56 void MaybeRenderEarly() override;
54 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; 57 void CodecChanged(media::VideoCodecBridge* codec) override;
58 void ReleaseCodecBuffers(
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.
63 void ReleaseCodecBufferForPicture(const media::PictureBuffer& picture_buffer); 68 void ReleaseCodecBufferForPicture(const media::PictureBuffer& picture_buffer);
64 69
65 // Return the AVDACodecImage for a given PictureBuffer's texture. 70 // Sets up the texture references (as found by |picture_buffer|), for the
66 AVDACodecImage* GetImageForPicture(const media::PictureBuffer&); 71 // specified |image|. If |image| is null, clears any ref on the texture
72 // associated with |picture_buffer|.
67 void SetImageForPicture( 73 void SetImageForPicture(
68 const media::PictureBuffer& picture_buffer, 74 const media::PictureBuffer& picture_buffer,
69 const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image); 75 const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image);
70 76
71 // Make a copy of the SurfaceTexture's front buffer and associate all given 77 // Make a copy of the SurfaceTexture's front buffer and associate all given
72 // picture buffer textures with it. The picture buffer textures will not 78 // picture buffer textures with it. The picture buffer textures will not
73 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's 79 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's
74 // used to back the picture buffers when the VDA is being destroyed. 80 // used to back the picture buffers when the VDA is being destroyed.
75 void CopySurfaceTextureToPictures( 81 void CopySurfaceTextureToPictures(
76 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers); 82 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers);
77 83
78 // Return true if and only if the surface_texture_cant_detach workaround is 84 // Return true if and only if the surface_texture_cant_detach workaround is
79 // not set. 85 // not set.
80 bool DoesSurfaceTextureDetachWork() const; 86 bool DoesSurfaceTextureDetachWork() const;
81 87
82 // Return true if and only if CopySurfaceTextureToPictures is expected to work 88 // Return true if and only if CopySurfaceTextureToPictures is expected to work
83 // on this device. 89 // on this device.
84 bool ShouldCopyPictures() const; 90 bool ShouldCopyPictures() const;
85 91
86 scoped_refptr<AVDASharedState> shared_state_; 92 scoped_refptr<AVDASharedState> shared_state_;
87 93
88 AVDAStateProvider* state_provider_; 94 AVDAStateProvider* state_provider_;
89 95
90 // The SurfaceTexture to render to. Non-null after Initialize() if 96 // The SurfaceTexture to render to. Non-null after Initialize() if
91 // we're not rendering to a SurfaceView. 97 // we're not rendering to a SurfaceView.
92 scoped_refptr<gfx::SurfaceTexture> surface_texture_; 98 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
93 99
94 media::VideoCodecBridge* media_codec_; 100 media::VideoCodecBridge* media_codec_;
95 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
96 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); 106 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy);
97 }; 107 };
98 108
99 } // namespace content 109 } // namespace content
100 110
101 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_ 111 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698