OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ | 5 #ifndef CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ |
6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ | 6 #define CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 VideoFrameProvider* provider); | 30 VideoFrameProvider* provider); |
31 | 31 |
32 VideoLayerImpl* ActiveVideoLayer() const; | 32 VideoLayerImpl* ActiveVideoLayer() const; |
33 void SetActiveVideoLayer(VideoLayerImpl* video_layer); | 33 void SetActiveVideoLayer(VideoLayerImpl* video_layer); |
34 | 34 |
35 bool Stopped() const; | 35 bool Stopped() const; |
36 // Must be called on the impl thread while the main thread is blocked. | 36 // Must be called on the impl thread while the main thread is blocked. |
37 void Stop(); | 37 void Stop(); |
38 | 38 |
39 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); | 39 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); |
40 void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); | 40 void PutCurrentFrame(); |
41 void ReleaseLock(); | 41 void ReleaseLock(); |
42 | 42 |
43 const gfx::Transform& StreamTextureMatrix() const; | 43 const gfx::Transform& StreamTextureMatrix() const; |
44 | 44 |
45 // VideoFrameProvider::Client implementation. | 45 // VideoFrameProvider::Client implementation. |
46 // Called on the main thread. | 46 // Called on the main thread. |
47 void StopUsingProvider() override; | 47 void StopUsingProvider() override; |
48 // Called on the impl thread. | 48 // Called on the impl thread. |
| 49 void StartRendering() override; |
| 50 void StopRendering() override; |
49 void DidReceiveFrame() override; | 51 void DidReceiveFrame() override; |
50 void DidUpdateMatrix(const float* matrix) override; | 52 void DidUpdateMatrix(const float* matrix) override; |
51 | 53 |
52 private: | 54 private: |
53 friend class base::RefCounted<VideoFrameProviderClientImpl>; | 55 friend class base::RefCounted<VideoFrameProviderClientImpl>; |
54 | 56 |
55 explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); | 57 explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); |
56 ~VideoFrameProviderClientImpl() override; | 58 ~VideoFrameProviderClientImpl() override; |
57 | 59 |
58 VideoFrameProvider* provider_; | 60 VideoFrameProvider* provider_; |
59 VideoLayerImpl* active_video_layer_; | 61 VideoLayerImpl* active_video_layer_; |
60 bool stopped_; | 62 bool stopped_; |
61 | 63 |
62 // Since the provider lives on another thread, it can be destroyed while the | 64 // Since the provider lives on another thread, it can be destroyed while the |
63 // frame controller are accessing its frame. Before being destroyed the | 65 // frame controller are accessing its frame. Before being destroyed the |
64 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider | 66 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider |
65 // from returning until the frame controller is done using the frame. | 67 // from returning until the frame controller is done using the frame. |
66 base::Lock provider_lock_; | 68 base::Lock provider_lock_; |
67 base::ThreadChecker thread_checker_; | 69 base::ThreadChecker thread_checker_; |
68 | 70 |
69 gfx::Transform stream_texture_matrix_; | 71 gfx::Transform stream_texture_matrix_; |
70 | 72 |
71 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl); | 73 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace cc | 76 } // namespace cc |
75 | 77 |
76 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ | 78 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ |
OLD | NEW |