forked from mirrors/gstreamer-rs
rtpheaderextension: Don't pass a mutable output buffer reference to write()
The extension is only supposed to use it for potentially reading metas from it, and `GstRTPBasePay` is currently passing the same buffer as the one that owns the data so we currently end up with the possibility to e.g. resize the buffer which would invalidate the data. This change prevents at least the biggest problems, but would still allow getting an immutable and mutable reference to the same data with a bit of effort. See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/375 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1399>
This commit is contained in:
parent
c8b98dde8c
commit
28fe70f479
2 changed files with 6 additions and 6 deletions
|
@ -32,7 +32,7 @@ pub trait RTPHeaderExtensionExtManual: sealed::Sealed + IsA<RTPHeaderExtension>
|
|||
&self,
|
||||
input_meta: &gst::Buffer,
|
||||
write_flags: RTPHeaderExtensionFlags,
|
||||
output: &mut gst::BufferRef,
|
||||
output: &gst::BufferRef,
|
||||
data: &mut [u8],
|
||||
) -> Result<usize, glib::BoolError> {
|
||||
let size = data.len();
|
||||
|
@ -41,7 +41,7 @@ pub trait RTPHeaderExtensionExtManual: sealed::Sealed + IsA<RTPHeaderExtension>
|
|||
self.as_ref().to_glib_none().0,
|
||||
input_meta.to_glib_none().0,
|
||||
write_flags.into_glib(),
|
||||
output.as_mut_ptr(),
|
||||
mut_override(output.as_ptr()),
|
||||
data.to_glib_none().0,
|
||||
size,
|
||||
);
|
||||
|
|
|
@ -19,7 +19,7 @@ pub trait RTPHeaderExtensionImpl: RTPHeaderExtensionImplExt + ElementImpl {
|
|||
&self,
|
||||
input: &gst::BufferRef,
|
||||
write_flags: crate::RTPHeaderExtensionFlags,
|
||||
output: &mut gst::BufferRef,
|
||||
output: &gst::BufferRef,
|
||||
output_data: &mut [u8],
|
||||
) -> Result<usize, gst::LoggableError> {
|
||||
self.parent_write(input, write_flags, output, output_data)
|
||||
|
@ -97,7 +97,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
|
|||
&self,
|
||||
input: &gst::BufferRef,
|
||||
write_flags: crate::RTPHeaderExtensionFlags,
|
||||
output: &mut gst::BufferRef,
|
||||
output: &gst::BufferRef,
|
||||
output_data: &mut [u8],
|
||||
) -> Result<usize, gst::LoggableError> {
|
||||
unsafe {
|
||||
|
@ -114,7 +114,7 @@ pub trait RTPHeaderExtensionImplExt: sealed::Sealed + ObjectSubclass {
|
|||
.0,
|
||||
input.as_ptr(),
|
||||
write_flags.into_glib(),
|
||||
output.as_mut_ptr(),
|
||||
mut_override(output.as_ptr()),
|
||||
output_data.as_mut_ptr(),
|
||||
output_data.len(),
|
||||
);
|
||||
|
@ -318,7 +318,7 @@ unsafe extern "C" fn write<T: RTPHeaderExtensionImpl>(
|
|||
match imp.write(
|
||||
gst::BufferRef::from_ptr(input),
|
||||
from_glib(write_flags),
|
||||
gst::BufferRef::from_mut_ptr(output),
|
||||
gst::BufferRef::from_ptr(output),
|
||||
if output_data_len == 0 {
|
||||
&mut []
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue