X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=udpinput.cpp;h=a2915e8333dff36c1b3cc1fa2efcb1cfbf1d27cf;hp=93eaaa76801c0dbab7383e2e7b8902b5fd408ea0;hb=4ca2711d4e8f8a3c20e5feda537b30c356a64329;hpb=f0621e41fdb96ce1bd58e7561e0aa76345072ba3 diff --git a/udpinput.cpp b/udpinput.cpp index 93eaaa7..a2915e8 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -11,7 +11,6 @@ #include "acceptor.h" #include "log.h" -#include "mutexlock.h" #include "serverpool.h" #include "state.pb.h" #include "stream.h" @@ -113,7 +112,6 @@ UDPInput::UDPInput(const string &url) construct_header(); - pthread_mutex_init(&stats_mutex, nullptr); stats.url = url; stats.connect_time = time(nullptr); } @@ -129,7 +127,6 @@ UDPInput::UDPInput(const InputProto &serialized) construct_header(); - pthread_mutex_init(&stats_mutex, nullptr); stats.url = url; stats.bytes_received = serialized.bytes_received(); stats.data_bytes_received = serialized.data_bytes_received(); @@ -220,19 +217,19 @@ void UDPInput::do_work() } { - MutexLock lock(&stats_mutex); + lock_guard lock(stats_mutex); stats.bytes_received += ret; stats.data_bytes_received += ret; } for (size_t stream_index : stream_indices) { - servers->add_data(stream_index, packet_buf, ret, /*metacube_flags=*/0); + servers->add_data(stream_index, packet_buf, ret, /*metacube_flags=*/0, /*pts=*/RationalPTS()); } } } InputStats UDPInput::get_stats() const { - MutexLock lock(&stats_mutex); + lock_guard lock(stats_mutex); return stats; }