Giter VIP home page Giter VIP logo

Comments (11)

fzwoch avatar fzwoch commented on June 1, 2024

I suspect that when the RTSP camera goes down the pipeline gets a correct EOS. The restart-on-EOS simply seeks to the beginning and that's it (I had file looping in mind). In case the camera is down this is likely to fail.

Only in the error case it tries to restart after every N milliseconds. You could try to mimic the EOS case from the ERROR case which may be okay for your specific use case.

The more correct approach needs some more thoughts and what to do in which case..

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

If you want to know what is actually happening it is always a good idea to run OBS with GST_DEBUG=3 obs (or higher numbers). Ideally I guess in that case it gets an EOS, tries to seek and fails and then enters the ERROR recovery loop. But I'm pretty sure I never tested it - so we may trip over something trivial here..

from obs-gstreamer.

ethaniel avatar ethaniel commented on June 1, 2024

I did a test just now by blocking the packets for 30 seconds with:
iptables -I INPUT -s 192.168.1.253 -j DROP (192.168.1.253 is my camera).

The pipeline did not recover when I deleted the iptables rule. Doing the GST_DEBUG now.

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

Likely the rtspsrc will propagate an EOS when the camera dies when it times out. But its likely to require some deeper investigation. Not sure when I will have some time for this myself..

from obs-gstreamer.

ethaniel avatar ethaniel commented on June 1, 2024

Here is the normal start:

0:00:37.223579238 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Unhandled error
0:00:37.223612469 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Option not supported (551)
0:00:37.223680150 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:8244:gst_rtspsrc_pause:<rtspsrc0> error: Could not send message. (Generic error)
error: Unhandled error
0:00:37.255834340 14598 0x7f85d0004b70 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:37.353901714 14598 0x7f85f00445e0 FIXME               basesink gstbasesink.c:3145:gst_base_sink_default_event:<video_appsink> stream-start event without group-id. Consider implementing group-id handling in the upstream elements

Here is what I got about 20 seconds after I added the iptables rule.

0:01:40.634802047 14598 0x7f85f0041a80 WARN                 rtspsrc gstrtspsrc.c:3155:on_timeout:<rtspsrc1> source 75de1aab, stream 75de1aab in session 0 timed out

Here is what I got when I removed the iptables rule:

0:01:59.706575653 14598 0x7f85d0004b70 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:01:59.708493542 14598 0x7f85f00444a0 WARN         rtpjitterbuffer rtpjitterbuffer.c:570:calculate_skew: delta - skew: 0:00:07.297847276 too big, reset skew
0:01:59.725968010 14598 0x7f8618139c10 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc1> error: Unhandled error
0:01:59.725992100 14598 0x7f8618139c10 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc1> error: Option not supported (551)
0:01:59.726029411 14598 0x7f8618139c10 WARN                 rtspsrc gstrtspsrc.c:8115:gst_rtspsrc_play:<rtspsrc1> error: Could not send message. (Generic error)
error: Unhandled error
0:01:59.728468791 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:01:59.728485561 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:8246:gst_rtspsrc_pause:<rtspsrc1> PAUSE interrupted
0:01:59.729043143 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:01:59.729053843 14598 0x7f866c1e69e0 WARN                 rtspsrc gstrtspsrc.c:7673:gst_rtspsrc_close:<rtspsrc1> TEARDOWN interrupted
0:02:01.751765371 14598 0x7f85f00446d0 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc2:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:02:01.847676655 14598 0x7f85d0004370 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc5> error: Internal data stream error.
0:02:01.847711956 14598 0x7f85d0004370 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc5> error: streaming stopped, reason not-linked (-1)
error: Internal data stream error.
0:02:01.849773648 14598 0x7f85f00445e0 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:02:01.849785038 14598 0x7f85f00445e0 WARN                 rtspsrc gstrtspsrc.c:8246:gst_rtspsrc_pause:<rtspsrc1> PAUSE interrupted
0:02:03.869512930 14598 0x7f859c0044a0 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc3:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:02:03.971642470 14598 0x7f859c004e80 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc8> error: Internal data stream error.
0:02:03.971671700 14598 0x7f859c004e80 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc8> error: streaming stopped, reason not-linked (-1)
error: Internal data stream error.
0:02:03.972105009 14598 0x7f85d00048a0 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:02:03.972116020 14598 0x7f85d00048a0 WARN                 rtspsrc gstrtspsrc.c:8246:gst_rtspsrc_pause:<rtspsrc1> PAUSE interrupted
0:02:06.017637514 14598 0x7f85ac001400 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc4:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:02:06.118297932 14598 0x7f85d00049e0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc11> error: Internal data stream error.
0:02:06.118325973 14598 0x7f85d00049e0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc11> error: streaming stopped, reason not-linked (-1)
error: Internal data stream error.
0:02:06.118759072 14598 0x7f85d0004990 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:02:06.118773872 14598 0x7f85d0004990 WARN                 rtspsrc gstrtspsrc.c:8246:gst_rtspsrc_pause:<rtspsrc1> PAUSE interrupted
0:02:08.133331278 14598 0x7f85f00445e0 FIXME                default gstutils.c:3981:gst_pad_create_stream_id_internal:<fakesrc5:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:02:08.232587506 14598 0x7f85f00444a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc14> error: Internal data stream error.
0:02:08.232620286 14598 0x7f85f00444a0 WARN                 basesrc gstbasesrc.c:3055:gst_base_src_loop:<udpsrc14> error: streaming stopped, reason not-linked (-1)
error: Internal data stream error.
0:02:08.233156957 14598 0x7f859c0045e0 WARN                 rtspsrc gstrtspsrc.c:5999:gst_rtspsrc_try_send:<rtspsrc1> send interrupted
0:02:08.233179858 14598 0x7f859c0045e0 WARN                 rtspsrc gstrtspsrc.c:8246:gst_rtspsrc_pause:<rtspsrc1> PAUSE interrupted

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

Look there.. it does actually throw errors. So the plugin seems to do kinda the right thing, i tries to restart in 2 second intervals. For some reason though the pipeline refuses to run after it has been stopped it seems.

What does the pipeline look like after all?

from obs-gstreamer.

ethaniel avatar ethaniel commented on June 1, 2024

If I have both checkboxes "Restart on EOS" and "Restart on error" turned on, then I can see the last frame "stuck" for around 60 seconds or longer.

If I have both checkboxes "off", then the last frame sticks around for 25 seconds only.
In both cases, if the stream comes back online within the first 25 seconds, it recovers automatically.

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

This one seemed to work. Looks like just restarting the pipeline does not seem to work. So this one just rebuilds the pipeline instead:

diff --git a/gstreamer-source.c b/gstreamer-source.c
index 6da6723..b0f689b 100644
--- a/gstreamer-source.c
+++ b/gstreamer-source.c
@@ -33,12 +33,17 @@ typedef struct {
        guint timeout_id;
 } data_t;
 
+static void start(data_t *data);
+static void stop(data_t *data);
+
 static gboolean start_pipe(gpointer user_data)
 {
        data_t *data = user_data;
 
        data->timeout_id = 0;
-       gst_element_set_state(data->pipe, GST_STATE_PLAYING);
+
+       stop(data);
+       start(data);
 
        return FALSE;
 }

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

P.S. OBS seems to freeze for me when the connection drops.. (and recovers at some point). Not great, but I think that is an entire different topic.

from obs-gstreamer.

ethaniel avatar ethaniel commented on June 1, 2024

OMG, it works!!! Wow, this was quick. Let me know if I can drop you a donation somewhere.
Here are the streams which your plugin controls by the way: https://www.youtube.com/channel/UCegzBUd6-PYoO_v7gjJgufg

from obs-gstreamer.

fzwoch avatar fzwoch commented on June 1, 2024

Nice cams! :-)

I haven't set up any donation/support stuff yet. Maybe I will apply on GitHub sponsors one day, but that's not crucial or necessary. Maybe if decide to make a business out of such things.. oh well..

from obs-gstreamer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.