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 // VideoCaptureHost serves video capture related messages from | 5 // VideoCaptureHost serves video capture related messages from |
6 // VideoCaptureMessageFilter which lives inside the render process. | 6 // VideoCaptureMessageFilter which lives inside the render process. |
7 // | 7 // |
8 // This class is owned by RenderProcessHostImpl, and instantiated on UI | 8 // This class is owned by RenderProcessHostImpl, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread. | 9 // thread, but all other operations and method calls happen on IO thread. |
10 // | 10 // |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 bool* message_was_ok) OVERRIDE; | 77 bool* message_was_ok) OVERRIDE; |
78 | 78 |
79 // VideoCaptureControllerEventHandler implementation. | 79 // VideoCaptureControllerEventHandler implementation. |
80 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE; | 80 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE; |
81 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 81 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
82 base::SharedMemoryHandle handle, | 82 base::SharedMemoryHandle handle, |
83 int length, | 83 int length, |
84 int buffer_id) OVERRIDE; | 84 int buffer_id) OVERRIDE; |
85 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, | 85 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, |
86 int buffer_id) OVERRIDE; | 86 int buffer_id) OVERRIDE; |
87 virtual void OnBufferReady( | 87 virtual void OnBufferReady(const VideoCaptureControllerID& id, |
88 const VideoCaptureControllerID& id, | 88 int buffer_id, |
89 int buffer_id, | 89 base::TimeTicks timestamp, |
90 base::Time timestamp, | 90 const media::VideoCaptureFormat& format) OVERRIDE; |
91 const media::VideoCaptureFormat& format) OVERRIDE; | |
92 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE; | 91 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE; |
93 | 92 |
94 private: | 93 private: |
95 friend class BrowserThread; | 94 friend class BrowserThread; |
96 friend class base::DeleteHelper<VideoCaptureHost>; | 95 friend class base::DeleteHelper<VideoCaptureHost>; |
97 friend class MockVideoCaptureHost; | 96 friend class MockVideoCaptureHost; |
98 friend class VideoCaptureHostTest; | 97 friend class VideoCaptureHostTest; |
99 | 98 |
100 virtual ~VideoCaptureHost(); | 99 virtual ~VideoCaptureHost(); |
101 | 100 |
(...skipping 29 matching lines...) Expand all Loading... |
131 int buffer_id); | 130 int buffer_id); |
132 | 131 |
133 void DoSendFreeBufferOnIOThread( | 132 void DoSendFreeBufferOnIOThread( |
134 const VideoCaptureControllerID& controller_id, | 133 const VideoCaptureControllerID& controller_id, |
135 int buffer_id); | 134 int buffer_id); |
136 | 135 |
137 // Send a filled buffer to the VideoCaptureMessageFilter. | 136 // Send a filled buffer to the VideoCaptureMessageFilter. |
138 void DoSendFilledBufferOnIOThread( | 137 void DoSendFilledBufferOnIOThread( |
139 const VideoCaptureControllerID& controller_id, | 138 const VideoCaptureControllerID& controller_id, |
140 int buffer_id, | 139 int buffer_id, |
141 base::Time timestamp, | 140 base::TimeTicks timestamp, |
142 const media::VideoCaptureFormat& format); | 141 const media::VideoCaptureFormat& format); |
143 | 142 |
144 // Handle error coming from VideoCaptureDevice. | 143 // Handle error coming from VideoCaptureDevice. |
145 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); | 144 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); |
146 | 145 |
147 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); | 146 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); |
148 | 147 |
149 void DeleteVideoCaptureControllerOnIOThread( | 148 void DeleteVideoCaptureControllerOnIOThread( |
150 const VideoCaptureControllerID& controller_id); | 149 const VideoCaptureControllerID& controller_id); |
151 | 150 |
152 MediaStreamManager* media_stream_manager_; | 151 MediaStreamManager* media_stream_manager_; |
153 | 152 |
154 typedef std::map<VideoCaptureControllerID, | 153 typedef std::map<VideoCaptureControllerID, |
155 base::WeakPtr<VideoCaptureController> > EntryMap; | 154 base::WeakPtr<VideoCaptureController> > EntryMap; |
156 | 155 |
157 // A map of VideoCaptureControllerID to the VideoCaptureController to which it | 156 // A map of VideoCaptureControllerID to the VideoCaptureController to which it |
158 // is connected. An entry in this map holds a null controller while it is in | 157 // is connected. An entry in this map holds a null controller while it is in |
159 // the process of starting. | 158 // the process of starting. |
160 EntryMap entries_; | 159 EntryMap entries_; |
161 | 160 |
162 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 161 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
163 }; | 162 }; |
164 | 163 |
165 } // namespace content | 164 } // namespace content |
166 | 165 |
167 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 166 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |