Skip to content

Commit 653da4b

Browse files
committed
adding crc calculation to is_crc_valid
1 parent 951138d commit 653da4b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/metadata-parser.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,10 @@ namespace librealsense
351351

352352
bool is_crc_valid(const S* md_info) const
353353
{
354-
LOG_ERROR("No CRC is sent within this stream's metadata");
355-
return false;
354+
Attribute crc = *(Attribute*)(reinterpret_cast<const uint8_t*>(md_info) + _crc_offset); //Attribute = CRC's type (ex. uint32_t)
355+
auto computed_crc32 = rsutils::number::calc_crc32(reinterpret_cast<const uint8_t*>(md_info),
356+
sizeof(S) - sizeof(crc));
357+
return (crc == computed_crc32);
356358
}
357359
};
358360

0 commit comments

Comments
 (0)