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

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: review #30 fix. Thanks danakj@. 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); 261 DCHECK(media::PIXEL_FORMAT_I420 == info->pixel_format ||
262 media::PIXEL_FORMAT_Y16 == info->pixel_format);
262 DCHECK_EQ(media::PIXEL_STORAGE_CPU, info->storage_type); 263 DCHECK_EQ(media::PIXEL_STORAGE_CPU, info->storage_type);
mcasas 2016/10/25 22:44:43 This DCHECK and the one in l.261-262 and the if()
aleksandar.stojiljkovic 2016/10/26 14:02:18 One way is to leave the the DCHECK and remove the
aleksandar.stojiljkovic 2016/10/28 18:58:55 mcasas@chromium.org, I had to modify this: state_
263 264
264 if (state_ != VIDEO_CAPTURE_STATE_STARTED || 265 if (state_ != VIDEO_CAPTURE_STATE_STARTED ||
265 info->pixel_format != media::PIXEL_FORMAT_I420 || 266 (info->pixel_format != media::PIXEL_FORMAT_I420 &&
267 info->pixel_format != media::PIXEL_FORMAT_Y16) ||
266 info->storage_type != media::PIXEL_STORAGE_CPU) { 268 info->storage_type != media::PIXEL_STORAGE_CPU) {
267 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id, 269 GetVideoCaptureHost()->ReleaseBuffer(device_id_, buffer_id,
268 gpu::SyncToken(), -1.0); 270 gpu::SyncToken(), -1.0);
269 return; 271 return;
270 } 272 }
271 273
272 base::TimeTicks reference_time; 274 base::TimeTicks reference_time;
273 media::VideoFrameMetadata frame_metadata; 275 media::VideoFrameMetadata frame_metadata;
274 frame_metadata.MergeInternalValuesFrom(info->metadata); 276 frame_metadata.MergeInternalValuesFrom(info->metadata);
275 const bool success = frame_metadata.GetTimeTicks( 277 const bool success = frame_metadata.GetTimeTicks(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 double consumer_resource_utilization = -1.0; 432 double consumer_resource_utilization = -1.0;
431 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 433 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
432 &consumer_resource_utilization)) { 434 &consumer_resource_utilization)) {
433 consumer_resource_utilization = -1.0; 435 consumer_resource_utilization = -1.0;
434 } 436 }
435 437
436 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); 438 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization);
437 } 439 }
438 440
439 } // namespace content 441 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698