mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-04-29 13:05:00 +00:00
Calculate buffer duration from frame info
This commit is contained in:
parent
98cd1bbc8a
commit
0baf7ee839
2 changed files with 2 additions and 2 deletions
|
@ -400,7 +400,7 @@ impl NdiAudioSrc {
|
|||
let vec = Vec::from_raw_parts(audio_frame.p_data as *mut u8, buff_size, buff_size);
|
||||
//TODO Set pts, duration and other info about the buffer
|
||||
let pts: gst::ClockTime = (pts * 100).into();
|
||||
let duration: gst::ClockTime = (20154200).into();
|
||||
let duration: gst::ClockTime = (((audio_frame.no_samples as f64 / audio_frame.sample_rate as f64) * 10000000.0) as u64).into();
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
buffer.set_pts(pts);
|
||||
buffer.set_duration(duration);
|
||||
|
|
|
@ -413,7 +413,7 @@ impl NdiVideoSrc {
|
|||
// println!("{:?}", video_frame.line_stride_in_bytes);
|
||||
//println!("{:?}", video_frame);
|
||||
//TODO get duration
|
||||
let duration: gst::ClockTime = (33333333).into();
|
||||
let duration: gst::ClockTime = (((video_frame.frame_rate_D as f64 / video_frame.frame_rate_N as f64) * 1000000000.0) as u64).into();
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
buffer.set_pts(pts);
|
||||
buffer.set_duration(duration);
|
||||
|
|
Loading…
Reference in a new issue