container/mts/encoder.go & revid: adressing PR feedback 1

This commit is contained in:
Saxon Nelson-Milton 2021-01-28 16:48:26 +10:30
parent b077752462
commit 0148c89c7b
3 changed files with 16 additions and 13 deletions

View File

@ -40,15 +40,6 @@ import (
"bitbucket.org/ausocean/utils/logger"
)
// Stream IDs as per ITU-T Rec. H.222.0 / ISO/IEC 13818-1 [1], tables 2-22 and 2-34.
const (
streamIDH264 = 27
streamIDH265 = 36
streamIDMJPEG = 28
streamIDJPEG = 136 // Privately number.
streamIDAudio = 0xc0 // ADPCM audio stream ID.
)
// These three constants are used to select between the three different
// methods of when the PSI is sent.
const (
@ -63,7 +54,6 @@ const (
EncodeH265
EncodeJPEG
EncodeMJPEG
EncodeAudio
EncodePCM
EncodeADPCM
)

View File

@ -206,10 +206,10 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
r.cfg.Logger.Log(logger.Debug, "using Files output")
rb := ring.NewBuffer(int(r.cfg.RBStartElementSize), int(nElements), writeTimeout)
fs, err := newFileSender(r.cfg.Logger, r.cfg.OutputPath, true)
w = newMTSSender(fs, r.cfg.Logger.Log, rb, r.cfg.ClipDuration)
if err != nil {
return err
}
w = newMTSSender(fs, r.cfg.Logger.Log, rb, r.cfg.ClipDuration)
mtsSenders = append(mtsSenders, w)
case config.OutputRTMP:
r.cfg.Logger.Log(logger.Debug, "using RTMP output")

View File

@ -52,7 +52,7 @@ func TestRaspistill(t *testing.T) {
timelapseInterval = "4"
rbStartElementSize = "1000000"
input = "Raspistill"
codec = "MJPEG"
codec = "JPEG"
output = "Files"
outDir = "out"
outputPath = outDir + "/"
@ -66,8 +66,15 @@ func TestRaspistill(t *testing.T) {
mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}})
// First remove out dir (if exists) to clear contents, then create dir.
os.RemoveAll(outDir)
err := os.RemoveAll(outDir)
if err != nil {
t.Fatalf("could not remove any prior out directory: %v",err)
}
os.Mkdir(outDir, os.ModePerm)
if err != nil {
t.Fatalf("could not create new out directory: %v",err)
}
rv, err := New(config.Config{Logger: (*testLogger)(t)}, nil)
if err != nil {
@ -141,4 +148,10 @@ func TestRaspistill(t *testing.T) {
t.Errorf("unexpected image extracted for img: %d", i)
}
}
// Clean up out directory.
err := os.RemoveAll(outDir)
if err != nil {
t.Fatalf("could not clean up out directory: %v",err)
}
}