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

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

Issue 2428263004: 16 bpp video stream capture, render and createImageBitmap(video) using (CPU) shared memory buffers (Closed)
Patch Set: Rebase after FakeVCD (2447233002) land. Created 4 years, 1 month 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 DCHECK_EQ(media::PIXEL_FORMAT_I420, info->pixel_format);
262 DCHECK_EQ(media::PIXEL_STORAGE_CPU, info->storage_type);
263 261
264 if (state_ != VIDEO_CAPTURE_STATE_STARTED || 262 if (state_ != VIDEO_CAPTURE_STATE_STARTED ||
265 info->pixel_format != media::PIXEL_FORMAT_I420 || 263 (info->pixel_format != media::PIXEL_FORMAT_I420 &&
264 info->pixel_format != media::PIXEL_FORMAT_Y16) ||
266 info->storage_type != media::PIXEL_STORAGE_CPU) { 265 info->storage_type != media::PIXEL_STORAGE_CPU) {
266 LOG(DFATAL) << "Wrong state or pixel format or storage, got state: "
267 << state_ << ", pixel format:"
268 << VideoPixelFormatToString(info->pixel_format)
269 << ", storage:" << info->storage_type;
267 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id, 270 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id,
268 gpu::SyncToken(), -1.0); 271 gpu::SyncToken(), -1.0);
269 return; 272 return;
270 } 273 }
271 274
272 base::TimeTicks reference_time; 275 base::TimeTicks reference_time;
273 media::VideoFrameMetadata frame_metadata; 276 media::VideoFrameMetadata frame_metadata;
274 frame_metadata.MergeInternalValuesFrom(info->metadata); 277 frame_metadata.MergeInternalValuesFrom(info->metadata);
275 const bool success = frame_metadata.GetTimeTicks( 278 const bool success = frame_metadata.GetTimeTicks(
276 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time); 279 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 double consumer_resource_utilization = -1.0; 433 double consumer_resource_utilization = -1.0;
431 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 434 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
432 &consumer_resource_utilization)) { 435 &consumer_resource_utilization)) {
433 consumer_resource_utilization = -1.0; 436 consumer_resource_utilization = -1.0;
434 } 437 }
435 438
436 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); 439 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization);
437 } 440 }
438 441
439 } // namespace content 442 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698