client: fix h264 decoding

This commit is contained in:
aler9
2022-04-08 17:52:24 +02:00
parent 5b37e9d5bb
commit fb5d2c31ce

View File

@@ -673,6 +673,13 @@ func (c *Client) playRecordStart() {
c.writeMutex.Unlock()
if c.state == clientStatePlay {
for _, ct := range c.tracks {
if _, ok := ct.track.(*TrackH264); ok {
ct.h264Decoder = &rtph264.Decoder{}
ct.h264Decoder.Init()
}
}
c.keepaliveTimer = time.NewTimer(c.keepalivePeriod)
switch *c.effectiveTransport {
@@ -716,15 +723,7 @@ func (c *Client) playRecordStart() {
v := time.Now().Unix()
c.tcpLastFrameTime = &v
}
} else {
for _, ct := range c.tracks {
if _, ok := ct.track.(*TrackH264); ok {
ct.h264Decoder = &rtph264.Decoder{}
ct.h264Decoder.Init()
}
}
if *c.effectiveTransport == TransportUDP {
} else if *c.effectiveTransport == TransportUDP {
for trackID, cct := range c.tracks {
ctrackID := trackID
@@ -739,7 +738,6 @@ func (c *Client) playRecordStart() {
cct.udpRTCPListener.start(false)
}
}
}
// for some reason, SetReadDeadline() must always be called in the same
// goroutine, otherwise Read() freezes.