From a5d0604c6a66b00a78ee7f45e01cb76f3314d43e Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Mon, 5 Feb 2024 16:48:08 +0900 Subject: [PATCH] decoder: remove take_free_frame method from FramePool The backend is the only one requesting frames from the pool, and it has access to its exact type so it can call the type-specific method there. This actually highlights a design issue with our frame pool and a need for redesign. --- src/backend/dummy/decoder.rs | 4 ---- src/backend/vaapi/surface_pool.rs | 7 ------- src/decoder.rs | 8 -------- 3 files changed, 19 deletions(-) diff --git a/src/backend/dummy/decoder.rs b/src/backend/dummy/decoder.rs index 63c1e6a7..bd4a70c7 100644 --- a/src/backend/dummy/decoder.rs +++ b/src/backend/dummy/decoder.rs @@ -121,10 +121,6 @@ impl FramePool for Backend { } fn clear(&mut self) {} - - fn take_free_frame(&mut self) -> Option>> { - None - } } impl StatelessDecoderBackendPicture for Backend { diff --git a/src/backend/vaapi/surface_pool.rs b/src/backend/vaapi/surface_pool.rs index 92e697af..b406f912 100644 --- a/src/backend/vaapi/surface_pool.rs +++ b/src/backend/vaapi/surface_pool.rs @@ -235,11 +235,4 @@ impl FramePool for VaSurfacePool { pool.surfaces.clear(); pool.managed_surfaces.clear(); } - - fn take_free_frame(&mut self) -> Option>> { - (**self) - .borrow_mut() - .get_surface(self) - .map(|s| Box::new(s) as Box>) - } } diff --git a/src/decoder.rs b/src/decoder.rs index e2f78721..dee1fca4 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -43,14 +43,6 @@ pub trait FramePool { fn num_managed_frames(&self) -> usize; /// Remove all frames from this pool. fn clear(&mut self); - /// Returns an object holding one of the available frames from this pool. - /// The frame will be available for rendering again once the returned object - /// is dropped. - /// - /// This is useful to prevent decoding from happening by holding all the available frames. - /// - /// Returns `None` if there is no free frame at the time of calling. - fn take_free_frame(&mut self) -> Option>>; } /// Information about the current stream.