OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "content/renderer/pepper/pepper_video_encoder_host.h" | 5 #include "content/renderer/pepper/pepper_video_encoder_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return; | 434 return; |
435 } | 435 } |
436 | 436 |
437 // If the plugin already requested video frames, we can now answer | 437 // If the plugin already requested video frames, we can now answer |
438 // that request. | 438 // that request. |
439 if (get_video_frames_reply_context_.is_valid()) | 439 if (get_video_frames_reply_context_.is_valid()) |
440 AllocateVideoFrames(); | 440 AllocateVideoFrames(); |
441 } | 441 } |
442 | 442 |
443 void PepperVideoEncoderHost::BitstreamBufferReady(int32_t buffer_id, | 443 void PepperVideoEncoderHost::BitstreamBufferReady(int32_t buffer_id, |
444 size_t payload_size, | 444 size_t payload_size, |
445 bool key_frame) { | 445 bool key_frame, |
| 446 base::TimeDelta /* timestamp */) { |
446 DCHECK(RenderThreadImpl::current()); | 447 DCHECK(RenderThreadImpl::current()); |
447 DCHECK(shm_buffers_[buffer_id]->in_use); | 448 DCHECK(shm_buffers_[buffer_id]->in_use); |
448 | 449 |
449 shm_buffers_[buffer_id]->in_use = false; | 450 shm_buffers_[buffer_id]->in_use = false; |
| 451 // TODO: Pass timestamp. Tracked in crbug/613984. |
450 host()->SendUnsolicitedReply( | 452 host()->SendUnsolicitedReply( |
451 pp_resource(), | 453 pp_resource(), |
452 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( | 454 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( |
453 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); | 455 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); |
454 } | 456 } |
455 | 457 |
456 void PepperVideoEncoderHost::NotifyError( | 458 void PepperVideoEncoderHost::NotifyError( |
457 media::VideoEncodeAccelerator::Error error) { | 459 media::VideoEncodeAccelerator::Error error) { |
458 DCHECK(RenderThreadImpl::current()); | 460 DCHECK(RenderThreadImpl::current()); |
459 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); | 461 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 } | 679 } |
678 | 680 |
679 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { | 681 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { |
680 DCHECK(RenderThreadImpl::current()); | 682 DCHECK(RenderThreadImpl::current()); |
681 DCHECK_GE(buffer_id, 0); | 683 DCHECK_GE(buffer_id, 0); |
682 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); | 684 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); |
683 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 685 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
684 } | 686 } |
685 | 687 |
686 } // namespace content | 688 } // namespace content |
OLD | NEW |