mirror of https://bitbucket.org/ausocean/av.git
revid: sender interface renamed to Sender and tstSender in mtsSender_test.go renamed to sender
This commit is contained in:
parent
91d21f1da8
commit
74110dee31
|
@ -51,14 +51,14 @@ const (
|
||||||
rTimeout = 10 * time.Millisecond
|
rTimeout = 10 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
type testSender struct {
|
type sender struct {
|
||||||
Buf [][]byte
|
Buf [][]byte
|
||||||
tstDiscon bool
|
tstDiscon bool
|
||||||
disconAt int
|
disconAt int
|
||||||
curPktNo int
|
curPktNo int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *testSender) send(d []byte) error {
|
func (ts *sender) send(d []byte) error {
|
||||||
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
|
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
|
||||||
ts.curPktNo++
|
ts.curPktNo++
|
||||||
return errors.New("could not send")
|
return errors.New("could not send")
|
||||||
|
@ -105,7 +105,7 @@ func TestSegment(t *testing.T) {
|
||||||
mts.Meta = meta.New()
|
mts.Meta = meta.New()
|
||||||
// Create ringbuffer tst sender, loadsender and the mpegts encoder
|
// Create ringbuffer tst sender, loadsender and the mpegts encoder
|
||||||
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
||||||
tstSender := &testSender{}
|
tstSender := &sender{}
|
||||||
loadSender := newMtsSender(tstSender, log)
|
loadSender := newMtsSender(tstSender, log)
|
||||||
packer := &tstPacker{rb: rb}
|
packer := &tstPacker{rb: rb}
|
||||||
encoder := mts.NewEncoder(packer, 25)
|
encoder := mts.NewEncoder(packer, 25)
|
||||||
|
@ -195,7 +195,7 @@ func TestSendFailDiscontinuity(t *testing.T) {
|
||||||
// Create ringbuffer tst sender, loadsender and the mpegts encoder
|
// Create ringbuffer tst sender, loadsender and the mpegts encoder
|
||||||
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
||||||
const disconClipNo = 3
|
const disconClipNo = 3
|
||||||
tstSender := &testSender{tstDiscon: true, disconAt: disconClipNo}
|
tstSender := &sender{tstDiscon: true, disconAt: disconClipNo}
|
||||||
loadSender := newMtsSender(tstSender, log)
|
loadSender := newMtsSender(tstSender, log)
|
||||||
packer := tstPacker{rb: rb}
|
packer := tstPacker{rb: rb}
|
||||||
encoder := mts.NewEncoder(&packer, 25)
|
encoder := mts.NewEncoder(&packer, 25)
|
||||||
|
|
|
@ -45,7 +45,7 @@ import (
|
||||||
"github.com/Comcast/gots/packet"
|
"github.com/Comcast/gots/packet"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sender interface {
|
type Sender interface {
|
||||||
send(d []byte) error
|
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
|
// clips based on PSI. It also fixes accounts for discontinuities by setting
|
||||||
// the discontinuity indicator for the first packet of a clip.
|
// the discontinuity indicator for the first packet of a clip.
|
||||||
type mtsSender struct {
|
type mtsSender struct {
|
||||||
sender sender
|
sender Sender
|
||||||
buf []byte
|
buf []byte
|
||||||
next []byte
|
next []byte
|
||||||
pkt [mts.PacketSize]byte
|
pkt [mts.PacketSize]byte
|
||||||
|
@ -144,7 +144,7 @@ type mtsSender struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// newmtsSender returns a new mtsSender.
|
// 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{
|
return &mtsSender{
|
||||||
sender: s,
|
sender: s,
|
||||||
repairer: mts.NewDiscontinuityRepairer(),
|
repairer: mts.NewDiscontinuityRepairer(),
|
||||||
|
|
Loading…
Reference in New Issue