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; |
449 host()->SendUnsolicitedReply( | 450 host()->SendUnsolicitedReply( |
450 pp_resource(), | 451 pp_resource(), |
451 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( | 452 PpapiPluginMsg_VideoEncoder_BitstreamBufferReady( |
Pawel Osciak
2016/05/23 07:15:52
Could we add a TODO +crbug to add this to the pepp
shenghao
2016/05/24 10:50:19
Done.
| |
452 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); | 453 buffer_id, static_cast<uint32_t>(payload_size), key_frame)); |
453 } | 454 } |
454 | 455 |
455 void PepperVideoEncoderHost::NotifyError( | 456 void PepperVideoEncoderHost::NotifyError( |
456 media::VideoEncodeAccelerator::Error error) { | 457 media::VideoEncodeAccelerator::Error error) { |
457 DCHECK(RenderThreadImpl::current()); | 458 DCHECK(RenderThreadImpl::current()); |
458 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); | 459 NotifyPepperError(PP_FromMediaEncodeAcceleratorError(error)); |
459 } | 460 } |
460 | 461 |
461 void PepperVideoEncoderHost::GetSupportedProfiles( | 462 void PepperVideoEncoderHost::GetSupportedProfiles( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
677 } | 678 } |
678 | 679 |
679 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { | 680 uint8_t* PepperVideoEncoderHost::ShmHandleToAddress(int32_t buffer_id) { |
680 DCHECK(RenderThreadImpl::current()); | 681 DCHECK(RenderThreadImpl::current()); |
681 DCHECK_GE(buffer_id, 0); | 682 DCHECK_GE(buffer_id, 0); |
682 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); | 683 DCHECK_LT(buffer_id, static_cast<int32_t>(shm_buffers_.size())); |
683 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); | 684 return static_cast<uint8_t*>(shm_buffers_[buffer_id]->shm->memory()); |
684 } | 685 } |
685 | 686 |
686 } // namespace content | 687 } // namespace content |
OLD | NEW |