Index: content/common/gpu/media/android_video_decode_accelerator_impl.h |
diff --git a/content/common/gpu/media/android_video_decode_accelerator.h b/content/common/gpu/media/android_video_decode_accelerator_impl.h |
similarity index 76% |
copy from content/common/gpu/media/android_video_decode_accelerator.h |
copy to content/common/gpu/media/android_video_decode_accelerator_impl.h |
index d5bacfd9af136c4e25111191d92d783629ab355c..afd7ad8a1908b6561bda0ae17e02de381cb082a0 100644 |
--- a/content/common/gpu/media/android_video_decode_accelerator.h |
+++ b/content/common/gpu/media/android_video_decode_accelerator_impl.h |
@@ -1,9 +1,9 @@ |
-// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
// 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_IMPL_H_ |
+#define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_IMPL_H_ |
#include <list> |
#include <map> |
@@ -15,7 +15,7 @@ |
#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 "content/common/gpu/media/android_video_decode_accelerator.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" |
@@ -25,18 +25,17 @@ class SurfaceTexture; |
} |
namespace content { |
-// A VideoDecodeAccelerator implementation for Android. |
+// Implementation of a VideoDecodeAccelerator for Android. |
// This class decodes the input encoded stream by using Android's MediaCodec |
// class. http://developer.android.com/reference/android/media/MediaCodec.html |
-class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
- : public media::VideoDecodeAccelerator { |
+// It delegates attaching pictures to PictureBuffers to the BackingStrategy, |
+// but otherwise handles the work of transferring data to / from MediaCodec. |
+class CONTENT_EXPORT AndroidVideoDecodeAcceleratorImpl |
sandersd (OOO until July 31)
2015/09/04 22:12:52
It seems like this would be better as just Android
liberato (no reviews please)
2015/09/08 19:50:00
it was a forward reference management strategy. i
|
+ : public AndroidVideoDecodeAccelerator |
+ , public AndroidVideoDecodeAccelerator::StateProvider { |
public: |
- // Does not take ownership of |client| which must outlive |*this|. |
- AndroidVideoDecodeAccelerator( |
- const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
- const base::Callback<bool(void)>& make_context_current); |
- // media::VideoDecodeAccelerator implementation. |
+ // Does not take ownership of |client| which must outlive |*this|. |
bool Initialize(media::VideoCodecProfile profile, Client* client) override; |
void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
void AssignPictureBuffers( |
@@ -47,8 +46,22 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator |
void Destroy() override; |
bool CanDecodeOnIOThread() override; |
- static media::VideoDecodeAccelerator::SupportedProfiles |
- GetSupportedProfiles(); |
+ // AndroidVideoDecodeAccelerator::StateProvider |
+ const gfx::Size& GetSize() const override; |
+ const base::ThreadChecker& ThreadChecker() const override; |
+ gfx::SurfaceTexture* GetSurfaceTexture() const override; |
+ uint32 GetSurfaceTextureId() const override; |
+ gpu::gles2::GLES2Decoder* GetGlDecoder() const override; |
+ media::VideoCodecBridge* GetMediaCodec() override; |
+ void PostError(const ::tracked_objects::Location& from_here, |
+ media::VideoDecodeAccelerator::Error error) override; |
+ |
+ protected: |
+ AndroidVideoDecodeAcceleratorImpl( |
+ const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, |
+ const base::Callback<bool(void)>& make_context_current, |
+ scoped_refptr<BackingStrategy> strategy); |
+ ~AndroidVideoDecodeAcceleratorImpl() override; |
private: |
enum State { |
@@ -58,13 +71,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 +168,18 @@ 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<AndroidVideoDecodeAcceleratorImpl> io_timer_; |
+ |
+ // Backing strategy that we'll use to connect PictureBuffers to frames. |
+ scoped_refptr<BackingStrategy> strategy_; |
// WeakPtrFactory for posting tasks back to |this|. |
- base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; |
+ base::WeakPtrFactory<AndroidVideoDecodeAcceleratorImpl> 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_IMPL_H_ |