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

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

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: halliwell@ comments. Created 4 years, 11 months 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 0 /* shared_memory_offset */, timestamp - first_frame_timestamp_); 367 0 /* shared_memory_offset */, timestamp - first_frame_timestamp_);
368 buffer_finished_callback = media::BindToCurrentLoop( 368 buffer_finished_callback = media::BindToCurrentLoop(
369 base::Bind(&VideoCaptureImpl::OnClientBufferFinished, 369 base::Bind(&VideoCaptureImpl::OnClientBufferFinished,
370 weak_factory_.GetWeakPtr(), buffer_id, buffer)); 370 weak_factory_.GetWeakPtr(), buffer_id, buffer));
371 break; 371 break;
372 } 372 }
373 default: 373 default:
374 NOTREACHED(); 374 NOTREACHED();
375 break; 375 break;
376 } 376 }
377 DCHECK(frame); 377 if (!frame) {
378 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id,
379 gpu::SyncToken(), -1.0));
380 return;
381 }
378 382
379 frame->metadata()->SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, 383 frame->metadata()->SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME,
380 timestamp); 384 timestamp);
381 frame->AddDestructionObserver( 385 frame->AddDestructionObserver(
382 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(), 386 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(),
383 base::Passed(&release_sync_token), buffer_finished_callback)); 387 base::Passed(&release_sync_token), buffer_finished_callback));
384 388
385 frame->metadata()->MergeInternalValuesFrom(metadata); 389 frame->metadata()->MergeInternalValuesFrom(metadata);
386 390
387 for (const auto& client : clients_) 391 for (const auto& client : clients_)
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 double consumer_resource_utilization = -1.0; 551 double consumer_resource_utilization = -1.0;
548 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 552 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
549 &consumer_resource_utilization)) { 553 &consumer_resource_utilization)) {
550 consumer_resource_utilization = -1.0; 554 consumer_resource_utilization = -1.0;
551 } 555 }
552 556
553 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); 557 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization);
554 } 558 }
555 559
556 } // namespace content 560 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | content/renderer/media/video_track_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698