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,13 +182,12 @@ func (m *WebRTCManager) CreatePeer(id string, sdp string) (string, types.Peer, e
return "", nil, err return "", nil, err
} }
/*
// clear the Transceiver bufers // clear the Transceiver bufers
go func() { go func() {
defer func() { defer func() {
m.logger.Warn().Msgf("ReadRTCP shutting down") m.logger.Warn().Msgf("ReadRTCP shutting down")
}() }()
/*
for { for {
packet, err := videoTransceiver.Sender.ReadRTCP() packet, err := videoTransceiver.Sender.ReadRTCP()
if err != nil { if err != nil {
@ -202,8 +201,8 @@ func (m *WebRTCManager) CreatePeer(id string, sdp string) (string, types.Peer, e
} }
m.logger.Debug().Msgf("aReadRTCP %v", packet) 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
@ -51,9 +50,8 @@ func init() {
Major: major, Major: major,
Minor: minor, Minor: minor,
Patch: patch, Patch: patch,
GitVersion: gitVersion,
GitCommit: gitCommit, GitCommit: gitCommit,
GitTreeState: gitState, GitBranch: gitBranch,
BuildDate: buildDate, BuildDate: buildDate,
GoVersion: runtime.Version(), GoVersion: runtime.Version(),
Compiler: runtime.Compiler, Compiler: runtime.Compiler,
@ -70,10 +68,8 @@ type Version struct {
Major string Major string
Minor string Minor string
Patch string Patch string
Version string
GitVersion string
GitCommit string GitCommit string
GitTreeState string GitBranch string
BuildDate string BuildDate string
GoVersion string GoVersion string
Compiler string Compiler string
@ -81,7 +77,20 @@ type Version struct {
} }
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 {