This commit is contained in:
Morlay 2025-01-24 09:30:11 +08:00 committed by GitHub
commit 8e21316d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,8 +27,9 @@ type Muxer struct {
} }
func NewMuxer(w *os.File) *Muxer { func NewMuxer(w *os.File) *Muxer {
return &Muxer{} return &Muxer{maxFrames: 5}
} }
func (self *Muxer) SetPath(path string) { func (self *Muxer) SetPath(path string) {
self.path = path self.path = path
} }
@ -296,7 +297,7 @@ func (element *Muxer) WritePacket(pkt av.Packet, GOP bool) (bool, []byte, error)
if stream.lastpkt != nil { if stream.lastpkt != nil {
ts = pkt.Time - stream.lastpkt.Time ts = pkt.Time - stream.lastpkt.Time
} }
got, buf, err := stream.writePacketV3(pkt, ts, 5) got, buf, err := stream.writePacketV3(pkt, ts, element.maxFrames)
stream.lastpkt = &pkt stream.lastpkt = &pkt
if err != nil { if err != nil {
return false, []byte{}, err return false, []byte{}, err
@ -307,7 +308,7 @@ func (element *Muxer) WritePacket(pkt av.Packet, GOP bool) (bool, []byte, error)
if stream.lastpkt != nil { if stream.lastpkt != nil {
ts = pkt.Time - stream.lastpkt.Time ts = pkt.Time - stream.lastpkt.Time
} }
got, buf, err := stream.writePacketV2(pkt, ts, 5) got, buf, err := stream.writePacketV2(pkt, ts, element.maxFrames)
stream.lastpkt = &pkt stream.lastpkt = &pkt
if err != nil { if err != nil {
return false, []byte{}, err return false, []byte{}, err