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/bind_to_current_loop.h" |
8 #include "base/callback.h" | 9 #include "base/callback.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
11 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
12 #include "content/common/gpu/media/h264_dpb.h" | 13 #include "content/common/gpu/media/h264_dpb.h" |
13 #include "media/base/bind_to_current_loop.h" | |
14 #include "third_party/libva/va/va_enc_h264.h" | 14 #include "third_party/libva/va/va_enc_h264.h" |
15 | 15 |
16 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " | 16 #define DVLOGF(level) DVLOG(level) << __FUNCTION__ << "(): " |
17 | 17 |
18 #define NOTIFY_ERROR(error, msg) \ | 18 #define NOTIFY_ERROR(error, msg) \ |
19 do { \ | 19 do { \ |
20 SetState(kError); \ | 20 SetState(kError); \ |
21 LOG(ERROR) << msg; \ | 21 LOG(ERROR) << msg; \ |
22 LOG(ERROR) << "Calling NotifyError(" << error << ")";\ | 22 LOG(ERROR) << "Calling NotifyError(" << error << ")";\ |
23 NotifyError(error); \ | 23 NotifyError(error); \ |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 base::Unretained(this))); | 216 base::Unretained(this))); |
217 | 217 |
218 return true; | 218 return true; |
219 } | 219 } |
220 | 220 |
221 void VaapiVideoEncodeAccelerator::InitializeTask() { | 221 void VaapiVideoEncodeAccelerator::InitializeTask() { |
222 DCHECK(encoder_thread_proxy_->BelongsToCurrentThread()); | 222 DCHECK(encoder_thread_proxy_->BelongsToCurrentThread()); |
223 DCHECK_EQ(state_, kUninitialized); | 223 DCHECK_EQ(state_, kUninitialized); |
224 DVLOGF(4); | 224 DVLOGF(4); |
225 | 225 |
226 va_surface_release_cb_ = media::BindToCurrentLoop( | 226 va_surface_release_cb_ = base::BindToCurrentLoop( |
227 base::Bind(&VaapiVideoEncodeAccelerator::RecycleVASurfaceID, | 227 base::Bind(&VaapiVideoEncodeAccelerator::RecycleVASurfaceID, |
228 base::Unretained(this))); | 228 base::Unretained(this))); |
229 | 229 |
230 if (!vaapi_wrapper_->CreateSurfaces( | 230 if (!vaapi_wrapper_->CreateSurfaces( |
231 coded_size_, kNumSurfaces, &available_va_surface_ids_)) { | 231 coded_size_, kNumSurfaces, &available_va_surface_ids_)) { |
232 NOTIFY_ERROR(kPlatformFailureError, "Failed creating VASurfaces"); | 232 NOTIFY_ERROR(kPlatformFailureError, "Failed creating VASurfaces"); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 UpdateSPS(); | 236 UpdateSPS(); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 } | 1065 } |
1066 | 1066 |
1067 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1067 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
1068 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1068 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
1069 } | 1069 } |
1070 | 1070 |
1071 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1071 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace content | 1074 } // namespace content |
OLD | NEW |