1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 19:42:20 +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
//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)
ffmpeg := exec.Command("ffmpeg",
"-i", "http://ftp.crans.org/events/Blender%20OpenMovies/big_buck_bunny_480p_stereo.ogg",
ffmpeg := exec.Command("ffmpeg", "-hide_banner", "-loglevel", "error",
"-f", "lavfi", "-i", "testsrc=size=640x480:rate=10",
"-f", "flv", "srt://127.0.0.1:9711?streamid=demo:")
output, err := ffmpeg.StdoutPipe()
errOutput, err := ffmpeg.StderrPipe()
if err != nil {
t.Fatal("Error while querying ffmpeg output:", err)
@ -53,20 +52,13 @@ func TestServeSRT(t *testing.T) {
}
go func() {
scanner := bufio.NewScanner(output)
scanner := bufio.NewScanner(errOutput)
for scanner.Scan() {
log.Printf("[FFMPEG TEST] %s", scanner.Text())
}
}()
go func() {
scanner := bufio.NewScanner(errOutput)
for scanner.Scan() {
log.Printf("[FFMPEG ERR TEST] %s", scanner.Text())
}
}()
time.Sleep(5000000000) // Delay is in nanoseconds, here 5s
time.Sleep(5 * time.Second) // Delay is in nanoseconds, here 5s
// TODO Check that the stream ran
// TODO Kill SRT server