Removed redundant else, to further abide by go style standards

This commit is contained in:
Saxon1 2017-12-03 02:45:33 +10:30
parent 9b779382eb
commit 98cd4ff9ac
1 changed files with 23 additions and 24 deletions

View File

@ -264,33 +264,32 @@ func input(input string, output string) {
if clip, err := ringBuffer.Get(); err != nil {
inputErrChan <- err
return
} else {
for {
upperBound := clipSize+mp2tPacketSize
_, err := io.ReadFull(br, clip[clipSize:upperBound])
if err != nil {
}
for {
upperBound := clipSize+mp2tPacketSize
_, err := io.ReadFull(br, clip[clipSize:upperBound])
if err != nil {
inputErrChan <- err
return
}
if *flags&filterFixContinuity != 0 && mp2tFixContinuity(clip[clipsSize:upperBound], packetCount, uint16(*selectedPID)) {
fmt.Printf("Packet #%d.%d fixed\n", clipCount, packetCount)
}
packetCount++
clipSize += mp2tPacketSize
// send if (1) our buffer is full or (2) 1 second has elapsed and we have % packetsPerFrame
now = time.Now()
if (packetCount == mp2tMaxPackets) ||
(now.Sub(prevTime) > clipDuration*time.Second && packetCount%packetsPerFrame == 0) {
clipCount++
if err := ringBuffer.DoneWriting(clipSize); err != nil {
inputErrChan <- err
return
}
if *flags&filterFixContinuity != 0 && mp2tFixContinuity(clip[clipsSize:upperBound], packetCount, uint16(*selectedPID)) {
fmt.Printf("Packet #%d.%d fixed\n", clipCount, packetCount)
}
packetCount++
clipSize += mp2tPacketSize
// send if (1) our buffer is full or (2) 1 second has elapsed and we have % packetsPerFrame
now = time.Now()
if (packetCount == mp2tMaxPackets) ||
(now.Sub(prevTime) > clipDuration*time.Second && packetCount%packetsPerFrame == 0) {
clipCount++
if err := ringBuffer.DoneWriting(clipSize); err != nil {
inputErrChan <- err
return
}
clipSize = 0
packetCount = 0
prevTime = now
break
}
clipSize = 0
packetCount = 0
prevTime = now
break
}
}
}