mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-23 17:23:51 +08:00
feat: Squash all min-features into full
This commit is contained in:
@@ -22,6 +22,8 @@ extern "C" {
|
||||
|
||||
const int env_debug_encoder = (getenv("DEBUG_ENCODER") != NULL) ? atoi(getenv("DEBUG_ENCODER")) : 0;
|
||||
|
||||
const int env_dashy = (getenv("DASHY") != NULL) ? atoi(getenv("DASHY")) : 0;
|
||||
|
||||
FfmpegEncoder::FfmpegEncoder(const EncoderInfo &encoder_info, int in_width, int in_height)
|
||||
: VideoEncoder(encoder_info, in_width, in_height) {
|
||||
frame = av_frame_alloc();
|
||||
@@ -57,7 +59,13 @@ void FfmpegEncoder::encoder_open() {
|
||||
this->codec_ctx->height = frame->height;
|
||||
this->codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
this->codec_ctx->time_base = (AVRational){ 1, encoder_info.fps };
|
||||
int err = avcodec_open2(this->codec_ctx, codec, NULL);
|
||||
AVDictionary *opts = NULL;
|
||||
if (env_dashy && codec_id == AV_CODEC_ID_H264) {
|
||||
av_dict_set(&opts, "preset", "ultrafast", 0);
|
||||
av_dict_set(&opts, "tune", "zerolatency", 0);
|
||||
}
|
||||
int err = avcodec_open2(this->codec_ctx, codec, &opts);
|
||||
av_dict_free(&opts);
|
||||
assert(err >= 0);
|
||||
|
||||
is_open = true;
|
||||
|
||||
@@ -230,8 +230,25 @@ void loggerd_thread() {
|
||||
std::unique_ptr<Context> ctx(Context::create());
|
||||
std::unique_ptr<Poller> poller(Poller::create());
|
||||
|
||||
const bool lite = getenv("LITE");
|
||||
const std::set<std::string> lite_skip_names = {
|
||||
"driverCameraState",
|
||||
"driverEncodeIdx",
|
||||
"driverStateV2",
|
||||
"driverMonitoringState",
|
||||
"driverEncodeData",
|
||||
"livestreamDriverEncodeIdx",
|
||||
"livestreamDriverEncodeData",
|
||||
// audio logs
|
||||
"userBookmark",
|
||||
"soundPressure",
|
||||
"rawAudioData",
|
||||
"audioFeedback",
|
||||
};
|
||||
|
||||
// subscribe to all socks
|
||||
for (const auto& [_, it] : services) {
|
||||
if (lite && lite_skip_names.count(it.name)) continue;
|
||||
const bool encoder = util::ends_with(it.name, "EncodeData");
|
||||
const bool livestream_encoder = util::starts_with(it.name, "livestream");
|
||||
const bool record_audio = (it.name == "rawAudioData") && Params().getBool("RecordAudio");
|
||||
@@ -261,7 +278,9 @@ void loggerd_thread() {
|
||||
std::vector<RemoteEncoder*> encoders_with_audio;
|
||||
for (const auto &cam : cameras_logged) {
|
||||
for (const auto &encoder_info : cam.encoder_infos) {
|
||||
encoder_infos_dict[encoder_info.publish_name] = encoder_info;
|
||||
const std::string &name = encoder_info.publish_name;
|
||||
if (lite && lite_skip_names.count(name)) continue;
|
||||
encoder_infos_dict[name] = encoder_info;
|
||||
s.max_waiting++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ const EncoderInfo main_wide_road_encoder_info = {
|
||||
const EncoderInfo main_driver_encoder_info = {
|
||||
.publish_name = "driverEncodeData",
|
||||
.filename = "dcamera.hevc",
|
||||
.record = Params().getBool("RecordFront"),
|
||||
.record = !getenv("LITE") && Params().getBool("RecordFront"),
|
||||
.get_settings = [](int in_width){return EncoderSettings::MainEncoderSettings(in_width);},
|
||||
INIT_ENCODE_FUNCTIONS(DriverEncode),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user