diff --git a/release/files_common b/release/files_common index 05152663c6..59f64a22fb 100644 --- a/release/files_common +++ b/release/files_common @@ -198,7 +198,6 @@ selfdrive/common/clutil.cc selfdrive/common/clutil.h selfdrive/common/params.h selfdrive/common/params.cc -selfdrive/common/mutex.h selfdrive/common/modeldata.h selfdrive/common/mat.h diff --git a/selfdrive/common/mutex.h b/selfdrive/common/mutex.h deleted file mode 100644 index ef01359357..0000000000 --- a/selfdrive/common/mutex.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COMMON_MUTEX_H -#define COMMON_MUTEX_H - -#include - -static inline void mutex_init_reentrant(pthread_mutex_t *mutex) { - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(mutex, &attr); -} - -#endif diff --git a/selfdrive/loggerd/omx_encoder.cc b/selfdrive/loggerd/omx_encoder.cc index b96d340f01..f8cf6f9b9b 100644 --- a/selfdrive/loggerd/omx_encoder.cc +++ b/selfdrive/loggerd/omx_encoder.cc @@ -18,7 +18,6 @@ #include #include -#include "common/mutex.h" #include "common/util.h" #include "common/swaglog.h" @@ -173,7 +172,6 @@ OmxEncoder::OmxEncoder(const char* filename, int width, int height, int fps, int this->fps = fps; this->remuxing = !h265; - mutex_init_reentrant(&this->lock); pthread_mutex_init(&this->state_lock, NULL); pthread_cond_init(&this->state_cv, NULL); @@ -408,10 +406,7 @@ int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u int in_width, int in_height, int *frame_segment, uint64_t ts) { int err; - pthread_mutex_lock(&this->lock); - if (!this->is_open) { - pthread_mutex_unlock(&this->lock); return -1; } @@ -421,7 +416,6 @@ int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u OMX_BUFFERHEADERTYPE* in_buf = nullptr; while (!this->free_in.try_pop(in_buf, 20)) { if (do_exit) { - pthread_mutex_unlock(&this->lock); return -1; } } @@ -487,15 +481,12 @@ int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u *frame_segment = this->segment; } - pthread_mutex_unlock(&this->lock); return ret; } void OmxEncoder::encoder_open(const char* path, int segment) { int err; - pthread_mutex_lock(&this->lock); - this->segment = segment; snprintf(this->vid_path, sizeof(this->vid_path), "%s/%s", path, this->filename); LOGD("encoder_open %s remuxing:%d", this->vid_path, this->remuxing); @@ -543,13 +534,9 @@ void OmxEncoder::encoder_open(const char* path, int segment) { this->is_open = true; this->counter = 0; - - pthread_mutex_unlock(&this->lock); } void OmxEncoder::encoder_close() { - pthread_mutex_lock(&this->lock); - if (this->is_open) { if (this->dirty) { // drain output only if there could be frames in the encoder @@ -586,8 +573,6 @@ void OmxEncoder::encoder_close() { unlink(this->lock_path); } this->is_open = false; - - pthread_mutex_unlock(&this->lock); } OmxEncoder::~OmxEncoder() { diff --git a/selfdrive/loggerd/omx_encoder.h b/selfdrive/loggerd/omx_encoder.h index ee27ef7cd1..39ccbfa95f 100644 --- a/selfdrive/loggerd/omx_encoder.h +++ b/selfdrive/loggerd/omx_encoder.h @@ -38,7 +38,6 @@ private: void wait_for_state(OMX_STATETYPE state); static void handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf); - pthread_mutex_t lock; int width, height, fps; char vid_path[1024]; char lock_path[1024];