mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
client: fix h264 decoding
This commit is contained in:
18
client.go
18
client.go
@@ -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.
|
||||
|
Reference in New Issue
Block a user