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