From 0148c89c7b712fb97aebc858a81cb337c04dcb0b Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Thu, 28 Jan 2021 16:48:26 +1030 Subject: [PATCH] container/mts/encoder.go & revid: adressing PR feedback 1 --- container/mts/encoder.go | 10 ---------- revid/pipeline.go | 2 +- revid/revid_test.go | 17 +++++++++++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/container/mts/encoder.go b/container/mts/encoder.go index 02b5b7e4..6c4bb151 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -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 ) diff --git a/revid/pipeline.go b/revid/pipeline.go index fb639f34..0c3302de 100644 --- a/revid/pipeline.go +++ b/revid/pipeline.go @@ -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") diff --git a/revid/revid_test.go b/revid/revid_test.go index 65741726..b653ff01 100644 --- a/revid/revid_test.go +++ b/revid/revid_test.go @@ -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) + } }