Compare commits

..

No commits in common. "3bad711693774b32336da99fa9bf8b1c674df6bd" and "f9c5b5e0c6f281cd47ac582b439c42f05e9b9854" have entirely different histories.

6 changed files with 13 additions and 9 deletions

3
.gitignore vendored
View File

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

View File

@ -4,7 +4,6 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"testing" "testing"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
@ -13,7 +12,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(filepath.Join("testassets", "mpthreetest.mp3")) reader, _ := os.Open("testassets/mpthreetest.mp3")
defer reader.Close() defer reader.Close()
demuxer := Demux(reader) demuxer := Demux(reader)

View File

@ -75,6 +75,8 @@ 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,6 +22,8 @@ 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,11 +43,16 @@ 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++
} }