1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-23 00:22:19 +00:00

use time.Second to wait for 5s

This commit is contained in:
Alexandre Iooss 2020-10-04 20:52:23 +02:00
parent f3d38dc10d
commit 708501c5c8
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
2 changed files with 5 additions and 13 deletions

View File

@ -76,7 +76,7 @@ func TestForwardStream(t *testing.T) {
} }
}() }()
time.Sleep(5000000000) // Delay is in nanoseconds, here 5s time.Sleep(5 * time.Second) // Delay is in nanoseconds, here 5s
// FIXME // FIXME
//if ffmpegInputStreams["demo"] == nil { //if ffmpegInputStreams["demo"] == nil {

View File

@ -38,11 +38,10 @@ func TestServeSRT(t *testing.T) {
go Serve(&Options{ListenAddress: ":9711", MaxClients: 2}, nil, nil, nil) go Serve(&Options{ListenAddress: ":9711", MaxClients: 2}, nil, nil, nil)
ffmpeg := exec.Command("ffmpeg", ffmpeg := exec.Command("ffmpeg", "-hide_banner", "-loglevel", "error",
"-i", "http://ftp.crans.org/events/Blender%20OpenMovies/big_buck_bunny_480p_stereo.ogg", "-f", "lavfi", "-i", "testsrc=size=640x480:rate=10",
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo:") "-f", "flv", "srt://127.0.0.1:9711?streamid=demo:")
output, err := ffmpeg.StdoutPipe()
errOutput, err := ffmpeg.StderrPipe() errOutput, err := ffmpeg.StderrPipe()
if err != nil { if err != nil {
t.Fatal("Error while querying ffmpeg output:", err) t.Fatal("Error while querying ffmpeg output:", err)
@ -53,20 +52,13 @@ func TestServeSRT(t *testing.T) {
} }
go func() { go func() {
scanner := bufio.NewScanner(output) scanner := bufio.NewScanner(errOutput)
for scanner.Scan() { for scanner.Scan() {
log.Printf("[FFMPEG TEST] %s", scanner.Text()) log.Printf("[FFMPEG TEST] %s", scanner.Text())
} }
}() }()
go func() { time.Sleep(5 * time.Second) // Delay is in nanoseconds, here 5s
scanner := bufio.NewScanner(errOutput)
for scanner.Scan() {
log.Printf("[FFMPEG ERR TEST] %s", scanner.Text())
}
}()
time.Sleep(5000000000) // Delay is in nanoseconds, here 5s
// TODO Check that the stream ran // TODO Check that the stream ran
// TODO Kill SRT server // TODO Kill SRT server