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 #include "content/renderer/media/video_capture_message_filter.h" | 5 #include "content/renderer/media/video_capture_message_filter.h" |
6 | 6 |
7 #include "content/common/media/video_capture_messages.h" | 7 #include "content/common/media/video_capture_messages.h" |
8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 int length, | 107 int length, |
108 int buffer_id) { | 108 int buffer_id) { |
109 Delegate* delegate = find_delegate(device_id); | 109 Delegate* delegate = find_delegate(device_id); |
110 if (!delegate) { | 110 if (!delegate) { |
111 DLOG(WARNING) << "OnBufferCreated: Got video SHM buffer for a " | 111 DLOG(WARNING) << "OnBufferCreated: Got video SHM buffer for a " |
112 "non-existent or removed video capture."; | 112 "non-existent or removed video capture."; |
113 | 113 |
114 // Send the buffer back to Host in case it's waiting for all buffers | 114 // Send the buffer back to Host in case it's waiting for all buffers |
115 // to be returned. | 115 // to be returned. |
116 base::SharedMemory::CloseHandle(handle); | 116 base::SharedMemory::CloseHandle(handle); |
117 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0)); | 117 Send(new VideoCaptureHostMsg_BufferReady( |
| 118 device_id, buffer_id, std::vector<uint32>())); |
118 return; | 119 return; |
119 } | 120 } |
120 | 121 |
121 delegate->OnBufferCreated(handle, length, buffer_id); | 122 delegate->OnBufferCreated(handle, length, buffer_id); |
122 } | 123 } |
123 | 124 |
124 void VideoCaptureMessageFilter::OnBufferReceived( | 125 void VideoCaptureMessageFilter::OnBufferReceived( |
125 int device_id, | 126 int device_id, |
126 int buffer_id, | 127 int buffer_id, |
127 const media::VideoCaptureFormat& format, | 128 const media::VideoCaptureFormat& format, |
128 base::TimeTicks timestamp) { | 129 base::TimeTicks timestamp) { |
129 Delegate* delegate = find_delegate(device_id); | 130 Delegate* delegate = find_delegate(device_id); |
130 if (!delegate) { | 131 if (!delegate) { |
131 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a " | 132 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a " |
132 "non-existent or removed video capture."; | 133 "non-existent or removed video capture."; |
133 | 134 |
134 // Send the buffer back to Host in case it's waiting for all buffers | 135 // Send the buffer back to Host in case it's waiting for all buffers |
135 // to be returned. | 136 // to be returned. |
136 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0)); | 137 Send(new VideoCaptureHostMsg_BufferReady( |
| 138 device_id, buffer_id, std::vector<uint32>())); |
137 return; | 139 return; |
138 } | 140 } |
139 | 141 |
140 delegate->OnBufferReceived(buffer_id, format, timestamp); | 142 delegate->OnBufferReceived(buffer_id, format, timestamp); |
141 } | 143 } |
142 | 144 |
143 void VideoCaptureMessageFilter::OnMailboxBufferReceived( | 145 void VideoCaptureMessageFilter::OnMailboxBufferReceived( |
144 int device_id, | 146 int device_id, |
145 int buffer_id, | 147 int buffer_id, |
146 const gpu::MailboxHolder& mailbox_holder, | 148 const gpu::MailboxHolder& mailbox_holder, |
147 const media::VideoCaptureFormat& format, | 149 const media::VideoCaptureFormat& format, |
148 base::TimeTicks timestamp) { | 150 base::TimeTicks timestamp) { |
149 Delegate* delegate = find_delegate(device_id); | 151 Delegate* delegate = find_delegate(device_id); |
150 | 152 |
151 if (!delegate) { | 153 if (!delegate) { |
152 DLOG(WARNING) << "OnMailboxBufferReceived: Got video mailbox buffer for a " | 154 DLOG(WARNING) << "OnMailboxBufferReceived: Got video mailbox buffer for a " |
153 "non-existent or removed video capture."; | 155 "non-existent or removed video capture."; |
154 | 156 |
155 // Send the buffer back to Host in case it's waiting for all buffers | 157 // Send the buffer back to Host in case it's waiting for all buffers |
156 // to be returned. | 158 // to be returned. |
157 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0)); | 159 Send(new VideoCaptureHostMsg_BufferReady( |
| 160 device_id, buffer_id, std::vector<uint32>())); |
158 return; | 161 return; |
159 } | 162 } |
160 | 163 |
161 delegate->OnMailboxBufferReceived( | 164 delegate->OnMailboxBufferReceived( |
162 buffer_id, mailbox_holder, format, timestamp); | 165 buffer_id, mailbox_holder, format, timestamp); |
163 } | 166 } |
164 | 167 |
165 void VideoCaptureMessageFilter::OnBufferDestroyed( | 168 void VideoCaptureMessageFilter::OnBufferDestroyed( |
166 int device_id, | 169 int device_id, |
167 int buffer_id) { | 170 int buffer_id) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 const media::VideoCaptureFormats& formats_in_use) { | 206 const media::VideoCaptureFormats& formats_in_use) { |
204 Delegate* delegate = find_delegate(device_id); | 207 Delegate* delegate = find_delegate(device_id); |
205 if (!delegate) { | 208 if (!delegate) { |
206 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device"; | 209 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device"; |
207 return; | 210 return; |
208 } | 211 } |
209 delegate->OnDeviceFormatsInUseReceived(formats_in_use); | 212 delegate->OnDeviceFormatsInUseReceived(formats_in_use); |
210 } | 213 } |
211 | 214 |
212 } // namespace content | 215 } // namespace content |
OLD | NEW |