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

Side by Side Diff: cc/layers/video_frame_provider_client_impl.h

Issue 1039533002: cc: Add support for sending BeginFrames for video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@misc_video_refactoring
Patch Set: Fix comment. Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/video_frame_provider_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/layers/video_frame_provider.h" 12 #include "cc/layers/video_frame_provider.h"
13 #include "cc/scheduler/video_frame_controller.h"
13 #include "ui/gfx/transform.h" 14 #include "ui/gfx/transform.h"
14 15
15 namespace media { class VideoFrame; } 16 namespace media { class VideoFrame; }
16 17
17 namespace cc { 18 namespace cc {
18 class VideoLayerImpl; 19 class VideoLayerImpl;
19 20
20 // VideoFrameProviderClientImpl liasons with the VideoFrameProvider and the 21 // VideoFrameProviderClientImpl liasons with the VideoFrameProvider and the
21 // VideoLayer. It receives updates from the provider and updates the layer as a 22 // VideoLayer. It receives updates from the provider and updates the layer as a
22 // result. It also allows the layer to access the video frame that the provider 23 // result. It also allows the layer to access the video frame that the provider
23 // has. 24 // has.
24 class CC_EXPORT VideoFrameProviderClientImpl 25 class CC_EXPORT VideoFrameProviderClientImpl
25 : public VideoFrameProvider::Client, 26 : public VideoFrameProvider::Client,
27 public VideoFrameController,
26 public base::RefCounted<VideoFrameProviderClientImpl> { 28 public base::RefCounted<VideoFrameProviderClientImpl> {
27 public: 29 public:
28 // Must be created on the impl thread while the main thread is blocked. 30 // Must be created on the impl thread while the main thread is blocked.
29 static scoped_refptr<VideoFrameProviderClientImpl> Create( 31 static scoped_refptr<VideoFrameProviderClientImpl> Create(
30 VideoFrameProvider* provider); 32 VideoFrameProvider* provider,
33 VideoFrameControllerClient* client);
31 34
32 VideoLayerImpl* ActiveVideoLayer() const; 35 VideoLayerImpl* ActiveVideoLayer() const;
33 void SetActiveVideoLayer(VideoLayerImpl* video_layer); 36 void SetActiveVideoLayer(VideoLayerImpl* video_layer);
34 37
35 bool Stopped() const; 38 bool Stopped() const;
36 // Must be called on the impl thread while the main thread is blocked. 39 // Must be called on the impl thread while the main thread is blocked.
37 void Stop(); 40 void Stop();
38 41
39 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame(); 42 scoped_refptr<media::VideoFrame> AcquireLockAndCurrentFrame();
40 void PutCurrentFrame(); 43 void PutCurrentFrame();
41 void ReleaseLock(); 44 void ReleaseLock();
42 45
43 const gfx::Transform& StreamTextureMatrix() const; 46 const gfx::Transform& StreamTextureMatrix() const;
44 47
48 // VideoFrameController implementation.
49 void OnBeginFrame(const BeginFrameArgs& args) override;
50
45 // VideoFrameProvider::Client implementation. 51 // VideoFrameProvider::Client implementation.
46 // Called on the main thread. 52 // Called on the main thread.
47 void StopUsingProvider() override; 53 void StopUsingProvider() override;
48 // Called on the impl thread. 54 // Called on the impl thread.
49 void StartRendering() override; 55 void StartRendering() override;
50 void StopRendering() override; 56 void StopRendering() override;
51 void DidReceiveFrame() override; 57 void DidReceiveFrame() override;
52 void DidUpdateMatrix(const float* matrix) override; 58 void DidUpdateMatrix(const float* matrix) override;
53 59
54 private: 60 private:
55 friend class base::RefCounted<VideoFrameProviderClientImpl>; 61 friend class base::RefCounted<VideoFrameProviderClientImpl>;
56 62
57 explicit VideoFrameProviderClientImpl(VideoFrameProvider* provider); 63 VideoFrameProviderClientImpl(VideoFrameProvider* provider,
64 VideoFrameControllerClient* client);
58 ~VideoFrameProviderClientImpl() override; 65 ~VideoFrameProviderClientImpl() override;
59 66
60 VideoFrameProvider* provider_; 67 VideoFrameProvider* provider_;
68 VideoFrameControllerClient* client_;
61 VideoLayerImpl* active_video_layer_; 69 VideoLayerImpl* active_video_layer_;
62 bool stopped_; 70 bool stopped_;
63 71
64 // Since the provider lives on another thread, it can be destroyed while the 72 // Since the provider lives on another thread, it can be destroyed while the
65 // frame controller are accessing its frame. Before being destroyed the 73 // frame controller are accessing its frame. Before being destroyed the
66 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider 74 // provider calls StopUsingProvider. provider_lock_ blocks StopUsingProvider
67 // from returning until the frame controller is done using the frame. 75 // from returning until the frame controller is done using the frame.
68 base::Lock provider_lock_; 76 base::Lock provider_lock_;
69 base::ThreadChecker thread_checker_; 77 base::ThreadChecker thread_checker_;
70 78
71 gfx::Transform stream_texture_matrix_; 79 gfx::Transform stream_texture_matrix_;
72 80
73 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl); 81 DISALLOW_COPY_AND_ASSIGN(VideoFrameProviderClientImpl);
74 }; 82 };
75 83
76 } // namespace cc 84 } // namespace cc
77 85
78 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_ 86 #endif // CC_LAYERS_VIDEO_FRAME_PROVIDER_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/layers/video_frame_provider_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698