Compare commits

...

3 Commits

Author SHA1 Message Date
Icedream 3bad711693
Update .gitignore. 2018-07-09 12:37:00 +02:00
Icedream f5a86e9282
Remove debug lines. 2018-07-09 12:36:54 +02:00
Icedream 4dc3a544f7
Use properly joined file paths. 2018-07-09 12:35:18 +02:00
6 changed files with 9 additions and 13 deletions

3
.gitignore vendored
View File

@ -22,8 +22,11 @@ _testmain.go
# built binaries # built binaries
uplink uplink
*.exe *.exe
*.dll
*.test *.test
*.orig
############################################################################### ###############################################################################
# Windows image file caches # Windows image file caches

View File

@ -4,6 +4,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"sync" "sync"
"testing" "testing"
@ -13,7 +14,7 @@ import (
func Test_Demux(t *testing.T) { func Test_Demux(t *testing.T) {
Convey("Demuxer", t, func() { Convey("Demuxer", t, func() {
Convey("audio-only", func() { Convey("audio-only", func() {
reader, _ := os.Open("testassets/mpthreetest.mp3") reader, _ := os.Open(filepath.Join("testassets", "mpthreetest.mp3"))
defer reader.Close() defer reader.Close()
demuxer := Demux(reader) demuxer := Demux(reader)
@ -43,7 +44,7 @@ func Test_Demux(t *testing.T) {
}) })
Convey("video and audio", func() { Convey("video and audio", func() {
reader, _ := os.Open("testassets/small.ogv") reader, _ := os.Open(filepath.Join("testassets", "small.ogv"))
defer reader.Close() defer reader.Close()
demuxer := Demux(reader) demuxer := Demux(reader)

View File

@ -4,6 +4,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"testing" "testing"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
@ -12,7 +13,7 @@ import (
func Test_Muxer(t *testing.T) { func Test_Muxer(t *testing.T) {
Convey("Muxer", t, func() { Convey("Muxer", t, func() {
Convey("audio-only", func() { Convey("audio-only", func() {
reader, _ := os.Open("testassets/mpthreetest.mp3") reader, _ := os.Open(filepath.Join("testassets", "mpthreetest.mp3"))
defer reader.Close() defer reader.Close()
demuxer := Demux(reader) demuxer := Demux(reader)

View File

@ -75,8 +75,6 @@ func (instance *pluginInstance) Init() {
sr := container.Sub() sr := container.Sub()
defer sr.Close() defer sr.Close()
log.Println("Someone tuned in to", channelId, channel)
if sendMetadata { if sendMetadata {
mw = streams.NewMetadataInjector(w, metaInt) mw = streams.NewMetadataInjector(w, metaInt)
nw = mw nw = mw

View File

@ -22,8 +22,6 @@ func (instance *pluginInstance) Init() {
channelManager := instance.channelManager channelManager := instance.channelManager
go func() { go func() {
time.Sleep(2 * time.Second) // give burst cache a chance to realize
c, err := channelManager.Open("sine") c, err := channelManager.Open("sine")
if err != nil { if err != nil {
log.Println("ERROR: sine channel could not be opened:", err) log.Println("ERROR: sine channel could not be opened:", err)

View File

@ -43,16 +43,11 @@ func (stream *SineStream) Read(data []byte) (n int, err error) {
targetTime := stream.Timestamp. targetTime := stream.Timestamp.
Add(time.Duration(float64(time.Second) * float64(stream.State) / float64(stream.Samplerate))) Add(time.Duration(float64(time.Second) * float64(stream.State) / float64(stream.Samplerate)))
delay := targetTime.Sub(time.Now()) delay := targetTime.Sub(time.Now())
/*log.Println("state", stream.State, "value", sampleValue, "time", targetTime, "delay", delay)
time.Sleep(time.Second)*/
if delay > 0 { if delay > 0 {
<-time.After(delay) <-time.After(delay)
} }
/*if stream.State%uint64(stream.Samplerate) == 0 {
log.Println("state", stream.State, "value", sampleValue, "time", targetTime, "delay", delay)
}*/
stream.State++ stream.State++
} }