| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/gpu/media/vaapi_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 DCHECK(!current_encode_job_); | 576 DCHECK(!current_encode_job_); |
| 577 current_encode_job_.reset(new EncodeJob()); | 577 current_encode_job_.reset(new EncodeJob()); |
| 578 | 578 |
| 579 if (!vaapi_wrapper_->CreateCodedBuffer(output_buffer_byte_size_, | 579 if (!vaapi_wrapper_->CreateCodedBuffer(output_buffer_byte_size_, |
| 580 ¤t_encode_job_->coded_buffer)) { | 580 ¤t_encode_job_->coded_buffer)) { |
| 581 NOTIFY_ERROR(kPlatformFailureError, "Failed creating coded buffer"); | 581 NOTIFY_ERROR(kPlatformFailureError, "Failed creating coded buffer"); |
| 582 return false; | 582 return false; |
| 583 } | 583 } |
| 584 | 584 |
| 585 current_encode_job_->input_surface = new VASurface( | 585 current_encode_job_->input_surface = new VASurface( |
| 586 available_va_surface_ids_.back(), coded_size_, va_surface_release_cb_); | 586 available_va_surface_ids_.back(), coded_size_, |
| 587 vaapi_wrapper_->va_surface_format(), va_surface_release_cb_); |
| 587 available_va_surface_ids_.pop_back(); | 588 available_va_surface_ids_.pop_back(); |
| 588 | 589 |
| 589 current_encode_job_->recon_surface = new VASurface( | 590 current_encode_job_->recon_surface = new VASurface( |
| 590 available_va_surface_ids_.back(), coded_size_, va_surface_release_cb_); | 591 available_va_surface_ids_.back(), coded_size_, |
| 592 vaapi_wrapper_->va_surface_format(), va_surface_release_cb_); |
| 591 available_va_surface_ids_.pop_back(); | 593 available_va_surface_ids_.pop_back(); |
| 592 | 594 |
| 593 // Reference surfaces are needed until the job is done, but they get | 595 // Reference surfaces are needed until the job is done, but they get |
| 594 // removed from ref_pic_list0_ when it's full at the end of job submission. | 596 // removed from ref_pic_list0_ when it's full at the end of job submission. |
| 595 // Keep refs to them along with the job and only release after sync. | 597 // Keep refs to them along with the job and only release after sync. |
| 596 current_encode_job_->reference_surfaces = ref_pic_list0_; | 598 current_encode_job_->reference_surfaces = ref_pic_list0_; |
| 597 | 599 |
| 598 return true; | 600 return true; |
| 599 } | 601 } |
| 600 | 602 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 } | 1051 } |
| 1050 | 1052 |
| 1051 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1053 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1052 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1054 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
| 1053 } | 1055 } |
| 1054 | 1056 |
| 1055 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1057 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
| 1056 } | 1058 } |
| 1057 | 1059 |
| 1058 } // namespace content | 1060 } // namespace content |
| OLD | NEW |