Index: media/filters/gpu_video_decoder.h |
diff --git a/media/filters/gpu_video_decoder.h b/media/filters/gpu_video_decoder.h |
index a0afd02f9be02b36240f44e1799315d82043e4b6..b14c4558619ac813b6f932f0ebc6a419c1af9560 100644 |
--- a/media/filters/gpu_video_decoder.h |
+++ b/media/filters/gpu_video_decoder.h |
@@ -10,6 +10,7 @@ |
#include <utility> |
#include <vector> |
+#include "base/memory/weak_ptr.h" |
#include "media/base/pipeline_status.h" |
#include "media/base/demuxer_stream.h" |
#include "media/base/video_decoder.h" |
@@ -27,6 +28,7 @@ class SkBitmap; |
namespace media { |
class DecoderBuffer; |
+class VDAClientProxy; |
// GPU-accelerated video decoder implementation. Relies on |
// AcceleratedVideoDecoderMsg_Decode and friends. |
@@ -64,7 +66,7 @@ class MEDIA_EXPORT GpuVideoDecoder |
// attempts at factory operations |
virtual void Abort() = 0; |
- // Returns true if Abort has been called. |
+ // Returns true if Abort() has been called. |
virtual bool IsAborted() = 0; |
protected: |
@@ -139,9 +141,10 @@ class MEDIA_EXPORT GpuVideoDecoder |
void GetBufferData(int32 id, base::TimeDelta* timetamp, |
gfx::Rect* visible_rect, gfx::Size* natural_size); |
- // Set |vda_| and |weak_vda_| on the VDA thread (in practice the render |
- // thread). |
- void SetVDA(VideoDecodeAccelerator* vda); |
+ // 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. |
@@ -172,6 +175,8 @@ class MEDIA_EXPORT GpuVideoDecoder |
// MessageLoop on which to fire callbacks and trampoline calls to this class |
// if they arrive on other loops. |
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 |
@@ -180,8 +185,12 @@ class MEDIA_EXPORT GpuVideoDecoder |
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 |
+ // 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_; |