Skip to content

Commit

Permalink
decoder: remove take_free_frame method from FramePool
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gnurou committed Feb 6, 2024
1 parent bca13dc commit a5d0604
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/backend/dummy/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ impl<M> FramePool<M> for Backend {
}

fn clear(&mut self) {}

fn take_free_frame(&mut self) -> Option<Box<dyn AsRef<M>>> {
None
}
}

impl<Codec: StatelessCodec> StatelessDecoderBackendPicture<Codec> for Backend {
Expand Down
7 changes: 0 additions & 7 deletions src/backend/vaapi/surface_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,4 @@ impl<M: SurfaceMemoryDescriptor> FramePool<M> for VaSurfacePool<M> {
pool.surfaces.clear();
pool.managed_surfaces.clear();
}

fn take_free_frame(&mut self) -> Option<Box<dyn AsRef<M>>> {
(**self)
.borrow_mut()
.get_surface(self)
.map(|s| Box::new(s) as Box<dyn AsRef<M>>)
}
}
8 changes: 0 additions & 8 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ pub trait FramePool<M> {
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<Box<dyn AsRef<M>>>;
}

/// Information about the current stream.
Expand Down

0 comments on commit a5d0604

Please sign in to comment.