handle panic error on non-existing packet index (for audio, as example)
This commit is contained in:
parent
ce2edddbeb
commit
0435cfa11a
@ -154,6 +154,9 @@ func (self *Muxer) WriteHeader(streams []av.CodecData) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Muxer) WritePacket(pkt av.Packet) (err error) {
|
func (self *Muxer) WritePacket(pkt av.Packet) (err error) {
|
||||||
|
if int(pkt.Idx) >= len(self.streams) {
|
||||||
|
return fmt.Errorf("Wrong stream index: %d", pkt.Idx)
|
||||||
|
}
|
||||||
stream := self.streams[pkt.Idx]
|
stream := self.streams[pkt.Idx]
|
||||||
pkt.Time += time.Second
|
pkt.Time += time.Second
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user