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 {
|
||||
if ts.tstDiscon && ts.curPktNo == ts.disconAt {
|
||||
fmt.Println("SendFailed")
|
||||
ts.curPktNo++
|
||||
return errors.New("could not send")
|
||||
}
|
||||
|
@ -135,7 +134,6 @@ func TestSegment(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Unexpected err: %v\n", err)
|
||||
}
|
||||
|
||||
loadSender.release()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ LICENSE
|
|||
|
||||
package mts
|
||||
|
||||
import "github.com/Comcast/gots/packet"
|
||||
import (
|
||||
"github.com/Comcast/gots/packet"
|
||||
)
|
||||
|
||||
// discontinuityRepairer provides function to detect discontinuities in mpegts
|
||||
// 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")
|
||||
}
|
||||
cc := p.ContinuityCounter()
|
||||
expect, exists := dr.ExpectedCC(pid)
|
||||
dr.IncExpectedCC(pid)
|
||||
if !exists {
|
||||
dr.SetExpectedCC(pid, cc)
|
||||
} else if cc != int(expect) {
|
||||
expect, _ := dr.ExpectedCC(pid)
|
||||
if cc != int(expect) {
|
||||
if packet.ContainsAdaptationField(p) {
|
||||
(*packet.AdaptationField)(p).SetDiscontinuity(true)
|
||||
} else {
|
||||
|
@ -82,6 +81,7 @@ func (dr *DiscontinuityRepairer) Repair(d []byte) error {
|
|||
dr.SetExpectedCC(pid, cc)
|
||||
copy(d[:PacketSize], pkt[:])
|
||||
}
|
||||
dr.IncExpectedCC(pid)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue