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 commite456460706c782a5af334b0791bf969f1fceda64Parent: 4682d3c2 changed files +2 -2
crates/ec-av1/src/decode/deblock.rsmodified+1 -1
| @@ -711,7 +711,7 @@ pub(super) const SCRATCH_CAP: usize = 32; | |||
| 711 | /// luma-sized allocation (every pooled buffer would drift to the largest | 711 | /// luma-sized allocation (every pooled buffer would drift to the largest |
| 712 | /// size otherwise). `None` when the pool is empty. | 712 | /// size otherwise). `None` when the pool is empty. |
| 713 | fn scratch_take(n: usize) -> Option<Vec<u16>> { | 713 | 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); |
| 715 | if p.is_empty() { | 715 | if p.is_empty() { |
| 716 | return None; | 716 | return None; |
| 717 | } | 717 | } |
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> { | |||
| 395 | /// Over [`SCRATCH_CAP`] the buffer is dropped (freed) instead -- the cap is | 395 | /// Over [`SCRATCH_CAP`] the buffer is dropped (freed) instead -- the cap is |
| 396 | /// what keeps a pool shared by every thread from being an unbounded stash. | 396 | /// what keeps a pool shared by every thread from being an unbounded stash. |
| 397 | pub(super) fn scratch_return(v: Vec<u16>) { | 397 | 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); |
| 399 | if p.len() < SCRATCH_CAP { | 399 | if p.len() < SCRATCH_CAP { |
| 400 | p.push(v); | 400 | p.push(v); |
| 401 | } | 401 | } |