diff --git a/revid/mtsSender_test.go b/revid/mtsSender_test.go index f600a664..eebb957a 100644 --- a/revid/mtsSender_test.go +++ b/revid/mtsSender_test.go @@ -116,11 +116,10 @@ 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{} loadSender := newMtsSender(tstSender, log) - packer := &tstPacker{rb: rb} - encoder := mts.NewEncoder(packer, 25) + rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout) + encoder := mts.NewEncoder(&tstPacker{rb: rb}, 25) // Turn time based PSI writing off for encoder. const psiSendCount = 10 @@ -174,10 +173,8 @@ func TestSegment(t *testing.T) { // Check that the clip data is okay. for i := 0; i < len(clip); i += mts.PacketSize { - firstPkt := clip[i : i+mts.PacketSize] - copy(pkt[:], firstPkt) - pid := pkt.PID() - if pid == mts.VideoPid { + copy(pkt[:], clip[i:i+mts.PacketSize]) + if pkt.PID() == mts.VideoPid { payload, err := pkt.Payload() if err != nil { t.Fatalf("Unexpected err: %v\n", err) @@ -206,12 +203,11 @@ 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 tstSender := &sender{testDiscontinuities: true, discontinuityAt: clipWithDiscontinuity} loadSender := newMtsSender(tstSender, log) - packer := tstPacker{rb: rb} - encoder := mts.NewEncoder(&packer, 25) + rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout) + encoder := mts.NewEncoder(&tstPacker{rb: rb}, 25) // Turn time based PSI writing off for encoder. const psiSendCount = 10