You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
971 B
34 lines
971 B
#define CATCH_CONFIG_MAIN
|
|
#include "catch2/catch.hpp"
|
|
|
|
#include "selfdrive/ui/replay/framereader.h"
|
|
|
|
const char *stream_url = "https://commadataci.blob.core.windows.net/openpilotci/0c94aa1e1296d7c6/2021-05-05--19-48-37/0/fcamera.hevc";
|
|
|
|
TEST_CASE("FrameReader") {
|
|
SECTION("process&get") {
|
|
FrameReader fr(stream_url);
|
|
bool ret = fr.process();
|
|
REQUIRE(ret == true);
|
|
REQUIRE(fr.valid() == true);
|
|
REQUIRE(fr.getFrameCount() == 1200);
|
|
|
|
// random get 50 frames
|
|
// srand(time(NULL));
|
|
// for (int i = 0; i < 50; ++i) {
|
|
// int idx = rand() % (fr.getFrameCount() - 1);
|
|
// REQUIRE(fr.get(idx) != nullptr);
|
|
// }
|
|
// sequence get 50 frames {
|
|
for (int i = 0; i < 50; ++i) {
|
|
REQUIRE(fr.get(i) != nullptr);
|
|
}
|
|
}
|
|
SECTION("process with timeout") {
|
|
FrameReader fr(stream_url, 1);
|
|
bool ret = fr.process();
|
|
REQUIRE(ret == false);
|
|
REQUIRE(fr.valid() == false);
|
|
REQUIRE(fr.getFrameCount() < 1200);
|
|
}
|
|
}
|
|
|