Remove czmq part 1 (#2332)
* remove czmq * remove streaming mode from loggerd * Add include for usleepalbatross
parent
4210ce24cf
commit
a4ccfcffe8
|
@ -1,6 +1,6 @@
|
|||
Import('env', 'cereal', 'messaging', 'arch')
|
||||
|
||||
if arch == "aarch64":
|
||||
env.Program('logcatd', 'logcatd_android.cc', LIBS=[cereal, messaging, 'cutils', 'zmq', 'czmq', 'capnp', 'kj'])
|
||||
env.Program('logcatd', 'logcatd_android.cc', LIBS=[cereal, messaging, 'cutils', 'zmq', 'capnp', 'kj'])
|
||||
else:
|
||||
env.Program('logcatd', 'logcatd_systemd.cc', LIBS=[cereal, messaging, 'zmq', 'capnp', 'kj', 'systemd', 'json11'])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Import('env', 'arch', 'cereal', 'messaging', 'common', 'visionipc')
|
||||
|
||||
src = ['loggerd.cc', 'logger.cc']
|
||||
libs = ['zmq', 'czmq', 'capnp', 'kj', 'z',
|
||||
libs = ['zmq', 'capnp', 'kj', 'z',
|
||||
'avformat', 'avcodec', 'swscale', 'avutil',
|
||||
'yuv', 'bz2', common, cereal, messaging, visionipc]
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <czmq.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <OMX_Component.h>
|
||||
|
@ -397,15 +395,6 @@ static void handle_out_buf(EncoderState *s, OMX_BUFFERHEADERTYPE *out_buf) {
|
|||
memcpy(s->codec_config, buf_data, out_buf->nFilledLen);
|
||||
}
|
||||
|
||||
if (s->stream_sock_raw) {
|
||||
//uint64_t current_time = nanos_since_boot();
|
||||
//uint64_t diff = current_time - out_buf->nTimeStamp*1000LL;
|
||||
//double msdiff = (double) diff / 1000000.0;
|
||||
// printf("encoded latency to tsEof: %f\n", msdiff);
|
||||
zmq_send(s->stream_sock_raw, &out_buf->nTimeStamp, sizeof(out_buf->nTimeStamp), ZMQ_SNDMORE);
|
||||
zmq_send(s->stream_sock_raw, buf_data, out_buf->nFilledLen, 0);
|
||||
}
|
||||
|
||||
if (s->of) {
|
||||
//printf("write %d flags 0x%x\n", out_buf->nFilledLen, out_buf->nFlags);
|
||||
fwrite(buf_data, out_buf->nFilledLen, 1, s->of);
|
||||
|
|
|
@ -56,15 +56,11 @@ typedef struct EncoderState {
|
|||
Queue free_in;
|
||||
Queue done_out;
|
||||
|
||||
void *stream_sock_raw;
|
||||
|
||||
AVFormatContext *ofmt_ctx;
|
||||
AVCodecContext *codec_ctx;
|
||||
AVStream *out_stream;
|
||||
bool remuxing;
|
||||
|
||||
void *zmq_ctx;
|
||||
|
||||
bool downscale;
|
||||
uint8_t *y_ptr2, *u_ptr2, *v_ptr2;
|
||||
} EncoderState;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <random>
|
||||
|
||||
#include <ftw.h>
|
||||
#include <zmq.h>
|
||||
#ifdef QCOM
|
||||
#include <cutils/properties.h>
|
||||
#endif
|
||||
|
@ -200,7 +199,7 @@ struct LoggerdState {
|
|||
LoggerdState s;
|
||||
|
||||
#ifndef DISABLE_ENCODER
|
||||
void encoder_thread(RotateState *rotate_state, bool is_streaming, bool raw_clips, int cam_idx) {
|
||||
void encoder_thread(RotateState *rotate_state, bool raw_clips, int cam_idx) {
|
||||
|
||||
switch (cam_idx) {
|
||||
case LOG_CAMERA_ID_DCAMERA: {
|
||||
|
@ -271,12 +270,6 @@ void encoder_thread(RotateState *rotate_state, bool is_streaming, bool raw_clips
|
|||
}
|
||||
|
||||
encoder_inited = true;
|
||||
if (is_streaming) {
|
||||
encoder.zmq_ctx = zmq_ctx_new();
|
||||
encoder.stream_sock_raw = zmq_socket(encoder.zmq_ctx, ZMQ_PUB);
|
||||
assert(encoder.stream_sock_raw);
|
||||
zmq_bind(encoder.stream_sock_raw, "tcp://*:9002");
|
||||
}
|
||||
}
|
||||
|
||||
// dont log a raw clip in the first minute
|
||||
|
@ -664,16 +657,6 @@ int main(int argc, char** argv) {
|
|||
logger_init(&s.logger, "rlog", bytes.begin(), bytes.size(), true);
|
||||
}
|
||||
|
||||
bool is_streaming = false;
|
||||
bool is_logging = true;
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "--stream") == 0) {
|
||||
is_streaming = true;
|
||||
} else if (argc > 1 && strcmp(argv[1], "--only-stream") == 0) {
|
||||
is_streaming = true;
|
||||
is_logging = false;
|
||||
}
|
||||
|
||||
s.rotate_seq_id = 0;
|
||||
s.should_close = 0;
|
||||
s.finish_close = 0;
|
||||
|
@ -681,17 +664,17 @@ int main(int argc, char** argv) {
|
|||
pthread_mutex_init(&s.rotate_lock, NULL);
|
||||
#ifndef DISABLE_ENCODER
|
||||
// rear camera
|
||||
std::thread encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_FCAMERA], is_streaming, false, LOG_CAMERA_ID_FCAMERA);
|
||||
std::thread encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_FCAMERA], false, LOG_CAMERA_ID_FCAMERA);
|
||||
s.rotate_state[LOG_CAMERA_ID_FCAMERA].enabled = true;
|
||||
// front camera
|
||||
std::thread front_encoder_thread_handle;
|
||||
if (record_front) {
|
||||
front_encoder_thread_handle = std::thread(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_DCAMERA], false, false, LOG_CAMERA_ID_DCAMERA);
|
||||
front_encoder_thread_handle = std::thread(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_DCAMERA], false, LOG_CAMERA_ID_DCAMERA);
|
||||
s.rotate_state[LOG_CAMERA_ID_DCAMERA].enabled = true;
|
||||
}
|
||||
#ifdef QCOM2
|
||||
// wide camera
|
||||
std::thread wide_encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_ECAMERA], false, false, LOG_CAMERA_ID_ECAMERA);
|
||||
std::thread wide_encoder_thread_handle(encoder_thread, &s.rotate_state[LOG_CAMERA_ID_ECAMERA], false, LOG_CAMERA_ID_ECAMERA);
|
||||
s.rotate_state[LOG_CAMERA_ID_ECAMERA].enabled = true;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -787,13 +770,11 @@ int main(int argc, char** argv) {
|
|||
pthread_mutex_lock(&s.rotate_lock);
|
||||
last_rotate_tms = millis_since_boot();
|
||||
|
||||
// rotate the log
|
||||
if (is_logging) {
|
||||
err = logger_next(&s.logger, LOG_ROOT, s.segment_path, sizeof(s.segment_path), &s.rotate_segment);
|
||||
assert(err == 0);
|
||||
if (s.logger.part == 0) { LOGW("logging to %s", s.segment_path); }
|
||||
LOGW("rotated to %s", s.segment_path);
|
||||
}
|
||||
err = logger_next(&s.logger, LOG_ROOT, s.segment_path, sizeof(s.segment_path), &s.rotate_segment);
|
||||
assert(err == 0);
|
||||
if (s.logger.part == 0) { LOGW("logging to %s", s.segment_path); }
|
||||
LOGW("rotated to %s", s.segment_path);
|
||||
|
||||
// rotate the encoders
|
||||
for (int cid=0;cid<=MAX_CAM_IDX;cid++) { s.rotate_state[cid].rotate(); }
|
||||
pthread_mutex_unlock(&s.rotate_lock);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <eigen3/Eigen/Dense>
|
||||
|
||||
#include "common/visionbuf.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "commonmodel.h"
|
||||
|
||||
#include <czmq.h>
|
||||
#include "common/mat.h"
|
||||
#include "common/timing.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "commonmodel.h"
|
||||
#include "runners/run.h"
|
||||
|
||||
#include <czmq.h>
|
||||
#include <memory>
|
||||
#include "messaging.hpp"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ OPENCV_LIBS = -lopencv_video -lopencv_core -lopencv_imgproc
|
|||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
VT_LDFLAGS += $(PHONELIBS)/capnp-c/mac/lib/libcapnp_c.a \
|
||||
$(PHONELIBS)/zmq/mac/lib/libczmq.a \
|
||||
$(PHONELIBS)/zmq/mac/lib/libzmq.a \
|
||||
-framework OpenCL
|
||||
|
||||
|
@ -41,7 +40,7 @@ else
|
|||
VT_LDFLAGS += $(CEREAL_LIBS) \
|
||||
-L/system/vendor/lib64 \
|
||||
-L$(BASEDIR)/external/zmq/lib/ \
|
||||
-l:libczmq.a -l:libzmq.a \
|
||||
-l:libzmq.a \
|
||||
-lOpenCL
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Import('env', 'cereal', 'messaging')
|
||||
env.Program('proclogd.cc', LIBS=[cereal, messaging, 'pthread', 'zmq', 'czmq', 'capnp', 'kj'])
|
||||
env.Program('proclogd.cc', LIBS=[cereal, messaging, 'pthread', 'zmq', 'capnp', 'kj'])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Import('env', 'qt_env', 'arch', 'common', 'messaging', 'gpucommon', 'visionipc', 'cereal')
|
||||
|
||||
src = ['ui.cc', 'paint.cc', 'sidebar.cc', '#phonelibs/nanovg/nanovg.c']
|
||||
libs = [common, 'zmq', 'czmq', 'capnp', 'kj', 'm', cereal, messaging, gpucommon, visionipc]
|
||||
libs = [common, 'zmq', 'capnp', 'kj', 'm', cereal, messaging, gpucommon, visionipc]
|
||||
|
||||
|
||||
if qt_env is None:
|
||||
|
|
|
@ -14,7 +14,7 @@ CXXFLAGS = -std=c++11 -g -fPIC -O2 $(WARN_FLAGS)
|
|||
|
||||
ZMQ_FLAGS = -I$(PHONELIBS)/zmq/aarch64/include
|
||||
ZMQ_LIBS = -L$(PHONELIBS)/zmq/aarch64/lib \
|
||||
-l:libczmq.a -l:libzmq.a \
|
||||
-l:libzmq.a \
|
||||
-lgnustl_shared
|
||||
|
||||
NANOVG_FLAGS = -I$(PHONELIBS)/nanovg
|
||||
|
|
Loading…
Reference in New Issue