mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-02 00:11:01 +00:00
Set the discont flag on the first audio/video buffer
This commit is contained in:
parent
9a53bcd405
commit
0911775142
1 changed files with 24 additions and 2 deletions
|
@ -493,6 +493,8 @@ impl Receiver {
|
|||
}
|
||||
|
||||
fn receive_thread(receiver: &Weak<ReceiverInner>, recv: RecvInstance) {
|
||||
let mut first_video_frame = true;
|
||||
let mut first_audio_frame = true;
|
||||
let mut first_frame = true;
|
||||
let mut timer = time::Instant::now();
|
||||
|
||||
|
@ -553,11 +555,31 @@ impl Receiver {
|
|||
}
|
||||
Ok(Some(Frame::Video(frame))) => {
|
||||
first_frame = false;
|
||||
receiver.create_video_buffer_and_info(&element, frame)
|
||||
let mut buffer = receiver.create_video_buffer_and_info(&element, frame);
|
||||
if first_video_frame {
|
||||
if let Ok(Buffer::Video(ref mut buffer, _)) = buffer {
|
||||
buffer
|
||||
.get_mut()
|
||||
.unwrap()
|
||||
.set_flags(gst::BufferFlags::DISCONT);
|
||||
first_video_frame = false;
|
||||
}
|
||||
}
|
||||
buffer
|
||||
}
|
||||
Ok(Some(Frame::Audio(frame))) => {
|
||||
first_frame = false;
|
||||
receiver.create_audio_buffer_and_info(&element, frame)
|
||||
let mut buffer = receiver.create_audio_buffer_and_info(&element, frame);
|
||||
if first_audio_frame {
|
||||
if let Ok(Buffer::Video(ref mut buffer, _)) = buffer {
|
||||
buffer
|
||||
.get_mut()
|
||||
.unwrap()
|
||||
.set_flags(gst::BufferFlags::DISCONT);
|
||||
first_audio_frame = false;
|
||||
}
|
||||
}
|
||||
buffer
|
||||
}
|
||||
Ok(Some(Frame::Metadata(frame))) => {
|
||||
if let Some(metadata) = frame.metadata() {
|
||||
|
|
Loading…
Reference in a new issue