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(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 255 DCHECK(BrowserThread::CurrentlyOn(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]); | |
danakj
2014/03/20 15:59:08
Do you know where is the callback that will eventu
dshwang
2014/03/20 16:11:20
That's good question. AFAIK, currently VidoeCaptur
Ami GONE FROM CHROMIUM
2014/04/11 20:55:17
Yep.
| |
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(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
279 return video_capture_format_; | 281 return video_capture_format_; |
280 } | 282 } |
281 | 283 |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 } | 637 } |
636 return NULL; | 638 return NULL; |
637 } | 639 } |
638 | 640 |
639 int VideoCaptureController::GetClientCount() { | 641 int VideoCaptureController::GetClientCount() { |
640 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 642 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
641 return controller_clients_.size(); | 643 return controller_clients_.size(); |
642 } | 644 } |
643 | 645 |
644 } // namespace content | 646 } // namespace content |
OLD | NEW |