Chromium Code Reviews| Index: content/common/gpu/media/android_video_decode_accelerator_base.h |
| diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator_base.h |
| similarity index 81% |
| copy from content/common/gpu/media/android_video_decode_accelerator.h |
| copy to content/common/gpu/media/android_video_decode_accelerator_base.h |
| index d5bacfd9af136c4e25111191d92d783629ab355c..8a4afabbdd40594a59e4a0415639974881cc6223 100644 |
| --- a/content/common/gpu/media/android_video_decode_accelerator.h |
| +++ b/content/common/gpu/media/android_video_decode_accelerator_base.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| -#define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| +#ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_BASE_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_BASE_H_ |
| #include <list> |
| #include <map> |
| @@ -15,7 +15,6 @@ |
| #include "base/threading/thread_checker.h" |
| #include "base/timer/timer.h" |
| #include "content/common/content_export.h" |
| -#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| #include "media/base/android/media_codec_bridge.h" |
| #include "media/video/video_decode_accelerator.h" |
| @@ -28,11 +27,11 @@ namespace content { |
| // A VideoDecodeAccelerator implementation for Android. |
| // This class decodes the input encoded stream by using Android's MediaCodec |
| // class. http://developer.android.com/reference/android/media/MediaCodec.html |
|
watk
2015/08/28 21:52:05
Update this comment?
liberato (no reviews please)
2015/09/04 17:59:47
whoops! thanks!
|
| -class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| +class CONTENT_EXPORT AndroidVideoDecodeAcceleratorBase |
| : public media::VideoDecodeAccelerator { |
| public: |
| // Does not take ownership of |client| which must outlive |*this|. |
|
watk
2015/08/28 21:52:05
Comment needs to go down a couple of lines
liberato (no reviews please)
2015/09/04 17:59:47
Done.
|
| - AndroidVideoDecodeAccelerator( |
| + AndroidVideoDecodeAcceleratorBase( |
| const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
| const base::Callback<bool(void)>& make_context_current); |
| @@ -50,6 +49,29 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| static media::VideoDecodeAccelerator::SupportedProfiles |
| GetSupportedProfiles(); |
| + protected: |
| + ~AndroidVideoDecodeAcceleratorBase() override; |
| + |
| + // Return the number of picture buffers that the implementation would like. |
| + // TODO(liberato): this isn't used much, and can probably be removed. |
| + virtual uint32 GetNumPictureBuffers() const = 0; |
| + |
| + // Return the GL texture target that the PictureBuffers will use. |
| + virtual uint32 GetTextureTarget() const = 0; |
| + |
| + // Use the provided PictureBuffer to hold the current surface. |
| + virtual void AssignCurrentSurfaceToPictureBuffer(int32 codec_buffer_index, |
| + const media::PictureBuffer&) = 0; |
| + |
| + // Misc getters for subclasses. |
| + Client* GetClient() const; |
| + const gfx::Size& GetSize() const; |
| + const base::ThreadChecker& ThreadChecker() const; |
| + gfx::SurfaceTexture* GetSurfaceTexture() const; |
| + uint32 GetSurfaceTextureId() const; |
| + gpu::gles2::GLES2Decoder* GetGlDecoder() const; |
| + media::VideoCodecBridge* GetMediaCodec(); |
| + |
| private: |
| enum State { |
| NO_ERROR, |
| @@ -58,13 +80,11 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| static const base::TimeDelta kDecodePollDelay; |
| - ~AndroidVideoDecodeAccelerator() override; |
| - |
| // Configures |media_codec_| with the given codec parameters from the client. |
| bool ConfigureMediaCodec(); |
| // Sends the current picture on the surface to the client. |
| - void SendCurrentSurfaceToClient(int32 bitstream_id); |
| + void SendCurrentSurfaceToClient(int32 codec_buffer_index, int32 bitstream_id); |
| // Does pending IO tasks if any. Once this is called, it polls |media_codec_| |
| // until it finishes pending tasks. For the polling, |kDecodePollDelay| is |
| @@ -157,18 +177,15 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
| // Owner of the GL context. Used to restore the context state. |
| base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_; |
| - // Used for copy the texture from |surface_texture_| to picture buffers. |
| - scoped_ptr<gpu::CopyTextureCHROMIUMResourceManager> copier_; |
| - |
| // Repeating timer responsible for draining pending IO to the codec. |
| - base::RepeatingTimer<AndroidVideoDecodeAccelerator> io_timer_; |
| + base::RepeatingTimer<AndroidVideoDecodeAcceleratorBase> io_timer_; |
| // WeakPtrFactory for posting tasks back to |this|. |
| - base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
| + base::WeakPtrFactory<AndroidVideoDecodeAcceleratorBase> weak_this_factory_; |
| friend class AndroidVideoDecodeAcceleratorTest; |
| }; |
| } // namespace content |
| -#endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ |
| +#endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_BASE_H_ |