OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // VideCaptureMessageFilter which lives inside the render process. | 6 // VideCaptureMessageFilter which lives inside the render process. |
7 // | 7 // |
8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 friend class VideoCaptureHostTest; | 81 friend class VideoCaptureHostTest; |
82 | 82 |
83 virtual ~VideoCaptureHost(); | 83 virtual ~VideoCaptureHost(); |
84 | 84 |
85 // IPC message: Start capture on the VideoCaptureDevice referenced by | 85 // IPC message: Start capture on the VideoCaptureDevice referenced by |
86 // VideoCaptureParams::session_id. |device_id| is an id created by | 86 // VideoCaptureParams::session_id. |device_id| is an id created by |
87 // VideCaptureMessageFilter to identify a session | 87 // VideCaptureMessageFilter to identify a session |
88 // between a VideCaptureMessageFilter and a VideoCaptureHost. | 88 // between a VideCaptureMessageFilter and a VideoCaptureHost. |
89 void OnStartCapture(int device_id, | 89 void OnStartCapture(int device_id, |
90 const media::VideoCaptureParams& params); | 90 const media::VideoCaptureParams& params); |
| 91 void OnControllerAdded( |
| 92 int device_id, const media::VideoCaptureParams& params, |
| 93 VideoCaptureController* controller); |
| 94 void DoControllerAddedOnIOThreead( |
| 95 int device_id, const media::VideoCaptureParams params, |
| 96 VideoCaptureController* controller); |
91 | 97 |
92 // IPC message: Stop capture on device referenced by |device_id|. | 98 // IPC message: Stop capture on device referenced by |device_id|. |
93 void OnStopCapture(int device_id); | 99 void OnStopCapture(int device_id); |
94 | 100 |
95 // IPC message: Pause capture on device referenced by |device_id|. | 101 // IPC message: Pause capture on device referenced by |device_id|. |
96 void OnPauseCapture(int device_id); | 102 void OnPauseCapture(int device_id); |
97 | 103 |
98 // IPC message: Receive an empty buffer from renderer. Send it to device | 104 // IPC message: Receive an empty buffer from renderer. Send it to device |
99 // referenced by |device_id|. | 105 // referenced by |device_id|. |
100 void OnReceiveEmptyBuffer(int device_id, int buffer_id); | 106 void OnReceiveEmptyBuffer(int device_id, int buffer_id); |
(...skipping 17 matching lines...) Expand all Loading... |
118 // Send a information about frame resolution and frame rate | 124 // Send a information about frame resolution and frame rate |
119 // to the VideoCaptureMessageFilter. | 125 // to the VideoCaptureMessageFilter. |
120 void DoSendFrameInfo(int device_id, | 126 void DoSendFrameInfo(int device_id, |
121 int width, | 127 int width, |
122 int height, | 128 int height, |
123 int frame_per_second); | 129 int frame_per_second); |
124 | 130 |
125 // Handle error coming from VideoCaptureDevice. | 131 // Handle error coming from VideoCaptureDevice. |
126 void DoHandleError(int device_id); | 132 void DoHandleError(int device_id); |
127 | 133 |
| 134 // Helpers. |
| 135 media_stream::VideoCaptureManager* GetVideoCaptureManager(); |
| 136 |
128 typedef std::map<VideoCaptureControllerID, | 137 typedef std::map<VideoCaptureControllerID, |
129 scoped_refptr<VideoCaptureController> >EntryMap; | 138 scoped_refptr<VideoCaptureController> > EntryMap; |
130 | |
131 // A map of VideoCaptureControllerID to VideoCaptureController | 139 // A map of VideoCaptureControllerID to VideoCaptureController |
132 // objects that is currently active. | 140 // objects that is currently active. |
133 EntryMap entries_; | 141 EntryMap entries_; |
134 | 142 |
| 143 typedef std::map<VideoCaptureControllerID, |
| 144 media::VideoCapture::State> EntryState; |
| 145 // Record state of each VideoCaptureControllerID. |
| 146 EntryState entry_state_; |
| 147 |
135 // Used to get a pointer to VideoCaptureManager to start/stop capture devices. | 148 // Used to get a pointer to VideoCaptureManager to start/stop capture devices. |
136 const content::ResourceContext* resource_context_; | 149 const content::ResourceContext* resource_context_; |
137 | 150 |
138 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 151 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
139 }; | 152 }; |
140 | 153 |
141 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 154 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |