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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 const bool inserted = | 249 const bool inserted = |
250 client_buffers_ | 250 client_buffers_ |
251 .insert(std::make_pair(buffer_id, | 251 .insert(std::make_pair(buffer_id, |
252 new ClientBuffer(std::move(shm), memory_size))) | 252 new ClientBuffer(std::move(shm), memory_size))) |
253 .second; | 253 .second; |
254 DCHECK(inserted); | 254 DCHECK(inserted); |
255 } | 255 } |
256 | 256 |
257 void VideoCaptureImpl::OnBufferReady(int32_t buffer_id, | 257 void VideoCaptureImpl::OnBufferReady(int32_t buffer_id, |
258 mojom::VideoFrameInfoPtr info) { | 258 media::mojom::VideoFrameInfoPtr info) { |
259 DVLOG(1) << __func__ << " buffer_id: " << buffer_id; | 259 DVLOG(1) << __func__ << " buffer_id: " << buffer_id; |
260 DCHECK(io_thread_checker_.CalledOnValidThread()); | 260 DCHECK(io_thread_checker_.CalledOnValidThread()); |
261 | 261 |
262 bool consume_buffer = state_ == VIDEO_CAPTURE_STATE_STARTED; | 262 bool consume_buffer = state_ == VIDEO_CAPTURE_STATE_STARTED; |
263 if ((info->pixel_format != media::PIXEL_FORMAT_I420 && | 263 if ((info->pixel_format != media::PIXEL_FORMAT_I420 && |
264 info->pixel_format != media::PIXEL_FORMAT_Y16) || | 264 info->pixel_format != media::PIXEL_FORMAT_Y16) || |
265 info->storage_type != media::PIXEL_STORAGE_CPU) { | 265 info->storage_type != media::PIXEL_STORAGE_CPU) { |
266 consume_buffer = false; | 266 consume_buffer = false; |
267 LOG(DFATAL) << "Wrong pixel format or storage, got pixel format:" | 267 LOG(DFATAL) << "Wrong pixel format or storage, got pixel format:" |
268 << VideoPixelFormatToString(info->pixel_format) | 268 << VideoPixelFormatToString(info->pixel_format) |
(...skipping 166 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 |