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, to synchronize with texture users in |
| 105 // the renderer process. |
103 void ReturnBuffer(const VideoCaptureControllerID& id, | 106 void ReturnBuffer(const VideoCaptureControllerID& id, |
104 VideoCaptureControllerEventHandler* event_handler, | 107 VideoCaptureControllerEventHandler* event_handler, |
105 int buffer_id); | 108 int buffer_id, |
| 109 uint32 sync_point); |
106 | 110 |
107 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; | 111 const media::VideoCaptureFormat& GetVideoCaptureFormat() const; |
108 | 112 |
109 private: | 113 private: |
110 class VideoCaptureDeviceClient; | 114 class VideoCaptureDeviceClient; |
111 | 115 |
112 struct ControllerClient; | 116 struct ControllerClient; |
113 typedef std::list<ControllerClient*> ControllerClients; | 117 typedef std::list<ControllerClient*> ControllerClients; |
114 | 118 |
115 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. | 119 // Worker functions on IO thread. Called by the VideoCaptureDeviceClient. |
116 void DoIncomingCapturedI420BufferOnIOThread( | 120 void DoIncomingCapturedVideoFrameOnIOThread( |
117 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> buffer, | 121 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer, |
118 const gfx::Size& dimensions, | 122 const media::VideoCaptureFormat& format, |
119 int frame_rate, | 123 const scoped_refptr<media::VideoFrame>& frame, |
120 base::TimeTicks timestamp); | 124 base::TimeTicks timestamp); |
121 void DoErrorOnIOThread(); | 125 void DoErrorOnIOThread(); |
122 void DoDeviceStoppedOnIOThread(); | 126 void DoDeviceStoppedOnIOThread(); |
123 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); | 127 void DoBufferDestroyedOnIOThread(int buffer_id_to_drop); |
124 | 128 |
125 // Find a client of |id| and |handler| in |clients|. | 129 // Find a client of |id| and |handler| in |clients|. |
126 ControllerClient* FindClient( | 130 ControllerClient* FindClient( |
127 const VideoCaptureControllerID& id, | 131 const VideoCaptureControllerID& id, |
128 VideoCaptureControllerEventHandler* handler, | 132 VideoCaptureControllerEventHandler* handler, |
129 const ControllerClients& clients); | 133 const ControllerClients& clients); |
(...skipping 16 matching lines...) Expand all Loading... |
146 media::VideoCaptureFormat video_capture_format_; | 150 media::VideoCaptureFormat video_capture_format_; |
147 | 151 |
148 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 152 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
149 | 153 |
150 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 154 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
151 }; | 155 }; |
152 | 156 |
153 } // namespace content | 157 } // namespace content |
154 | 158 |
155 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 159 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |