Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: content/common/gpu/media/vaapi_wrapper.h

Issue 1432963003: [Ozone] Extends the lifetime of VaapiWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT for upstream Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This file contains an implementation of VaapiWrapper, used by 5 // This file contains an implementation of VaapiWrapper, used by
6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode, 6 // VaapiVideoDecodeAccelerator and VaapiH264Decoder for decode,
7 // and VaapiVideoEncodeAccelerator for encode, to interface 7 // and VaapiVideoEncodeAccelerator for encode, to interface
8 // with libva (VA-API library for hardware video codec). 8 // with libva (VA-API library for hardware video codec).
9 9
10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 10 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
(...skipping 25 matching lines...) Expand all
36 // This class handles VA-API calls and ensures proper locking of VA-API calls 36 // This class handles VA-API calls and ensures proper locking of VA-API calls
37 // to libva, the userspace shim to the HW codec driver. libva is not 37 // to libva, the userspace shim to the HW codec driver. libva is not
38 // thread-safe, so we have to perform locking ourselves. This class is fully 38 // thread-safe, so we have to perform locking ourselves. This class is fully
39 // synchronous and its methods can be called from any thread and may wait on 39 // synchronous and its methods can be called from any thread and may wait on
40 // the va_lock_ while other, concurrent calls run. 40 // the va_lock_ while other, concurrent calls run.
41 // 41 //
42 // This class is responsible for managing VAAPI connection, contexts and state. 42 // This class is responsible for managing VAAPI connection, contexts and state.
43 // It is also responsible for managing and freeing VABuffers (not VASurfaces), 43 // It is also responsible for managing and freeing VABuffers (not VASurfaces),
44 // which are used to queue parameters and slice data to the HW codec, 44 // which are used to queue parameters and slice data to the HW codec,
45 // as well as underlying memory for VASurfaces themselves. 45 // as well as underlying memory for VASurfaces themselves.
46 class CONTENT_EXPORT VaapiWrapper { 46 class CONTENT_EXPORT VaapiWrapper : public base::RefCounted<VaapiWrapper> {
47 public: 47 public:
48 enum CodecMode { 48 enum CodecMode {
49 kDecode, 49 kDecode,
50 kEncode, 50 kEncode,
51 kCodecModeMax, 51 kCodecModeMax,
52 }; 52 };
53 53
54 // Return an instance of VaapiWrapper initialized for |va_profile| and 54 // Return an instance of VaapiWrapper initialized for |va_profile| and
55 // |mode|. |report_error_to_uma_cb| will be called independently from 55 // |mode|. |report_error_to_uma_cb| will be called independently from
56 // reporting errors to clients via method return values. 56 // reporting errors to clients via method return values.
57 static scoped_ptr<VaapiWrapper> Create( 57 static scoped_refptr<VaapiWrapper> Create(
58 CodecMode mode, 58 CodecMode mode,
59 VAProfile va_profile, 59 VAProfile va_profile,
60 const base::Closure& report_error_to_uma_cb); 60 const base::Closure& report_error_to_uma_cb);
61 61
62 // Create VaapiWrapper for VideoCodecProfile. It maps VideoCodecProfile 62 // Create VaapiWrapper for VideoCodecProfile. It maps VideoCodecProfile
63 // |profile| to VAProfile. 63 // |profile| to VAProfile.
64 // |report_error_to_uma_cb| will be called independently from reporting 64 // |report_error_to_uma_cb| will be called independently from reporting
65 // errors to clients via method return values. 65 // errors to clients via method return values.
66 static scoped_ptr<VaapiWrapper> CreateForVideoCodec( 66 static scoped_refptr<VaapiWrapper> CreateForVideoCodec(
67 CodecMode mode, 67 CodecMode mode,
68 media::VideoCodecProfile profile, 68 media::VideoCodecProfile profile,
69 const base::Closure& report_error_to_uma_cb); 69 const base::Closure& report_error_to_uma_cb);
70 70
71 // Return the supported video encode profiles. 71 // Return the supported video encode profiles.
72 static media::VideoEncodeAccelerator::SupportedProfiles 72 static media::VideoEncodeAccelerator::SupportedProfiles
73 GetSupportedEncodeProfiles(); 73 GetSupportedEncodeProfiles();
74 74
75 // Return the supported video decode profiles. 75 // Return the supported video decode profiles.
76 static media::VideoDecodeAccelerator::SupportedProfiles 76 static media::VideoDecodeAccelerator::SupportedProfiles
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // Singleton variable to store supported profile information for encode and 357 // Singleton variable to store supported profile information for encode and
358 // decode. 358 // decode.
359 static base::LazyInstance<LazyProfileInfos> profile_infos_; 359 static base::LazyInstance<LazyProfileInfos> profile_infos_;
360 360
361 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper); 361 DISALLOW_COPY_AND_ASSIGN(VaapiWrapper);
362 }; 362 };
363 363
364 } // namespace content 364 } // namespace content
365 365
366 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_ 366 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698