diff --git a/trunk/src/utest/srs_utest_kernel.cpp b/trunk/src/utest/srs_utest_kernel.cpp index bd4f7c4be..2e4e0960c 100644 --- a/trunk/src/utest/srs_utest_kernel.cpp +++ b/trunk/src/utest/srs_utest_kernel.cpp @@ -935,6 +935,87 @@ VOID TEST(KernelFLVTest, CoverVodStreamErrorCase) } } +VOID TEST(KernelFLVTest, CoverFLVVodSHCase) +{ + srs_error_t err; + + if (true) { + uint8_t buf[] = { + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x09, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x08, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00 + }; + + MockSrsFileReader r((const char*)buf, sizeof(buf)); + HELPER_EXPECT_SUCCESS(r.open("")); + + SrsFlvVodStreamDecoder d; + HELPER_EXPECT_SUCCESS(d.initialize(&r)); + + int64_t start = -1; int size = 0; + HELPER_EXPECT_SUCCESS(d.read_sequence_header_summary(&start, &size)); + EXPECT_EQ(15, start); + EXPECT_EQ(30, size); + } + + if (true) { + uint8_t buf[] = { + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x09, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x09, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00 + }; + + MockSrsFileReader r((const char*)buf, sizeof(buf)); + HELPER_EXPECT_SUCCESS(r.open("")); + + SrsFlvVodStreamDecoder d; + HELPER_EXPECT_SUCCESS(d.initialize(&r)); + + int64_t start = -1; int size = 0; + HELPER_EXPECT_SUCCESS(d.read_sequence_header_summary(&start, &size)); + EXPECT_EQ(15, start); + EXPECT_EQ(15, size); + } + + if (true) { + uint8_t buf[] = { + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x08, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x08, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00 + }; + + MockSrsFileReader r((const char*)buf, sizeof(buf)); + HELPER_EXPECT_SUCCESS(r.open("")); + + SrsFlvVodStreamDecoder d; + HELPER_EXPECT_SUCCESS(d.initialize(&r)); + + int64_t start = -1; int size = 0; + HELPER_EXPECT_SUCCESS(d.read_sequence_header_summary(&start, &size)); + EXPECT_EQ(15, start); + EXPECT_EQ(15, size); + } + + if (true) { + uint8_t buf[] = { + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x12, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00 + }; + + MockSrsFileReader r((const char*)buf, sizeof(buf)); + HELPER_EXPECT_SUCCESS(r.open("")); + + SrsFlvVodStreamDecoder d; + HELPER_EXPECT_SUCCESS(d.initialize(&r)); + + int64_t start = -1; int size = 0; + HELPER_EXPECT_FAILED(d.read_sequence_header_summary(&start, &size)); + EXPECT_EQ(-1, start); + EXPECT_EQ(0, size); + } +} + /** * test the flv decoder, * exception: file stream not open.