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

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

Issue 1125263005: MJPEG acceleration for V4L2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 VideoCaptureController::~VideoCaptureController() { 269 VideoCaptureController::~VideoCaptureController() {
270 STLDeleteContainerPointers(controller_clients_.begin(), 270 STLDeleteContainerPointers(controller_clients_.begin(),
271 controller_clients_.end()); 271 controller_clients_.end());
272 } 272 }
273 273
274 void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread( 274 void VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread(
275 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer, 275 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
276 const scoped_refptr<VideoFrame>& frame, 276 const scoped_refptr<VideoFrame>& frame,
277 const base::TimeTicks& timestamp) { 277 const base::TimeTicks& timestamp) {
278
279 {
280 static int count = 0;
281 static base::TimeDelta total_time;
282 static base::TimeDelta min_delta = base::TimeDelta::Max();
283 static base::TimeDelta max_delta;
284 static base::TimeDelta v[30];
285 count++;
286 base::TimeDelta delta = base::TimeTicks::Now() - timestamp;
287 total_time += delta;
288 if (delta > max_delta)
289 max_delta = delta;
290 if (delta < min_delta)
291 min_delta = delta;
292 v[(count-1) % 30] = delta;
293 if (count % 30 == 0) {
294 LOG(ERROR) << "count=" << count
295 << ", latency=" << delta.InMillisecondsF()
296 << ", avg=" << total_time.InMillisecondsF() / count
297 << ", min=" << min_delta.InMillisecondsF()
298 << ", max=" << max_delta.InMillisecondsF();
299
300 LOG(ERROR) << v[0].InMillisecondsF() << " "
301 << v[1].InMillisecondsF() << " "
302 << v[2].InMillisecondsF() << " "
303 << v[3].InMillisecondsF() << " "
304 << v[4].InMillisecondsF() << " "
305 << v[5].InMillisecondsF() << " "
306 << v[6].InMillisecondsF() << " "
307 << v[7].InMillisecondsF() << " "
308 << v[8].InMillisecondsF() << " "
309 << v[9].InMillisecondsF() << " "
310 << v[10].InMillisecondsF() << " "
311 << v[11].InMillisecondsF() << " "
312 << v[12].InMillisecondsF() << " "
313 << v[13].InMillisecondsF() << " "
314 << v[14].InMillisecondsF() << " "
315 << v[15].InMillisecondsF() << " "
316 << v[16].InMillisecondsF() << " "
317 << v[17].InMillisecondsF() << " "
318 << v[18].InMillisecondsF() << " "
319 << v[19].InMillisecondsF() << " "
320 << v[20].InMillisecondsF() << " "
321 << v[21].InMillisecondsF() << " "
322 << v[22].InMillisecondsF() << " "
323 << v[23].InMillisecondsF() << " "
324 << v[24].InMillisecondsF() << " "
325 << v[25].InMillisecondsF() << " "
326 << v[26].InMillisecondsF() << " "
327 << v[27].InMillisecondsF() << " "
328 << v[28].InMillisecondsF() << " "
329 << v[29].InMillisecondsF();
330 }
331 }
332
278 DCHECK_CURRENTLY_ON(BrowserThread::IO); 333 DCHECK_CURRENTLY_ON(BrowserThread::IO);
279 const int buffer_id = buffer->id(); 334 const int buffer_id = buffer->id();
280 DCHECK_NE(buffer_id, VideoCaptureBufferPool::kInvalidId); 335 DCHECK_NE(buffer_id, VideoCaptureBufferPool::kInvalidId);
281 336
282 int count = 0; 337 int count = 0;
283 if (state_ == VIDEO_CAPTURE_STATE_STARTED) { 338 if (state_ == VIDEO_CAPTURE_STATE_STARTED) {
284 if (!frame->metadata()->HasKey(media::VideoFrameMetadata::FRAME_RATE)) { 339 if (!frame->metadata()->HasKey(media::VideoFrameMetadata::FRAME_RATE)) {
285 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 340 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE,
286 video_capture_format_.frame_rate); 341 video_capture_format_.frame_rate);
287 } 342 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 DCHECK_CURRENTLY_ON(BrowserThread::IO); 468 DCHECK_CURRENTLY_ON(BrowserThread::IO);
414 int active_client_count = 0; 469 int active_client_count = 0;
415 for (ControllerClient* client : controller_clients_) { 470 for (ControllerClient* client : controller_clients_) {
416 if (!client->paused) 471 if (!client->paused)
417 ++active_client_count; 472 ++active_client_count;
418 } 473 }
419 return active_client_count; 474 return active_client_count;
420 } 475 }
421 476
422 } // namespace content 477 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698