mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-22 10:12:06 +08:00
ad522f8444
* initial codex * remove ISP delay from encode ms * try something simpler * not allowing increase bug * decrease bitrate increase rate * upsample only on consecutive good checks * rearrange * clean * Revert frame timing processing time change * clean * remove bitrate option and just do it on --stream * make set_bitrate a lot more simple * clean default impl * further cleaning * struct for bitrate to pass ci * refactor a bit * add comment * small clean * add init() * increase bitrate * update ffmpeg message * remove unnecessary include * modify set_bitrate * change to Param * remove getInt helper; add back in diff pr * reword unclear error message * move webrtcd change to new branch
35 lines
762 B
C++
35 lines
762 B
C++
#pragma once
|
|
|
|
#include "common/queue.h"
|
|
#include "system/loggerd/encoder/encoder.h"
|
|
|
|
#define BUF_IN_COUNT 7
|
|
#define BUF_OUT_COUNT 6
|
|
|
|
class V4LEncoder : public VideoEncoder {
|
|
public:
|
|
V4LEncoder(const EncoderInfo &encoder_info, int in_width, int in_height);
|
|
~V4LEncoder();
|
|
int encode_frame(VisionBuf* buf, VisionIpcBufExtra *extra);
|
|
void encoder_open();
|
|
void encoder_close();
|
|
void set_bitrate(int bitrate);
|
|
|
|
private:
|
|
int fd;
|
|
|
|
bool is_open = false;
|
|
int segment_num = -1;
|
|
int counter = 0;
|
|
int current_bitrate = -1;
|
|
bool adaptive_bitrate;
|
|
|
|
SafeQueue<VisionIpcBufExtra> extras;
|
|
|
|
static void dequeue_handler(V4LEncoder *e);
|
|
std::thread dequeue_handler_thread;
|
|
|
|
VisionBuf buf_out[BUF_OUT_COUNT];
|
|
SafeQueue<unsigned int> free_buf_in;
|
|
};
|