Add is_key_frame in IsMediaSample Matcher

Added the key frame field to the IsMediaSample mather. All
tests that do not care about a sample being a keyframe (or not)
have been updated to use "_".

Change-Id: I44180687c58c260b6856e683d647f532227b14d5
This commit is contained in:
Aaron Vaage 2018-06-14 16:39:59 -07:00
parent 1fed9f9367
commit e0ce59aa91
5 changed files with 109 additions and 96 deletions

View File

@ -134,7 +134,13 @@ MATCHER_P6(MatchEncryptionConfig,
TryMatch(arg.key_id, key_id, result_listener, "key_id"); TryMatch(arg.key_id, key_id, result_listener, "key_id");
} }
MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") { MATCHER_P5(IsMediaSample,
stream_index,
timestamp,
duration,
encrypted,
keyframe,
"") {
if (!TryMatchStreamDataType(arg->stream_data_type, if (!TryMatchStreamDataType(arg->stream_data_type,
StreamDataType::kMediaSample, result_listener)) { StreamDataType::kMediaSample, result_listener)) {
return false; return false;
@ -142,11 +148,13 @@ MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") {
const std::string is_encrypted_string = const std::string is_encrypted_string =
BoolToString(arg->media_sample->is_encrypted()); BoolToString(arg->media_sample->is_encrypted());
const std::string is_key_frame_string =
BoolToString(arg->media_sample->is_key_frame());
*result_listener << "which is (" << arg->stream_index << ", " *result_listener << "which is (" << arg->stream_index << ", "
<< arg->media_sample->dts() << ", " << arg->media_sample->dts() << ", "
<< arg->media_sample->duration() << ", " << arg->media_sample->duration() << ", "
<< is_encrypted_string << ")"; << is_encrypted_string << ", " << is_key_frame_string << ")";
return TryMatch(arg->stream_index, stream_index, result_listener, return TryMatch(arg->stream_index, stream_index, result_listener,
"stream_index") && "stream_index") &&
@ -155,7 +163,9 @@ MATCHER_P4(IsMediaSample, stream_index, timestamp, duration, encrypted, "") {
TryMatch(arg->media_sample->duration(), duration, result_listener, TryMatch(arg->media_sample->duration(), duration, result_listener,
"duration") && "duration") &&
TryMatch(arg->media_sample->is_encrypted(), encrypted, result_listener, TryMatch(arg->media_sample->is_encrypted(), encrypted, result_listener,
"is_encrypted"); "is_encrypted") &&
TryMatch(arg->media_sample->is_key_frame(), keyframe, result_listener,
"is_key_frame");
} }
MATCHER_P6(IsTextSample, MATCHER_P6(IsTextSample,

View File

@ -71,11 +71,11 @@ TEST_F(ChunkingHandlerTest, AudioNoSubsegmentsThenFlush) {
ElementsAre(IsSegmentInfo(kStreamIndex, 0, kDuration * 3, ElementsAre(IsSegmentInfo(kStreamIndex, 0, kDuration * 3,
!kIsSubsegment, !kEncrypted), !kIsSubsegment, !kEncrypted),
IsMediaSample(kStreamIndex, i * kDuration, IsMediaSample(kStreamIndex, i * kDuration,
kDuration, !kEncrypted))); kDuration, !kEncrypted, _)));
} else { } else {
EXPECT_THAT(GetOutputStreamDataVector(), EXPECT_THAT(GetOutputStreamDataVector(),
ElementsAre(IsMediaSample(kStreamIndex, i * kDuration, ElementsAre(IsMediaSample(kStreamIndex, i * kDuration,
kDuration, !kEncrypted))); kDuration, !kEncrypted, _)));
} }
} }
@ -103,15 +103,16 @@ TEST_F(ChunkingHandlerTest, AudioWithSubsegments) {
GetOutputStreamDataVector(), GetOutputStreamDataVector(),
ElementsAre( ElementsAre(
IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted, _), IsStreamInfo(kStreamIndex, kTimeScale0, !kEncrypted, _),
IsMediaSample(kStreamIndex, 0, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, 0, kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, kDuration, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, kDuration, kDuration, !kEncrypted, _),
IsSegmentInfo(kStreamIndex, 0, kDuration * 2, kIsSubsegment, IsSegmentInfo(kStreamIndex, 0, kDuration * 2, kIsSubsegment,
!kEncrypted), !kEncrypted),
IsMediaSample(kStreamIndex, 2 * kDuration, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, 2 * kDuration, kDuration, !kEncrypted, _),
IsSegmentInfo(kStreamIndex, 0, kDuration * 3, !kIsSubsegment, IsSegmentInfo(kStreamIndex, 0, kDuration * 3, !kIsSubsegment,
!kEncrypted), !kEncrypted),
IsMediaSample(kStreamIndex, 3 * kDuration, kDuration, !kEncrypted), IsMediaSample(kStreamIndex, 3 * kDuration, kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, 4 * kDuration, kDuration, !kEncrypted))); IsMediaSample(kStreamIndex, 4 * kDuration, kDuration, !kEncrypted,
_)));
} }
TEST_F(ChunkingHandlerTest, VideoAndSubsegmentAndNonzeroStart) { TEST_F(ChunkingHandlerTest, VideoAndSubsegmentAndNonzeroStart) {
@ -136,22 +137,22 @@ TEST_F(ChunkingHandlerTest, VideoAndSubsegmentAndNonzeroStart) {
IsStreamInfo(kStreamIndex, kTimeScale1, !kEncrypted, _), IsStreamInfo(kStreamIndex, kTimeScale1, !kEncrypted, _),
// The first samples @ kStartTimestamp is discarded - not key frame. // The first samples @ kStartTimestamp is discarded - not key frame.
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 2, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 2,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
// The next segment boundary 13245 / 1000 != 12645 / 1000. // The next segment boundary 13245 / 1000 != 12645 / 1000.
IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration, IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration,
kDuration * 2, !kIsSubsegment, !kEncrypted), kDuration * 2, !kIsSubsegment, !kEncrypted),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 3, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 3,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 4, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 4,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
// The subsegment has duration kDuration * 2 since it can only // The subsegment has duration kDuration * 2 since it can only
// terminate before key frame. // terminate before key frame.
IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration * 3, IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration * 3,
kDuration * 2, kIsSubsegment, !kEncrypted), kDuration * 2, kIsSubsegment, !kEncrypted),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 5, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 5,
kDuration, !kEncrypted))); kDuration, !kEncrypted, _)));
} }
TEST_F(ChunkingHandlerTest, CueEvent) { TEST_F(ChunkingHandlerTest, CueEvent) {
@ -185,25 +186,25 @@ TEST_F(ChunkingHandlerTest, CueEvent) {
GetOutputStreamDataVector(), GetOutputStreamDataVector(),
ElementsAre( ElementsAre(
IsMediaSample(kStreamIndex, kVideoStartTimestamp, kDuration, IsMediaSample(kStreamIndex, kVideoStartTimestamp, kDuration,
!kEncrypted), !kEncrypted, _),
// A new segment is created due to the existance of Cue. // A new segment is created due to the existance of Cue.
IsSegmentInfo(kStreamIndex, kVideoStartTimestamp, kDuration, IsSegmentInfo(kStreamIndex, kVideoStartTimestamp, kDuration,
!kIsSubsegment, !kEncrypted), !kIsSubsegment, !kEncrypted),
IsCueEvent(kStreamIndex, kCueTimeInSeconds), IsCueEvent(kStreamIndex, kCueTimeInSeconds),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 1, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 1,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 2, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 2,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration, IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration,
kDuration * 2, kIsSubsegment, !kEncrypted), kDuration * 2, kIsSubsegment, !kEncrypted),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 3, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 3,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 4, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 4,
kDuration, !kEncrypted), kDuration, !kEncrypted, _),
IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration, IsSegmentInfo(kStreamIndex, kVideoStartTimestamp + kDuration,
kDuration * 4, !kIsSubsegment, !kEncrypted), kDuration * 4, !kIsSubsegment, !kEncrypted),
IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 5, IsMediaSample(kStreamIndex, kVideoStartTimestamp + kDuration * 5,
kDuration, !kEncrypted))); kDuration, !kEncrypted, _)));
} }
} // namespace media } // namespace media

View File

@ -91,13 +91,13 @@ TEST_F(CueAlignmentHandlerTest, VideoInputWithNoCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent)); EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent));
} }
@ -135,13 +135,13 @@ TEST_F(CueAlignmentHandlerTest, AudioInputWithNoCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent)); EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent));
} }
@ -250,13 +250,13 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent)); EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent));
} }
@ -267,13 +267,13 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithNoCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent)); EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent));
} }
@ -357,15 +357,15 @@ TEST_F(CueAlignmentHandlerTest, VideoInputWithCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsCueEvent(kParent, kSample2StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample2StartInSeconds)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent)); EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent));
} }
@ -411,15 +411,15 @@ TEST_F(CueAlignmentHandlerTest, AudioInputWithCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsCueEvent(kParent, kSample1StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample1StartInSeconds)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent)); EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent));
} }
@ -608,15 +608,15 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsCueEvent(kParent, kSample2StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample2StartInSeconds)));
EXPECT_CALL(*Output(kAudioStream), EXPECT_CALL(*Output(kAudioStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent)); EXPECT_CALL(*Output(kAudioStream), OnFlush(kParent));
} }
@ -627,15 +627,15 @@ TEST_F(CueAlignmentHandlerTest, TextAudioVideoInputWithCues) {
OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _))); OnProcess(IsStreamInfo(kParent, kMsTimeScale, !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample0Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample1Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsCueEvent(kParent, kSample2StartInSeconds))); OnProcess(IsCueEvent(kParent, kSample2StartInSeconds)));
EXPECT_CALL(*Output(kVideoStream), EXPECT_CALL(*Output(kVideoStream),
OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration, OnProcess(IsMediaSample(kParent, kSample2Start, kSampleDuration,
!kEncrypted))); !kEncrypted, _)));
EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent)); EXPECT_CALL(*Output(kVideoStream), OnFlush(kParent));
} }

View File

@ -510,7 +510,7 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithNoKeyRotation) {
const auto& output_stream_data = GetOutputStreamDataVector(); const auto& output_stream_data = GetOutputStreamDataVector();
EXPECT_THAT(output_stream_data, EXPECT_THAT(output_stream_data,
ElementsAre(IsMediaSample(kStreamIndex, i * kSegmentDuration, ElementsAre(IsMediaSample(kStreamIndex, i * kSegmentDuration,
kSegmentDuration, is_encrypted), kSegmentDuration, is_encrypted, _),
IsSegmentInfo(kStreamIndex, i * kSegmentDuration, IsSegmentInfo(kStreamIndex, i * kSegmentDuration,
kSegmentDuration, !kIsSubsegment, kSegmentDuration, !kIsSubsegment,
is_encrypted))); is_encrypted)));
@ -578,7 +578,7 @@ TEST_P(EncryptionHandlerEncryptionTest, ClearLeadWithKeyRotation) {
const auto& output_stream_data = GetOutputStreamDataVector(); const auto& output_stream_data = GetOutputStreamDataVector();
EXPECT_THAT(output_stream_data, EXPECT_THAT(output_stream_data,
ElementsAre(IsMediaSample(kStreamIndex, i * kSegmentDuration, ElementsAre(IsMediaSample(kStreamIndex, i * kSegmentDuration,
kSegmentDuration, is_encrypted), kSegmentDuration, is_encrypted, _),
IsSegmentInfo(kStreamIndex, i * kSegmentDuration, IsSegmentInfo(kStreamIndex, i * kSegmentDuration,
kSegmentDuration, !kIsSubsegment, kSegmentDuration, !kIsSubsegment,
is_encrypted))); is_encrypted)));

View File

@ -129,7 +129,7 @@ TEST_F(WebVttToMp4HandlerTest, IngoresEmptyPayloadSamples) {
// the while segment. // the while segment.
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(IsMediaSample(kStreamIndex, kSegmentStart, OnProcess(IsMediaSample(kStreamIndex, kSegmentStart,
kSegmentDuration, !kEncrypted))); kSegmentDuration, !kEncrypted, _)));
// Segment // Segment
EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegmentStart, EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegmentStart,
kSegmentDuration, !kSubSegment, kSegmentDuration, !kSubSegment,
@ -176,13 +176,13 @@ TEST_F(WebVttToMp4HandlerTest, NonZeroStartTime) {
// Gap // Gap
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kGapStart, OnProcess(AllOf(IsMediaSample(kStreamIndex, kGapStart,
kGapDuration, !kEncrypted), kGapDuration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1))))); Not(MediaSampleContainsId(kId1)))));
// Sample // Sample
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kSampleStart, OnProcess(AllOf(IsMediaSample(kStreamIndex, kSampleStart,
kSampleDuration, !kEncrypted), kSampleDuration, !kEncrypted, _),
MediaSampleContainsId(kId1)))); MediaSampleContainsId(kId1))));
// Segment // Segment
@ -233,21 +233,21 @@ TEST_F(WebVttToMp4HandlerTest, NoOverlap) {
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kSample1Start, OnProcess(AllOf(IsMediaSample(kStreamIndex, kSample1Start,
kSample1Duration, !kEncrypted), kSample1Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2))))); Not(MediaSampleContainsId(kId2)))));
// Gap // Gap
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kGapStart, OnProcess(AllOf(IsMediaSample(kStreamIndex, kGapStart,
kGapDuration, !kEncrypted), kGapDuration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1)), Not(MediaSampleContainsId(kId1)),
Not(MediaSampleContainsId(kId2))))); Not(MediaSampleContainsId(kId2)))));
// Sample 2 // Sample 2
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kSample2Start, OnProcess(AllOf(IsMediaSample(kStreamIndex, kSample2Start,
kSample2Duration, !kEncrypted), kSample2Duration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1)), Not(MediaSampleContainsId(kId1)),
MediaSampleContainsId(kId2)))); MediaSampleContainsId(kId2))));
@ -306,7 +306,7 @@ TEST_F(WebVttToMp4HandlerTest, Overlap) {
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
IsMediaSample(kStreamIndex, kOnlySample1Start, IsMediaSample(kStreamIndex, kOnlySample1Start,
kOnlySample1Duration, !kEncrypted), kOnlySample1Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2))))); Not(MediaSampleContainsId(kId2)))));
@ -314,13 +314,13 @@ TEST_F(WebVttToMp4HandlerTest, Overlap) {
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf( OnProcess(AllOf(
IsMediaSample(kStreamIndex, kSample1AndSample2Start, IsMediaSample(kStreamIndex, kSample1AndSample2Start,
kSample1AndSample2Duration, !kEncrypted), kSample1AndSample2Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId2)))); MediaSampleContainsId(kId1), MediaSampleContainsId(kId2))));
// Sample 2 // Sample 2
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
IsMediaSample(kStreamIndex, kOnlySample2Start, IsMediaSample(kStreamIndex, kOnlySample2Start,
kOnlySample2Duration, !kEncrypted), kOnlySample2Duration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1)), Not(MediaSampleContainsId(kId1)),
MediaSampleContainsId(kId2)))); MediaSampleContainsId(kId2))));
@ -379,9 +379,10 @@ TEST_F(WebVttToMp4HandlerTest, Contains) {
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// Sample 1 // Sample 1
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(
IsMediaSample(kStreamIndex, kBeforeSample2Start, *Out(),
kBeforeSample2Duration, !kEncrypted), OnProcess(AllOf(IsMediaSample(kStreamIndex, kBeforeSample2Start,
kBeforeSample2Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2))))); Not(MediaSampleContainsId(kId2)))));
@ -389,13 +390,14 @@ TEST_F(WebVttToMp4HandlerTest, Contains) {
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf( OnProcess(AllOf(
IsMediaSample(kStreamIndex, kDuringSample2Start, IsMediaSample(kStreamIndex, kDuringSample2Start,
kDuringSample2Duration, !kEncrypted), kDuringSample2Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId2)))); MediaSampleContainsId(kId1), MediaSampleContainsId(kId2))));
// Sample 1 Again // Sample 1 Again
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(
IsMediaSample(kStreamIndex, kAfterSample2Start, *Out(),
kAfterSample2Duration, !kEncrypted), OnProcess(AllOf(IsMediaSample(kStreamIndex, kAfterSample2Start,
kAfterSample2Duration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2))))); Not(MediaSampleContainsId(kId2)))));
@ -440,7 +442,7 @@ TEST_F(WebVttToMp4HandlerTest, ExactOverlap) {
// Both Samples // Both Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kSampleStart, OnProcess(AllOf(IsMediaSample(kStreamIndex, kSampleStart,
kSampleDuration, !kEncrypted), kSampleDuration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
MediaSampleContainsId(kId2)))); MediaSampleContainsId(kId2))));
@ -503,22 +505,22 @@ TEST_F(WebVttToMp4HandlerTest, OverlapStartWithStaggerEnd) {
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf( OnProcess(AllOf(
IsMediaSample(kStreamIndex, kThreeSamplesStart, IsMediaSample(kStreamIndex, kThreeSamplesStart,
kThreeSamplesDuration, !kEncrypted), kThreeSamplesDuration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId2), MediaSampleContainsId(kId1), MediaSampleContainsId(kId2),
MediaSampleContainsId(kId3)))); MediaSampleContainsId(kId3))));
// Two Samples // Two Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kTwoSamplesStart, OnProcess(AllOf(
kTwoSamplesDuration, !kEncrypted), IsMediaSample(kStreamIndex, kTwoSamplesStart,
MediaSampleContainsId(kId1), kTwoSamplesDuration, !kEncrypted, _),
MediaSampleContainsId(kId2), MediaSampleContainsId(kId1), MediaSampleContainsId(kId2),
Not(MediaSampleContainsId(kId3))))); Not(MediaSampleContainsId(kId3)))));
// One Sample // One Sample
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(), OnProcess(AllOf(
OnProcess(AllOf(IsMediaSample(kStreamIndex, kOneSampleStart, IsMediaSample(kStreamIndex, kOneSampleStart,
kOneSampleDuration, !kEncrypted), kOneSampleDuration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2)), Not(MediaSampleContainsId(kId2)),
Not(MediaSampleContainsId(kId3))))); Not(MediaSampleContainsId(kId3)))));
@ -580,26 +582,26 @@ TEST_F(WebVttToMp4HandlerTest, StaggerStartWithOverlapEnd) {
EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _))); EXPECT_CALL(*Out(), OnProcess(IsStreamInfo(kStreamIndex, _, _, _)));
// One Sample // One Sample
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(), OnProcess(AllOf(
OnProcess(AllOf(IsMediaSample(kStreamIndex, kOneSampleStart, IsMediaSample(kStreamIndex, kOneSampleStart,
kOneSampleDuration, !kEncrypted), kOneSampleDuration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId1),
Not(MediaSampleContainsId(kId2)), Not(MediaSampleContainsId(kId2)),
Not(MediaSampleContainsId(kId3))))); Not(MediaSampleContainsId(kId3)))));
// Two Samples // Two Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kTwoSamplesStart, OnProcess(AllOf(
kTwoSamplesDuration, !kEncrypted), IsMediaSample(kStreamIndex, kTwoSamplesStart,
MediaSampleContainsId(kId1), kTwoSamplesDuration, !kEncrypted, _),
MediaSampleContainsId(kId2), MediaSampleContainsId(kId1), MediaSampleContainsId(kId2),
Not(MediaSampleContainsId(kId3))))); Not(MediaSampleContainsId(kId3)))));
// Three Samples // Three Samples
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf( OnProcess(AllOf(
IsMediaSample(kStreamIndex, kThreeSamplesStart, IsMediaSample(kStreamIndex, kThreeSamplesStart,
kThreeSamplesDuration, !kEncrypted), kThreeSamplesDuration, !kEncrypted, _),
MediaSampleContainsId(kId1), MediaSampleContainsId(kId2), MediaSampleContainsId(kId1), MediaSampleContainsId(kId2),
MediaSampleContainsId(kId3)))); MediaSampleContainsId(kId3))));
@ -658,12 +660,12 @@ TEST_F(WebVttToMp4HandlerTest, CrossSegmentSamples) {
// Gap, Sample, Segment // Gap, Sample, Segment
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kGap1Start, OnProcess(AllOf(IsMediaSample(kStreamIndex, kGap1Start,
kGapDuration, !kEncrypted), kGapDuration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1))))); Not(MediaSampleContainsId(kId1)))));
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
IsMediaSample(kStreamIndex, kSamplePart1Start, IsMediaSample(kStreamIndex, kSamplePart1Start,
kSamplePart1Duration, !kEncrypted), kSamplePart1Duration, !kEncrypted, _),
MediaSampleContainsId(kId1)))); MediaSampleContainsId(kId1))));
EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start, EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegment1Start,
@ -673,12 +675,12 @@ TEST_F(WebVttToMp4HandlerTest, CrossSegmentSamples) {
// Sample, Gap, Segment // Sample, Gap, Segment
EXPECT_CALL(*Out(), OnProcess(AllOf( EXPECT_CALL(*Out(), OnProcess(AllOf(
IsMediaSample(kStreamIndex, kSamplePart2Start, IsMediaSample(kStreamIndex, kSamplePart2Start,
kSamplePart2Duration, !kEncrypted), kSamplePart2Duration, !kEncrypted, _),
MediaSampleContainsId(kId1)))); MediaSampleContainsId(kId1))));
EXPECT_CALL(*Out(), EXPECT_CALL(*Out(),
OnProcess(AllOf(IsMediaSample(kStreamIndex, kGap2Start, OnProcess(AllOf(IsMediaSample(kStreamIndex, kGap2Start,
kGapDuration, !kEncrypted), kGapDuration, !kEncrypted, _),
Not(MediaSampleContainsId(kId1))))); Not(MediaSampleContainsId(kId1)))));
EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start, EXPECT_CALL(*Out(), OnProcess(IsSegmentInfo(kStreamIndex, kSegment2Start,