mutext on ts/muxer and get_parameter for keep alive

This commit is contained in:
Dimitrii 2020-08-27 14:45:52 +03:00
parent 061613f0e1
commit d22f3dc929
2 changed files with 9 additions and 4 deletions

View File

@ -197,7 +197,7 @@ func (self *Client) SendRtpKeepalive() (err error) {
fmt.Println("rtp: keep alive")
}
req := Request{
Method: "OPTIONS",
Method: "GET_PARAMETER",
Uri: self.requestUri,
}
if self.session != "" {

View File

@ -3,6 +3,7 @@ package ts
import (
"fmt"
"io"
"sync"
"time"
"github.com/deepch/vdk/av"
@ -16,7 +17,7 @@ var CodecTypes = []av.CodecType{av.H264, av.AAC}
type Muxer struct {
w io.Writer
streams map[int]*Stream
mutex sync.Mutex
PaddingToMakeCounterCont bool
psidata []byte
@ -63,6 +64,10 @@ func (self *Muxer) newStream(idx int, codec av.CodecData) (err error) {
pid: pid,
tsw: tsio.NewTSWriter(pid),
}
defer self.mutex.Unlock()
self.mutex.Lock()
self.streams[idx] = stream
return
}