mirror of https://bitbucket.org/ausocean/av.git
Fixed up comments
This commit is contained in:
parent
94f8ffb361
commit
93ad5ed247
|
@ -1,15 +1,16 @@
|
||||||
/*
|
/*
|
||||||
NAME
|
NAME
|
||||||
revid - a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols.
|
BitrateCalculator.go - is a simple struct with methods to allow for easy
|
||||||
|
calculation of bitrate.
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
See Readme.md
|
See Readme.md
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
Alan Noble <anoble@gmail.com>
|
Saxon Nelson-Milton <saxon.milton@gmail.com>
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
revid is Copyright (C) 2017 Alan Noble.
|
BitrateCalculator.go is Copyright (C) 2017 the Australian Ocean Lab (AusOcean)
|
||||||
|
|
||||||
It is free software: you can redistribute it and/or modify them
|
It is free software: you can redistribute it and/or modify them
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
|
@ -44,7 +45,7 @@ type BitrateCalculator struct {
|
||||||
|
|
||||||
// Place this at the start of the code segment that you would like to time
|
// Place this at the start of the code segment that you would like to time
|
||||||
func (bc *BitrateCalculator) Start(outputDelay int) {
|
func (bc *BitrateCalculator) Start(outputDelay int) {
|
||||||
if outputDelay >= 0{
|
if outputDelay >= 0 {
|
||||||
bc.outputDelay = outputDelay
|
bc.outputDelay = outputDelay
|
||||||
} else {
|
} else {
|
||||||
bc.outputDelay = 0
|
bc.outputDelay = 0
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/*
|
/*
|
||||||
NAME
|
NAME
|
||||||
revid - a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols.
|
BitrateCalculator_test.go - is a file that may be used to test the
|
||||||
|
BitrateCalculator.go file using the golang testing utilities
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
See Readme.md
|
See Readme.md
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
Alan Noble <anoble@gmail.com>
|
Saxon Nelson-Milton <saxon.milton@gmail.com>
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
revid is Copyright (C) 2017 Alan Noble.
|
BitrateCalculator_test.go is Copyright (C) 2017 the Australian Ocean Lab (AusOcean)
|
||||||
|
|
||||||
It is free software: you can redistribute it and/or modify them
|
It is free software: you can redistribute it and/or modify them
|
||||||
under the terms of the GNU General Public License as published by the
|
under the terms of the GNU General Public License as published by the
|
||||||
|
@ -50,26 +51,26 @@ func Test1(t *testing.T) {
|
||||||
bitrateCalc.Start(bitrateDelay1)
|
bitrateCalc.Start(bitrateDelay1)
|
||||||
time.Sleep(testTime * time.Millisecond)
|
time.Sleep(testTime * time.Millisecond)
|
||||||
currentBitrate := int64(bitrateCalc.Stop(amountOfData))
|
currentBitrate := int64(bitrateCalc.Stop(amountOfData))
|
||||||
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond)/1e9))
|
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond) / 1e9))
|
||||||
if currentBitrate != actualBitrate {
|
if currentBitrate != actualBitrate {
|
||||||
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now let's check that the output delay feature works
|
// Now let's check that the output delay feature works
|
||||||
func Test2(t *testing.T){
|
func Test2(t *testing.T) {
|
||||||
bitrateCalc = BitrateCalculator{}
|
bitrateCalc = BitrateCalculator{}
|
||||||
var currentBitrate int64
|
var currentBitrate int64
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
bitrateCalc.Start(bitrateDelay2)
|
bitrateCalc.Start(bitrateDelay2)
|
||||||
time.Sleep(testTime*time.Millisecond)
|
time.Sleep(testTime * time.Millisecond)
|
||||||
currentBitrate = int64(bitrateCalc.Stop(amountOfData))
|
currentBitrate = int64(bitrateCalc.Stop(amountOfData))
|
||||||
if i == 0 && currentBitrate != 0 {
|
if i == 0 && currentBitrate != 0 {
|
||||||
t.Errorf("The bitrate calc did not delay outputting!")
|
t.Errorf("The bitrate calc did not delay outputting!")
|
||||||
}
|
}
|
||||||
time.Sleep(6000*time.Millisecond)
|
time.Sleep(6000 * time.Millisecond)
|
||||||
}
|
}
|
||||||
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond)/1e9))
|
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond) / 1e9))
|
||||||
if currentBitrate != actualBitrate {
|
if currentBitrate != actualBitrate {
|
||||||
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue