+ if (!has_drained && duration<double>(steady_clock::now() - first_connect_start).count() >= global_flags.srt_output_latency_ms * 1e-3) {
+ // The entire concept for SRT is to have fixed, low latency.
+ // If we've been out for more than a latency period, we shouldn't
+ // try to send the entire backlog. (But we should be tolerant
+ // of a quick disconnect and reconnect.) Maybe it would be better
+ // to have a sliding window of how much we remove, but it quickly
+ // starts getting esoteric, so juts drop it all.
+ fprintf(stderr, "WARNING: No SRT connection for more than %d ms, dropping data.\n",
+ global_flags.srt_output_latency_ms);
+ srt_mux->drain();
+ has_drained = true;
+ }