mirror of
https://github.com/v0l/zap-stream-core.git
synced 2025-06-17 20:08:50 +00:00
fix packet timestamps
This commit is contained in:
@ -7,6 +7,7 @@ use ffmpeg_sys_next::{
|
||||
avcodec_find_decoder, avcodec_free_context, avcodec_open2, avcodec_parameters_to_context,
|
||||
avcodec_receive_frame, avcodec_send_packet, AVCodecContext, AVERROR, AVERROR_EOF, AVPacket, AVStream,
|
||||
};
|
||||
use ffmpeg_sys_next::AVPictureType::{AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_NONE};
|
||||
use tokio::sync::broadcast;
|
||||
use tokio::sync::mpsc::UnboundedReceiver;
|
||||
|
||||
@ -99,9 +100,8 @@ impl Decoder {
|
||||
}
|
||||
return Err(Error::msg(format!("Failed to decode {}", ret)));
|
||||
}
|
||||
(*frame).time_base = (*pkt).time_base;
|
||||
(*frame).opaque = stream as *mut libc::c_void;
|
||||
self.chan_out.send(PipelinePayload::AvFrame(frame))?;
|
||||
(*frame).time_base = (*stream).time_base;
|
||||
self.chan_out.send(PipelinePayload::AvFrame("Decoder frame".to_owned(), frame))?;
|
||||
frames += 1;
|
||||
}
|
||||
return Ok(frames);
|
||||
@ -111,7 +111,7 @@ impl Decoder {
|
||||
|
||||
pub fn process(&mut self) -> Result<usize, Error> {
|
||||
while let Ok(pkg) = self.chan_in.try_recv() {
|
||||
return if let PipelinePayload::AvPacket(pkt) = pkg {
|
||||
return if let PipelinePayload::AvPacket(_, pkt) = pkg {
|
||||
unsafe {
|
||||
let frames = self.decode_pkt(pkt)?;
|
||||
Ok(frames)
|
||||
|
Reference in New Issue
Block a user