mirror of
https://github.com/v0l/zap-stream-core.git
synced 2025-06-18 12:27:12 +00:00
Drops
This commit is contained in:
@ -4,7 +4,7 @@ use std::ptr;
|
||||
use anyhow::Error;
|
||||
use ffmpeg_sys_next::{
|
||||
av_buffer_ref, av_frame_alloc, av_frame_copy_props, AVBufferRef, AVFrame,
|
||||
SWS_BILINEAR, sws_getContext, sws_scale_frame, SwsContext,
|
||||
SWS_BILINEAR, sws_freeContext, sws_getContext, sws_scale_frame, SwsContext,
|
||||
};
|
||||
use tokio::sync::broadcast;
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
@ -25,6 +25,15 @@ unsafe impl Send for Scaler {}
|
||||
|
||||
unsafe impl Sync for Scaler {}
|
||||
|
||||
impl Drop for Scaler {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
sws_freeContext(self.ctx);
|
||||
self.ctx = ptr::null_mut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Scaler {
|
||||
pub fn new(
|
||||
chan_in: broadcast::Receiver<PipelinePayload>,
|
||||
@ -79,7 +88,7 @@ impl Scaler {
|
||||
self.chan_out.send(PipelinePayload::AvFrame(
|
||||
"Scaler frame".to_owned(),
|
||||
dst_frame,
|
||||
src_index
|
||||
src_index,
|
||||
))?;
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user