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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 friend class DeleteTask<VideoCaptureHost>; | 73 friend class DeleteTask<VideoCaptureHost>; |
74 friend class MockVideoCaptureHost; | 74 friend class MockVideoCaptureHost; |
75 friend class VideoCaptureHostTest; | 75 friend class VideoCaptureHostTest; |
76 | 76 |
77 virtual ~VideoCaptureHost(); | 77 virtual ~VideoCaptureHost(); |
78 | 78 |
79 // IPC message: Start capture on the VideoCaptureDevice referenced by | 79 // IPC message: Start capture on the VideoCaptureDevice referenced by |
80 // VideoCaptureParams::session_id. device_id is an id created by | 80 // VideoCaptureParams::session_id. device_id is an id created by |
81 // VideCaptureMessageFilter to identify a session | 81 // VideCaptureMessageFilter to identify a session |
82 // between a VideCaptureMessageFilter and a VideoCaptureHost. | 82 // between a VideCaptureMessageFilter and a VideoCaptureHost. |
83 void OnStartCapture(const IPC::Message& msg, int device_id, | 83 void OnStartCapture(int device_id, |
84 const media::VideoCaptureParams& params); | 84 const media::VideoCaptureParams& params); |
85 | 85 |
86 // IPC message: Stop capture on device referenced by device_id. | 86 // IPC message: Stop capture on device referenced by device_id. |
87 void OnStopCapture(const IPC::Message& msg, int device_id); | 87 void OnStopCapture(int device_id); |
88 | 88 |
89 // IPC message: Pause capture on device referenced by device_id. | 89 // IPC message: Pause capture on device referenced by device_id. |
90 void OnPauseCapture(const IPC::Message& msg, int device_id); | 90 void OnPauseCapture(int device_id); |
91 | 91 |
92 // IPC message: Receive an empty buffer from renderer. Send it to device | 92 // IPC message: Receive an empty buffer from renderer. Send it to device |
93 // referenced by |device_id|. | 93 // referenced by |device_id|. |
94 void OnReceiveEmptyBuffer(const IPC::Message& msg, | 94 void OnReceiveEmptyBuffer(int device_id, |
95 int device_id, | |
96 int buffer_id); | 95 int buffer_id); |
97 | 96 |
98 | 97 |
99 // Called on the IO thread when VideoCaptureController have | 98 // Called on the IO thread when VideoCaptureController have |
100 // reported that all DIBs have been returned. | 99 // reported that all DIBs have been returned. |
101 void DoDeleteVideoCaptureController(const VideoCaptureControllerID& id); | 100 void DoDeleteVideoCaptureController(const VideoCaptureControllerID& id); |
102 | 101 |
103 // Send a newly created buffer to the VideoCaptureMessageFilter. | 102 // Send a newly created buffer to the VideoCaptureMessageFilter. |
104 void DoSendNewBuffer(int32 routing_id, | 103 void DoSendNewBuffer(int device_id, |
105 int device_id, | |
106 base::SharedMemoryHandle handle, | 104 base::SharedMemoryHandle handle, |
107 int length, | 105 int length, |
108 int buffer_id); | 106 int buffer_id); |
109 | 107 |
110 // Send a filled buffer to the VideoCaptureMessageFilter. | 108 // Send a filled buffer to the VideoCaptureMessageFilter. |
111 void DoSendFilledBuffer(int32 routing_id, | 109 void DoSendFilledBuffer(int device_id, |
112 int device_id, | |
113 int buffer_id, | 110 int buffer_id, |
114 base::Time timestamp); | 111 base::Time timestamp); |
115 | 112 |
116 // Send a information about frame resolution and frame rate | 113 // Send a information about frame resolution and frame rate |
117 // to the VideoCaptureMessageFilter. | 114 // to the VideoCaptureMessageFilter. |
118 void DoSendFrameInfo(int32 routing_id, | 115 void DoSendFrameInfo(int device_id, |
119 int device_id, | |
120 int width, | 116 int width, |
121 int height, | 117 int height, |
122 int frame_per_second); | 118 int frame_per_second); |
123 | 119 |
124 // Handle error coming from VideoCaptureDevice. | 120 // Handle error coming from VideoCaptureDevice. |
125 void DoHandleError(int32 routing_id, int device_id); | 121 void DoHandleError(int device_id); |
126 | 122 |
127 typedef std::map<VideoCaptureControllerID, | 123 typedef std::map<VideoCaptureControllerID, |
128 scoped_refptr<VideoCaptureController> >EntryMap; | 124 scoped_refptr<VideoCaptureController> >EntryMap; |
129 | 125 |
130 // A map of VideoCaptureControllerID to VideoCaptureController | 126 // A map of VideoCaptureControllerID to VideoCaptureController |
131 // objects that is currently active. | 127 // objects that is currently active. |
132 EntryMap entries_; | 128 EntryMap entries_; |
133 | 129 |
134 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
135 }; | 131 }; |
136 | 132 |
137 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 133 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |