Crop and stop delaying software h265 frames
Browse files at this commit96addff6f5eae726e50144f2d7ed13c5dd2d4c07Parent: 8c90a0d- fix
- crop and stop delaying software h265 frames
3 changed files +21 -22
- crates/client/Cargo.toml +17 -17
- crates/client/src/media/decode.rs +2 -1
- crates/client/src/share/session.rs +2 -4
crates/client/Cargo.tomlmodified+17 -17
| @@ -9,21 +9,21 @@ tokio.workspace = true | |||
| 9 | quinn = { workspace = true, features = ["rustls-ring", "platform-verifier"] } | 9 | quinn = { workspace = true, features = ["rustls-ring", "platform-verifier"] } |
| 10 | 10 | ||
| 11 | gpui-kit = { version = "0.11.0", features = ["syntect"] } | 11 | gpui-kit = { version = "0.11.0", features = ["syntect"] } |
| 12 | -ec-opus = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 12 | +ec-opus = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 13 | -ec-core = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 13 | +ec-core = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 14 | -ec-probe = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 14 | +ec-probe = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 15 | -ec-mp4 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 15 | +ec-mp4 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 16 | -ec-matroska = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 16 | +ec-matroska = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 17 | -ec-ogg = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 17 | +ec-ogg = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 18 | -ec-h264 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 18 | +ec-h264 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 19 | -ec-vp8 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 19 | +ec-vp8 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 20 | -ec-aac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 20 | +ec-aac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 21 | -ec-mp3 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 21 | +ec-mp3 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 22 | -ec-vorbis = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 22 | +ec-vorbis = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 23 | -ec-flac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 23 | +ec-flac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 24 | -ec-h265 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 24 | +ec-h265 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 25 | -ec-vp9 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 25 | +ec-vp9 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 26 | -ec-av1 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 26 | +ec-av1 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 27 | ureq = "3.5.2" | 27 | ureq = "3.5.2" |
| 28 | bytes = "1.12.2" | 28 | bytes = "1.12.2" |
| 29 | tracing = "0.1.44" | 29 | tracing = "0.1.44" |
| @@ -38,8 +38,8 @@ rtrb = "0.4.1" | |||
| 38 | pipewire = { version = "0.10.1", features = ["v0_3_49"] } | 38 | pipewire = { version = "0.10.1", features = ["v0_3_49"] } |
| 39 | ksni = "0.3.7" | 39 | ksni = "0.3.7" |
| 40 | ashpd = { version = "0.14.3", default-features = false, features = ["tokio", "screencast"] } | 40 | ashpd = { version = "0.14.3", default-features = false, features = ["tokio", "screencast"] } |
| 41 | -ec-hw = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 41 | +ec-hw = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 42 | -ec-va = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "24666c0482f23b366ea752d2eb988c41ea07657f" } | 42 | +ec-va = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9953355c2c468d9c357fdebbec67345ea006d173" } |
| 43 | 43 | ||
| 44 | [target.'cfg(target_os = "windows")'.dependencies] | 44 | [target.'cfg(target_os = "windows")'.dependencies] |
| 45 | wasapi = "0.27.0" | 45 | wasapi = "0.27.0" |
crates/client/src/media/decode.rsmodified+2 -1
| @@ -231,6 +231,7 @@ impl VideoDecoder { | |||
| 231 | warn!("video packet skipped: {error}"); | 231 | warn!("video packet skipped: {error}"); |
| 232 | return Vec::new(); | 232 | return Vec::new(); |
| 233 | } | 233 | } |
| 234 | + decoder.end_picture(); | ||
| 234 | drain_h265(decoder, seconds) | 235 | drain_h265(decoder, seconds) |
| 235 | } | 236 | } |
| 236 | VideoDecoder::Vp9(decoder) => match decoder.decode(&packet.data) { | 237 | VideoDecoder::Vp9(decoder) => match decoder.decode(&packet.data) { |
| @@ -352,7 +353,7 @@ fn plane(samples: &[u16], shift: u32) -> Vec<u8> { | |||
| 352 | 353 | ||
| 353 | fn drain_h265(decoder: &mut ec_h265::Decoder, pts: f64) -> Vec<(f64, Picture)> { | 354 | fn drain_h265(decoder: &mut ec_h265::Decoder, pts: f64) -> Vec<(f64, Picture)> { |
| 354 | std::iter::from_fn(|| decoder.next_frame()) | 355 | std::iter::from_fn(|| decoder.next_frame()) |
| 355 | - .map(|frame| (pts, h265_picture(&frame.picture))) | 356 | + .map(|frame| (pts, h265_picture(&frame.cropped()))) |
| 356 | .collect() | 357 | .collect() |
| 357 | } | 358 | } |
| 358 | 359 | ||
crates/client/src/share/session.rsmodified+2 -4
| @@ -787,9 +787,7 @@ mod tests { | |||
| 787 | 787 | ||
| 788 | let encoded: Vec<Encoded> = rx.try_iter().collect(); | 788 | let encoded: Vec<Encoded> = rx.try_iter().collect(); |
| 789 | let mut decoders = vec![VideoDecoder::for_codec(codec).expect("decoder")]; | 789 | let mut decoders = vec![VideoDecoder::for_codec(codec).expect("decoder")]; |
| 790 | - if codec != Codec::H265 { | 790 | + decoders.push(crate::media::decode::software(codec).expect("software decoder")); |
| 791 | - decoders.push(crate::media::decode::software(codec).expect("software decoder")); | ||
| 792 | - } | ||
| 793 | let lumas: Vec<Vec<u8>> = decoders | 791 | let lumas: Vec<Vec<u8>> = decoders |
| 794 | .into_iter() | 792 | .into_iter() |
| 795 | .map(|mut decoder| { | 793 | .map(|mut decoder| { |
| @@ -813,7 +811,7 @@ mod tests { | |||
| 813 | } | 811 | } |
| 814 | } | 812 | } |
| 815 | } | 813 | } |
| 816 | - assert!(pictures.len() >= 9, "{codec:?} {:?} {}", decoder.engine(), pictures.len()); | 814 | + assert_eq!(pictures.len(), 10, "{codec:?} {:?}", decoder.engine()); |
| 817 | let last = pictures.pop().expect("picture"); | 815 | let last = pictures.pop().expect("picture"); |
| 818 | assert_eq!((last.width, last.height), (width, height), "{codec:?} {:?}", decoder.engine()); | 816 | assert_eq!((last.width, last.height), (width, height), "{codec:?} {:?}", decoder.engine()); |
| 819 | (0..height as usize) | 817 | (0..height as usize) |