mirror of https://bitbucket.org/ausocean/av.git
revid: cleaned up code structure in mtsSender_test.go
This commit is contained in:
parent
ef5e43dac7
commit
8452d8f3d1
|
@ -116,11 +116,10 @@ func TestSegment(t *testing.T) {
|
||||||
mts.Meta = meta.New()
|
mts.Meta = meta.New()
|
||||||
|
|
||||||
// Create ringBuffer, sender, loadsender and the MPEGTS encoder.
|
// Create ringBuffer, sender, loadsender and the MPEGTS encoder.
|
||||||
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
|
||||||
tstSender := &sender{}
|
tstSender := &sender{}
|
||||||
loadSender := newMtsSender(tstSender, log)
|
loadSender := newMtsSender(tstSender, log)
|
||||||
packer := &tstPacker{rb: rb}
|
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
||||||
encoder := mts.NewEncoder(packer, 25)
|
encoder := mts.NewEncoder(&tstPacker{rb: rb}, 25)
|
||||||
|
|
||||||
// Turn time based PSI writing off for encoder.
|
// Turn time based PSI writing off for encoder.
|
||||||
const psiSendCount = 10
|
const psiSendCount = 10
|
||||||
|
@ -174,10 +173,8 @@ func TestSegment(t *testing.T) {
|
||||||
|
|
||||||
// Check that the clip data is okay.
|
// Check that the clip data is okay.
|
||||||
for i := 0; i < len(clip); i += mts.PacketSize {
|
for i := 0; i < len(clip); i += mts.PacketSize {
|
||||||
firstPkt := clip[i : i+mts.PacketSize]
|
copy(pkt[:], clip[i:i+mts.PacketSize])
|
||||||
copy(pkt[:], firstPkt)
|
if pkt.PID() == mts.VideoPid {
|
||||||
pid := pkt.PID()
|
|
||||||
if pid == mts.VideoPid {
|
|
||||||
payload, err := pkt.Payload()
|
payload, err := pkt.Payload()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected err: %v\n", err)
|
t.Fatalf("Unexpected err: %v\n", err)
|
||||||
|
@ -206,12 +203,11 @@ func TestSendFailDiscontinuity(t *testing.T) {
|
||||||
mts.Meta = meta.New()
|
mts.Meta = meta.New()
|
||||||
|
|
||||||
// Create ringBuffer sender, loadSender and the MPEGTS encoder.
|
// Create ringBuffer sender, loadSender and the MPEGTS encoder.
|
||||||
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
|
||||||
const clipWithDiscontinuity = 3
|
const clipWithDiscontinuity = 3
|
||||||
tstSender := &sender{testDiscontinuities: true, discontinuityAt: clipWithDiscontinuity}
|
tstSender := &sender{testDiscontinuities: true, discontinuityAt: clipWithDiscontinuity}
|
||||||
loadSender := newMtsSender(tstSender, log)
|
loadSender := newMtsSender(tstSender, log)
|
||||||
packer := tstPacker{rb: rb}
|
rb := ring.NewBuffer(rbSize, rbElementSize, wTimeout)
|
||||||
encoder := mts.NewEncoder(&packer, 25)
|
encoder := mts.NewEncoder(&tstPacker{rb: rb}, 25)
|
||||||
|
|
||||||
// Turn time based PSI writing off for encoder.
|
// Turn time based PSI writing off for encoder.
|
||||||
const psiSendCount = 10
|
const psiSendCount = 10
|
||||||
|
|
Loading…
Reference in New Issue