CI: Cover kernel ts

pull/1651/head
winlin 6 years ago
parent 8eccfeceb9
commit 36c41715e7

1
trunk/.gitignore vendored

@ -36,4 +36,5 @@
srs
*.dSYM/
*.gcov
*.ts

@ -3367,7 +3367,7 @@ VOID TEST(KernelTSTest, CoverContextUtility)
}
}
VOID TEST(KernelTSTest, CoverContextCodec)
VOID TEST(KernelTSTest, CoverContextEncode)
{
SrsTsContext ctx;
MockTsHandler h;
@ -3386,6 +3386,14 @@ VOID TEST(KernelTSTest, CoverContextCodec)
srs_freep(err);
}
if (true) {
SrsBuffer b((char*)"\x00\x00\x00\x00", 4);
srs_error_t err = ctx.decode(&b, &h);
EXPECT_TRUE(srs_success != err);
srs_freep(err);
}
if (true) {
MockSrsFileWriter f;
SrsTsMessage m;
@ -3397,6 +3405,84 @@ VOID TEST(KernelTSTest, CoverContextCodec)
err = ctx.encode(&f, &m, SrsVideoCodecIdHEVC, SrsAudioCodecIdOpus);
EXPECT_TRUE(srs_success != err);
srs_freep(err);
err = ctx.encode_pat_pmt(&f, 0, SrsTsStreamReserved, 0, SrsTsStreamReserved);
EXPECT_TRUE(srs_success != err);
srs_freep(err);
}
if (true) {
MockSrsFileWriter f;
SrsTsMessage m;
srs_error_t err = ctx.encode_pes(&f, &m, 0x200, SrsTsStreamVideoH264, false);
EXPECT_TRUE(srs_success != err);
srs_freep(err);
EXPECT_TRUE(srs_success == ctx.encode_pat_pmt(&f, 200, SrsTsStreamVideoH264, 201, SrsTsStreamAudioAAC));
}
if (true) {
MockSrsFileWriter f;
SrsTsMessage m;
EXPECT_TRUE(srs_success == ctx.encode(&f, &m, SrsVideoCodecIdAVC, SrsAudioCodecIdAAC));
m.payload->append("Hello, world!", 13);
EXPECT_TRUE(srs_success == ctx.encode(&f, &m, SrsVideoCodecIdAVC, SrsAudioCodecIdAAC));
}
}
VOID TEST(KernelTSTest, CoverContextDecode)
{
SrsTsContext ctx;
MockTsHandler h;
if (true) {
uint8_t raw[] = {
0x47, 0x40, 0x11, 0x10, 0x00, 0x42, 0xf0, 0x25, 0x00, 0x01, 0xc1, 0x00, 0x00, 0xff, 0x01, 0xff,
0x00, 0x01, 0xfc, 0x80, 0x14, 0x48, 0x12, 0x01, 0x06, 0x46, 0x46, 0x6d, 0x70, 0x65, 0x67, 0x09,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x30, 0x31, 0x77, 0x7c, 0x43, 0xca, 0xff, 0xff, 0xff
};
SrsBuffer b((char*)raw, sizeof(raw));
EXPECT_TRUE(srs_success == ctx.decode(&b, &h));
}
if (true) {
uint8_t raw[] = {
0x47, 0x40, 0x00, 0x10, 0x00, 0x00, 0xb0, 0x0d, 0x00, 0x01, 0xc1, 0x00, 0x00, 0x00, 0x01, 0xf0,
0x00, 0x2a, 0xb1, 0x04, 0xb2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
SrsBuffer b((char*)raw, sizeof(raw));
EXPECT_TRUE(srs_success == ctx.decode(&b, &h));
}
if (true) {
uint8_t raw[] = {
0x47, 0x50, 0x00, 0x10, 0x00, 0x02, 0xb0, 0x17, 0x00, 0x01, 0xc1, 0x00, 0x00, 0xe1, 0x00, 0xf0,
0x00, 0x1b, 0xe1, 0x00, 0xf0, 0x00, 0x0f, 0xe1, 0x01, 0xf0, 0x00, 0x2f, 0x44, 0xb9, 0x9b, 0xff
};
SrsBuffer b((char*)raw, sizeof(raw));
EXPECT_TRUE(srs_success == ctx.decode(&b, &h));
}
if (true) {
uint8_t raw[] = {
0x47, 0x41, 0x00, 0x30, 0x07, 0x50, 0x00, 0x00, 0x7b, 0x0c, 0x7e, 0x00, 0x00, 0x00, 0x01, 0xe0,
0x00, 0x00, 0x80, 0xc0, 0x0a, 0x31, 0x00, 0x09, 0x10, 0xa1, 0x11, 0x00, 0x07, 0xd8, 0x61, 0x00,
0x00, 0x00, 0x01, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x06, 0x05, 0xff, 0xff, 0xac, 0xdc, 0x45,
0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7, 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef, 0x78, 0x32,
0x36, 0x34, 0x20, 0x2d, 0x20, 0x63, 0x6f, 0x72, 0x65, 0x20, 0x31, 0x33, 0x38, 0x20, 0x2d, 0x20,
0x48, 0x2e, 0x32, 0x36, 0x34, 0x2f, 0x4d, 0x50, 0x45, 0x47, 0x2d, 0x34, 0x20, 0x41, 0x56, 0x43,
0x20, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x20, 0x2d, 0x20, 0x43, 0x6f, 0x70, 0x79, 0x6c, 0x65, 0x66,
0x74, 0x20, 0x32, 0x30, 0x30, 0x33, 0x2d, 0x32, 0x30, 0x31, 0x33, 0x20, 0x2d, 0x20, 0x68, 0x74,
0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6c, 0x61,
0x6e, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x78, 0x32, 0x36, 0x34, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x20,
0x2d, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x20, 0x63, 0x61, 0x62, 0x61, 0x63,
0x3d, 0x31, 0x20, 0x72, 0x65, 0x66, 0x3d, 0x33, 0x20, 0x64, 0x65, 0x62
};
SrsBuffer b((char*)raw, sizeof(raw));
EXPECT_TRUE(srs_success == ctx.decode(&b, &h));
}
}

Loading…
Cancel
Save