OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureController is the glue between a VideoCaptureDevice and all | 5 // VideoCaptureController is the glue between a VideoCaptureDevice and all |
6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of | 6 // VideoCaptureHosts that have connected to it. A controller exists on behalf of |
7 // one (and only one) VideoCaptureDevice; both are owned by the | 7 // one (and only one) VideoCaptureDevice; both are owned by the |
8 // VideoCaptureManager. | 8 // VideoCaptureManager. |
9 // | 9 // |
10 // The VideoCaptureController is responsible for: | 10 // The VideoCaptureController is responsible for: |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 // kInvalidMediaCaptureSessionId if the indicated client was not registered. | 91 // kInvalidMediaCaptureSessionId if the indicated client was not registered. |
92 int RemoveClient(const VideoCaptureControllerID& id, | 92 int RemoveClient(const VideoCaptureControllerID& id, |
93 VideoCaptureControllerEventHandler* event_handler); | 93 VideoCaptureControllerEventHandler* event_handler); |
94 | 94 |
95 int GetClientCount(); | 95 int GetClientCount(); |
96 | 96 |
97 // API called directly by VideoCaptureManager in case the device is | 97 // API called directly by VideoCaptureManager in case the device is |
98 // prematurely closed. | 98 // prematurely closed. |
99 void StopSession(int session_id); | 99 void StopSession(int session_id); |
100 | 100 |
101 // Return a buffer previously given in | 101 // Return a buffer with id |buffer_id| previously given in |
102 // VideoCaptureControllerEventHandler::OnBufferReady. | 102 // VideoCaptureControllerEventHandler::OnBufferReady. In the case that the |
103 // buffer was backed by a texture, |sync_point| will be waited on before | |
104 // destroying or recycling the texture. | |
jiayl
2014/01/31 19:32:39
The use of |sync_point| still seems unclear to som
sheu
2014/02/07 00:37:25
Syncpoints are used for cross-process/cross-contex
jiayl
2014/02/07 01:22:08
Is it possible to add a link in the comment to pro
sheu
2014/02/14 01:59:29
Honestly, I think that the syncpoint mechanism sho
jiayl
2014/02/14 17:39:44
But the code will be read, used, and maintained by
sheu
2014/02/14 20:23:19
I'm sorry if I sound a little obstinate or obstruc
| |
103 void ReturnBuffer(const VideoCaptureControllerID& id, | 105 void ReturnBuffer(const VideoCaptureControllerID& id, |
104 VideoCaptureControllerEventHandler* event_handler, | 106 VideoCaptureControllerEventHandler* event_handler, |
105 int buffer_id); | 107 int buffer_id, |
108 uint32 sync_point); | |
106 | 109 |
107 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; | 110 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; |
108 | 111 |
109 private: | 112 private: |
110 class VideoCaptureDeviceClient; | 113 class VideoCaptureDeviceClient; |
111 | 114 |
112 struct ControllerClient; | 115 struct ControllerClient; |
113 typedef std::list<ControllerClient*> ControllerClients; | 116 typedef std::list<ControllerClient*> ControllerClients; |
114 | 117 |
115 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. | 118 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. |
116 void DoIncomingCapturedI420BufferOnIOThread( | 119 void DoIncomingCapturedVideoFrameOnIOThread( |
117 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 120 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer, |
118 const gfx::Size& dimensions, | 121 const media::VideoCaptureFormat& format, |
119 int frame_rate, | 122 const scoped_refptr<media::VideoFrame>& frame, |
120 base::TimeTicks timestamp); | 123 base::TimeTicks timestamp); |
121 void DoErrorOnIOThread(); | 124 void DoErrorOnIOThread(); |
122 void DoDeviceStoppedOnIOThread(); | 125 void DoDeviceStoppedOnIOThread(); |
123 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); | 126 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); |
124 | 127 |
125 // Find a client of |id| and |handler| in |clients|. | 128 // Find a client of |id| and |handler| in |clients|. |
126 ControllerClient* FindClient( | 129 ControllerClient* FindClient( |
127 const VideoCaptureControllerID& id, | 130 const VideoCaptureControllerID& id, |
128 VideoCaptureControllerEventHandler* handler, | 131 VideoCaptureControllerEventHandler* handler, |
129 const ControllerClients& clients); | 132 const ControllerClients& clients); |
(...skipping 16 matching lines...) Expand all Loading... | |
146 media::VideoCaptureFormat video_capture_format_; | 149 media::VideoCaptureFormat video_capture_format_; |
147 | 150 |
148 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 151 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
149 | 152 |
150 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 153 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
151 }; | 154 }; |
152 | 155 |
153 } // namespace content | 156 } // namespace content |
154 | 157 |
155 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 158 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |