fix recording timestamp with some audio codecs (#3969) (#4041) (#4062)

When a stream contained an Opus, MPEG-4 audio or AC3 track, timestamp in
the segment file name was increasing at twice the speed.
This commit is contained in:
Alessandro Ros
2024-12-21 11:18:23 +01:00
committed by GitHub
parent d23fb08e2d
commit f1e031c5c8
+3 -3
View File
@@ -611,7 +611,7 @@ func (f *formatFMP4) initialize() bool {
Payload: packet,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err
@@ -649,7 +649,7 @@ func (f *formatFMP4) initialize() bool {
Payload: au,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err
@@ -771,7 +771,7 @@ func (f *formatFMP4) initialize() bool {
Payload: frame,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err