Automatically restart streams in deepstream-test5-app

Hello!

Do you have any recommendations about the proper way to handle stream management for multiple live RTSP (URI) streams using the test5-app?

We’ve successfully implemented functionality to start and stop entire pipelines, but running streams on separate pipelines consumes too much GPU memory and limits the total streams we can process - also doesn’t allow the ability to batch multiple streams together with streammux.

We’re looking for recommendations on how to run multiple sources within a pipeline, sense if a live stream is down or gets interrupted, try to re-connect and if not successful, end the stream without bringing down the other streams or entire pipeline.

Thanks!

Hi,

We’re looking for recommendations on how to run multiple sources within a pipeline, sense if a live stream is down or gets interrupted, try to re-connect and if not successful, end the stream without bringing down the other streams or entire pipeline.

The re-connection logic has already been added to test5-app. The logic is implemented in deepsstream_app.c which is used with test-5. Here’s the the code which does that.

case GST_MESSAGE_ERROR:{
      GError *error = NULL;
      gchar *debuginfo = NULL;
      guint i = 0;
      gst_message_parse_error (message, &error, &debuginfo);
      g_printerr ("ERROR from %s: %s\n",
          GST_OBJECT_NAME (message->src), error->message);
      if (debuginfo) {
        g_printerr ("Debug info: %s\n", debuginfo);
      }

      NvDsSrcParentBin *bin = &appCtx->pipeline.multi_src_bin;
      for (i = 0; i < bin->num_bins; i++) {
        if (bin->sub_bins[i].src_elem == (GstElement *) GST_MESSAGE_SRC (message))
          break;
      }

      if ((i != bin->num_bins) &&
          (appCtx->config.multi_source_config[0].type == NV_DS_SOURCE_RTSP)) {
        // Error from one of RTSP source.
        NvDsSrcBin *subBin = &bin->sub_bins[i];

        if (!subBin->reconfiguring ||
            g_strrstr(debuginfo, "500 (Internal Server Error)")) {
          if (!subBin->reconfiguring) {
            // Check status of stream at regular interval.
            g_timeout_add (SOURCE_RESET_INTERVAL_IN_MS,
                           watch_source_status, subBin);
          }
          // Reconfigure the stream.
          subBin->reconfiguring = TRUE;
          g_timeout_add (20, reset_source_pipeline, subBin);
        }
        g_error_free (error);
        g_free (debuginfo);
        return TRUE;
      }

      g_error_free (error);
      g_free (debuginfo);
      appCtx->return_value = -1;
      appCtx->quit = TRUE;
      break;
    }

You can further add the logic to remove a particular source bin if it’s no longer required.

Hi, I am building on top of default deepstream reference app, and this piece of code is there in deepstream.c file. But still I am facing a similar issue. How to solve ?

Please create a new thread and add more info about the issue you are facing along with steps to reproduce it. Feel free to reference this thread in your question if you feel it’s relevant.