teltek / gst-plugin-ndi

GStreamer NDI Plugin for Linux
GNU Lesser General Public License v2.1
154 stars 27 forks source link

Backport sink to gst 1.14 #78

Open michaelgruner opened 2 years ago

michaelgruner commented 2 years ago

Provides a backport of the sink elements for GStreamer 1.14. It does so by keeping a local copy of the aggregator sources. The backport may be built conditionally by using the "sink-v1_14" feature.

michaelgruner commented 2 years ago

Oh, BTW, I had to manually edit some of the aggregator sources to add the update_segment method. I know these are autogenerated, but this was the only missing piece.

sdroege commented 2 years ago

Oh, BTW, I had to manually edit some of the aggregator sources to add the update_segment method. I know these are autogenerated, but this was the only missing piece.

Did you take that from gstreamer-rs or re-implement it?

michaelgruner commented 2 years ago

Oh, BTW, I had to manually edit some of the aggregator sources to add the update_segment method. I know these are autogenerated, but this was the only missing piece.

Did you take that from gstreamer-rs or re-implement it?

I took the full base directory from gst-plugins-rs/utils/fallbackswitch/base

sdroege commented 2 years ago

I took the full base directory from gst-plugins-rs/utils/fallbackswitch/base

Can you update that from the latest bindings and GStreamer? The version from fallbackswitch is old.

FWIW, I'm going to remove that pre-1.18 configuration from fallbackswitch soonish. 1.18 is old enough and maintaining that wastes too much time (which is also why that version is outdated and why I'm explictly asking you to keep this up to date here).

michaelgruner commented 2 years ago

Changes done @sdroege please review one last time

minusplusminus commented 2 years ago

Hi, i'm using shared memory gst functionality and I get a panic when using this combined with ndisink

producer

gst-launch-1.0 -v videotestsrc ! "video/x-raw, format=BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1" \
! queue ! shmsink socket-path=/dev/shm/sink shm-size=663552000 sync=true wait-for-connection=false

consumer

gst-launch-1.0 -vvv shmsrc socket-path=/dev/shm/sink is-live=true \
! "video/x-raw, format=BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1" \
! queue ! videoconvert ! queue ! ndisink ndi-name="My NDI source"

compiled with

apt install -y git && git clone https://github.com/RidgeRun/gst-plugin-ndi/  && \
    cd gst-plugin-ndi && \
    git checkout  backport-sink-to-gst-1.14 && \
    ~/.cargo/bin/cargo build --no-default-features --features="sink-v1_14"
nvbuf_utils: Could not get EGL display connection
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/NdiSink:gst-ndi file 2.GstPad:sink: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
thread '<unnamed>' panicked at 'attempt to multiply with overflow', src/ndisink/imp.rs:316:60
stack backtrace:
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw, format=(string)BGRx, width=(int)1920, height=(int)1080, framerate=(fraction)60/1
   0: rust_begin_unwind
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
   2: core::panicking::panic
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:48:5
   3: <gstndi::ndisink::imp::NdiSink as gstreamer_base::subclass::base_sink::BaseSinkImpl>::render
             at /usr/src/ndi/gst-plugin-ndi/src/ndisink/imp.rs:316:60
   4: gstreamer_base::subclass::base_sink::base_sink_render::{{closure}}
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-base-0.17.2/src/subclass/base_sink.rs:462:9
   5: core::ops::function::FnOnce::call_once
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ops/function.rs:227:5
   6: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panic/unwind_safe.rs:271:9
   7: std::panicking::try::do_call
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:406:40
   8: __rust_try
   9: std::panicking::try
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:370:19
  10: std::panic::catch_unwind
             at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panic.rs:133:14
  11: gstreamer_base::subclass::base_sink::base_sink_render
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-base-0.17.2/src/subclass/base_sink.rs:461:5
  12: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
ERROR: from element /GstPipeline:pipeline0/NdiSink:gst-ndi file 2: GStreamer encountered a general supporting library error.
Additional debug info:
/root/.cargo/registry/src/github.com-1ecc6299db9ec823/gstreamer-base-0.17.2/src/subclass/base_sink.rs(461): gstreamer_base::subclass::base_sink (): /GstPipeline:pipeline0/NdiSink:gst-ndi file 2:
Panicked: attempt to multiply with overflow
Execution ended after 0:00:00.128894964
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

In other situations gst ndi I don't know if the same issue exists on the latest

minusplusminus commented 2 years ago

Never mind. Found that feature "reference-timestamps" is required to run on v14.