From 1ed77847fe3f53b14595bab8f1f47134fee03c9b Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 23 Jan 2021 17:11:36 -0800 Subject: [PATCH] loggerd: remove vipc arg from encode frame --- selfdrive/loggerd/encoder.h | 6 ++---- selfdrive/loggerd/loggerd.cc | 4 ++-- selfdrive/loggerd/omx_encoder.cc | 4 ++-- selfdrive/loggerd/omx_encoder.h | 3 +-- selfdrive/loggerd/raw_logger.cc | 4 ++-- selfdrive/loggerd/raw_logger.h | 7 ++----- 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/selfdrive/loggerd/encoder.h b/selfdrive/loggerd/encoder.h index 5af2d16b37..9ac2d9d367 100644 --- a/selfdrive/loggerd/encoder.h +++ b/selfdrive/loggerd/encoder.h @@ -2,14 +2,12 @@ #include -#include "visionipc.h" - class VideoEncoder { public: virtual ~VideoEncoder() {} virtual int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, - int in_width, int in_height, - int *frame_segment, VisionIpcBufExtra *extra) = 0; + int in_width, int in_height, + int *frame_segment, uint64_t ts) = 0; virtual void encoder_open(const char* path, int segment) = 0; virtual void encoder_close() = 0; }; diff --git a/selfdrive/loggerd/loggerd.cc b/selfdrive/loggerd/loggerd.cc index a70285efed..862d958047 100644 --- a/selfdrive/loggerd/loggerd.cc +++ b/selfdrive/loggerd/loggerd.cc @@ -270,12 +270,12 @@ void encoder_thread(int cam_idx) { int out_segment = -1; int out_id = encoders[0]->encode_frame(buf->y, buf->u, buf->v, buf->width, buf->height, - &out_segment, &extra); + &out_segment, extra.timestamp_eof); if (encoders.size() > 1) { int out_segment_alt = -1; encoders[1]->encode_frame(buf->y, buf->u, buf->v, buf->width, buf->height, - &out_segment_alt, &extra); + &out_segment_alt, extra.timestamp_eof); } // publish encode index diff --git a/selfdrive/loggerd/omx_encoder.cc b/selfdrive/loggerd/omx_encoder.cc index 7977cfd90c..40b16739f9 100644 --- a/selfdrive/loggerd/omx_encoder.cc +++ b/selfdrive/loggerd/omx_encoder.cc @@ -406,7 +406,7 @@ void OmxEncoder::handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf) { int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int in_width, int in_height, - int *frame_segment, VisionIpcBufExtra *extra) { + int *frame_segment, uint64_t ts) { int err; pthread_mutex_lock(&this->lock); @@ -458,7 +458,7 @@ int OmxEncoder::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const u in_buf->nFilledLen = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height); in_buf->nFlags = OMX_BUFFERFLAG_ENDOFFRAME; in_buf->nOffset = 0; - in_buf->nTimeStamp = extra->timestamp_eof/1000LL; // OMX_TICKS, in microseconds + in_buf->nTimeStamp = ts/1000LL; // OMX_TICKS, in microseconds this->last_t = in_buf->nTimeStamp; OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf)); diff --git a/selfdrive/loggerd/omx_encoder.h b/selfdrive/loggerd/omx_encoder.h index 00b7b57ded..62912a6545 100644 --- a/selfdrive/loggerd/omx_encoder.h +++ b/selfdrive/loggerd/omx_encoder.h @@ -14,7 +14,6 @@ extern "C" { #include "encoder.h" #include "common/cqueue.h" -#include "visionipc.h" // OmxEncoder, lossey codec using hardware hevc class OmxEncoder : public VideoEncoder { @@ -23,7 +22,7 @@ public: ~OmxEncoder(); int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int in_width, int in_height, - int *frame_segment, VisionIpcBufExtra *extra); + int *frame_segment, uint64_t ts); void encoder_open(const char* path, int segment); void encoder_close(); diff --git a/selfdrive/loggerd/raw_logger.cc b/selfdrive/loggerd/raw_logger.cc index c61d1c72e8..4919805789 100644 --- a/selfdrive/loggerd/raw_logger.cc +++ b/selfdrive/loggerd/raw_logger.cc @@ -129,7 +129,7 @@ void RawLogger::encoder_close() { int RawLogger::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int in_width, int in_height, - int *frame_segment, VisionIpcBufExtra *extra) { + int *frame_segment, uint64_t ts) { int err = 0; AVPacket pkt; @@ -140,7 +140,7 @@ int RawLogger::encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const ui frame->data[0] = (uint8_t*)y_ptr; frame->data[1] = (uint8_t*)u_ptr; frame->data[2] = (uint8_t*)v_ptr; - frame->pts = extra->timestamp_eof; + frame->pts = ts; int ret = counter; diff --git a/selfdrive/loggerd/raw_logger.h b/selfdrive/loggerd/raw_logger.h index 9bb5590092..ae52ded074 100644 --- a/selfdrive/loggerd/raw_logger.h +++ b/selfdrive/loggerd/raw_logger.h @@ -1,5 +1,4 @@ -#ifndef FFV1LOGGER_H -#define FFV1LOGGER_H +#pragma once #include #include @@ -24,7 +23,7 @@ public: ~RawLogger(); int encode_frame(const uint8_t *y_ptr, const uint8_t *u_ptr, const uint8_t *v_ptr, int in_width, int in_height, - int *frame_segment, VisionIpcBufExtra *extra); + int *frame_segment, uint64_t ts); void encoder_open(const char* path, int segment); void encoder_close(); @@ -47,5 +46,3 @@ private: AVFrame *frame = NULL; }; - -#endif