| 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 "media/gpu/vaapi_video_decode_accelerator.h" | 5 #include "media/gpu/vaapi_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 return false; | 352 return false; |
| 353 } | 353 } |
| 354 | 354 |
| 355 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); | 355 client_ptr_factory_.reset(new base::WeakPtrFactory<Client>(client)); |
| 356 client_ = client_ptr_factory_->GetWeakPtr(); | 356 client_ = client_ptr_factory_->GetWeakPtr(); |
| 357 | 357 |
| 358 VideoCodecProfile profile = config.profile; | 358 VideoCodecProfile profile = config.profile; |
| 359 | 359 |
| 360 base::AutoLock auto_lock(lock_); | 360 base::AutoLock auto_lock(lock_); |
| 361 DCHECK_EQ(state_, kUninitialized); | 361 DCHECK_EQ(state_, kUninitialized); |
| 362 DVLOG(2) << "Initializing VAVDA, profile: " << profile; | 362 DVLOG(2) << "Initializing VAVDA, profile: " << GetProfileName(profile); |
| 363 | 363 |
| 364 #if defined(USE_X11) | 364 #if defined(USE_X11) |
| 365 if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { | 365 if (gl::GetGLImplementation() != gl::kGLImplementationDesktopGL) { |
| 366 DVLOG(1) << "HW video decode acceleration not available without " | 366 DVLOG(1) << "HW video decode acceleration not available without " |
| 367 "DesktopGL (GLX)."; | 367 "DesktopGL (GLX)."; |
| 368 return false; | 368 return false; |
| 369 } | 369 } |
| 370 #elif defined(USE_OZONE) | 370 #elif defined(USE_OZONE) |
| 371 if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { | 371 if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2) { |
| 372 DVLOG(1) << "HW video decode acceleration not available without " | 372 DVLOG(1) << "HW video decode acceleration not available without " |
| 373 << "EGLGLES2."; | 373 << "EGLGLES2."; |
| 374 return false; | 374 return false; |
| 375 } | 375 } |
| 376 #endif // USE_X11 | 376 #endif // USE_X11 |
| 377 | 377 |
| 378 vaapi_wrapper_ = VaapiWrapper::CreateForVideoCodec( | 378 vaapi_wrapper_ = VaapiWrapper::CreateForVideoCodec( |
| 379 VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); | 379 VaapiWrapper::kDecode, profile, base::Bind(&ReportToUMA, VAAPI_ERROR)); |
| 380 | 380 |
| 381 if (!vaapi_wrapper_.get()) { | 381 if (!vaapi_wrapper_.get()) { |
| 382 DVLOG(1) << "Failed initializing VAAPI for profile " << profile; | 382 DVLOG(1) << "Failed initializing VAAPI for profile " |
| 383 << GetProfileName(profile); |
| 383 return false; | 384 return false; |
| 384 } | 385 } |
| 385 | 386 |
| 386 if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { | 387 if (profile >= H264PROFILE_MIN && profile <= H264PROFILE_MAX) { |
| 387 h264_accelerator_.reset( | 388 h264_accelerator_.reset( |
| 388 new VaapiH264Accelerator(this, vaapi_wrapper_.get())); | 389 new VaapiH264Accelerator(this, vaapi_wrapper_.get())); |
| 389 decoder_.reset(new H264Decoder(h264_accelerator_.get())); | 390 decoder_.reset(new H264Decoder(h264_accelerator_.get())); |
| 390 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { | 391 } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { |
| 391 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); | 392 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); |
| 392 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); | 393 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); |
| 393 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { | 394 } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { |
| 394 vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); | 395 vp9_accelerator_.reset(new VaapiVP9Accelerator(this, vaapi_wrapper_.get())); |
| 395 decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); | 396 decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); |
| 396 } else { | 397 } else { |
| 397 DLOG(ERROR) << "Unsupported profile " << profile; | 398 DLOG(ERROR) << "Unsupported profile " << GetProfileName(profile); |
| 398 return false; | 399 return false; |
| 399 } | 400 } |
| 400 | 401 |
| 401 CHECK(decoder_thread_.Start()); | 402 CHECK(decoder_thread_.Start()); |
| 402 decoder_thread_task_runner_ = decoder_thread_.task_runner(); | 403 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
| 403 | 404 |
| 404 state_ = kIdle; | 405 state_ = kIdle; |
| 405 output_mode_ = config.output_mode; | 406 output_mode_ = config.output_mode; |
| 406 return true; | 407 return true; |
| 407 } | 408 } |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 return vaapi_pic->dec_surface(); | 1881 return vaapi_pic->dec_surface(); |
| 1881 } | 1882 } |
| 1882 | 1883 |
| 1883 // static | 1884 // static |
| 1884 VideoDecodeAccelerator::SupportedProfiles | 1885 VideoDecodeAccelerator::SupportedProfiles |
| 1885 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1886 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1886 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1887 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1887 } | 1888 } |
| 1888 | 1889 |
| 1889 } // namespace media | 1890 } // namespace media |
| OLD | NEW |