mirror of https://bitbucket.org/ausocean/av.git
audio-netsender: fixed type and netsender errors
This commit is contained in:
parent
3bd3e52371
commit
83a425ce2b
|
@ -386,7 +386,7 @@ func (ac *audioClient) output() {
|
|||
reported := time.Now() // When we last did so.
|
||||
|
||||
for {
|
||||
var rc int
|
||||
var rc bool
|
||||
start := time.Now()
|
||||
audio := false
|
||||
var pins []netsender.Pin
|
||||
|
@ -447,8 +447,8 @@ func (ac *audioClient) output() {
|
|||
reported = start
|
||||
report = false
|
||||
}
|
||||
if rc == netsender.ResponseUpdate {
|
||||
_, err = ac.ns.Config()
|
||||
if rc {
|
||||
err = ac.ns.Config()
|
||||
if err != nil {
|
||||
log.Log(logger.Warning, "netsender.Config failed", "error", err.Error())
|
||||
goto sleep
|
||||
|
@ -529,7 +529,7 @@ func (ac *audioClient) formatBuffer() alsa.Buffer {
|
|||
|
||||
// Convert channels.
|
||||
if ac.ab.Format.Channels == 2 && wantChannels == 1 {
|
||||
if formatted.Data, err = pcm.StereoToMono(ac.ab); err != nil {
|
||||
if formatted, err = pcm.StereoToMono(ac.ab); err != nil {
|
||||
log.Log(logger.Warning, "channel conversion failed, audio has remained stereo", "error", err.Error())
|
||||
} else {
|
||||
formatted.Format.Channels = 1
|
||||
|
@ -542,9 +542,9 @@ func (ac *audioClient) formatBuffer() alsa.Buffer {
|
|||
|
||||
// Convert rate.
|
||||
if bufCopied {
|
||||
formatted.Data, err = pcm.Resample(formatted, wantRate)
|
||||
formatted, err = pcm.Resample(formatted, wantRate)
|
||||
} else {
|
||||
formatted.Data, err = pcm.Resample(ac.ab, wantRate)
|
||||
formatted, err = pcm.Resample(ac.ab, wantRate)
|
||||
}
|
||||
if err != nil {
|
||||
log.Log(logger.Warning, "rate conversion failed, audio has remained original rate", "error", err.Error())
|
||||
|
|
Loading…
Reference in New Issue