rtp_buffer: buffer() does not need to return an Option

When a RTP buffer is mapped, its buffer field always holds a
non-null pointer.
This commit is contained in:
Mathieu Duponchelle 2022-05-05 14:36:43 +02:00
parent a16c3888e5
commit d83faa044e

View file

@ -315,15 +315,13 @@ impl<'a, T> RTPBuffer<'a, T> {
} }
} }
pub fn buffer(&self) -> Option<&gst::BufferRef> { pub fn buffer(&self) -> &gst::BufferRef {
unsafe { unsafe {
let ptr = self.rtp_buffer.buffer; let ptr = self.rtp_buffer.buffer;
if ptr.is_null() { assert!(!ptr.is_null());
None
} else { gst::BufferRef::from_ptr(ptr)
Some(gst::BufferRef::from_ptr(ptr))
}
} }
} }