mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Add utest or CRC32 IEEE, refine TABs of code
This commit is contained in:
parent
608c88b8f2
commit
dea5e5bb48
2 changed files with 607 additions and 588 deletions
|
@ -108,6 +108,7 @@ int64_t srs_get_system_time_ms()
|
|||
|
||||
return _srs_system_time_us_cache / 1000;
|
||||
}
|
||||
|
||||
int64_t srs_get_system_startup_time_ms()
|
||||
{
|
||||
if (_srs_system_time_startup_time <= 0) {
|
||||
|
@ -116,6 +117,7 @@ int64_t srs_get_system_startup_time_ms()
|
|||
|
||||
return _srs_system_time_startup_time / 1000;
|
||||
}
|
||||
|
||||
int64_t srs_update_system_time_ms()
|
||||
{
|
||||
timeval now;
|
||||
|
@ -515,6 +517,7 @@ int srs_do_create_dir_recursively(string dir)
|
|||
srs_error("create dir %s failed. ret=%d", dir.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
srs_info("create dir %s success.", dir.c_str());
|
||||
|
||||
return ret;
|
||||
|
@ -844,7 +847,6 @@ int srs_do_create_dir_recursively(string dir)
|
|||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef UINT_MAX
|
||||
#define UINT_MAX 0xffffffff
|
||||
#endif
|
||||
|
@ -890,7 +892,6 @@ int srs_do_create_dir_recursively(string dir)
|
|||
#endif
|
||||
|
||||
#define av_be2ne32(x) av_bswap32(x)
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Base64 encode/decode
|
||||
|
@ -1002,7 +1003,6 @@ int srs_do_create_dir_recursively(string dir)
|
|||
* Simplified by Michael.
|
||||
* Fixed edge cases and made it work from data (vs. strings) by Ryan.
|
||||
*****************************************************************************/
|
||||
|
||||
char* srs_av_base64_encode(char* out, int out_size, const uint8_t* in, int in_size)
|
||||
{
|
||||
static const char b64[] =
|
||||
|
|
|
@ -1523,5 +1523,24 @@ VOID TEST(KernelUtility, AvcUev)
|
|||
}
|
||||
}
|
||||
|
||||
VOID TEST(KernelUtility, CRC32IEEE)
|
||||
{
|
||||
string datas[] = {
|
||||
"123456789", "srs", "ossrs.net",
|
||||
"SRS's a simplest, conceptual integrated, industrial-strength live streaming origin cluster."
|
||||
};
|
||||
|
||||
uint32_t checksums[] = {
|
||||
0xcbf43926, 0x7df334e9, 0x2f52242b,
|
||||
0x7e8677bd
|
||||
};
|
||||
|
||||
for (int i = 0; i < (int)(sizeof(datas)/sizeof(string)); i++) {
|
||||
string data = datas[i];
|
||||
uint32_t checksum = checksums[i];
|
||||
EXPECT_EQ(checksum, srs_crc32_ieee(data.data(), data.length(), 0));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue