From 96035f6d8b742b30e900d0a31a38a55c5b334b3d Mon Sep 17 00:00:00 2001 From: Trek H Date: Thu, 12 Sep 2019 19:16:11 +0930 Subject: [PATCH] adpcm and mts: comments and pid change --- codec/adpcm/adpcm.go | 2 +- container/mts/encoder.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/codec/adpcm/adpcm.go b/codec/adpcm/adpcm.go index 479f6261..b61d9fee 100644 --- a/codec/adpcm/adpcm.go +++ b/codec/adpcm/adpcm.go @@ -369,7 +369,7 @@ func capAdd16(a, b int16) int16 { // EncBytes will return the number of adpcm bytes that will be generated when encoding the given amount of pcm bytes (n). func EncBytes(n int) int { // For 'n' pcm bytes, 1 sample is left uncompressed, the rest is compressed by a factor of 4 - // and a start index and padding-flag byte are added. + // and a chunk length (4B), start index (1B) and padding-flag (1B) are added. // Also if there are an even number of samples, there will be half a byte of padding added to the last byte. if n%bytesPerEnc == 0 { return (n-byteDepth)/compFact + headSize + 1 diff --git a/container/mts/encoder.go b/container/mts/encoder.go index 7d968d5f..9bc2ca44 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -44,7 +44,7 @@ import ( const ( H264ID = 27 H265ID = 36 - audioStreamID = 0xc0 // First audio stream ID. + audioStreamID = 0xc0 // ADPCM audio stream ID. ) // Constants used to communicate which media codec will be packetized. @@ -168,7 +168,7 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder { Pil: 0, Essd: &psi.ESSD{ St: byte(sid), - Epid: 0x0100, + Epid: byte(mPid), Esil: 0x00, }, }