Add Unique Sample Ids in Text to MP4
In our text to mp4 tests, we used the same sample id for each sample, this changes it so that each sample (within a single test) has a unique id. This is done in preparation to look for the ids in the created media samples. Change-Id: I3215a6f09279af8f40e1ce8a959e0a522a811173
This commit is contained in:
parent
b9dee56294
commit
668bae314f
|
@ -17,6 +17,10 @@ namespace {
|
||||||
const size_t kStreamIndex = 0;
|
const size_t kStreamIndex = 0;
|
||||||
const bool kSubSegment = true;
|
const bool kSubSegment = true;
|
||||||
const bool kEncrypted = true;
|
const bool kEncrypted = true;
|
||||||
|
|
||||||
|
const char* kId1 = "sample-id-1";
|
||||||
|
const char* kId2 = "sample-id-2";
|
||||||
|
const char* kId3 = "sample-id-3";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class WebVttToMp4HandlerTest : public MediaHandlerTestBase {
|
class WebVttToMp4HandlerTest : public MediaHandlerTestBase {
|
||||||
|
@ -45,11 +49,12 @@ class WebVttToMp4HandlerTest : public MediaHandlerTestBase {
|
||||||
StreamData::FromStreamInfo(kStreamIndex, std::move(info)));
|
StreamData::FromStreamInfo(kStreamIndex, std::move(info)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status DispatchText(int64_t start_time, int64_t end_time) {
|
Status DispatchText(const std::string& id,
|
||||||
const std::string kId = "id";
|
int64_t start_time,
|
||||||
|
int64_t end_time) {
|
||||||
const std::string kPayload = "payload";
|
const std::string kPayload = "payload";
|
||||||
|
|
||||||
auto sample = GetTextSample(kId, start_time, end_time, kPayload);
|
auto sample = GetTextSample(id, start_time, end_time, kPayload);
|
||||||
return In()->Dispatch(
|
return In()->Dispatch(
|
||||||
StreamData::FromTextSample(kStreamIndex, std::move(sample)));
|
StreamData::FromTextSample(kStreamIndex, std::move(sample)));
|
||||||
}
|
}
|
||||||
|
@ -110,7 +115,7 @@ TEST_F(WebVttToMp4HandlerTest, NonZeroStartTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSampleStart, kSampleEnd));
|
ASSERT_OK(DispatchText(kId1, kSampleStart, kSampleEnd));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -166,8 +171,8 @@ TEST_F(WebVttToMp4HandlerTest, NoOverlap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSample1Start, kSample1End));
|
ASSERT_OK(DispatchText(kId1, kSample1Start, kSample1End));
|
||||||
ASSERT_OK(DispatchText(kSample2Start, kSample2End));
|
ASSERT_OK(DispatchText(kId2, kSample2Start, kSample2End));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -230,8 +235,8 @@ TEST_F(WebVttToMp4HandlerTest, Overlap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSample1Start, kSample1End));
|
ASSERT_OK(DispatchText(kId1, kSample1Start, kSample1End));
|
||||||
ASSERT_OK(DispatchText(kSample2Start, kSample2End));
|
ASSERT_OK(DispatchText(kId2, kSample2Start, kSample2End));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -296,8 +301,8 @@ TEST_F(WebVttToMp4HandlerTest, Contains) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSample1Start, kSample1End));
|
ASSERT_OK(DispatchText(kId1, kSample1Start, kSample1End));
|
||||||
ASSERT_OK(DispatchText(kSample2Start, kSample2End));
|
ASSERT_OK(DispatchText(kId2, kSample2Start, kSample2End));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -337,8 +342,8 @@ TEST_F(WebVttToMp4HandlerTest, ExactOverlap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSampleStart, kSampleEnd));
|
ASSERT_OK(DispatchText(kId1, kSampleStart, kSampleEnd));
|
||||||
ASSERT_OK(DispatchText(kSampleStart, kSampleEnd));
|
ASSERT_OK(DispatchText(kId2, kSampleStart, kSampleEnd));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -404,9 +409,9 @@ TEST_F(WebVttToMp4HandlerTest, OverlapStartWithStaggerEnd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSample1Start, kSample1End));
|
ASSERT_OK(DispatchText(kId1, kSample1Start, kSample1End));
|
||||||
ASSERT_OK(DispatchText(kSample2Start, kSample2End));
|
ASSERT_OK(DispatchText(kId2, kSample2Start, kSample2End));
|
||||||
ASSERT_OK(DispatchText(kSample3Start, kSample3End));
|
ASSERT_OK(DispatchText(kId3, kSample3Start, kSample3End));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -472,9 +477,9 @@ TEST_F(WebVttToMp4HandlerTest, StaggerStartWithOverlapEnd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSample1Start, kSample1End));
|
ASSERT_OK(DispatchText(kId1, kSample1Start, kSample1End));
|
||||||
ASSERT_OK(DispatchText(kSample2Start, kSample2End));
|
ASSERT_OK(DispatchText(kId2, kSample2Start, kSample2End));
|
||||||
ASSERT_OK(DispatchText(kSample3Start, kSample3End));
|
ASSERT_OK(DispatchText(kId3, kSample3Start, kSample3End));
|
||||||
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
ASSERT_OK(DispatchSegment(kSegmentStart, kSegmentEnd));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
@ -539,9 +544,9 @@ TEST_F(WebVttToMp4HandlerTest, CrossSegmentSamples) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_OK(DispatchStream());
|
ASSERT_OK(DispatchStream());
|
||||||
ASSERT_OK(DispatchText(kSampleStart, kSampleEnd));
|
ASSERT_OK(DispatchText(kId1, kSampleStart, kSampleEnd));
|
||||||
ASSERT_OK(DispatchSegment(kSegment1Start, kSegment1End));
|
ASSERT_OK(DispatchSegment(kSegment1Start, kSegment1End));
|
||||||
ASSERT_OK(DispatchText(kSampleStart, kSampleEnd));
|
ASSERT_OK(DispatchText(kId1, kSampleStart, kSampleEnd));
|
||||||
ASSERT_OK(DispatchSegment(kSegment2Start, kSegment2End));
|
ASSERT_OK(DispatchSegment(kSegment2Start, kSegment2End));
|
||||||
ASSERT_OK(Flush());
|
ASSERT_OK(Flush());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue