loggerd: set encodeIdx.valid if frame id is correct (#22634)
* loggerd: set encodeIdx.valid if frame id is correct * check valid flag in test * test cleanup * bump cerealpull/22698/head
parent
c30bd052c3
commit
89f311714c
2
cereal
2
cereal
|
@ -1 +1 @@
|
|||
Subproject commit e5f5656f511aeba0e048d483f9fc3a374286cf4f
|
||||
Subproject commit 7ae52a7d832d16bffb69b4a3d04c4c4d52dd71c2
|
|
@ -156,6 +156,8 @@ bool CameraBuf::acquire() {
|
|||
cur_frame_data.timestamp_sof,
|
||||
cur_frame_data.timestamp_eof,
|
||||
};
|
||||
cur_rgb_buf->set_frame_id(cur_frame_data.frame_id);
|
||||
cur_yuv_buf->set_frame_id(cur_frame_data.frame_id);
|
||||
vipc_server->send(cur_rgb_buf, &extra);
|
||||
vipc_server->send(cur_yuv_buf, &extra);
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ void encoder_thread(const LogCameraInfo &cam_info) {
|
|||
for (int i = 0; i < encoders.size(); ++i) {
|
||||
int out_id = encoders[i]->encode_frame(buf->y, buf->u, buf->v,
|
||||
buf->width, buf->height, extra.timestamp_eof);
|
||||
|
||||
|
||||
if (out_id == -1) {
|
||||
LOGE("Failed to encode frame. frame_id: %d encode_id: %d", extra.frame_id, encode_idx);
|
||||
}
|
||||
|
@ -223,8 +223,9 @@ void encoder_thread(const LogCameraInfo &cam_info) {
|
|||
if (i == 0 && out_id != -1) {
|
||||
MessageBuilder msg;
|
||||
// this is really ugly
|
||||
auto eidx = cam_info.type == DriverCam ? msg.initEvent().initDriverEncodeIdx() :
|
||||
(cam_info.type == WideRoadCam ? msg.initEvent().initWideRoadEncodeIdx() : msg.initEvent().initRoadEncodeIdx());
|
||||
bool valid = (buf->get_frame_id() == extra.frame_id);
|
||||
auto eidx = cam_info.type == DriverCam ? msg.initEvent(valid).initDriverEncodeIdx() :
|
||||
(cam_info.type == WideRoadCam ? msg.initEvent(valid).initWideRoadEncodeIdx() : msg.initEvent(valid).initRoadEncodeIdx());
|
||||
eidx.setFrameId(extra.frame_id);
|
||||
eidx.setTimestampSof(extra.timestamp_sof);
|
||||
eidx.setTimestampEof(extra.timestamp_eof);
|
||||
|
|
|
@ -121,10 +121,13 @@ class TestEncoder(unittest.TestCase):
|
|||
# Check encodeIdx
|
||||
if encode_idx_name is not None:
|
||||
rlog_path = f"{route_prefix_path}--{i}/rlog.bz2"
|
||||
msgs = [m for m in LogReader(rlog_path) if m.which() == encode_idx_name]
|
||||
encode_msgs = [getattr(m, encode_idx_name) for m in msgs]
|
||||
|
||||
segment_idxs = [getattr(m, encode_idx_name).segmentId for m in LogReader(rlog_path) if m.which() == encode_idx_name]
|
||||
encode_idxs = [getattr(m, encode_idx_name).encodeId for m in LogReader(rlog_path) if m.which() == encode_idx_name]
|
||||
frame_idxs = [getattr(m, encode_idx_name).frameId for m in LogReader(rlog_path) if m.which() == encode_idx_name]
|
||||
valid = [m.valid for m in msgs]
|
||||
segment_idxs = [m.segmentId for m in encode_msgs]
|
||||
encode_idxs = [m.encodeId for m in encode_msgs]
|
||||
frame_idxs = [m.frameId for m in encode_msgs]
|
||||
|
||||
# Check frame count
|
||||
self.assertEqual(frame_count, len(segment_idxs))
|
||||
|
@ -134,6 +137,8 @@ class TestEncoder(unittest.TestCase):
|
|||
self.assertEqual(0, segment_idxs[0])
|
||||
self.assertEqual(len(set(segment_idxs)), len(segment_idxs))
|
||||
|
||||
self.assertTrue(all(valid))
|
||||
|
||||
if not eon_dcam:
|
||||
self.assertEqual(expected_frames * i, encode_idxs[0])
|
||||
first_frames.append(frame_idxs[0])
|
||||
|
|
Loading…
Reference in New Issue