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

Side by Side Diff: content/renderer/media/video_capture_impl.cc

Issue 2365223002: Video Capture: Allow suspension of individual devices. (Closed)
Patch Set: Style tweaks, per mcasas's comments. Created 4 years, 2 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 // Notes about usage of this object by VideoCaptureImplManager. 5 // Notes about usage of this object by VideoCaptureImplManager.
6 // 6 //
7 // VideoCaptureImplManager access this object by using a Unretained() 7 // VideoCaptureImplManager access this object by using a Unretained()
8 // binding and tasks on the IO thread. It is then important that 8 // binding and tasks on the IO thread. It is then important that
9 // VideoCaptureImpl never post task to itself. All operations must be 9 // VideoCaptureImpl never post task to itself. All operations must be
10 // synchronous. 10 // synchronous.
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 case VIDEO_CAPTURE_STATE_STOPPED: 441 case VIDEO_CAPTURE_STATE_STOPPED:
442 state_ = VIDEO_CAPTURE_STATE_STOPPED; 442 state_ = VIDEO_CAPTURE_STATE_STOPPED;
443 DVLOG(1) << "OnStateChanged: stopped!, device_id = " << device_id_; 443 DVLOG(1) << "OnStateChanged: stopped!, device_id = " << device_id_;
444 client_buffers_.clear(); 444 client_buffers_.clear();
445 client_buffer2s_.clear(); 445 client_buffer2s_.clear();
446 weak_factory_.InvalidateWeakPtrs(); 446 weak_factory_.InvalidateWeakPtrs();
447 if (!clients_.empty() || !clients_pending_on_restart_.empty()) 447 if (!clients_.empty() || !clients_pending_on_restart_.empty())
448 RestartCapture(); 448 RestartCapture();
449 break; 449 break;
450 case VIDEO_CAPTURE_STATE_PAUSED: 450 case VIDEO_CAPTURE_STATE_PAUSED:
451 case VIDEO_CAPTURE_STATE_RESUMED:
451 for (const auto& client : clients_) 452 for (const auto& client : clients_)
452 client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_PAUSED); 453 client.second.state_update_cb.Run(state);
453 break; 454 break;
454 case VIDEO_CAPTURE_STATE_ERROR: 455 case VIDEO_CAPTURE_STATE_ERROR:
455 DVLOG(1) << "OnStateChanged: error!, device_id = " << device_id_; 456 DVLOG(1) << "OnStateChanged: error!, device_id = " << device_id_;
456 for (const auto& client : clients_) 457 for (const auto& client : clients_)
457 client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_ERROR); 458 client.second.state_update_cb.Run(VIDEO_CAPTURE_STATE_ERROR);
458 clients_.clear(); 459 clients_.clear();
459 state_ = VIDEO_CAPTURE_STATE_ERROR; 460 state_ = VIDEO_CAPTURE_STATE_ERROR;
460 break; 461 break;
461 case VIDEO_CAPTURE_STATE_ENDED: 462 case VIDEO_CAPTURE_STATE_ENDED:
462 DVLOG(1) << "OnStateChanged: ended!, device_id = " << device_id_; 463 DVLOG(1) << "OnStateChanged: ended!, device_id = " << device_id_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 double consumer_resource_utilization = -1.0; 571 double consumer_resource_utilization = -1.0;
571 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 572 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
572 &consumer_resource_utilization)) { 573 &consumer_resource_utilization)) {
573 consumer_resource_utilization = -1.0; 574 consumer_resource_utilization = -1.0;
574 } 575 }
575 576
576 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); 577 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization);
577 } 578 }
578 579
579 } // namespace content 580 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_impl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698