mirror of https://bitbucket.org/ausocean/av.git
revid: correct cc logic is discontinuity.go
This commit is contained in:
parent
819c9a784c
commit
ca0a008c59
|
@ -59,7 +59,6 @@ type testSender struct {
|
||||||
|
|
||||||
func (ts *testSender) send(d []byte) error {
|
func (ts *testSender) send(d []byte) error {
|
||||||
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
|
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
|
||||||
fmt.Println("SendFailed")
|
|
||||||
ts.curPktNo++
|
ts.curPktNo++
|
||||||
return errors.New("could not send")
|
return errors.New("could not send")
|
||||||
}
|
}
|
||||||
|
@ -135,7 +134,6 @@ func TestSegment(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unexpected err: %v\n", err)
|
t.Fatalf("Unexpected err: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSender.release()
|
loadSender.release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,9 @@ LICENSE
|
||||||
|
|
||||||
package mts
|
package mts
|
||||||
|
|
||||||
import "github.com/Comcast/gots/packet"
|
import (
|
||||||
|
"github.com/Comcast/gots/packet"
|
||||||
|
)
|
||||||
|
|
||||||
// discontinuityRepairer provides function to detect discontinuities in mpegts
|
// discontinuityRepairer provides function to detect discontinuities in mpegts
|
||||||
// and set the discontinuity indicator as appropriate.
|
// and set the discontinuity indicator as appropriate.
|
||||||
|
@ -66,11 +68,8 @@ func (dr *DiscontinuityRepairer) Repair(d []byte) error {
|
||||||
panic("Clip to repair must have PAT first")
|
panic("Clip to repair must have PAT first")
|
||||||
}
|
}
|
||||||
cc := p.ContinuityCounter()
|
cc := p.ContinuityCounter()
|
||||||
expect, exists := dr.ExpectedCC(pid)
|
expect, _ := dr.ExpectedCC(pid)
|
||||||
dr.IncExpectedCC(pid)
|
if cc != int(expect) {
|
||||||
if !exists {
|
|
||||||
dr.SetExpectedCC(pid, cc)
|
|
||||||
} else if cc != int(expect) {
|
|
||||||
if packet.ContainsAdaptationField(p) {
|
if packet.ContainsAdaptationField(p) {
|
||||||
(*packet.AdaptationField)(p).SetDiscontinuity(true)
|
(*packet.AdaptationField)(p).SetDiscontinuity(true)
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,6 +81,7 @@ func (dr *DiscontinuityRepairer) Repair(d []byte) error {
|
||||||
dr.SetExpectedCC(pid, cc)
|
dr.SetExpectedCC(pid, cc)
|
||||||
copy(d[:PacketSize], pkt[:])
|
copy(d[:PacketSize], pkt[:])
|
||||||
}
|
}
|
||||||
|
dr.IncExpectedCC(pid)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue