| 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 MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |    5 #ifndef MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 
|    6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |    6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 
|    7  |    7  | 
|    8 #include <stdint.h> |    8 #include <stdint.h> | 
|    9 #include <vector> |    9 #include <vector> | 
|   10  |   10  | 
|   11 #include "base/macros.h" |   11 #include "base/macros.h" | 
|   12 #include "media/gpu/avda_state_provider.h" |   12 #include "media/gpu/avda_state_provider.h" | 
|   13 #include "media/gpu/media_gpu_export.h" |   13 #include "media/gpu/media_gpu_export.h" | 
|   14  |   14  | 
|   15 namespace gpu { |   15 namespace gpu { | 
|   16 namespace gles2 { |   16 namespace gles2 { | 
|   17 class GLStreamTextureImage; |   17 class GLStreamTextureImage; | 
|   18 } |   18 } | 
|   19 } |   19 } | 
|   20  |   20  | 
|   21 namespace gl { |   21 namespace gl { | 
|   22 class ScopedJavaSurface; |   22 class ScopedJavaSurface; | 
|   23 class SurfaceTexture; |   23 class SurfaceTexture; | 
|   24 } |   24 } | 
|   25  |   25  | 
|   26 namespace media { |   26 namespace media { | 
|   27 class AVDACodecImage; |   27 class AVDACodecImage; | 
|   28 class AVDASharedState; |   28 class AVDASharedState; | 
|   29 class VideoCodecBridge; |   29 class MediaCodecBridge; | 
|   30  |   30  | 
|   31 // AVDAPictureBufferManager is used by AVDA to associate its PictureBuffers with |   31 // AVDAPictureBufferManager is used by AVDA to associate its PictureBuffers with | 
|   32 // MediaCodec output buffers. It attaches AVDACodecImages to the PictureBuffer |   32 // MediaCodec output buffers. It attaches AVDACodecImages to the PictureBuffer | 
|   33 // textures so that when they're used to draw the AVDACodecImage can release the |   33 // textures so that when they're used to draw the AVDACodecImage can release the | 
|   34 // MediaCodec buffer to the backing Surface. If the Surface is a SurfaceTexture, |   34 // MediaCodec buffer to the backing Surface. If the Surface is a SurfaceTexture, | 
|   35 // the front buffer can then be used to draw without needing to copy the pixels. |   35 // the front buffer can then be used to draw without needing to copy the pixels. | 
|   36 // If the Surface is a SurfaceView, the release causes the frame to be displayed |   36 // If the Surface is a SurfaceView, the release causes the frame to be displayed | 
|   37 // immediately. |   37 // immediately. | 
|   38 class MEDIA_GPU_EXPORT AVDAPictureBufferManager { |   38 class MEDIA_GPU_EXPORT AVDAPictureBufferManager { | 
|   39  public: |   39  public: | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   67  |   67  | 
|   68   // Release MediaCodec buffers. |   68   // Release MediaCodec buffers. | 
|   69   void ReleaseCodecBuffers(const PictureBufferMap& buffers); |   69   void ReleaseCodecBuffers(const PictureBufferMap& buffers); | 
|   70  |   70  | 
|   71   // Attempts to free up codec output buffers by rendering early. |   71   // Attempts to free up codec output buffers by rendering early. | 
|   72   void MaybeRenderEarly(); |   72   void MaybeRenderEarly(); | 
|   73  |   73  | 
|   74   // Called when the MediaCodec instance changes. If |codec| is nullptr the |   74   // Called when the MediaCodec instance changes. If |codec| is nullptr the | 
|   75   // MediaCodec is being destroyed. Previously provided codecs should no longer |   75   // MediaCodec is being destroyed. Previously provided codecs should no longer | 
|   76   // be referenced. |   76   // be referenced. | 
|   77   void CodecChanged(VideoCodecBridge* codec); |   77   void CodecChanged(MediaCodecBridge* codec); | 
|   78  |   78  | 
|   79   // Whether the pictures buffers are overlayable. |   79   // Whether the pictures buffers are overlayable. | 
|   80   bool ArePicturesOverlayable(); |   80   bool ArePicturesOverlayable(); | 
|   81  |   81  | 
|   82   // Are there any unrendered picture buffers oustanding? |   82   // Are there any unrendered picture buffers oustanding? | 
|   83   bool HasUnrenderedPictures() const; |   83   bool HasUnrenderedPictures() const; | 
|   84  |   84  | 
|   85   scoped_refptr<gl::SurfaceTexture> surface_texture() { |   85   scoped_refptr<gl::SurfaceTexture> surface_texture() { | 
|   86     return surface_texture_; |   86     return surface_texture_; | 
|   87   } |   87   } | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|  105   AVDACodecImage* GetImageForPicture(int picture_buffer_id) const; |  105   AVDACodecImage* GetImageForPicture(int picture_buffer_id) const; | 
|  106  |  106  | 
|  107   scoped_refptr<AVDASharedState> shared_state_; |  107   scoped_refptr<AVDASharedState> shared_state_; | 
|  108  |  108  | 
|  109   AVDAStateProvider* const state_provider_; |  109   AVDAStateProvider* const state_provider_; | 
|  110  |  110  | 
|  111   // The SurfaceTexture to render to. Non-null after Initialize() if |  111   // The SurfaceTexture to render to. Non-null after Initialize() if | 
|  112   // we're not rendering to a SurfaceView. |  112   // we're not rendering to a SurfaceView. | 
|  113   scoped_refptr<gl::SurfaceTexture> surface_texture_; |  113   scoped_refptr<gl::SurfaceTexture> surface_texture_; | 
|  114  |  114  | 
|  115   VideoCodecBridge* media_codec_; |  115   MediaCodecBridge* media_codec_; | 
|  116  |  116  | 
|  117   // Picture buffer IDs that are out for display. Stored in order of frames as |  117   // Picture buffer IDs that are out for display. Stored in order of frames as | 
|  118   // they are returned from the decoder. |  118   // they are returned from the decoder. | 
|  119   std::vector<int32_t> pictures_out_for_display_; |  119   std::vector<int32_t> pictures_out_for_display_; | 
|  120  |  120  | 
|  121   // Maps a picture buffer id to a AVDACodecImage. |  121   // Maps a picture buffer id to a AVDACodecImage. | 
|  122   std::map<int, scoped_refptr<AVDACodecImage>> codec_images_; |  122   std::map<int, scoped_refptr<AVDACodecImage>> codec_images_; | 
|  123  |  123  | 
|  124   DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager); |  124   DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager); | 
|  125 }; |  125 }; | 
|  126  |  126  | 
|  127 }  // namespace media |  127 }  // namespace media | 
|  128  |  128  | 
|  129 #endif  // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ |  129 #endif  // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ | 
| OLD | NEW |