| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_decode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_decode_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/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 14 #include "content/common/gpu/gpu_channel.h" | 15 #include "content/common/gpu/gpu_channel.h" |
| 15 #include "content/common/gpu/media/accelerated_video_decoder.h" | 16 #include "content/common/gpu/media/accelerated_video_decoder.h" |
| 16 #include "content/common/gpu/media/h264_decoder.h" | 17 #include "content/common/gpu/media/h264_decoder.h" |
| 17 #include "content/common/gpu/media/vaapi_picture.h" | 18 #include "content/common/gpu/media/vaapi_picture.h" |
| 18 #include "media/base/bind_to_current_loop.h" | |
| 19 #include "media/video/picture.h" | 19 #include "media/video/picture.h" |
| 20 #include "ui/gl/gl_bindings.h" | 20 #include "ui/gl/gl_bindings.h" |
| 21 #include "ui/gl/gl_image.h" | 21 #include "ui/gl/gl_image.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 // UMA errors that the VaapiVideoDecodeAccelerator class reports. | 26 // UMA errors that the VaapiVideoDecodeAccelerator class reports. |
| 27 enum VAVDADecoderFailure { | 27 enum VAVDADecoderFailure { |
| 28 VAAPI_ERROR = 0, | 28 VAAPI_ERROR = 0, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 message_loop_(base::MessageLoop::current()), | 189 message_loop_(base::MessageLoop::current()), |
| 190 decoder_thread_("VaapiDecoderThread"), | 190 decoder_thread_("VaapiDecoderThread"), |
| 191 num_frames_at_client_(0), | 191 num_frames_at_client_(0), |
| 192 num_stream_bufs_at_decoder_(0), | 192 num_stream_bufs_at_decoder_(0), |
| 193 finish_flush_pending_(false), | 193 finish_flush_pending_(false), |
| 194 awaiting_va_surfaces_recycle_(false), | 194 awaiting_va_surfaces_recycle_(false), |
| 195 requested_num_pics_(0), | 195 requested_num_pics_(0), |
| 196 bind_image_(bind_image), | 196 bind_image_(bind_image), |
| 197 weak_this_factory_(this) { | 197 weak_this_factory_(this) { |
| 198 weak_this_ = weak_this_factory_.GetWeakPtr(); | 198 weak_this_ = weak_this_factory_.GetWeakPtr(); |
| 199 va_surface_release_cb_ = media::BindToCurrentLoop( | 199 va_surface_release_cb_ = base::BindToCurrentLoop( |
| 200 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); | 200 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { | 203 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { |
| 204 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 204 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 207 bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, |
| 208 Client* client) { | 208 Client* client) { |
| 209 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 209 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 return i; | 1215 return i; |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 // static | 1218 // static |
| 1219 media::VideoDecodeAccelerator::SupportedProfiles | 1219 media::VideoDecodeAccelerator::SupportedProfiles |
| 1220 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1220 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1221 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1221 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 } // namespace content | 1224 } // namespace content |
| OLD | NEW |