]> git.sesse.net Git - nageru/blobdiff - mux.cpp
Allow symlinked frame files. Useful for testing.
[nageru] / mux.cpp
diff --git a/mux.cpp b/mux.cpp
index 2f682c9b3c63967487d8c52986b44b65cba9933e..bcbbef3c1c7ba429a534c6cda6b4e98cf9852005 100644 (file)
--- a/mux.cpp
+++ b/mux.cpp
@@ -1,12 +1,12 @@
 #include "mux.h"
 
+#include <algorithm>
 #include <assert.h>
+#include <mutex>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <algorithm>
-#include <mutex>
 #include <string>
 #include <utility>
 #include <vector>
@@ -171,7 +171,8 @@ void Mux::add_packet(const AVPacket &pkt, int64_t pts, int64_t dts, AVRational t
                lock_guard<mutex> lock(mu);
                if (write_strategy == WriteStrategy::WRITE_BACKGROUND) {
                        packet_queue.push_back(QueuedPacket{ av_packet_clone(&pkt_copy), pts });
-                       if (plug_count == 0) packet_queue_ready.notify_all();
+                       if (plug_count == 0)
+                               packet_queue_ready.notify_all();
                } else if (plug_count > 0) {
                        packet_queue.push_back(QueuedPacket{ av_packet_clone(&pkt_copy), pts });
                } else {
@@ -196,7 +197,7 @@ void Mux::write_packet_or_die(const AVPacket &pkt, int64_t unscaled_pts)
        int64_t old_pos = avctx->pb->pos;
        if (av_interleaved_write_frame(avctx, const_cast<AVPacket *>(&pkt)) < 0) {
                fprintf(stderr, "av_interleaved_write_frame() failed\n");
-               exit(1);
+               abort();
        }
        avio_flush(avctx->pb);
        for (MuxMetrics *metric : metrics) {
@@ -237,6 +238,8 @@ void Mux::unplug()
 
 void Mux::thread_func()
 {
+       pthread_setname_np(pthread_self(), "Mux");
+
        unique_lock<mutex> lock(mu);
        for ( ;; ) {
                packet_queue_ready.wait(lock, [this]() {