mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
route original timestamps without converting to durations (#3839)
This improves timestamp precision.
This commit is contained in:
parent
54c0737074
commit
23002d9f5f
43 changed files with 475 additions and 400 deletions
|
|
@ -14,6 +14,12 @@ import (
|
|||
"github.com/bluenviron/mediamtx/internal/unit"
|
||||
)
|
||||
|
||||
func multiplyAndDivide(v, m, d int64) int64 {
|
||||
secs := v / d
|
||||
dec := v % d
|
||||
return (secs*m + dec*m/d)
|
||||
}
|
||||
|
||||
func paramsFromConf(logLevel conf.LogLevel, cnf *conf.Path) params {
|
||||
return params{
|
||||
LogLevel: func() string {
|
||||
|
|
@ -105,7 +111,7 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
|
|||
stream.WriteUnit(medi, medi.Formats[0], &unit.H264{
|
||||
Base: unit.Base{
|
||||
NTP: time.Now(),
|
||||
PTS: dts,
|
||||
PTS: multiplyAndDivide(int64(dts), 90000, int64(time.Second)),
|
||||
},
|
||||
AU: au,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue