2019-02-15 18:10:35 +03:00
|
|
|
/*
|
|
|
|
NAME
|
|
|
|
mtsSender_test.go
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
mtsSender_test.go contains tests that validate the functionalilty of the
|
|
|
|
mtsSender under senders.go. Tests include checks that the mtsSender is
|
|
|
|
segmenting sends correctly, and also that it can correct discontinuities.
|
|
|
|
|
|
|
|
AUTHORS
|
|
|
|
Saxon A. Nelson-Milton <saxon@ausocean.org>
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
mtsSender_test.go is Copyright (C) 2017-2019 the Australian Ocean Lab (AusOcean)
|
|
|
|
|
|
|
|
It is free software: you can redistribute it and/or modify them
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2019-03-01 02:32:43 +03:00
|
|
|
in gpl.txt. If not, see http://www.gnu.org/licenses.
|
2019-02-15 18:10:35 +03:00
|
|
|
*/
|
|
|
|
package revid
|
|
|
|
|
2019-02-16 09:03:39 +03:00
|
|
|
import (
|
2019-02-16 20:05:59 +03:00
|
|
|
"errors"
|
2019-02-16 09:03:39 +03:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2019-03-01 02:33:39 +03:00
|
|
|
"github.com/Comcast/gots/packet"
|
|
|
|
"github.com/Comcast/gots/pes"
|
|
|
|
|
2019-03-25 04:21:03 +03:00
|
|
|
"bitbucket.org/ausocean/av/container/mts"
|
|
|
|
"bitbucket.org/ausocean/av/container/mts/meta"
|
2019-02-16 09:03:39 +03:00
|
|
|
"bitbucket.org/ausocean/utils/logger"
|
2020-01-08 15:20:29 +03:00
|
|
|
"bitbucket.org/ausocean/utils/vring"
|
2019-02-16 09:03:39 +03:00
|
|
|
)
|
|
|
|
|
2019-03-12 09:38:36 +03:00
|
|
|
var (
|
|
|
|
errSendFailed = errors.New("send failed")
|
|
|
|
)
|
|
|
|
|
2020-01-09 06:28:44 +03:00
|
|
|
// Ring buffer parameters.
|
2020-01-08 15:20:29 +03:00
|
|
|
const (
|
2020-01-09 06:28:44 +03:00
|
|
|
rbMaxElements = 10000
|
|
|
|
rbCapacity = 200000000 // bytes
|
|
|
|
rbWriteTimeout = 5
|
2020-01-08 15:20:29 +03:00
|
|
|
)
|
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// destination simulates a destination for the mtsSender. It allows for the
|
|
|
|
// emulation of failed and delayed sends.
|
2019-04-01 04:32:15 +03:00
|
|
|
type destination struct {
|
2019-04-18 10:25:48 +03:00
|
|
|
// Holds the clips written to this destination using Write.
|
|
|
|
buf [][]byte
|
|
|
|
|
|
|
|
// testFails is set to true if we would like a write to fail at a particular
|
|
|
|
// clip as determined by failAt.
|
|
|
|
testFails bool
|
|
|
|
failAt int
|
|
|
|
|
|
|
|
// Holds the current clip number.
|
2019-04-15 03:55:35 +03:00
|
|
|
currentClip int
|
2019-04-18 10:25:48 +03:00
|
|
|
|
|
|
|
// Pointer to the testing.T of a test where this struct is being used. This
|
|
|
|
// is used so that logging can be done through the testing log utilities.
|
|
|
|
t *testing.T
|
|
|
|
|
|
|
|
// sendDelay is the amount of time we would like a Write to be delayed when
|
|
|
|
// we hit the clip number indicated by delayAt.
|
|
|
|
sendDelay time.Duration
|
|
|
|
delayAt int
|
|
|
|
|
|
|
|
// done will be used to send a signal to the main routine to indicate that
|
|
|
|
// the destination has received all clips. doneAt indicates the final clip
|
|
|
|
// number.
|
|
|
|
done chan struct{}
|
|
|
|
doneAt int
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
|
|
|
|
2019-04-01 04:32:15 +03:00
|
|
|
func (ts *destination) Write(d []byte) (int, error) {
|
2019-04-08 12:32:42 +03:00
|
|
|
ts.t.Log("writing clip to destination")
|
2019-04-15 03:55:35 +03:00
|
|
|
if ts.delayAt != 0 && ts.currentClip == ts.delayAt {
|
2019-04-08 12:32:42 +03:00
|
|
|
time.Sleep(ts.sendDelay)
|
|
|
|
}
|
2019-04-15 03:55:35 +03:00
|
|
|
if ts.testFails && ts.currentClip == ts.failAt {
|
2019-04-08 12:32:42 +03:00
|
|
|
ts.t.Log("failed send")
|
2019-04-15 03:55:35 +03:00
|
|
|
ts.currentClip++
|
2019-04-01 04:32:15 +03:00
|
|
|
return 0, errSendFailed
|
2019-02-16 17:01:30 +03:00
|
|
|
}
|
2019-02-16 20:05:59 +03:00
|
|
|
cpy := make([]byte, len(d))
|
|
|
|
copy(cpy, d)
|
2019-03-01 03:41:20 +03:00
|
|
|
ts.buf = append(ts.buf, cpy)
|
2019-04-15 03:55:35 +03:00
|
|
|
if ts.currentClip == ts.doneAt {
|
|
|
|
close(ts.done)
|
|
|
|
}
|
|
|
|
ts.currentClip++
|
2019-04-01 04:32:15 +03:00
|
|
|
return len(d), nil
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
func (ts *destination) Close() error { return nil }
|
|
|
|
|
|
|
|
// dummyLogger will allow logging to be done by the testing pkg.
|
|
|
|
type dummyLogger testing.T
|
|
|
|
|
2019-04-13 14:11:47 +03:00
|
|
|
func (dl *dummyLogger) log(lvl int8, msg string, args ...interface{}) {
|
2019-02-16 09:03:39 +03:00
|
|
|
var l string
|
|
|
|
switch lvl {
|
|
|
|
case logger.Warning:
|
|
|
|
l = "warning"
|
|
|
|
case logger.Debug:
|
|
|
|
l = "debug"
|
|
|
|
case logger.Info:
|
|
|
|
l = "info"
|
|
|
|
case logger.Error:
|
|
|
|
l = "error"
|
|
|
|
case logger.Fatal:
|
|
|
|
l = "fatal"
|
|
|
|
}
|
|
|
|
msg = l + ": " + msg
|
|
|
|
for i := 0; i < len(args); i++ {
|
|
|
|
msg += " %v"
|
|
|
|
}
|
2019-04-08 12:32:42 +03:00
|
|
|
if len(args) == 0 {
|
|
|
|
dl.Log(msg + "\n")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
dl.Logf(msg+"\n", args)
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// TestSegment ensures that the mtsSender correctly segments data into clips
|
|
|
|
// based on positioning of PSI in the mtsEncoder's output stream.
|
2019-03-12 08:52:11 +03:00
|
|
|
func TestMtsSenderSegment(t *testing.T) {
|
2019-02-16 16:22:40 +03:00
|
|
|
mts.Meta = meta.New()
|
2019-03-01 07:45:44 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Create ringBuffer, sender, sender and the MPEGTS encoder.
|
2019-04-15 03:55:35 +03:00
|
|
|
const numberOfClips = 11
|
2019-04-18 10:25:48 +03:00
|
|
|
dst := &destination{t: t, done: make(chan struct{}), doneAt: numberOfClips}
|
2020-01-09 06:28:44 +03:00
|
|
|
rb, err := vring.NewBuffer(rbMaxElements, rbCapacity, 0)
|
2020-01-08 15:20:29 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not initialise ring buffer: %v", err)
|
|
|
|
}
|
|
|
|
sender := newMtsSender(dst, (*dummyLogger)(t).log, rb, 0)
|
2019-02-16 09:03:39 +03:00
|
|
|
|
|
|
|
const psiSendCount = 10
|
2019-09-24 01:12:26 +03:00
|
|
|
encoder, err := mts.NewEncoder(sender, 25, mts.EncodeH264, mts.PacketBasedPSI(psiSendCount))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not create MTS encoder, failed with error: %v", err)
|
|
|
|
}
|
2019-02-16 09:03:39 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Write the packets to the encoder, which will in turn write to the mtsSender.
|
|
|
|
// Payload will just be packet number.
|
|
|
|
t.Log("writing packets")
|
2019-02-16 09:03:39 +03:00
|
|
|
const noOfPacketsToWrite = 100
|
|
|
|
for i := 0; i < noOfPacketsToWrite; i++ {
|
2019-03-10 05:30:58 +03:00
|
|
|
encoder.Write([]byte{byte(i)})
|
2019-04-08 12:32:42 +03:00
|
|
|
}
|
2019-02-16 09:03:39 +03:00
|
|
|
|
2019-04-15 03:55:35 +03:00
|
|
|
// Wait until the destination has all the data, then close the sender.
|
2019-04-18 10:25:48 +03:00
|
|
|
<-dst.done
|
2019-04-08 12:32:42 +03:00
|
|
|
sender.Close()
|
2019-02-16 09:03:39 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Check the data.
|
2019-04-18 10:25:48 +03:00
|
|
|
result := dst.buf
|
2019-04-08 12:32:42 +03:00
|
|
|
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 {
|
|
|
|
t.Fatalf("Clip %v is not correct length. Got: %v Want: %v\n Clip: %v\n", clipNo, clipLen, psiSendCount*mts.PacketSize, clip)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Also check that the first packet is a PAT.
|
|
|
|
firstPkt := clip[:mts.PacketSize]
|
|
|
|
var pkt packet.Packet
|
|
|
|
copy(pkt[:], firstPkt)
|
|
|
|
pid := pkt.PID()
|
|
|
|
if pid != mts.PatPid {
|
|
|
|
t.Fatalf("First packet of clip %v is not pat, but rather: %v\n", clipNo, pid)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the clip data is okay.
|
|
|
|
t.Log("checking clip data")
|
|
|
|
for i := 0; i < len(clip); i += mts.PacketSize {
|
|
|
|
copy(pkt[:], clip[i:i+mts.PacketSize])
|
|
|
|
if pkt.PID() == mts.VideoPid {
|
|
|
|
t.Log("got video PID")
|
|
|
|
payload, err := pkt.Payload()
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Unexpected err: %v\n", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse PES from the MTS payload.
|
|
|
|
pes, err := pes.NewPESHeader(payload)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Unexpected err: %v\n", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the data from the PES packet and convert to an int.
|
|
|
|
data := int8(pes.Data()[0])
|
|
|
|
|
|
|
|
// Calc expected data in the PES and then check.
|
|
|
|
if data != int8(expectData) {
|
|
|
|
t.Errorf("Did not get expected pkt data. ClipNo: %v, pktNoInClip: %v, Got: %v, want: %v\n", clipNo, i/mts.PacketSize, data, expectData)
|
|
|
|
}
|
|
|
|
expectData++
|
2019-02-16 20:05:59 +03:00
|
|
|
}
|
|
|
|
}
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
2019-04-08 12:32:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// TestMtsSenderFailedSend checks that a failed send is correctly handled by
|
|
|
|
// the mtsSender. The mtsSender should try to send the same clip again.
|
|
|
|
func TestMtsSenderFailedSend(t *testing.T) {
|
|
|
|
mts.Meta = meta.New()
|
|
|
|
|
|
|
|
// Create destination, the mtsSender and the mtsEncoder
|
|
|
|
const clipToFailAt = 3
|
2019-04-18 12:01:49 +03:00
|
|
|
dst := &destination{t: t, testFails: true, failAt: clipToFailAt, done: make(chan struct{})}
|
2020-03-27 16:08:03 +03:00
|
|
|
rb, err := vring.NewBuffer(rbMaxElements, rbCapacity, 10*time.Millisecond)
|
2020-01-08 15:20:29 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not initialise ring buffer: %v", err)
|
|
|
|
}
|
|
|
|
sender := newMtsSender(dst, (*dummyLogger)(t).log, rb, 0)
|
2019-04-08 12:32:42 +03:00
|
|
|
|
|
|
|
const psiSendCount = 10
|
2019-09-24 01:12:26 +03:00
|
|
|
encoder, err := mts.NewEncoder(sender, 25, mts.EncodeH264, mts.PacketBasedPSI(psiSendCount))
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not create MTS encoder, failed with error: %v", err)
|
|
|
|
}
|
2019-04-08 12:32:42 +03:00
|
|
|
|
|
|
|
// Write the packets to the encoder, which will in turn write to the mtsSender.
|
|
|
|
// Payload will just be packet number.
|
|
|
|
t.Log("writing packets")
|
|
|
|
const noOfPacketsToWrite = 100
|
|
|
|
for i := 0; i < noOfPacketsToWrite; i++ {
|
|
|
|
encoder.Write([]byte{byte(i)})
|
|
|
|
}
|
|
|
|
|
2019-04-15 03:55:35 +03:00
|
|
|
// Wait until the destination has all the data, then close the sender.
|
2019-04-18 12:01:49 +03:00
|
|
|
<-dst.done
|
2019-04-08 12:32:42 +03:00
|
|
|
sender.Close()
|
2019-02-16 09:03:39 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Check that we have data as expected.
|
2019-04-18 12:01:49 +03:00
|
|
|
result := dst.buf
|
2019-02-16 20:05:59 +03:00
|
|
|
expectData := 0
|
2019-02-16 09:03:39 +03:00
|
|
|
for clipNo, clip := range result {
|
2019-02-16 22:02:44 +03:00
|
|
|
t.Logf("Checking clip: %v\n", clipNo)
|
2019-03-01 07:45:44 +03:00
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Check that the clip is of expected length.
|
2019-02-16 09:03:39 +03:00
|
|
|
clipLen := len(clip)
|
2019-02-16 20:05:59 +03:00
|
|
|
if clipLen != psiSendCount*mts.PacketSize {
|
2019-02-16 16:22:40 +03:00
|
|
|
t.Fatalf("Clip %v is not correct length. Got: %v Want: %v\n Clip: %v\n", clipNo, clipLen, psiSendCount*mts.PacketSize, clip)
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Also check that the first packet is a PAT.
|
2019-02-16 09:03:39 +03:00
|
|
|
firstPkt := clip[:mts.PacketSize]
|
2019-03-01 07:18:26 +03:00
|
|
|
var pkt packet.Packet
|
2019-02-16 09:03:39 +03:00
|
|
|
copy(pkt[:], firstPkt)
|
2019-03-01 07:18:26 +03:00
|
|
|
pid := pkt.PID()
|
2019-02-16 09:03:39 +03:00
|
|
|
if pid != mts.PatPid {
|
2019-02-16 17:01:30 +03:00
|
|
|
t.Fatalf("First packet of clip %v is not pat, but rather: %v\n", clipNo, pid)
|
|
|
|
}
|
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Check that the clip data is okay.
|
2019-04-08 12:32:42 +03:00
|
|
|
t.Log("checking clip data")
|
2019-02-16 17:01:30 +03:00
|
|
|
for i := 0; i < len(clip); i += mts.PacketSize {
|
2019-03-01 07:58:40 +03:00
|
|
|
copy(pkt[:], clip[i:i+mts.PacketSize])
|
|
|
|
if pkt.PID() == mts.VideoPid {
|
2019-04-08 12:32:42 +03:00
|
|
|
t.Log("got video PID")
|
2019-03-01 07:18:26 +03:00
|
|
|
payload, err := pkt.Payload()
|
2019-02-16 17:01:30 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Unexpected err: %v\n", err)
|
|
|
|
}
|
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Parse PES from the MTS payload.
|
2019-02-16 17:01:30 +03:00
|
|
|
pes, err := pes.NewPESHeader(payload)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Unexpected err: %v\n", err)
|
|
|
|
}
|
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Get the data from the PES packet and convert to an int.
|
2019-02-16 20:05:59 +03:00
|
|
|
data := int8(pes.Data()[0])
|
2019-02-16 17:01:30 +03:00
|
|
|
|
2019-03-01 05:58:34 +03:00
|
|
|
// Calc expected data in the PES and then check.
|
2019-02-16 20:05:59 +03:00
|
|
|
if data != int8(expectData) {
|
|
|
|
t.Errorf("Did not get expected pkt data. ClipNo: %v, pktNoInClip: %v, Got: %v, want: %v\n", clipNo, i/mts.PacketSize, data, expectData)
|
2019-02-16 17:01:30 +03:00
|
|
|
}
|
2019-02-16 20:05:59 +03:00
|
|
|
expectData++
|
2019-02-16 17:01:30 +03:00
|
|
|
}
|
2019-02-16 09:03:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-15 18:10:35 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// TestMtsSenderDiscontinuity checks that a discontinuity in a stream is
|
|
|
|
// correctly handled by the mtsSender. A discontinuity is caused by overflowing
|
|
|
|
// the mtsSender's ringBuffer. It is expected that the next clip seen has the
|
|
|
|
// disconinuity indicator applied.
|
2019-03-12 08:52:11 +03:00
|
|
|
func TestMtsSenderDiscontinuity(t *testing.T) {
|
2019-02-16 17:01:30 +03:00
|
|
|
mts.Meta = meta.New()
|
2019-03-01 07:45:44 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Create destination, the mtsSender and the mtsEncoder.
|
|
|
|
const clipToDelay = 3
|
2019-04-18 12:01:49 +03:00
|
|
|
dst := &destination{t: t, sendDelay: 10 * time.Millisecond, delayAt: clipToDelay, done: make(chan struct{})}
|
2020-01-09 06:28:44 +03:00
|
|
|
rb, err := vring.NewBuffer(1, rbCapacity, 0)
|
2020-01-08 15:20:29 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not initialise ring buffer: %v", err)
|
|
|
|
}
|
|
|
|
sender := newMtsSender(dst, (*dummyLogger)(t).log, rb, 0)
|
2019-02-16 17:01:30 +03:00
|
|
|
|
|
|
|
const psiSendCount = 10
|
2019-10-01 14:17:03 +03:00
|
|
|
encoder, err := mts.NewEncoder(sender, 25, mts.EncodeH264, mts.PacketBasedPSI(psiSendCount))
|
2019-09-24 01:12:26 +03:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("could not create MTS encoder, failed with error: %v", err)
|
|
|
|
}
|
2019-02-16 17:01:30 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Write the packets to the encoder, which will in turn write to the mtsSender.
|
|
|
|
// Payload will just be packet number.
|
2019-02-16 17:01:30 +03:00
|
|
|
const noOfPacketsToWrite = 100
|
|
|
|
for i := 0; i < noOfPacketsToWrite; i++ {
|
2019-03-10 05:30:58 +03:00
|
|
|
encoder.Write([]byte{byte(i)})
|
2019-02-16 17:01:30 +03:00
|
|
|
}
|
|
|
|
|
2019-04-15 03:55:35 +03:00
|
|
|
// Wait until the destination has all the data, then close the sender.
|
2019-04-18 12:01:49 +03:00
|
|
|
<-dst.done
|
2019-04-08 12:32:42 +03:00
|
|
|
sender.Close()
|
|
|
|
|
|
|
|
// Check the data.
|
2019-04-18 12:01:49 +03:00
|
|
|
result := dst.buf
|
2019-04-08 12:32:42 +03:00
|
|
|
expectedCC := 0
|
|
|
|
for clipNo, clip := range result {
|
|
|
|
t.Logf("Checking clip: %v\n", clipNo)
|
2019-02-16 17:01:30 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Check that the clip is of expected length.
|
|
|
|
clipLen := len(clip)
|
|
|
|
if clipLen != psiSendCount*mts.PacketSize {
|
|
|
|
t.Fatalf("Clip %v is not correct length. Got: %v Want: %v\n Clip: %v\n", clipNo, clipLen, psiSendCount*mts.PacketSize, clip)
|
|
|
|
}
|
2019-03-01 07:45:44 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Also check that the first packet is a PAT.
|
|
|
|
firstPkt := clip[:mts.PacketSize]
|
|
|
|
var pkt packet.Packet
|
|
|
|
copy(pkt[:], firstPkt)
|
|
|
|
pid := pkt.PID()
|
|
|
|
if pid != mts.PatPid {
|
|
|
|
t.Fatalf("First packet of clip %v is not pat, but rather: %v\n", clipNo, pid)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the discontinuity indicator
|
|
|
|
discon, _ := (*packet.AdaptationField)(&pkt).Discontinuity()
|
2019-02-16 17:01:30 +03:00
|
|
|
|
2019-04-08 12:32:42 +03:00
|
|
|
// Check the continuity counter.
|
|
|
|
cc := pkt.ContinuityCounter()
|
|
|
|
if cc != expectedCC {
|
|
|
|
t.Log("discontinuity found")
|
|
|
|
expectedCC = cc
|
|
|
|
if !discon {
|
|
|
|
t.Errorf("discontinuity indicator not set where expected for clip: %v", clipNo)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if discon && clipNo != 0 {
|
|
|
|
t.Errorf("did not expect discontinuity indicator to be set for clip: %v", clipNo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectedCC = (expectedCC + 1) & 0xf
|
2019-02-16 17:01:30 +03:00
|
|
|
}
|
2019-02-15 18:10:35 +03:00
|
|
|
}
|