Garbled frames are coming in RTSP streams

I’ve kind of made some lead way as far as the RTSP Stream output from Nvidia Deepstream Starting up slowly. I have edited the following file apps-common/deepstream_sink_bin.c to add idframeinterval ever 5 frames and it starts up much faster!

In this method:

static gboolean
create_udpsink_bin (NvDsSinkEncoderConfig * config, NvDsSinkBinSubBin * bin)

I edited the following line and it starts much quicker!

if (prop.integrated) {
    if (config->enc_type == NV_DS_ENCODER_TYPE_HW) {
      g_object_set (G_OBJECT (bin->encoder), "preset-level", 1, NULL);
      g_object_set (G_OBJECT (bin->encoder), "insert-sps-pps", 1, NULL);

      #ifdef IS_TEGRA
        g_print("System is TEGRA! Setting idrinterval! \n");
        g_object_set (G_OBJECT (bin->encoder), "idrinterval", 5, NULL);
      
      #endif

    
    }
  } else {
    g_object_set (G_OBJECT (bin->transform), "gpu-id", config->gpu_id, NULL);
  }

The part I added was:

#ifdef IS_TEGRA
        g_print("System is TEGRA! Setting idrinterval! \n");
        g_object_set (G_OBJECT (bin->encoder), "idrinterval", 5, NULL);
      
      #endif

Which basically says if the systems architecture is Tegra then add the idrinterval at an interval of 5! I got this idea from the following forum post:
https://forums.developer.nvidia.com/t/deepstream-6-2version-seems-not-produce-idr-periodically/251958/5