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.SetOutputChan(make(chan []byte, outChanSize))
|
||||||
parser.Start()
|
parser.Start()
|
||||||
|
|
||||||
count := 0
|
for i, n := 0, 0; n <= nOfFrames; i++ {
|
||||||
for i := range data {
|
|
||||||
// If we have a whole frame, write it to a file for inspection otherwise do
|
|
||||||
// nothing
|
|
||||||
select {
|
select {
|
||||||
case parser.InputChan() <- data[i]:
|
case parser.InputChan() <- data[i]:
|
||||||
case frame := <-parser.OutputChan():
|
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 {
|
if err != nil {
|
||||||
t.Errorf("Should not have got error creating output file!")
|
t.Errorf("Should not have got error creating output file!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
outputFile.Write(frame)
|
outputFile.Write(frame)
|
||||||
outputFile.Close()
|
outputFile.Close()
|
||||||
count++
|
n++
|
||||||
if count > nOfFrames {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue