| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 release_sync_point_storage = new uint32(0); | 336 release_sync_point_storage = new uint32(0); |
| 337 frame = media::VideoFrame::WrapNativeTexture( | 337 frame = media::VideoFrame::WrapNativeTexture( |
| 338 pixel_format, | 338 pixel_format, |
| 339 mailbox_holder, | 339 mailbox_holder, |
| 340 base::Bind(&SaveReleaseSyncPoint, release_sync_point_storage), | 340 base::Bind(&SaveReleaseSyncPoint, release_sync_point_storage), |
| 341 coded_size, | 341 coded_size, |
| 342 gfx::Rect(coded_size), | 342 gfx::Rect(coded_size), |
| 343 coded_size, | 343 coded_size, |
| 344 timestamp - first_frame_timestamp_); | 344 timestamp - first_frame_timestamp_); |
| 345 } | 345 } |
| 346 frame->metadata()->SetTimeTicks(media::VideoFrameMetadata::REFERENCE_TIME, |
| 347 timestamp); |
| 346 frame->AddDestructionObserver( | 348 frame->AddDestructionObserver( |
| 347 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(), | 349 base::Bind(&VideoCaptureImpl::DidFinishConsumingFrame, frame->metadata(), |
| 348 release_sync_point_storage, | 350 release_sync_point_storage, |
| 349 media::BindToCurrentLoop(base::Bind( | 351 media::BindToCurrentLoop(base::Bind( |
| 350 &VideoCaptureImpl::OnClientBufferFinished, | 352 &VideoCaptureImpl::OnClientBufferFinished, |
| 351 weak_factory_.GetWeakPtr(), buffer_id, buffer)))); | 353 weak_factory_.GetWeakPtr(), buffer_id, buffer)))); |
| 352 | 354 |
| 353 frame->metadata()->MergeInternalValuesFrom(metadata); | 355 frame->metadata()->MergeInternalValuesFrom(metadata); |
| 354 deliver_frame_cb_.Run(frame, timestamp); | 356 deliver_frame_cb_.Run(frame, timestamp); |
| 355 } | 357 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 void VideoCaptureImpl::ResetClient() { | 490 void VideoCaptureImpl::ResetClient() { |
| 489 client_params_ = media::VideoCaptureParams(); | 491 client_params_ = media::VideoCaptureParams(); |
| 490 state_update_cb_.Reset(); | 492 state_update_cb_.Reset(); |
| 491 deliver_frame_cb_.Reset(); | 493 deliver_frame_cb_.Reset(); |
| 492 first_frame_timestamp_ = base::TimeTicks(); | 494 first_frame_timestamp_ = base::TimeTicks(); |
| 493 device_id_ = kUndefinedDeviceId; | 495 device_id_ = kUndefinedDeviceId; |
| 494 state_ = VIDEO_CAPTURE_STATE_STOPPED; | 496 state_ = VIDEO_CAPTURE_STATE_STOPPED; |
| 495 } | 497 } |
| 496 | 498 |
| 497 } // namespace content | 499 } // namespace content |
| OLD | NEW |