mirror of https://bitbucket.org/ausocean/av.git
Merge branch 'master' into start-in-paused-state
This commit is contained in:
commit
ab97bcb6d1
|
@ -1,16 +1,18 @@
|
|||
# install files and directories required by NetSender clients (such as gpio-netsender, revid-cli, etc.)
|
||||
# NB: the default (soft) install does not override conf files
|
||||
USER := $(shell whoami)
|
||||
PATH := /usr/local/go/bin:$(PATH)
|
||||
|
||||
.SILENT:make_dirs
|
||||
.SILENT:soft_copy_files
|
||||
.SILENT:hard_copy_files
|
||||
.SILENT:syncreboot
|
||||
.SILENT:clean
|
||||
|
||||
install: as_root make_dirs soft_copy_files
|
||||
install: as_root make_dirs soft_copy_files syncreboot
|
||||
@echo "Install complete"
|
||||
|
||||
install_hard: as_root make_dirs hard_copy_files
|
||||
install_hard: as_root make_dirs hard_copy_files syncreboot
|
||||
@echo "Hard install complete"
|
||||
|
||||
as_root:
|
||||
|
@ -38,6 +40,7 @@ soft_copy_files:
|
|||
echo "/etc/netsender.conf left unmodified" ; \
|
||||
else \
|
||||
cp netsender.conf /etc; \
|
||||
chown pi /etc/netsender.conf; \
|
||||
fi
|
||||
|
||||
hard_copy_files:
|
||||
|
@ -51,6 +54,10 @@ hard_copy_files:
|
|||
cp /etc/netsender.conf /etc/netsender.conf.bak ; \
|
||||
fi
|
||||
cp -f netsender.conf /etc
|
||||
chown pi /etc/netsender.conf
|
||||
|
||||
syncreboot:
|
||||
cd ../../utils/cmd/syncreboot; make; make install
|
||||
|
||||
clean: as_root
|
||||
rm -rf /var/netsender
|
||||
|
|
|
@ -186,15 +186,18 @@ func (c *Config) Validate(r *Revid) error {
|
|||
c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for rtmp out",
|
||||
"framesPerClip", defaultFramesPerClip)
|
||||
c.FramesPerClip = defaultFramesPerClip
|
||||
c.Packetization = Flv
|
||||
case NothingDefined:
|
||||
c.Logger.Log(logger.Warning, pkg+"no output defined, defaulting", "output",
|
||||
defaultOutput)
|
||||
c.Outputs[i] = defaultOutput
|
||||
c.Packetization = defaultPacketization
|
||||
fallthrough
|
||||
case Http, Rtp:
|
||||
c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for http out",
|
||||
"framesPerClip", httpFramesPerClip)
|
||||
c.FramesPerClip = httpFramesPerClip
|
||||
c.Packetization = Mpegts
|
||||
default:
|
||||
return errors.New("bad output type defined in config")
|
||||
}
|
||||
|
|
|
@ -51,10 +51,12 @@ import (
|
|||
|
||||
// Ring buffer sizes and read/write timeouts.
|
||||
const (
|
||||
ringBufferSize = 1000
|
||||
ringBufferElementSize = 150000
|
||||
writeTimeout = 10 * time.Millisecond
|
||||
readTimeout = 10 * time.Millisecond
|
||||
mtsRbSize = 100
|
||||
mtsRbElementSize = 150000
|
||||
flvRbSize = 1000
|
||||
flvRbElementSize = 10000
|
||||
writeTimeout = 10 * time.Millisecond
|
||||
readTimeout = 10 * time.Millisecond
|
||||
)
|
||||
|
||||
// RTMP connection properties.
|
||||
|
@ -141,11 +143,6 @@ type packer struct {
|
|||
// are deemed to be successful, although a successful
|
||||
// write may include a dropped frame.
|
||||
func (p *packer) Write(frame []byte) (int, error) {
|
||||
if len(frame) > ringBufferElementSize {
|
||||
p.owner.config.Logger.Log(logger.Warning, pkg+"frame was too big", "frame size", len(frame))
|
||||
return len(frame), nil
|
||||
}
|
||||
|
||||
if len(p.owner.destination) != 0 {
|
||||
n, err := p.owner.buffer.Write(frame)
|
||||
if err != nil {
|
||||
|
@ -226,7 +223,14 @@ func (r *Revid) reset(config Config) error {
|
|||
}
|
||||
r.config = config
|
||||
|
||||
r.buffer = ring.NewBuffer(ringBufferSize, ringBufferElementSize, writeTimeout)
|
||||
// NB: currently we use two outputs that require the same packetization method
|
||||
// so we only need to check first output, but this may change later.
|
||||
switch r.config.Outputs[0] {
|
||||
case Rtmp, FfmpegRtmp:
|
||||
r.buffer = ring.NewBuffer(flvRbSize, flvRbElementSize, writeTimeout)
|
||||
case Http, Rtp:
|
||||
r.buffer = ring.NewBuffer(mtsRbSize, mtsRbElementSize, writeTimeout)
|
||||
}
|
||||
|
||||
r.destination = r.destination[:0]
|
||||
for _, typ := range r.config.Outputs {
|
||||
|
|
Loading…
Reference in New Issue