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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return; | 433 return; |
434 } | 434 } |
435 | 435 |
436 // If the plugin already requested video frames, we can now answer | 436 // If the plugin already requested video frames, we can now answer |
437 // that request. | 437 // that request. |
438 if (get_video_frames_reply_context_.is_valid()) | 438 if (get_video_frames_reply_context_.is_valid()) |
439 AllocateVideoFrames(); | 439 AllocateVideoFrames(); |
440 } | 440 } |
441 | 441 |
442 void PepperVideoEncoderHost::BitstreamBufferReady(int32_t buffer_id, | 442 void PepperVideoEncoderHost::BitstreamBufferReady(int32_t buffer_id, |
443 size_t payload_size, | 443 size_t payload_size, |
444 bool key_frame) { | 444 bool key_frame, |
| 445 base::TimeDelta /* timestamp */) { |
445 DCHECK(RenderThreadImpl::current()); | 446 DCHECK(RenderThreadImpl::current()); |
446 DCHECK(shm_buffers_[buffer_id]->in_use); | 447 DCHECK(shm_buffers_[buffer_id]->in_use); |
447 | 448 |
448 shm_buffers_[buffer_id]->in_use = false; | 449 shm_buffers_[buffer_id]->in_use = false; |
| 450 // TODO: Pass timestamp. Tracked in crbug/613984. |
449 host()->SendUnsolicitedReply( | 451 host()->SendUnsolicitedReply( |
450 pp_resource(), | 452 pp_resource(), |
451 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( | 453 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( |
452 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); | 454 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); |
453 } | 455 } |
454 | 456 |
455 void PepperVideoEncoderHost::NotifyError( | 457 void PepperVideoEncoderHost::NotifyError( |
456 media::VideoEncodeAccelerator::Error error) { | 458 media::VideoEncodeAccelerator::Error error) { |
457 DCHECK(RenderThreadImpl::current()); | 459 DCHECK(RenderThreadImpl::current()); |
458 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); | 460 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); |
(...skipping 218 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 |