update hwcodec, fix gpu/cpu stuck caused by nv codec (#7826)

* Disable all nv codec encoding on windows except nv sdk encoding,
  because it doesn't use CUContext
* Keep nv codec on linux, because I didn't reproduce the stuck on it
* Add ffmpeg d3d11 vram decoding

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-04-25 20:16:48 +08:00 committed by GitHub
parent 23147f2328
commit 0e7e27f99d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

4
Cargo.lock generated
View File

@ -3038,8 +3038,8 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hwcodec" name = "hwcodec"
version = "0.3.3" version = "0.4.1"
source = "git+https://github.com/21pages/hwcodec#eeebf980d4eb41daaf05090b097d5a59d688d3d8" source = "git+https://github.com/21pages/hwcodec#17870c015a3f371339a91c5305d1e920bd8284e3"
dependencies = [ dependencies = [
"bindgen 0.59.2", "bindgen 0.59.2",
"cc", "cc",

View File

@ -17,7 +17,7 @@ use hbb_common::{
}; };
use hwcodec::{ use hwcodec::{
common::{DataFormat, Driver, MAX_GOP}, common::{DataFormat, Driver, MAX_GOP},
native::{ vram::{
decode::{self, DecodeFrame, Decoder}, decode::{self, DecodeFrame, Decoder},
encode::{self, EncodeFrame, Encoder}, encode::{self, EncodeFrame, Encoder},
Available, DecodeContext, DynamicContext, EncodeContext, FeatureContext, Available, DecodeContext, DynamicContext, EncodeContext, FeatureContext,
@ -294,6 +294,10 @@ impl VRamDecoder {
pub fn try_get(format: CodecFormat, luid: Option<i64>) -> Option<DecodeContext> { pub fn try_get(format: CodecFormat, luid: Option<i64>) -> Option<DecodeContext> {
let v: Vec<_> = Self::available(format, luid); let v: Vec<_> = Self::available(format, luid);
if v.len() > 0 { if v.len() > 0 {
// prefer ffmpeg
if let Some(ctx) = v.iter().find(|c| c.driver == Driver::FFMPEG) {
return Some(ctx.clone());
}
Some(v[0].clone()) Some(v[0].clone())
} else { } else {
None None