Index: cc/layers/video_frame_provider_client_impl.h |
diff --git a/cc/layers/video_frame_provider_client_impl.h b/cc/layers/video_frame_provider_client_impl.h |
index 39f66fb009db00e81960b3099c243495f8f58f02..2fe5b14567818500d00a14192f0ff1c0470c27e8 100644 |
--- a/cc/layers/video_frame_provider_client_impl.h |
+++ b/cc/layers/video_frame_provider_client_impl.h |
@@ -8,26 +8,38 @@ |
#include "base/memory/ref_counted.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/thread_checker.h" |
+#include "cc/base/cc_export.h" |
#include "cc/layers/video_frame_provider.h" |
#include "ui/gfx/transform.h" |
-namespace media { class VideoFrame; } |
+namespace media { |
+class VideoFrame; |
+} // namespace media |
danakj
2015/03/24 17:38:01
(this isn't actually needed by the linter for smal
sunnyps
2015/03/24 19:43:38
Done.
|
namespace cc { |
+ |
danakj
2015/03/24 17:38:01
why whitespace?
sunnyps
2015/03/24 19:43:38
Done.
|
class VideoLayerImpl; |
-class VideoFrameProviderClientImpl |
+// VideoFrameProviderClientImpl liasons with the VideoFrameProvider and the |
+// VideoLayer. It receives updates from the provider and updates the layer as a |
+// result. It also allows the layer to access the video frame that the provider |
+// has. |
+class CC_EXPORT VideoFrameProviderClientImpl |
: public VideoFrameProvider::Client, |
public base::RefCounted<VideoFrameProviderClientImpl> { |
public: |
+ // Must be created on the impl thread while the main thread is blocked. |
static scoped_refptr<VideoFrameProviderClientImpl> Create( |
VideoFrameProvider* provider); |
- VideoLayerImpl* active_video_layer() { return active_video_layer_; } |
- void SetActiveVideoLayer(VideoLayerImpl* video_layer); |
+ // Must be called on the impl thread. |
+ void Start(VideoLayerImpl* active_video_layer); |
+ bool Started() const; |
+ bool Stopped() const; |
+ // Must be called on the impl thread while the main thread is blocked. It is |
+ // legal to call Stop without calling Start. |
void Stop(); |
- bool Stopped(); |
scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); |
void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); |
@@ -36,22 +48,28 @@ class VideoFrameProviderClientImpl |
return stream_texture_matrix_; |
} |
- // VideoFrameProvider::Client implementation. These methods are all callable |
- // on any thread. |
+ // VideoFrameProvider::Client implementation. |
+ // Called on the main thread. |
void StopUsingProvider() override; |
+ // Called on the impl thread. |
void DidReceiveFrame() override; |
void DidUpdateMatrix(const float* matrix) override; |
private: |
- explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); |
friend class base::RefCounted<VideoFrameProviderClientImpl>; |
+ |
+ VideoFrameProviderClientImpl(VideoFrameProvider* provider); |
~VideoFrameProviderClientImpl() override; |
+ VideoFrameProvider* provider_; |
VideoLayerImpl* active_video_layer_; |
+ bool stopped_; |
- // Guards the destruction of provider_ and the frame that it provides |
+ // Since the provider lives on another thread, it can be destroyed while the |
+ // frame controller are accessing it's frame. Before being destroyed the |
+ // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider |
+ // from returning till the frame controller is done using the frame. |
base::Lock provider_lock_; |
- VideoFrameProvider* provider_; |
base::ThreadChecker thread_checker_; |
gfx::Transform stream_texture_matrix_; |