revid: improved code layout in mtsSender_test.go

This commit is contained in:
Saxon 2019-03-01 15:15:44 +10:30
parent 2570cb6ecb
commit ef5e43dac7
1 changed files with 4 additions and 0 deletions

View File

@ -114,6 +114,7 @@ func (p *tstPacker) Write(d []byte) (int, error) {
// based on positioning of PSI in the mtsEncoder's output stream.
func TestSegment(t *testing.T) {
mts.Meta = meta.New()
// Create ringBuffer, sender, loadsender and the MPEGTS encoder.
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
tstSender := &sender{}
@ -155,6 +156,7 @@ func TestSegment(t *testing.T) {
expectData := 0
for clipNo, clip := range result {
t.Logf("Checking clip: %v\n", clipNo)
// Check that the clip is of expected length.
clipLen := len(clip)
if clipLen != psiSendCount*mts.PacketSize {
@ -202,6 +204,7 @@ func TestSegment(t *testing.T) {
func TestSendFailDiscontinuity(t *testing.T) {
mts.Meta = meta.New()
// Create ringBuffer sender, loadSender and the MPEGTS encoder.
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
const clipWithDiscontinuity = 3
@ -244,6 +247,7 @@ func TestSendFailDiscontinuity(t *testing.T) {
if gotLen != expectedLen {
t.Errorf("We don't have one less clip as we should. Got: %v, want: %v\n", gotLen, expectedLen)
}
// Now check that the discontinuity indicator is set at the discontinuityClip PAT.
disconClip := result[clipWithDiscontinuity]
firstPkt := disconClip[:mts.PacketSize]