encoderd: remove unnecessary calls to ` encoder_close()` on exit. (#28970)

old-commit-hash: ddd849a882
This commit is contained in:
Dean Lee 2023-08-24 08:56:22 +08:00 committed by GitHub
parent e311487192
commit 8c6cb78f38
1 changed files with 3 additions and 12 deletions

View File

@ -47,7 +47,7 @@ bool sync_encoders(EncoderdState *s, CameraType cam_type, uint32_t frame_id) {
void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) {
util::set_thread_name(cam_info.thread_name);
std::vector<Encoder *> encoders;
std::vector<std::unique_ptr<Encoder>> encoders;
VisionIpcClient vipc_client = VisionIpcClient("camerad", cam_info.stream_type, false);
int cur_seg = 0;
@ -64,14 +64,11 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) {
assert(buf_info.width > 0 && buf_info.height > 0);
for (const auto &encoder_info : cam_info.encoder_infos) {
encoders.push_back(new Encoder(encoder_info, buf_info.width, buf_info.height));
auto &e = encoders.emplace_back(new Encoder(encoder_info, buf_info.width, buf_info.height));
e->encoder_open(nullptr);
}
}
for (int i = 0; i < encoders.size(); ++i) {
encoders[i]->encoder_open(NULL);
}
bool lagging = false;
while (!do_exit) {
VisionIpcBufExtra extra;
@ -113,12 +110,6 @@ void encoder_thread(EncoderdState *s, const LogCameraInfo &cam_info) {
}
}
}
LOG("encoder destroy");
for (auto &e : encoders) {
e->encoder_close();
delete e;
}
}
template <size_t N>