mirror of https://bitbucket.org/ausocean/av.git
Using n instead of count, and also simplified code
This commit is contained in:
parent
b3a57557e2
commit
b59e756d53
|
@ -64,24 +64,18 @@ func TestH264Parser(t *testing.T) {
|
|||
parser.SetOutputChan(make(chan []byte, outChanSize))
|
||||
parser.Start()
|
||||
|
||||
count := 0
|
||||
for i := range data {
|
||||
// If we have a whole frame, write it to a file for inspection otherwise do
|
||||
// nothing
|
||||
for i, n := 0, 0; n <= nOfFrames; i++ {
|
||||
select {
|
||||
case parser.InputChan() <- data[i]:
|
||||
case frame := <-parser.OutputChan():
|
||||
outputFile, err := os.Create("testOutput/" + strconv.Itoa(count) + ".h264_frame")
|
||||
outputFile, err := os.Create("testOutput/" + strconv.Itoa(n) + ".h264_frame")
|
||||
if err != nil {
|
||||
t.Errorf("Should not have got error creating output file!")
|
||||
return
|
||||
}
|
||||
outputFile.Write(frame)
|
||||
outputFile.Close()
|
||||
count++
|
||||
if count > nOfFrames {
|
||||
return
|
||||
}
|
||||
n++
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue