| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (client) { | 244 if (client) { |
| 245 client->session_closed = true; | 245 client->session_closed = true; |
| 246 client->event_handler->OnEnded(client->controller_id); | 246 client->event_handler->OnEnded(client->controller_id); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void VideoCaptureController::ReturnBuffer( | 250 void VideoCaptureController::ReturnBuffer( |
| 251 const VideoCaptureControllerID& id, | 251 const VideoCaptureControllerID& id, |
| 252 VideoCaptureControllerEventHandler* event_handler, | 252 VideoCaptureControllerEventHandler* event_handler, |
| 253 int buffer_id, | 253 int buffer_id, |
| 254 uint32 sync_point) { | 254 const std::vector<uint32>& sync_points) { |
| 255 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 255 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 256 | 256 |
| 257 ControllerClient* client = FindClient(id, event_handler, controller_clients_); | 257 ControllerClient* client = FindClient(id, event_handler, controller_clients_); |
| 258 | 258 |
| 259 // If this buffer is not held by this client, or this client doesn't exist | 259 // If this buffer is not held by this client, or this client doesn't exist |
| 260 // in controller, do nothing. | 260 // in controller, do nothing. |
| 261 ControllerClient::ActiveBufferMap::iterator iter; | 261 ControllerClient::ActiveBufferMap::iterator iter; |
| 262 if (!client || (iter = client->active_buffers.find(buffer_id)) == | 262 if (!client || (iter = client->active_buffers.find(buffer_id)) == |
| 263 client->active_buffers.end()) { | 263 client->active_buffers.end()) { |
| 264 NOTREACHED(); | 264 NOTREACHED(); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 scoped_refptr<media::VideoFrame> frame = iter->second; | 267 scoped_refptr<media::VideoFrame> frame = iter->second; |
| 268 client->active_buffers.erase(iter); | 268 client->active_buffers.erase(iter); |
| 269 | 269 |
| 270 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) | 270 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { |
| 271 frame->mailbox_holder()->sync_point = sync_point; | 271 for (size_t i = 0; i < sync_points.size(); i++) |
| 272 frame->AppendReleaseSyncPoint(sync_points[i]); |
| 273 } |
| 272 | 274 |
| 273 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); | 275 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |
| 274 } | 276 } |
| 275 | 277 |
| 276 const media::VideoCaptureFormat& | 278 const media::VideoCaptureFormat& |
| 277 VideoCaptureController::GetVideoCaptureFormat() const { | 279 VideoCaptureController::GetVideoCaptureFormat() const { |
| 278 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 280 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 279 return video_capture_format_; | 281 return video_capture_format_; |
| 280 } | 282 } |
| 281 | 283 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 } | 645 } |
| 644 return NULL; | 646 return NULL; |
| 645 } | 647 } |
| 646 | 648 |
| 647 int VideoCaptureController::GetClientCount() { | 649 int VideoCaptureController::GetClientCount() { |
| 648 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 650 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 649 return controller_clients_.size(); | 651 return controller_clients_.size(); |
| 650 } | 652 } |
| 651 | 653 |
| 652 } // namespace content | 654 } // namespace content |
| OLD | NEW |