| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 void VaapiVideoEncodeAccelerator::InitializeTask() { | 219 void VaapiVideoEncodeAccelerator::InitializeTask() { |
| 220 DCHECK(encoder_thread_task_runner_->BelongsToCurrentThread()); | 220 DCHECK(encoder_thread_task_runner_->BelongsToCurrentThread()); |
| 221 DCHECK_EQ(state_, kUninitialized); | 221 DCHECK_EQ(state_, kUninitialized); |
| 222 DVLOGF(4); | 222 DVLOGF(4); |
| 223 | 223 |
| 224 va_surface_release_cb_ = media::BindToCurrentLoop( | 224 va_surface_release_cb_ = media::BindToCurrentLoop( |
| 225 base::Bind(&VaapiVideoEncodeAccelerator::RecycleVASurfaceID, | 225 base::Bind(&VaapiVideoEncodeAccelerator::RecycleVASurfaceID, |
| 226 base::Unretained(this))); | 226 base::Unretained(this))); |
| 227 | 227 |
| 228 if (!vaapi_wrapper_->CreateSurfaces(VA_RT_FORMAT_YUV420, coded_size_, | 228 if (!vaapi_wrapper_->CreateSurfaces( |
| 229 kNumSurfaces, | 229 coded_size_, kNumSurfaces, &available_va_surface_ids_)) { |
| 230 &available_va_surface_ids_)) { | |
| 231 NOTIFY_ERROR(kPlatformFailureError, "Failed creating VASurfaces"); | 230 NOTIFY_ERROR(kPlatformFailureError, "Failed creating VASurfaces"); |
| 232 return; | 231 return; |
| 233 } | 232 } |
| 234 | 233 |
| 235 UpdateSPS(); | 234 UpdateSPS(); |
| 236 GeneratePackedSPS(); | 235 GeneratePackedSPS(); |
| 237 | 236 |
| 238 UpdatePPS(); | 237 UpdatePPS(); |
| 239 GeneratePackedPPS(); | 238 GeneratePackedPPS(); |
| 240 | 239 |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 } | 1048 } |
| 1050 | 1049 |
| 1051 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1050 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1052 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1051 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
| 1053 } | 1052 } |
| 1054 | 1053 |
| 1055 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1054 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
| 1056 } | 1055 } |
| 1057 | 1056 |
| 1058 } // namespace content | 1057 } // namespace content |
| OLD | NEW |