Skip to content

Commit

Permalink
fix recording timestamp with some audio codecs (#3969) (#4041)
Browse files Browse the repository at this point in the history
When a stream contained an Opus, MPEG-4 audio or AC3 track, timestamp in
the segment file name was increasing at twice the speed.
  • Loading branch information
aler9 committed Dec 20, 2024
1 parent d23fb08 commit 029ace0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/recorder/format_fmp4.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),

Check warning on line 614 in internal/recorder/format_fmp4.go

View check run for this annotation

Codecov / codecov/patch

internal/recorder/format_fmp4.go#L614

Added line #L614 was not covered by tests
})
if err != nil {
return err
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)),

Check warning on line 774 in internal/recorder/format_fmp4.go

View check run for this annotation

Codecov / codecov/patch

internal/recorder/format_fmp4.go#L774

Added line #L774 was not covered by tests
})
if err != nil {
return err
Expand Down

0 comments on commit 029ace0

Please sign in to comment.