| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (client) { | 233 if (client) { |
| 234 client->session_closed = true; | 234 client->session_closed = true; |
| 235 client->event_handler->OnEnded(client->controller_id); | 235 client->event_handler->OnEnded(client->controller_id); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void VideoCaptureController::ReturnBuffer( | 239 void VideoCaptureController::ReturnBuffer( |
| 240 const VideoCaptureControllerID& id, | 240 const VideoCaptureControllerID& id, |
| 241 VideoCaptureControllerEventHandler* event_handler, | 241 VideoCaptureControllerEventHandler* event_handler, |
| 242 int buffer_id, | 242 int buffer_id, |
| 243 uint32 sync_point) { | 243 const std::vector<uint32>& sync_points) { |
| 244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 244 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 245 | 245 |
| 246 ControllerClient* client = FindClient(id, event_handler, controller_clients_); | 246 ControllerClient* client = FindClient(id, event_handler, controller_clients_); |
| 247 | 247 |
| 248 // If this buffer is not held by this client, or this client doesn't exist | 248 // If this buffer is not held by this client, or this client doesn't exist |
| 249 // in controller, do nothing. | 249 // in controller, do nothing. |
| 250 ControllerClient::ActiveBufferMap::iterator iter; | 250 ControllerClient::ActiveBufferMap::iterator iter; |
| 251 if (!client || (iter = client->active_buffers.find(buffer_id)) == | 251 if (!client || (iter = client->active_buffers.find(buffer_id)) == |
| 252 client->active_buffers.end()) { | 252 client->active_buffers.end()) { |
| 253 NOTREACHED(); | 253 NOTREACHED(); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 scoped_refptr<media::VideoFrame> frame = iter->second; | 256 scoped_refptr<media::VideoFrame> frame = iter->second; |
| 257 client->active_buffers.erase(iter); | 257 client->active_buffers.erase(iter); |
| 258 | 258 |
| 259 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) | 259 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { |
| 260 frame->mailbox_holder()->sync_point = sync_point; | 260 for (size_t i = 0; i < sync_points.size(); i++) |
| 261 frame->AppendReleaseSyncPoint(sync_points[i]); |
| 262 } |
| 261 | 263 |
| 262 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); | 264 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); |
| 263 } | 265 } |
| 264 | 266 |
| 265 const media::VideoCaptureFormat& | 267 const media::VideoCaptureFormat& |
| 266 VideoCaptureController::GetVideoCaptureFormat() const { | 268 VideoCaptureController::GetVideoCaptureFormat() const { |
| 267 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 268 return video_capture_format_; | 270 return video_capture_format_; |
| 269 } | 271 } |
| 270 | 272 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 } | 610 } |
| 609 return NULL; | 611 return NULL; |
| 610 } | 612 } |
| 611 | 613 |
| 612 int VideoCaptureController::GetClientCount() { | 614 int VideoCaptureController::GetClientCount() { |
| 613 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 615 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 614 return controller_clients_.size(); | 616 return controller_clients_.size(); |
| 615 } | 617 } |
| 616 | 618 |
| 617 } // namespace content | 619 } // namespace content |
| OLD | NEW |