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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 state_ = VIDEO_CAPTURE_STATE_ENDED; | 254 state_ = VIDEO_CAPTURE_STATE_ENDED; |
255 break; | 255 break; |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 void VideoCaptureImpl::OnBufferReady(int32_t buffer_id, | 259 void VideoCaptureImpl::OnBufferReady(int32_t buffer_id, |
260 mojom::VideoFrameInfoPtr info) { | 260 mojom::VideoFrameInfoPtr info) { |
261 DVLOG(1) << __func__ << " buffer_id: " << buffer_id; | 261 DVLOG(1) << __func__ << " buffer_id: " << buffer_id; |
262 | 262 |
263 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 263 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
264 DCHECK_EQ(media::PIXEL_FORMAT_I420, info->pixel_format); | 264 DCHECK(media::PIXEL_FORMAT_I420 == info->pixel_format || |
265 DCHECK_EQ(media::PIXEL_STORAGE_CPU, info->storage_type); | 265 media::PIXEL_FORMAT_Y16 == info->pixel_format); |
266 | 266 |
267 if (state_ != VIDEO_CAPTURE_STATE_STARTED || | 267 if (state_ != VIDEO_CAPTURE_STATE_STARTED || |
268 info->pixel_format != media::PIXEL_FORMAT_I420 || | 268 (info->pixel_format != media::PIXEL_FORMAT_I420 && |
| 269 info->pixel_format != media::PIXEL_FORMAT_Y16) || |
269 info->storage_type != media::PIXEL_STORAGE_CPU) { | 270 info->storage_type != media::PIXEL_STORAGE_CPU) { |
270 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id, | 271 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id, |
271 gpu::SyncToken(), -1.0); | 272 gpu::SyncToken(), -1.0); |
272 return; | 273 return; |
273 } | 274 } |
274 | 275 |
275 base::TimeTicks reference_time; | 276 base::TimeTicks reference_time; |
276 media::VideoFrameMetadata frame_metadata; | 277 media::VideoFrameMetadata frame_metadata; |
277 frame_metadata.MergeInternalValuesFrom(info->metadata); | 278 frame_metadata.MergeInternalValuesFrom(info->metadata); |
278 const bool success = frame_metadata.GetTimeTicks( | 279 const bool success = frame_metadata.GetTimeTicks( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 double consumer_resource_utilization = -1.0; | 446 double consumer_resource_utilization = -1.0; |
446 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 447 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
447 &consumer_resource_utilization)) { | 448 &consumer_resource_utilization)) { |
448 consumer_resource_utilization = -1.0; | 449 consumer_resource_utilization = -1.0; |
449 } | 450 } |
450 | 451 |
451 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); | 452 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); |
452 } | 453 } |
453 | 454 |
454 } // namespace content | 455 } // namespace content |
OLD | NEW |