mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-10-13 04:14:00 +08:00
fix: rtmp play write timeout
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
|||||||
_ "m7s.live/v5/plugin/flv"
|
_ "m7s.live/v5/plugin/flv"
|
||||||
_ "m7s.live/v5/plugin/gb28181"
|
_ "m7s.live/v5/plugin/gb28181"
|
||||||
_ "m7s.live/v5/plugin/logrotate"
|
_ "m7s.live/v5/plugin/logrotate"
|
||||||
_ "m7s.live/v5/plugin/monitor"
|
|
||||||
_ "m7s.live/v5/plugin/mp4"
|
_ "m7s.live/v5/plugin/mp4"
|
||||||
mp4 "m7s.live/v5/plugin/mp4/pkg"
|
mp4 "m7s.live/v5/plugin/mp4/pkg"
|
||||||
_ "m7s.live/v5/plugin/preview"
|
_ "m7s.live/v5/plugin/preview"
|
||||||
|
@@ -9,7 +9,6 @@ import (
|
|||||||
_ "m7s.live/v5/plugin/debug"
|
_ "m7s.live/v5/plugin/debug"
|
||||||
_ "m7s.live/v5/plugin/flv"
|
_ "m7s.live/v5/plugin/flv"
|
||||||
_ "m7s.live/v5/plugin/logrotate"
|
_ "m7s.live/v5/plugin/logrotate"
|
||||||
_ "m7s.live/v5/plugin/monitor"
|
|
||||||
_ "m7s.live/v5/plugin/rtmp"
|
_ "m7s.live/v5/plugin/rtmp"
|
||||||
_ "m7s.live/v5/plugin/rtsp"
|
_ "m7s.live/v5/plugin/rtsp"
|
||||||
_ "m7s.live/v5/plugin/test"
|
_ "m7s.live/v5/plugin/test"
|
||||||
|
@@ -449,11 +449,11 @@ func (nc *NetConnection) SendMessage(t byte, msg RtmpMessage) (err error) {
|
|||||||
if sid, ok := msg.(HaveStreamID); ok {
|
if sid, ok := msg.(HaveStreamID); ok {
|
||||||
head.MessageStreamID = sid.GetStreamID()
|
head.MessageStreamID = sid.GetStreamID()
|
||||||
}
|
}
|
||||||
nc.SetWriteDeadline(time.Now().Add(time.Second * 5)) // 设置写入超时时间为5秒
|
|
||||||
return nc.sendChunk(util.NewMemory(nc.tmpBuf), head, RTMP_CHUNK_HEAD_12)
|
return nc.sendChunk(util.NewMemory(nc.tmpBuf), head, RTMP_CHUNK_HEAD_12)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nc *NetConnection) sendChunk(mem util.Memory, head *ChunkHeader, headType byte) (err error) {
|
func (nc *NetConnection) sendChunk(mem util.Memory, head *ChunkHeader, headType byte) (err error) {
|
||||||
|
nc.SetWriteDeadline(time.Now().Add(time.Second * 5)) // 设置写入超时时间为5秒
|
||||||
head.WriteTo(headType, &nc.chunkHeaderBuf)
|
head.WriteTo(headType, &nc.chunkHeaderBuf)
|
||||||
defer func(reuse net.Buffers) {
|
defer func(reuse net.Buffers) {
|
||||||
nc.sendBuffers = reuse
|
nc.sendBuffers = reuse
|
||||||
|
Reference in New Issue
Block a user