Update mp4 entry duration

This commit is contained in:
Alexey Khit
2022-09-13 14:39:19 +03:00
parent e049a17216
commit 0f9e3c97c5
+4 -2
View File
@@ -125,13 +125,15 @@ func (m *Muxer) Marshal(packet *rtp.Packet) []byte {
} }
entry := mp4io.TrackFragRunEntry{ entry := mp4io.TrackFragRunEntry{
Duration: 90000, //Duration: 90000,
Size: uint32(len(packet.Payload)), Size: uint32(len(packet.Payload)),
} }
newTime := packet.Timestamp newTime := packet.Timestamp
if m.pts > 0 { if m.pts > 0 {
m.dts += uint64(newTime - m.pts) //m.dts += uint64(newTime - m.pts)
entry.Duration = newTime - m.pts
m.dts += uint64(entry.Duration)
} }
m.pts = newTime m.pts = newTime