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/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (client) { | 236 if (client) { |
237 client->session_closed = true; | 237 client->session_closed = true; |
238 client->event_handler->OnEnded(client->controller_id); | 238 client->event_handler->OnEnded(client->controller_id); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 void VideoCaptureController::ReturnBuffer( | 242 void VideoCaptureController::ReturnBuffer( |
243 const VideoCaptureControllerID& id, | 243 const VideoCaptureControllerID& id, |
244 VideoCaptureControllerEventHandler* event_handler, | 244 VideoCaptureControllerEventHandler* event_handler, |
245 int buffer_id, | 245 int buffer_id, |
246 uint32 sync_point) { | 246 const std::vector<uint32>& sync_points) { |
247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
248 | 248 |
249 ControllerClient* client = FindClient(id, event_handler, controller_clients_); | 249 ControllerClient* client = FindClient(id, event_handler, controller_clients_); |
250 | 250 |
251 // If this buffer is not held by this client, or this client doesn't exist | 251 // If this buffer is not held by this client, or this client doesn't exist |
252 // in controller, do nothing. | 252 // in controller, do nothing. |
253 ControllerClient::ActiveBufferMap::iterator iter; | 253 ControllerClient::ActiveBufferMap::iterator iter; |
254 if (!client || (iter = client->active_buffers.find(buffer_id)) == | 254 if (!client || (iter = client->active_buffers.find(buffer_id)) == |
255 client->active_buffers.end()) { | 255 client->active_buffers.end()) { |
256 NOTREACHED(); | 256 NOTREACHED(); |
257 return; | 257 return; |
258 } | 258 } |
259 scoped_refptr<media::VideoFrame> frame = iter->second; | 259 scoped_refptr<media::VideoFrame> frame = iter->second; |
260 client->active_buffers.erase(iter); | 260 client->active_buffers.erase(iter); |
261 | 261 |
262 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) | 262 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { |
263 frame->mailbox_holder()->sync_point = sync_point; | 263 for (size_t i = 0; i < sync_points.size(); i++) |
| 264 frame->AppendReleaseSyncPoint(sync_points[i]); |
| 265 } |
264 | 266 |
265 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); | 267 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |
266 } | 268 } |
267 | 269 |
268 const media::VideoCaptureFormat& | 270 const media::VideoCaptureFormat& |
269 VideoCaptureController::GetVideoCaptureFormat() const { | 271 VideoCaptureController::GetVideoCaptureFormat() const { |
270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
271 return video_capture_format_; | 273 return video_capture_format_; |
272 } | 274 } |
273 | 275 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 } | 626 } |
625 return NULL; | 627 return NULL; |
626 } | 628 } |
627 | 629 |
628 int VideoCaptureController::GetClientCount() { | 630 int VideoCaptureController::GetClientCount() { |
629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 631 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
630 return controller_clients_.size(); | 632 return controller_clients_.size(); |
631 } | 633 } |
632 | 634 |
633 } // namespace content | 635 } // namespace content |
OLD | NEW |