Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 313623003: WIP: Option2: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (client) { 242 if (client) {
243 client->session_closed = true; 243 client->session_closed = true;
244 client->event_handler->OnEnded(client->controller_id); 244 client->event_handler->OnEnded(client->controller_id);
245 } 245 }
246 } 246 }
247 247
248 void VideoCaptureController::ReturnBuffer( 248 void VideoCaptureController::ReturnBuffer(
249 const VideoCaptureControllerID& id, 249 const VideoCaptureControllerID& id,
250 VideoCaptureControllerEventHandler* event_handler, 250 VideoCaptureControllerEventHandler* event_handler,
251 int buffer_id, 251 int buffer_id,
252 const std::vector<uint32>& sync_points) { 252 const std::map<std::string, uint32>& sync_points) {
253 DCHECK_CURRENTLY_ON(BrowserThread::IO); 253 DCHECK_CURRENTLY_ON(BrowserThread::IO);
254 254
255 ControllerClient* client = FindClient(id, event_handler, controller_clients_); 255 ControllerClient* client = FindClient(id, event_handler, controller_clients_);
256 256
257 // If this buffer is not held by this client, or this client doesn't exist 257 // If this buffer is not held by this client, or this client doesn't exist
258 // in controller, do nothing. 258 // in controller, do nothing.
259 ControllerClient::ActiveBufferMap::iterator iter; 259 ControllerClient::ActiveBufferMap::iterator iter;
260 if (!client || (iter = client->active_buffers.find(buffer_id)) == 260 if (!client || (iter = client->active_buffers.find(buffer_id)) ==
261 client->active_buffers.end()) { 261 client->active_buffers.end()) {
262 NOTREACHED(); 262 NOTREACHED();
263 return; 263 return;
264 } 264 }
265 scoped_refptr<media::VideoFrame> frame = iter->second; 265 scoped_refptr<media::VideoFrame> frame = iter->second;
266 client->active_buffers.erase(iter); 266 client->active_buffers.erase(iter);
267 267
268 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { 268 if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) {
269 for (size_t i = 0; i < sync_points.size(); i++) 269 for (std::map<std::string, uint32>::const_iterator iter =
270 frame->AppendReleaseSyncPoint(sync_points[i]); 270 sync_points.begin();
271 iter != sync_points.end();
272 iter++) {
273 frame->AppendReleaseSyncPoint(iter->first, iter->second);
274 }
271 } 275 }
272 276
273 buffer_pool_->RelinquishConsumerHold(buffer_id, 1); 277 buffer_pool_->RelinquishConsumerHold(buffer_id, 1);
274 } 278 }
275 279
276 const media::VideoCaptureFormat& 280 const media::VideoCaptureFormat&
277 VideoCaptureController::GetVideoCaptureFormat() const { 281 VideoCaptureController::GetVideoCaptureFormat() const {
278 DCHECK_CURRENTLY_ON(BrowserThread::IO); 282 DCHECK_CURRENTLY_ON(BrowserThread::IO);
279 return video_capture_format_; 283 return video_capture_format_;
280 } 284 }
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 645 }
642 return NULL; 646 return NULL;
643 } 647 }
644 648
645 int VideoCaptureController::GetClientCount() { 649 int VideoCaptureController::GetClientCount() {
646 DCHECK_CURRENTLY_ON(BrowserThread::IO); 650 DCHECK_CURRENTLY_ON(BrowserThread::IO);
647 return controller_clients_.size(); 651 return controller_clients_.size();
648 } 652 }
649 653
650 } // namespace content 654 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698