forge
Explore
Log in

Don't you dare go Hollow

S5: deblock scratch pool locks use PoisonError::into_inner; a panicked thread no longer aborts every later decode (pool state is a plain Vec, safe to reuse)

Browse files at this commit

e456460706c782a5af334b0791bf969f1fceda64Ahmet Kaan GümüşParent: 4682d3c
crates/ec-av1/src/decode/deblock.rsmodified+1 -1
@@ -711,7 +711,7 @@ pub(super) const SCRATCH_CAP: usize = 32;
711711 /// luma-sized allocation (every pooled buffer would drift to the largest
712712 /// size otherwise). `None` when the pool is empty.
713713 fn scratch_take(n: usize) -> Option<Vec<u16>> {
714- let mut p = PLANE_SCRATCH.lock().unwrap();
714+ let mut p = PLANE_SCRATCH.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
715715 if p.is_empty() {
716716 return None;
717717 }
crates/ec-av1/src/decode/replay.rsmodified+1 -1
@@ -395,7 +395,7 @@ pub(super) fn crop_owned(plane: PlaneBuf<'_>, w: usize, h: usize) -> Vec<u16> {
395395 /// Over [`SCRATCH_CAP`] the buffer is dropped (freed) instead -- the cap is
396396 /// what keeps a pool shared by every thread from being an unbounded stash.
397397 pub(super) fn scratch_return(v: Vec<u16>) {
398- let mut p = PLANE_SCRATCH.lock().unwrap();
398+ let mut p = PLANE_SCRATCH.lock().unwrap_or_else(std::sync::PoisonError::into_inner);
399399 if p.len() < SCRATCH_CAP {
400400 p.push(v);
401401 }