stream/mts: fixed logic regarding psi writing frequency

This commit is contained in:
Saxon 2019-02-28 18:19:06 +10:30
parent 651e4d892a
commit 31025a114a
1 changed files with 1 additions and 1 deletions

View File

@ -178,7 +178,7 @@ func (e *Encoder) TimeBasedPsi(b bool, sendCount int) {
// sending them to the output channel. // sending them to the output channel.
func (e *Encoder) Encode(nalu []byte) error { func (e *Encoder) Encode(nalu []byte) error {
now := time.Now() now := time.Now()
if (e.timeBasedPsi && (now.Sub(e.psiLastTime) > psiInterval)) || e.pktCount >= e.psiSendCount { if (e.timeBasedPsi && (now.Sub(e.psiLastTime) > psiInterval)) || (!e.timeBasedPsi && (e.pktCount >= e.psiSendCount)) {
e.pktCount = 0 e.pktCount = 0
err := e.writePSI() err := e.writePSI()
if err != nil { if err != nil {