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 // 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 session_id_(session_id), | 69 session_id_(session_id), |
70 video_capture_host_for_testing_(nullptr), | 70 video_capture_host_for_testing_(nullptr), |
71 observer_binding_(this), | 71 observer_binding_(this), |
72 state_(VIDEO_CAPTURE_STATE_STOPPED), | 72 state_(VIDEO_CAPTURE_STATE_STOPPED), |
73 weak_factory_(this) { | 73 weak_factory_(this) { |
74 io_thread_checker_.DetachFromThread(); | 74 io_thread_checker_.DetachFromThread(); |
75 | 75 |
76 if (ChildThread::Get()) { // This will be null in unit tests. | 76 if (ChildThread::Get()) { // This will be null in unit tests. |
77 mojom::VideoCaptureHostPtr temp_video_capture_host; | 77 mojom::VideoCaptureHostPtr temp_video_capture_host; |
78 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( | 78 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( |
79 mojo::GetProxy(&temp_video_capture_host)); | 79 mojo::MakeRequest(&temp_video_capture_host)); |
80 video_capture_host_info_ = temp_video_capture_host.PassInterface(); | 80 video_capture_host_info_ = temp_video_capture_host.PassInterface(); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 VideoCaptureImpl::~VideoCaptureImpl() { | 84 VideoCaptureImpl::~VideoCaptureImpl() { |
85 DCHECK(io_thread_checker_.CalledOnValidThread()); | 85 DCHECK(io_thread_checker_.CalledOnValidThread()); |
86 if (state_ == VIDEO_CAPTURE_STATE_STARTED && GetVideoCaptureHost()) | 86 if (state_ == VIDEO_CAPTURE_STATE_STARTED && GetVideoCaptureHost()) |
87 GetVideoCaptureHost()->Stop(device_id_); | 87 GetVideoCaptureHost()->Stop(device_id_); |
88 } | 88 } |
89 | 89 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 double consumer_resource_utilization = -1.0; | 435 double consumer_resource_utilization = -1.0; |
436 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 436 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
437 &consumer_resource_utilization)) { | 437 &consumer_resource_utilization)) { |
438 consumer_resource_utilization = -1.0; | 438 consumer_resource_utilization = -1.0; |
439 } | 439 } |
440 | 440 |
441 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); | 441 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); |
442 } | 442 } |
443 | 443 |
444 } // namespace content | 444 } // namespace content |
OLD | NEW |