]> git.sesse.net Git - nageru/blobdiff - shared/mux.h
Drop buffered SRT data if the connection is down for too long.
[nageru] / shared / mux.h
index 0fb913a37636fc746771896c763e2ea238ba4eb5..5020f37d943c64e98ee73c1d8e7771a2da88659d 100644 (file)
@@ -92,6 +92,12 @@ public:
        void plug();
        void unplug();
 
+       // Temporary stop the mux; any packets coming in are discarded, and any existing ones
+       // in the queue will be dropped. Any writes in progress will finish as usual.
+       // Incompatible with plug().
+       void drain();
+       void undrain();
+
 private:
        // If write_strategy == WRITE_FOREGORUND, Must be called with <mu> held.
        void write_packet_or_die(const AVPacket &pkt, int64_t unscaled_pts);
@@ -108,6 +114,7 @@ private:
 
        AVFormatContext *avctx;  // Protected by <mu>, iff write_strategy == WRITE_BACKGROUND.
        int plug_count = 0;  // Protected by <mu>.
+       bool drained = false;  // Protected by <mu>.
 
        // Protected by <mu>. If write_strategy == WRITE_FOREGROUND,
        // this is only in use when plugging.