From 92d4c5f79acb8616fddd231bf7aa27cbdbb84e74 Mon Sep 17 00:00:00 2001 From: Saxon Date: Thu, 16 May 2019 16:41:52 +0930 Subject: [PATCH] container/mts/encoder.go: generalising stream id logic --- codec/h265/lex.go | 1 - container/mts/encoder.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/codec/h265/lex.go b/codec/h265/lex.go index fcf2e59d..d67cf289 100644 --- a/codec/h265/lex.go +++ b/codec/h265/lex.go @@ -86,7 +86,6 @@ func (l *Lexer) Lex(dst io.Writer, src io.Reader, delay time.Duration) error { if err != nil { return fmt.Errorf("could not get rtp payload, failed with err: %v\n", err) } - nalType := (payload[0] >> 1) & 0x3f // If not currently fragmented then we ignore current write. diff --git a/container/mts/encoder.go b/container/mts/encoder.go index a90df386..0302c73a 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -138,10 +138,10 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder { sid = audioStreamID case H265: mPid = videoPid - sid = H264ID + sid = H265ID case H264: mPid = videoPid - sid = H265ID + sid = H264ID } // standardPmt is a minimal PMT, without descriptors for time and location. @@ -224,7 +224,7 @@ func (e *Encoder) Write(data []byte) (int, error) { // Prepare PES data. pesPkt := pes.Packet{ - StreamID: byte(36), + StreamID: e.streamID, PDI: hasPTS, PTS: e.pts(), Data: data,