minor changes

This commit is contained in:
Craig 2020-01-26 10:43:08 +00:00
parent e7ff0e8b8d
commit 06feef7559
4 changed files with 60 additions and 54 deletions

View File

@ -5,4 +5,4 @@ GIT_COMMIT=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"` GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"`
go build -o bin/neko -ldflags "-s -X version.buildTime=${BUILD_TIME} -X version.gitRevision=${GIT_DIRTY}${GIT_REVISION} -X version.gitBranch=${GIT_BRANCH}" -i cmd/neko/main.go go build -o bin/neko -ldflags "-s -X 'n.eko.moe/neko.buildDate=${BUILD_TIME}' -X 'n.eko.moe/neko.gitCommit=${GIT_DIRTY}${GIT_COMMIT}' -X 'n.eko.moe/neko.gitBranch=${GIT_BRANCH}'" -i cmd/neko/main.go

View File

@ -1,8 +1,6 @@
package cmd package cmd
import ( import (
"fmt"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -32,5 +30,5 @@ func init() {
log.Panic().Err(err).Msg("unable to run root command") log.Panic().Err(err).Msg("unable to run root command")
} }
root.SetVersionTemplate(fmt.Sprintf("version: %s\n", neko.Service.Version)) root.SetVersionTemplate(neko.Service.Version.Details())
} }

View File

@ -92,11 +92,11 @@ func (m *WebRTCManager) Start() {
return return
case sample := <-videoPipeline.Sample: case sample := <-videoPipeline.Sample:
if err := m.sessions.WriteVideoSample(sample); err != nil { if err := m.sessions.WriteVideoSample(sample); err != nil {
m.logger.Warn().Err(err).Msg("video pipeline failed") m.logger.Warn().Err(err).Msg("video pipeline failed to write")
} }
case sample := <-audioPipeline.Sample: case sample := <-audioPipeline.Sample:
if err := m.sessions.WriteAudioSample(sample); err != nil { if err := m.sessions.WriteAudioSample(sample); err != nil {
m.logger.Warn().Err(err).Msg("audio pipeline failed") m.logger.Warn().Err(err).Msg("audio pipeline failed to write")
} }
case <-m.cleanup.C: case <-m.cleanup.C:
hid.Check(time.Second * 10) hid.Check(time.Second * 10)
@ -182,28 +182,27 @@ func (m *WebRTCManager) CreatePeer(id string, sdp string) (string, types.Peer, e
return "", nil, err return "", nil, err
} }
// clear the Transceiver bufers /*
go func() { // clear the Transceiver bufers
defer func() { go func() {
m.logger.Warn().Msgf("ReadRTCP shutting down") defer func() {
}() m.logger.Warn().Msgf("ReadRTCP shutting down")
}()
for {
packet, err := videoTransceiver.Sender.ReadRTCP()
if err != nil {
return
}
m.logger.Debug().Msgf("vReadRTCP %v", packet)
/* packet, err = audioTransceiver.Sender.ReadRTCP()
for { if err != nil {
packet, err := videoTransceiver.Sender.ReadRTCP() return
if err != nil { }
return m.logger.Debug().Msgf("aReadRTCP %v", packet)
} }
m.logger.Debug().Msgf("vReadRTCP %v", packet) }()
*/
packet, err = audioTransceiver.Sender.ReadRTCP()
if err != nil {
return
}
m.logger.Debug().Msgf("aReadRTCP %v", packet)
}
*/
}()
// set remote description // set remote description
connection.SetRemoteDescription(description) connection.SetRemoteDescription(description)

View File

@ -28,13 +28,12 @@ const Header = `&34
var ( var (
// //
buildDate = "" buildDate = "dev"
// //
gitCommit = "" gitCommit = "dev"
// //
gitVersion = "" gitBranch = "dev"
//
gitState = ""
// Major version when you make incompatible API changes, // Major version when you make incompatible API changes,
major = "0" major = "0"
// Minor version when you add functionality in a backwards-compatible manner, and // Minor version when you add functionality in a backwards-compatible manner, and
@ -48,16 +47,15 @@ var Service *Neko
func init() { func init() {
Service = &Neko{ Service = &Neko{
Version: &Version{ Version: &Version{
Major: major, Major: major,
Minor: minor, Minor: minor,
Patch: patch, Patch: patch,
GitVersion: gitVersion, GitCommit: gitCommit,
GitCommit: gitCommit, GitBranch: gitBranch,
GitTreeState: gitState, BuildDate: buildDate,
BuildDate: buildDate, GoVersion: runtime.Version(),
GoVersion: runtime.Version(), Compiler: runtime.Compiler,
Compiler: runtime.Compiler, Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
}, },
Root: &config.Root{}, Root: &config.Root{},
Server: &config.Server{}, Server: &config.Server{},
@ -67,21 +65,32 @@ func init() {
} }
type Version struct { type Version struct {
Major string Major string
Minor string Minor string
Patch string Patch string
Version string GitCommit string
GitVersion string GitBranch string
GitCommit string BuildDate string
GitTreeState string GoVersion string
BuildDate string Compiler string
GoVersion string Platform string
Compiler string
Platform string
} }
func (i *Version) String() string { func (i *Version) String() string {
return fmt.Sprintf("%s.%s.%s", i.Major, i.Minor, i.Patch) return fmt.Sprintf("%s.%s.%s %s", i.Major, i.Minor, i.Patch, i.GitCommit)
}
func (i *Version) Details() string {
return fmt.Sprintf(
"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
fmt.Sprintf("Verison %s.%s.%s", i.Major, i.Minor, i.Patch),
fmt.Sprintf("GitCommit %s", i.GitCommit),
fmt.Sprintf("GitBranch %s", i.GitBranch),
fmt.Sprintf("BuildDate %s", i.BuildDate),
fmt.Sprintf("GoVersion %s", i.GoVersion),
fmt.Sprintf("Compiler %s", i.Compiler),
fmt.Sprintf("Platform %s", i.Platform),
)
} }
type Neko struct { type Neko struct {