Skip to content

Commit

Permalink
add utest
Browse files Browse the repository at this point in the history
  • Loading branch information
mapengfei53 committed Jan 4, 2023
1 parent 036e872 commit 24c2a55
Showing 1 changed file with 51 additions and 2 deletions.
53 changes: 51 additions & 2 deletions trunk/src/utest/srs_utest_mp4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)
SrsBuffer b(buf, sizeof(buf));

if (true) {
SrsMp4VisualSampleEntry box;
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeAVC1);
box.data_reference_index = 1;
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
HELPER_EXPECT_SUCCESS(box.encode(&b));
Expand All @@ -1337,7 +1337,7 @@ VOID TEST(KernelMp4Test, SampleDescBox)

if (true) {
b.skip(-1 * b.pos());
SrsMp4VisualSampleEntry box;
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeAVC1);
HELPER_EXPECT_SUCCESS(box.decode(&b));
}
}
Expand Down Expand Up @@ -1366,6 +1366,55 @@ VOID TEST(KernelMp4Test, SampleDescBox)
}
}

if (true) {
char buf[8+8+70];
SrsBuffer b(buf, sizeof(buf));

if (true) {
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeHEV1);
box.data_reference_index = 1;
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
HELPER_EXPECT_SUCCESS(box.encode(&b));

stringstream ss;
SrsMp4DumpContext dc;
box.dumps(ss, dc);

string v = ss.str();
EXPECT_STREQ("hev1, 86B, refs#1, size=0x0\n", v.c_str());
}

if (true) {
b.skip(-1 * b.pos());
SrsMp4VisualSampleEntry box = SrsMp4VisualSampleEntry(SrsMp4BoxTypeAVC1);
HELPER_EXPECT_SUCCESS(box.decode(&b));
}
}

if (true) {
char buf[8];
SrsBuffer b(buf, sizeof(buf));

if (true) {
SrsMp4HevcBox box;
EXPECT_EQ((int)sizeof(buf), (int)box.nb_bytes());
HELPER_EXPECT_SUCCESS(box.encode(&b));

stringstream ss;
SrsMp4DumpContext dc;
box.dumps(ss, dc);

string v = ss.str();
EXPECT_STREQ("hvcC, 8B, HEVC Config: 0B\n \n", v.c_str());
}

if (true) {
b.skip(-1 * b.pos());
SrsMp4HevcBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
}
}

if (true) {
char buf[8+8+20];
SrsBuffer b(buf, sizeof(buf));
Expand Down

0 comments on commit 24c2a55

Please sign in to comment.