Commit 6dfb57e2 authored by Tristan Matthews's avatar Tristan Matthews

* #30347: socket_pair: remove ScopedLock

parent ad65b4a1
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "libav_deps.h" #include "libav_deps.h"
#include "socket_pair.h" #include "socket_pair.h"
#include "scoped_lock.h"
#include "libav_utils.h" #include "libav_utils.h"
#include "logger.h" #include "logger.h"
...@@ -144,7 +143,6 @@ SocketPair::SocketPair(const char *uri, int localPort) : ...@@ -144,7 +143,6 @@ SocketPair::SocketPair(const char *uri, int localPort) :
rtcpDestAddrLen_(), rtcpDestAddrLen_(),
interrupted_(false) interrupted_(false)
{ {
pthread_mutex_init(&rtcpWriteMutex_, NULL);
openSockets(uri, localPort); openSockets(uri, localPort);
} }
...@@ -152,9 +150,6 @@ SocketPair::~SocketPair() ...@@ -152,9 +150,6 @@ SocketPair::~SocketPair()
{ {
interrupted_ = true; interrupted_ = true;
closeSockets(); closeSockets();
// destroy in reverse order
pthread_mutex_destroy(&rtcpWriteMutex_);
} }
void SocketPair::interrupt() void SocketPair::interrupt()
...@@ -290,7 +285,7 @@ int SocketPair::writeCallback(void *opaque, uint8_t *buf, int buf_size) ...@@ -290,7 +285,7 @@ int SocketPair::writeCallback(void *opaque, uint8_t *buf, int buf_size)
if (RTP_PT_IS_RTCP(buf[1])) { if (RTP_PT_IS_RTCP(buf[1])) {
/* RTCP payload type */ /* RTCP payload type */
sfl::ScopedLock lock(context->rtcpWriteMutex_); std::lock_guard<std::mutex> lock(context->rtcpWriteMutex_);
ret = ff_network_wait_fd(context->rtcpHandle_); ret = ff_network_wait_fd(context->rtcpHandle_);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "video_base.h" #include "video_base.h"
#include <sys/socket.h> #include <sys/socket.h>
#include <pthread.h> #include <mutex>
#include <stdint.h> #include <stdint.h>
namespace sfl_video { namespace sfl_video {
...@@ -55,7 +55,7 @@ namespace sfl_video { ...@@ -55,7 +55,7 @@ namespace sfl_video {
private: private:
NON_COPYABLE(SocketPair); NON_COPYABLE(SocketPair);
pthread_mutex_t rtcpWriteMutex_; std::mutex rtcpWriteMutex_;
int rtpHandle_; int rtpHandle_;
int rtcpHandle_; int rtcpHandle_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment