revid: sender interface renamed to Sender and tstSender in mtsSender_test.go renamed to sender

This commit is contained in:
Saxon 2019-03-01 10:16:54 +10:30
parent 91d21f1da8
commit 74110dee31
2 changed files with 7 additions and 7 deletions

View File

@ -51,14 +51,14 @@ const (
rTimeout = 10 * time.Millisecond
)
type testSender struct {
type sender struct {
Buf [][]byte
tstDiscon bool
disconAt int
curPktNo int
}
func (ts *testSender) send(d []byte) error {
func (ts *sender) send(d []byte) error {
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
ts.curPktNo++
return errors.New("could not send")
@ -105,7 +105,7 @@ func TestSegment(t *testing.T) {
mts.Meta = meta.New()
// Create ringbuffer tst sender, loadsender and the mpegts encoder
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
tstSender := &testSender{}
tstSender := &sender{}
loadSender := newMtsSender(tstSender, log)
packer := &tstPacker{rb: rb}
encoder := mts.NewEncoder(packer, 25)
@ -195,7 +195,7 @@ func TestSendFailDiscontinuity(t *testing.T) {
// Create ringbuffer tst sender, loadsender and the mpegts encoder
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
const disconClipNo = 3
tstSender := &testSender{tstDiscon: true, disconAt: disconClipNo}
tstSender := &sender{tstDiscon: true, disconAt: disconClipNo}
loadSender := newMtsSender(tstSender, log)
packer := tstPacker{rb: rb}
encoder := mts.NewEncoder(&packer, 25)

View File

@ -45,7 +45,7 @@ import (
"github.com/Comcast/gots/packet"
)
type sender interface {
type Sender interface {
send(d []byte) error
}
@ -132,7 +132,7 @@ func (s *fileSender) close() error {
// clips based on PSI. It also fixes accounts for discontinuities by setting
// the discontinuity indicator for the first packet of a clip.
type mtsSender struct {
sender sender
sender Sender
buf []byte
next []byte
pkt [mts.PacketSize]byte
@ -144,7 +144,7 @@ type mtsSender struct {
}
// newmtsSender returns a new mtsSender.
func newMtsSender(s sender, log func(lvl int8, msg string, args ...interface{})) *mtsSender {
func newMtsSender(s Sender, log func(lvl int8, msg string, args ...interface{})) *mtsSender {
return &mtsSender{
sender: s,
repairer: mts.NewDiscontinuityRepairer(),