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

Unified Diff: media/filters/gpu_video_decoder.h

Issue 19534002: Make RendererGpuVideoDecoderFactories live on arbitrary threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/gpu_video_decoder.h
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h
index f7e3f8f17b560b4d256e9eb7cc05c8818c0304cd..b65828fbc9a0715ea9f54805e0165ba977802945 100644
--- a/media/filters/gpu_video_decoder.h
+++ b/media/filters/gpu_video_decoder.h
@@ -28,17 +28,17 @@ class SkBitmap;
namespace media {
class DecoderBuffer;
-class VDAClientProxy;
// GPU-accelerated video decoder implementation. Relies on
// AcceleratedVideoDecoderMsg_Decode and friends.
-// All methods internally trampoline to the |message_loop| passed to the ctor.
class MEDIA_EXPORT GpuVideoDecoder
: public VideoDecoder,
public VideoDecodeAccelerator::Client {
public:
// Helper interface for specifying factories needed to instantiate a
// GpuVideoDecoder.
+ // TODO(wuchengli): move this out of GpuVideoDecoder because RTCVideoDecoder
Ami GONE FROM CHROMIUM 2013/07/22 19:46:21 Rebase makes this unnecessary?
wuchengli 2013/07/23 16:29:28 I couldn't submit that CL today because of submit
+ // also uses this.
class MEDIA_EXPORT Factories : public base::RefCountedThreadSafe<Factories> {
public:
// Caller owns returned pointer.
@@ -72,11 +72,15 @@ class MEDIA_EXPORT GpuVideoDecoder
// Returns true if Abort() has been called.
virtual bool IsAborted() = 0;
+ // Makes a copy of |this|.
+ virtual scoped_refptr<Factories> Clone() = 0;
+
protected:
friend class base::RefCountedThreadSafe<Factories>;
virtual ~Factories();
};
+ // |message_loop| should be the same as the one running |factories|.
Ami GONE FROM CHROMIUM 2013/07/22 19:46:21 Why not drop this param and just use factories->Ge
wuchengli 2013/07/23 16:29:28 That was recommended by Andrew. https://codereview
GpuVideoDecoder(const scoped_refptr<base::MessageLoopProxy>& message_loop,
const scoped_refptr<Factories>& factories);
@@ -133,13 +137,6 @@ class MEDIA_EXPORT GpuVideoDecoder
void GetBufferData(int32 id, base::TimeDelta* timetamp,
gfx::Rect* visible_rect, gfx::Size* natural_size);
- // Sets |vda_| and |weak_vda_| on the GVD thread and runs |status_cb|.
- void SetVDA(const PipelineStatusCB& status_cb,
- VideoDecodeAccelerator* vda,
- base::WeakPtr<VideoDecodeAccelerator> weak_vda);
-
- // Call VDA::Destroy() on |vda_loop_proxy_| ensuring that |this| outlives the
- // Destroy() call.
void DestroyVDA();
// A shared memory segment and its allocated size.
@@ -161,28 +158,16 @@ class MEDIA_EXPORT GpuVideoDecoder
bool needs_bitstream_conversion_;
- // Message loop on which to fire callbacks and trampoline calls to this class
- // if they arrive on other loops.
+ // Message loop which this class and |factories_| run on.
scoped_refptr<base::MessageLoopProxy> gvd_loop_proxy_;
base::WeakPtrFactory<GpuVideoDecoder> weak_factory_;
base::WeakPtr<GpuVideoDecoder> weak_this_;
- // Message loop on which to makes all calls to vda_. (beware this loop may be
- // paused during the Pause/Flush/Stop dance PipelineImpl::Stop() goes
- // through).
- scoped_refptr<base::MessageLoopProxy> vda_loop_proxy_;
-
scoped_refptr<Factories> factories_;
- // Proxies calls from |vda_| to |gvd_loop_proxy_| and used to safely detach
- // during shutdown.
- scoped_refptr<VDAClientProxy> client_proxy_;
-
- // Populated during Initialize() via SetVDA() (on success) and unchanged
- // until an error occurs.
+ // Populated during Initialize() (on success) and unchanged until an error
+ // occurs.
scoped_ptr<VideoDecodeAccelerator> vda_;
- // Used to post tasks from the GVD thread to the VDA thread safely.
- base::WeakPtr<VideoDecodeAccelerator> weak_vda_;
// Callbacks that are !is_null() only during their respective operation being
// asynchronously executed.

Powered by Google App Engine
This is Rietveld 408576698