| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 bool Stopped() const; | 39 bool Stopped() const; |
| 40 // Must be called on the impl thread while the main thread is blocked. | 40 // Must be called on the impl thread while the main thread is blocked. |
| 41 void Stop(); | 41 void Stop(); |
| 42 | 42 |
| 43 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); | 43 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); |
| 44 void PutCurrentFrame(); | 44 void PutCurrentFrame(); |
| 45 void ReleaseLock(); | 45 void ReleaseLock(); |
| 46 bool HasCurrentFrame(); | 46 bool HasCurrentFrame(); |
| 47 | 47 |
| 48 const gfx::Transform& StreamTextureMatrix() const; | |
| 49 | |
| 50 // VideoFrameController implementation. | 48 // VideoFrameController implementation. |
| 51 void OnBeginFrame(const BeginFrameArgs& args) override; | 49 void OnBeginFrame(const BeginFrameArgs& args) override; |
| 52 void DidDrawFrame() override; | 50 void DidDrawFrame() override; |
| 53 | 51 |
| 54 // VideoFrameProvider::Client implementation. | 52 // VideoFrameProvider::Client implementation. |
| 55 // Called on the main thread. | 53 // Called on the main thread. |
| 56 void StopUsingProvider() override; | 54 void StopUsingProvider() override; |
| 57 // Called on the impl thread. | 55 // Called on the impl thread. |
| 58 void StartRendering() override; | 56 void StartRendering() override; |
| 59 void StopRendering() override; | 57 void StopRendering() override; |
| 60 void DidReceiveFrame() override; | 58 void DidReceiveFrame() override; |
| 61 void DidUpdateMatrix(const float* matrix) override; | |
| 62 | 59 |
| 63 const VideoFrameProvider* get_provider_for_testing() const { | 60 const VideoFrameProvider* get_provider_for_testing() const { |
| 64 return provider_; | 61 return provider_; |
| 65 } | 62 } |
| 66 | 63 |
| 67 private: | 64 private: |
| 68 friend class base::RefCounted<VideoFrameProviderClientImpl>; | 65 friend class base::RefCounted<VideoFrameProviderClientImpl>; |
| 69 | 66 |
| 70 VideoFrameProviderClientImpl(VideoFrameProvider* provider, | 67 VideoFrameProviderClientImpl(VideoFrameProvider* provider, |
| 71 VideoFrameControllerClient* client); | 68 VideoFrameControllerClient* client); |
| 72 ~VideoFrameProviderClientImpl() override; | 69 ~VideoFrameProviderClientImpl() override; |
| 73 | 70 |
| 74 VideoFrameProvider* provider_; | 71 VideoFrameProvider* provider_; |
| 75 VideoFrameControllerClient* client_; | 72 VideoFrameControllerClient* client_; |
| 76 VideoLayerImpl* active_video_layer_; | 73 VideoLayerImpl* active_video_layer_; |
| 77 bool stopped_; | 74 bool stopped_; |
| 78 bool rendering_; | 75 bool rendering_; |
| 79 bool needs_put_current_frame_; | 76 bool needs_put_current_frame_; |
| 80 | 77 |
| 81 // Since the provider lives on another thread, it can be destroyed while the | 78 // Since the provider lives on another thread, it can be destroyed while the |
| 82 // frame controller are accessing its frame. Before being destroyed the | 79 // frame controller are accessing its frame. Before being destroyed the |
| 83 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider | 80 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider |
| 84 // from returning until the frame controller is done using the frame. | 81 // from returning until the frame controller is done using the frame. |
| 85 base::Lock provider_lock_; | 82 base::Lock provider_lock_; |
| 86 base::ThreadChecker thread_checker_; | 83 base::ThreadChecker thread_checker_; |
| 87 | 84 |
| 88 gfx::Transform stream_texture_matrix_; | |
| 89 | |
| 90 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl); | 85 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl); |
| 91 }; | 86 }; |
| 92 | 87 |
| 93 } // namespace cc | 88 } // namespace cc |
| 94 | 89 |
| 95 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ | 90 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ |
| OLD | NEW |