| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 timestamp - first_frame_timestamp_); | 367 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 DLOG(ERROR) << "Couldn't create video frame"; |
| 379 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, |
| 380 gpu::SyncToken(), -1.0)); |
| 381 return; |
| 382 } |
| 378 | 383 |
| 379 frame->metadata()->SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, | 384 frame->metadata()->SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, |
| 380 timestamp); | 385 timestamp); |
| 381 frame->AddDestructionObserver( | 386 frame->AddDestructionObserver( |
| 382 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(), | 387 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(), |
| 383 base::Passed(&release_sync_token), buffer_finished_callback)); | 388 base::Passed(&release_sync_token), buffer_finished_callback)); |
| 384 | 389 |
| 385 frame->metadata()->MergeInternalValuesFrom(metadata); | 390 frame->metadata()->MergeInternalValuesFrom(metadata); |
| 386 | 391 |
| 387 for (const auto& client : clients_) | 392 for (const auto& client : clients_) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 double consumer_resource_utilization = -1.0; | 552 double consumer_resource_utilization = -1.0; |
| 548 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 553 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
| 549 &consumer_resource_utilization)) { | 554 &consumer_resource_utilization)) { |
| 550 consumer_resource_utilization = -1.0; | 555 consumer_resource_utilization = -1.0; |
| 551 } | 556 } |
| 552 | 557 |
| 553 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); | 558 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); |
| 554 } | 559 } |
| 555 | 560 |
| 556 } // namespace content | 561 } // namespace content |
| OLD | NEW |