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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 void VideoCaptureImpl::OnBufferReceived( | 304 void VideoCaptureImpl::OnBufferReceived( |
305 int buffer_id, | 305 int buffer_id, |
306 base::TimeDelta timestamp, | 306 base::TimeDelta timestamp, |
307 const base::DictionaryValue& metadata, | 307 const base::DictionaryValue& metadata, |
308 media::VideoPixelFormat pixel_format, | 308 media::VideoPixelFormat pixel_format, |
309 media::VideoFrame::StorageType storage_type, | 309 media::VideoFrame::StorageType storage_type, |
310 const gfx::Size& coded_size, | 310 const gfx::Size& coded_size, |
311 const gfx::Rect& visible_rect) { | 311 const gfx::Rect& visible_rect) { |
312 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 312 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
313 if (state_ != VIDEO_CAPTURE_STATE_STARTED || suspended_ || | 313 if (state_ != VIDEO_CAPTURE_STATE_STARTED || suspended_ || |
314 pixel_format != media::PIXEL_FORMAT_I420 || | 314 (pixel_format != media::PIXEL_FORMAT_I420 && |
| 315 (pixel_format != media::PIXEL_FORMAT_Y16 || |
| 316 storage_type != media::VideoFrame::STORAGE_SHMEM)) || |
315 (storage_type != media::VideoFrame::STORAGE_SHMEM && | 317 (storage_type != media::VideoFrame::STORAGE_SHMEM && |
316 storage_type != media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS)) { | 318 storage_type != media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS)) { |
317 // Crash in debug builds since the host should not have provided a buffer | 319 // Crash in debug builds since the host should not have provided a buffer |
318 // with an unsupported pixel format or storage type. | 320 // with an unsupported pixel format or storage type. |
319 DCHECK_EQ(media::PIXEL_FORMAT_I420, pixel_format); | 321 DCHECK(media::PIXEL_FORMAT_I420 == pixel_format || |
| 322 (media::PIXEL_FORMAT_Y16 == pixel_format && |
| 323 storage_type == media::VideoFrame::STORAGE_SHMEM)); |
320 DCHECK(storage_type == media::VideoFrame::STORAGE_SHMEM || | 324 DCHECK(storage_type == media::VideoFrame::STORAGE_SHMEM || |
321 storage_type == media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS); | 325 storage_type == media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS); |
322 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, | 326 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, |
323 gpu::SyncToken(), -1.0)); | 327 gpu::SyncToken(), -1.0)); |
324 return; | 328 return; |
325 } | 329 } |
326 | 330 |
327 base::TimeTicks reference_time; | 331 base::TimeTicks reference_time; |
328 media::VideoFrameMetadata frame_metadata; | 332 media::VideoFrameMetadata frame_metadata; |
329 frame_metadata.MergeInternalValuesFrom(metadata); | 333 frame_metadata.MergeInternalValuesFrom(metadata); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 double consumer_resource_utilization = -1.0; | 574 double consumer_resource_utilization = -1.0; |
571 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 575 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
572 &consumer_resource_utilization)) { | 576 &consumer_resource_utilization)) { |
573 consumer_resource_utilization = -1.0; | 577 consumer_resource_utilization = -1.0; |
574 } | 578 } |
575 | 579 |
576 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); | 580 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); |
577 } | 581 } |
578 | 582 |
579 } // namespace content | 583 } // namespace content |
OLD | NEW |