| 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_sender.h" | 9 #include "ipc/ipc_sender.h" |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(device_id, buffer_id, 0)); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 delegate->OnBufferCreated(handle, length, buffer_id); | 121 delegate->OnBufferCreated(handle, length, buffer_id); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void VideoCaptureMessageFilter::OnBufferReceived( | 124 void VideoCaptureMessageFilter::OnBufferReceived( |
| 125 int device_id, | 125 const VideoCaptureMsg_BufferReady_Params& params) { |
| 126 int buffer_id, | 126 Delegate* delegate = find_delegate(params.device_id); |
| 127 const media::VideoCaptureFormat& format, | |
| 128 const gfx::Rect& visible_rect, | |
| 129 base::TimeTicks timestamp) { | |
| 130 Delegate* delegate = find_delegate(device_id); | |
| 131 if (!delegate) { | 127 if (!delegate) { |
| 132 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a " | 128 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a " |
| 133 "non-existent or removed video capture."; | 129 "non-existent or removed video capture."; |
| 134 | 130 |
| 135 // Send the buffer back to Host in case it's waiting for all buffers | 131 // Send the buffer back to Host in case it's waiting for all buffers |
| 136 // to be returned. | 132 // to be returned. |
| 137 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0)); | 133 Send(new VideoCaptureHostMsg_BufferReady( |
| 134 params.device_id, params.buffer_id, 0)); |
| 138 return; | 135 return; |
| 139 } | 136 } |
| 140 | 137 |
| 141 delegate->OnBufferReceived(buffer_id, format, visible_rect, timestamp); | 138 delegate->OnBufferReceived(params.buffer_id, |
| 139 params.coded_size, |
| 140 params.visible_rect, |
| 141 params.timestamp, |
| 142 params.metadata); |
| 142 } | 143 } |
| 143 | 144 |
| 144 void VideoCaptureMessageFilter::OnMailboxBufferReceived( | 145 void VideoCaptureMessageFilter::OnMailboxBufferReceived( |
| 145 int device_id, | 146 const VideoCaptureMsg_MailboxBufferReady_Params& params) { |
| 146 int buffer_id, | 147 Delegate* delegate = find_delegate(params.device_id); |
| 147 const gpu::MailboxHolder& mailbox_holder, | |
| 148 const media::VideoCaptureFormat& format, | |
| 149 base::TimeTicks timestamp) { | |
| 150 Delegate* delegate = find_delegate(device_id); | |
| 151 | 148 |
| 152 if (!delegate) { | 149 if (!delegate) { |
| 153 DLOG(WARNING) << "OnMailboxBufferReceived: Got video mailbox buffer for a " | 150 DLOG(WARNING) << "OnMailboxBufferReceived: Got video mailbox buffer for a " |
| 154 "non-existent or removed video capture."; | 151 "non-existent or removed video capture."; |
| 155 | 152 |
| 156 // Send the buffer back to Host in case it's waiting for all buffers | 153 // Send the buffer back to Host in case it's waiting for all buffers |
| 157 // to be returned. | 154 // to be returned. |
| 158 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0)); | 155 Send(new VideoCaptureHostMsg_BufferReady( |
| 156 params.device_id, params.buffer_id, 0)); |
| 159 return; | 157 return; |
| 160 } | 158 } |
| 161 | 159 |
| 162 delegate->OnMailboxBufferReceived( | 160 delegate->OnMailboxBufferReceived( |
| 163 buffer_id, mailbox_holder, format, timestamp); | 161 params.buffer_id, |
| 162 params.mailbox_holder, |
| 163 params.packed_frame_size, |
| 164 params.timestamp, |
| 165 params.metadata); |
| 164 } | 166 } |
| 165 | 167 |
| 166 void VideoCaptureMessageFilter::OnBufferDestroyed( | 168 void VideoCaptureMessageFilter::OnBufferDestroyed( |
| 167 int device_id, | 169 int device_id, |
| 168 int buffer_id) { | 170 int buffer_id) { |
| 169 Delegate* delegate = find_delegate(device_id); | 171 Delegate* delegate = find_delegate(device_id); |
| 170 if (!delegate) { | 172 if (!delegate) { |
| 171 DLOG(WARNING) << "OnBufferDestroyed: Instructed to free buffer for a " | 173 DLOG(WARNING) << "OnBufferDestroyed: Instructed to free buffer for a " |
| 172 "non-existent or removed video capture."; | 174 "non-existent or removed video capture."; |
| 173 return; | 175 return; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 204 const media::VideoCaptureFormats& formats_in_use) { | 206 const media::VideoCaptureFormats& formats_in_use) { |
| 205 Delegate* delegate = find_delegate(device_id); | 207 Delegate* delegate = find_delegate(device_id); |
| 206 if (!delegate) { | 208 if (!delegate) { |
| 207 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device"; | 209 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device"; |
| 208 return; | 210 return; |
| 209 } | 211 } |
| 210 delegate->OnDeviceFormatsInUseReceived(formats_in_use); | 212 delegate->OnDeviceFormatsInUseReceived(formats_in_use); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace content | 215 } // namespace content |
| OLD | NEW |