| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 weak_this_factory_(this) { | 309 weak_this_factory_(this) { |
| 310 weak_this_ = weak_this_factory_.GetWeakPtr(); | 310 weak_this_ = weak_this_factory_.GetWeakPtr(); |
| 311 va_surface_release_cb_ = media::BindToCurrentLoop( | 311 va_surface_release_cb_ = media::BindToCurrentLoop( |
| 312 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); | 312 base::Bind(&VaapiVideoDecodeAccelerator::RecycleVASurfaceID, weak_this_)); |
| 313 } | 313 } |
| 314 | 314 |
| 315 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { | 315 VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() { |
| 316 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 316 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool VaapiVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile, | 319 bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, |
| 320 Client* client) { | 320 Client* client) { |
| 321 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 321 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
| 322 | 322 |
| 323 if (config.is_encrypted) { |
| 324 NOTREACHED() << "Encrypted streams are not supported for this VDA"; |
| 325 return false; |
| 326 } |
| 327 |
| 323 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 328 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 324 client_ = client_ptr_factory_->GetWeakPtr(); | 329 client_ = client_ptr_factory_->GetWeakPtr(); |
| 325 | 330 |
| 331 media::VideoCodecProfile profile = config.profile; |
| 332 |
| 326 base::AutoLock auto_lock(lock_); | 333 base::AutoLock auto_lock(lock_); |
| 327 DCHECK_EQ(state_, kUninitialized); | 334 DCHECK_EQ(state_, kUninitialized); |
| 328 DVLOG(2) << "Initializing VAVDA, profile: " << profile; | 335 DVLOG(2) << "Initializing VAVDA, profile: " << profile; |
| 329 | 336 |
| 330 #if defined(USE_X11) | 337 #if defined(USE_X11) |
| 331 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { | 338 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { |
| 332 DVLOG(1) << "HW video decode acceleration not available without " | 339 DVLOG(1) << "HW video decode acceleration not available without " |
| 333 "DesktopGL (GLX)."; | 340 "DesktopGL (GLX)."; |
| 334 return false; | 341 return false; |
| 335 } | 342 } |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 return vaapi_pic->dec_surface(); | 1739 return vaapi_pic->dec_surface(); |
| 1733 } | 1740 } |
| 1734 | 1741 |
| 1735 // static | 1742 // static |
| 1736 media::VideoDecodeAccelerator::SupportedProfiles | 1743 media::VideoDecodeAccelerator::SupportedProfiles |
| 1737 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1744 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1738 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1745 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1739 } | 1746 } |
| 1740 | 1747 |
| 1741 } // namespace content | 1748 } // namespace content |
| OLD | NEW |