rtsp: route original absolute timestamp of packets (#1300) (#4378)
Some checks failed
code_lint / golangci_lint (push) Has been cancelled
code_lint / mod_tidy (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_highlevel (push) Has been cancelled

This commit is contained in:
Alessandro Ros 2025-03-29 19:08:42 +01:00 committed by GitHub
parent 4bbedc4955
commit 8b98c02903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 168 additions and 60 deletions

View file

@ -7,12 +7,12 @@ import (
"github.com/bluenviron/gortsplib/v4"
"github.com/bluenviron/gortsplib/v4/pkg/base"
"github.com/bluenviron/gortsplib/v4/pkg/headers"
"github.com/pion/rtp"
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/counterdumper"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/logger"
"github.com/bluenviron/mediamtx/internal/protocols/rtsp"
"github.com/bluenviron/mediamtx/internal/protocols/tls"
)
@ -168,21 +168,12 @@ func (s *Source) Run(params defs.StaticSourceRunParams) error {
defer s.Parent.SetNotReady(defs.PathSourceStaticSetNotReadyReq{})
for _, medi := range desc.Medias {
for _, forma := range medi.Formats {
cmedi := medi
cforma := forma
c.OnPacketRTP(cmedi, cforma, func(pkt *rtp.Packet) {
pts, ok := c.PacketPTS2(cmedi, pkt)
if !ok {
return
}
res.Stream.WriteRTPPacket(cmedi, cforma, pkt, time.Now(), pts)
})
}
}
rtsp.ToStream(
c,
desc.Medias,
params.Conf,
res.Stream,
s)
rangeHeader, err := createRangeHeader(params.Conf)
if err != nil {