Commit bfe7d405 authored by dcheng@chromium.org's avatar dcheng@chromium.org

Revert of Merge VideoDecodeAcceleratorImpl with VideoDecodeAccelerator...

Revert of Merge VideoDecodeAcceleratorImpl with VideoDecodeAccelerator (https://codereview.chromium.org/317083003/)

Reason for revert:
Speculative revert to fix content_unittest failures in http://build.chromium.org/p/chromium.linux/builders/Android%20Tests%20%28dbg%29/builds/20807

Original issue's description:
> Merge VideoDecodeAcceleratorImpl with VideoDecodeAccelerator
> 
> This moves the single method CanDecodeOnIOThread on
> VideoDecodeAcceleratorImpl to VideoDecodeAccelerator. The
> implementations that were subclasses of VideoDecodeAcceleratorImpl now
> get an override for CanDecodeOnIOThread that returns false.
> 
> TEST=linux desktop build
> BUG=380884
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275621

TBR=scherkus@chromium.org,fischman@chromium.org,spang@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=380884

Review URL: https://codereview.chromium.org/319323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275636 0039d316-1c4b-4281-b951-d872f2087c98
parent f6ba0594
...@@ -514,10 +514,6 @@ void AndroidVideoDecodeAccelerator::Destroy() { ...@@ -514,10 +514,6 @@ void AndroidVideoDecodeAccelerator::Destroy() {
delete this; delete this;
} }
bool AndroidVideoDecodeAccelerator::CanDecodeOnIOThread() {
return false;
}
void AndroidVideoDecodeAccelerator::RequestPictureBuffers() { void AndroidVideoDecodeAccelerator::RequestPictureBuffers() {
client_->ProvidePictureBuffers(kNumPictureBuffers, size_, GL_TEXTURE_2D); client_->ProvidePictureBuffers(kNumPictureBuffers, size_, GL_TEXTURE_2D);
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "media/base/android/media_codec_bridge.h" #include "media/base/android/media_codec_bridge.h"
...@@ -29,7 +30,7 @@ namespace content { ...@@ -29,7 +30,7 @@ namespace content {
// This class decodes the input encoded stream by using Android's MediaCodec // This class decodes the input encoded stream by using Android's MediaCodec
// class. http://developer.android.com/reference/android/media/MediaCodec.html // class. http://developer.android.com/reference/android/media/MediaCodec.html
class CONTENT_EXPORT AndroidVideoDecodeAccelerator class CONTENT_EXPORT AndroidVideoDecodeAccelerator
: public media::VideoDecodeAccelerator { : public VideoDecodeAcceleratorImpl {
public: public:
// Does not take ownership of |client| which must outlive |*this|. // Does not take ownership of |client| which must outlive |*this|.
AndroidVideoDecodeAccelerator( AndroidVideoDecodeAccelerator(
...@@ -46,7 +47,6 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator ...@@ -46,7 +47,6 @@ class CONTENT_EXPORT AndroidVideoDecodeAccelerator
virtual void Flush() OVERRIDE; virtual void Flush() OVERRIDE;
virtual void Reset() OVERRIDE; virtual void Reset() OVERRIDE;
virtual void Destroy() OVERRIDE; virtual void Destroy() OVERRIDE;
virtual bool CanDecodeOnIOThread() OVERRIDE;
private: private:
enum State { enum State {
......
...@@ -622,10 +622,6 @@ void DXVAVideoDecodeAccelerator::Destroy() { ...@@ -622,10 +622,6 @@ void DXVAVideoDecodeAccelerator::Destroy() {
delete this; delete this;
} }
bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() {
return false;
}
bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) {
if (profile < media::H264PROFILE_MIN || profile > media::H264PROFILE_MAX) if (profile < media::H264PROFILE_MIN || profile > media::H264PROFILE_MAX)
return false; return false;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/threading/non_thread_safe.h" #include "base/threading/non_thread_safe.h"
#include "base/win/scoped_comptr.h" #include "base/win/scoped_comptr.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
#include "media/video/video_decode_accelerator.h" #include "media/video/video_decode_accelerator.h"
interface IMFSample; interface IMFSample;
...@@ -30,7 +31,7 @@ namespace content { ...@@ -30,7 +31,7 @@ namespace content {
// This class lives on a single thread and DCHECKs that it is never accessed // This class lives on a single thread and DCHECKs that it is never accessed
// from any other. // from any other.
class CONTENT_EXPORT DXVAVideoDecodeAccelerator class CONTENT_EXPORT DXVAVideoDecodeAccelerator
: public media::VideoDecodeAccelerator, : public VideoDecodeAcceleratorImpl,
NON_EXPORTED_BASE(public base::NonThreadSafe) { NON_EXPORTED_BASE(public base::NonThreadSafe) {
public: public:
enum State { enum State {
...@@ -56,7 +57,6 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator ...@@ -56,7 +57,6 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
virtual void Flush() OVERRIDE; virtual void Flush() OVERRIDE;
virtual void Reset() OVERRIDE; virtual void Reset() OVERRIDE;
virtual void Destroy() OVERRIDE; virtual void Destroy() OVERRIDE;
virtual bool CanDecodeOnIOThread() OVERRIDE;
private: private:
typedef void* EGLConfig; typedef void* EGLConfig;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/memory/shared_memory.h" #include "base/memory/shared_memory.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "content/common/gpu/gpu_command_buffer_stub.h" #include "content/common/gpu/gpu_command_buffer_stub.h"
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
#include "gpu/command_buffer/service/texture_manager.h" #include "gpu/command_buffer/service/texture_manager.h"
#include "ipc/ipc_listener.h" #include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
...@@ -97,7 +98,7 @@ class GpuVideoDecodeAccelerator ...@@ -97,7 +98,7 @@ class GpuVideoDecodeAccelerator
GpuCommandBufferStub* stub_; GpuCommandBufferStub* stub_;
// The underlying VideoDecodeAccelerator. // The underlying VideoDecodeAccelerator.
scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; scoped_ptr<VideoDecodeAcceleratorImpl> video_decode_accelerator_;
// Callback for making the relevant context current for GL calls. // Callback for making the relevant context current for GL calls.
// Returns false if failed. // Returns false if failed.
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/common/gpu/media/v4l2_video_device.h" #include "content/common/gpu/media/v4l2_video_device.h"
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
#include "media/base/limits.h" #include "media/base/limits.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
#include "media/video/picture.h" #include "media/video/picture.h"
...@@ -72,7 +73,7 @@ namespace content { ...@@ -72,7 +73,7 @@ namespace content {
// subtle races (esp. if we get Reset() in the meantime), we block the decoder // subtle races (esp. if we get Reset() in the meantime), we block the decoder
// thread while we wait for AssignPictureBuffers from the client. // thread while we wait for AssignPictureBuffers from the client.
class CONTENT_EXPORT V4L2VideoDecodeAccelerator class CONTENT_EXPORT V4L2VideoDecodeAccelerator
: public media::VideoDecodeAccelerator { : public VideoDecodeAcceleratorImpl {
public: public:
V4L2VideoDecodeAccelerator( V4L2VideoDecodeAccelerator(
EGLDisplay egl_display, EGLDisplay egl_display,
...@@ -94,6 +95,8 @@ class CONTENT_EXPORT V4L2VideoDecodeAccelerator ...@@ -94,6 +95,8 @@ class CONTENT_EXPORT V4L2VideoDecodeAccelerator
virtual void Flush() OVERRIDE; virtual void Flush() OVERRIDE;
virtual void Reset() OVERRIDE; virtual void Reset() OVERRIDE;
virtual void Destroy() OVERRIDE; virtual void Destroy() OVERRIDE;
// VideoDecodeAcceleratorImpl implementation.
virtual bool CanDecodeOnIOThread() OVERRIDE; virtual bool CanDecodeOnIOThread() OVERRIDE;
private: private:
......
...@@ -916,8 +916,4 @@ void VaapiVideoDecodeAccelerator::Destroy() { ...@@ -916,8 +916,4 @@ void VaapiVideoDecodeAccelerator::Destroy() {
delete this; delete this;
} }
bool VaapiVideoDecodeAccelerator::CanDecodeOnIOThread() {
return false;
}
} // namespace content } // namespace content
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/common/gpu/media/vaapi_h264_decoder.h" #include "content/common/gpu/media/vaapi_h264_decoder.h"
#include "content/common/gpu/media/vaapi_wrapper.h" #include "content/common/gpu/media/vaapi_wrapper.h"
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
#include "media/base/bitstream_buffer.h" #include "media/base/bitstream_buffer.h"
#include "media/video/picture.h" #include "media/video/picture.h"
#include "media/video/video_decode_accelerator.h" #include "media/video/video_decode_accelerator.h"
...@@ -41,7 +42,7 @@ namespace content { ...@@ -41,7 +42,7 @@ namespace content {
// stopped during |this->Destroy()|, so any tasks posted to the decoder thread // stopped during |this->Destroy()|, so any tasks posted to the decoder thread
// can assume |*this| is still alive. See |weak_this_| below for more details. // can assume |*this| is still alive. See |weak_this_| below for more details.
class CONTENT_EXPORT VaapiVideoDecodeAccelerator class CONTENT_EXPORT VaapiVideoDecodeAccelerator
: public media::VideoDecodeAccelerator { : public VideoDecodeAcceleratorImpl {
public: public:
VaapiVideoDecodeAccelerator( VaapiVideoDecodeAccelerator(
Display* x_display, Display* x_display,
...@@ -58,7 +59,6 @@ class CONTENT_EXPORT VaapiVideoDecodeAccelerator ...@@ -58,7 +59,6 @@ class CONTENT_EXPORT VaapiVideoDecodeAccelerator
virtual void Flush() OVERRIDE; virtual void Flush() OVERRIDE;
virtual void Reset() OVERRIDE; virtual void Reset() OVERRIDE;
virtual void Destroy() OVERRIDE; virtual void Destroy() OVERRIDE;
virtual bool CanDecodeOnIOThread() OVERRIDE;
private: private:
// Notify the client that an error has occurred and decoding cannot continue. // Notify the client that an error has occurred and decoding cannot continue.
......
// Copyright 2014 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.
#include "content/common/gpu/media/video_decode_accelerator_impl.h"
namespace content {
VideoDecodeAcceleratorImpl::VideoDecodeAcceleratorImpl() {}
bool VideoDecodeAcceleratorImpl::CanDecodeOnIOThread() { return false; }
VideoDecodeAcceleratorImpl::~VideoDecodeAcceleratorImpl() {}
} // namespace content
// Copyright 2014 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_VIDEO_DECODE_ACCELERATOR_IMPL_H_
#define CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_IMPL_H_
#include "content/common/content_export.h"
#include "media/video/video_decode_accelerator.h"
namespace content {
class CONTENT_EXPORT VideoDecodeAcceleratorImpl
: public media::VideoDecodeAccelerator {
public:
VideoDecodeAcceleratorImpl();
// Returns true if VDA::Decode and VDA::Client callbacks can run on the IO
// thread. Otherwise they will run on the GPU child thread. The purpose of
// running Decode on the IO thread is to reduce decode latency. Note Decode
// should return as soon as possible and not block on the IO thread. Also,
// PictureReady should be run on the child thread if a picture is delivered
// the first time so it can be cleared.
virtual bool CanDecodeOnIOThread();
protected:
virtual ~VideoDecodeAcceleratorImpl();
};
} // namespace content
namespace base {
template <class T>
struct DefaultDeleter;
// Specialize DefaultDeleter so that scoped_ptr<VideoDecodeAcceleratorImpl>
// always uses "Destroy()" instead of trying to use the destructor.
template <>
struct DefaultDeleter<content::VideoDecodeAcceleratorImpl> {
public:
inline void operator()(void* video_decode_accelerator) const {
static_cast<content::VideoDecodeAcceleratorImpl*>(video_decode_accelerator)
->Destroy();
}
};
} // namespace base
#endif // CONTENT_COMMON_GPU_MEDIA_VIDEO_DECODE_ACCELERATOR_IMPL_H_
...@@ -284,6 +284,8 @@ ...@@ -284,6 +284,8 @@
'common/gpu/media/gpu_video_decode_accelerator.h', 'common/gpu/media/gpu_video_decode_accelerator.h',
'common/gpu/media/gpu_video_encode_accelerator.cc', 'common/gpu/media/gpu_video_encode_accelerator.cc',
'common/gpu/media/gpu_video_encode_accelerator.h', 'common/gpu/media/gpu_video_encode_accelerator.h',
'common/gpu/media/video_decode_accelerator_impl.cc',
'common/gpu/media/video_decode_accelerator_impl.h',
'common/gpu/stream_texture_android.cc', 'common/gpu/stream_texture_android.cc',
'common/gpu/stream_texture_android.h', 'common/gpu/stream_texture_android.h',
'common/gpu/sync_point_manager.cc', 'common/gpu/sync_point_manager.cc',
......
...@@ -32,7 +32,6 @@ class MockVideoDecodeAccelerator : public VideoDecodeAccelerator { ...@@ -32,7 +32,6 @@ class MockVideoDecodeAccelerator : public VideoDecodeAccelerator {
MOCK_METHOD0(Flush, void()); MOCK_METHOD0(Flush, void());
MOCK_METHOD0(Reset, void()); MOCK_METHOD0(Reset, void());
MOCK_METHOD0(Destroy, void()); MOCK_METHOD0(Destroy, void());
MOCK_METHOD0(CanDecodeOnIOThread, bool());
private: private:
void DeleteThis(); void DeleteThis();
......
...@@ -4,20 +4,12 @@ ...@@ -4,20 +4,12 @@
#include "media/video/video_decode_accelerator.h" #include "media/video/video_decode_accelerator.h"
#include "base/logging.h"
namespace media { namespace media {
VideoDecodeAccelerator::~VideoDecodeAccelerator() {} VideoDecodeAccelerator::~VideoDecodeAccelerator() {}
bool VideoDecodeAccelerator::CanDecodeOnIOThread() {
// GPU process subclasses must override this.
LOG(FATAL) << "This should only get called in the GPU process";
return false; // not reached
} }
} // namespace media
namespace base { namespace base {
void DefaultDeleter<media::VideoDecodeAccelerator>::operator()( void DefaultDeleter<media::VideoDecodeAccelerator>::operator()(
......
...@@ -132,17 +132,6 @@ class MEDIA_EXPORT VideoDecodeAccelerator { ...@@ -132,17 +132,6 @@ class MEDIA_EXPORT VideoDecodeAccelerator {
// unconditionally, so make sure to drop all pointers to it! // unconditionally, so make sure to drop all pointers to it!
virtual void Destroy() = 0; virtual void Destroy() = 0;
// GPU PROCESS ONLY. Implementations of this interface in the
// content/common/gpu/media should implement this, and implementations in
// other processes should not override the default implementation.
// Returns true if VDA::Decode and VDA::Client callbacks can run on the IO
// thread. Otherwise they will run on the GPU child thread. The purpose of
// running Decode on the IO thread is to reduce decode latency. Note Decode
// should return as soon as possible and not block on the IO thread. Also,
// PictureReady should be run on the child thread if a picture is delivered
// the first time so it can be cleared.
virtual bool CanDecodeOnIOThread();
protected: protected:
// Do not delete directly; use Destroy() or own it with a scoped_ptr, which // Do not delete directly; use Destroy() or own it with a scoped_ptr, which
// will Destroy() it properly by default. // will Destroy() it properly by default.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment