-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RSDK-9847] - Bump gortsplib dep #80
base: main
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,12 +404,12 @@ func (rc *rtspCamera) initH264(session *description.Session) (err error) { | |
} | ||
|
||
publishToWebRTC := func(pkt *rtp.Packet) { | ||
pts, ok := rc.client.PacketPTS(media, pkt) | ||
pts, ok := rc.client.PacketPTS2(media, pkt) | ||
if !ok { | ||
return | ||
} | ||
ntp := time.Now() | ||
u, err := fp.ProcessRTPPacket(pkt, ntp, pts, true) | ||
u, err := fp.ProcessRTPPacket(pkt, ntp, time.Duration(pts), true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is PTS not time since epoch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not necessarily time since epoch but normally time since the start of the media stream. In this case we are simply parsing out the PTS from the RTP packet we are receiving. |
||
if err != nil { | ||
rc.logger.Debug(err.Error()) | ||
return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ import ( | |
"github.com/bluenviron/gortsplib/v4/pkg/base" | ||
"github.com/bluenviron/gortsplib/v4/pkg/description" | ||
"github.com/bluenviron/gortsplib/v4/pkg/format" | ||
"github.com/bluenviron/gortsplib/v4/pkg/rtptime" | ||
"github.com/bluenviron/mediacommon/pkg/codecs/h264" | ||
"github.com/erh/viamupnp" | ||
"github.com/koron/go-ssdp" | ||
|
@@ -51,7 +50,7 @@ func TestRTSPCamera(t *testing.T) { | |
timeoutCtx, timeoutCancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer timeoutCancel() | ||
config := resource.NewEmptyConfig(camera.Named("foo"), ModelAgnostic) | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress} | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress + "/"} | ||
rtspCam, err := NewRTSPCamera(timeoutCtx, nil, config, logger) | ||
test.That(t, err, test.ShouldBeNil) | ||
defer func() { test.That(t, rtspCam.Close(context.Background()), test.ShouldBeNil) }() | ||
|
@@ -66,7 +65,7 @@ func TestRTSPCamera(t *testing.T) { | |
timeoutCtx, timeoutCancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer timeoutCancel() | ||
config := resource.NewEmptyConfig(camera.Named("foo"), ModelAgnostic) | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress} | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress + "/"} | ||
rtspCam, err := NewRTSPCamera(timeoutCtx, nil, config, logger) | ||
test.That(t, err, test.ShouldBeNil) | ||
defer func() { test.That(t, rtspCam.Close(context.Background()), test.ShouldBeNil) }() | ||
|
@@ -111,7 +110,7 @@ func TestRTSPCamera(t *testing.T) { | |
|
||
config := resource.NewEmptyConfig(camera.Named("foo"), ModelAgnostic) | ||
config.ConvertedAttributes = &Config{ | ||
Address: "rtsp://" + h.s.RTSPAddress, | ||
Address: "rtsp://" + h.s.RTSPAddress + "/", | ||
RTPPassthrough: tc.rtpPassthrough, | ||
} | ||
|
||
|
@@ -202,7 +201,7 @@ func TestRTSPCameraPerformance(t *testing.T) { | |
timeoutCtx, timeoutCancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer timeoutCancel() | ||
config := resource.NewEmptyConfig(camera.Named("foo"), ModelAgnostic) | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress} | ||
config.ConvertedAttributes = &Config{Address: "rtsp://" + h.s.RTSPAddress + "/"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we confirm that this doesn't double append There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that was a log that I inserted into gorstplib that was logging expected route and route request. Confirmed the full RTSP URI was indeed rtsp://127.0.0.1:3251/ Moved to using |
||
rtspCam, err := NewRTSPCamera(timeoutCtx, nil, config, logger) | ||
test.That(t, err, test.ShouldBeNil) | ||
defer func() { test.That(t, rtspCam.Close(context.Background()), test.ShouldBeNil) }() | ||
|
@@ -374,12 +373,7 @@ func newH264ServerHandler( | |
t.Log(err.Error()) | ||
t.FailNow() | ||
} | ||
rtpTime := &rtptime.Encoder{ClockRate: forma.ClockRate()} | ||
err = rtpTime.Initialize() | ||
if err != nil { | ||
t.Log(err.Error()) | ||
t.FailNow() | ||
} | ||
|
||
start := time.Now() | ||
|
||
// setup a ticker to sleep between frames | ||
|
@@ -408,12 +402,9 @@ func newH264ServerHandler( | |
t.FailNow() | ||
} | ||
|
||
// get current timestamp | ||
ts := rtpTime.Encode(time.Since(start)) | ||
|
||
// write packets to the server | ||
for _, pkt := range pkts { | ||
pkt.Timestamp = ts | ||
pkt.Timestamp = uint32(multiplyAndDivide(int64(time.Since(start)), int64(forma.ClockRate()), int64(time.Second))) | ||
|
||
sh.mu.Lock() | ||
err = sh.stream.WritePacketRTP(sh.media, pkt) | ||
|
@@ -447,6 +438,12 @@ func newH264ServerHandler( | |
} | ||
} | ||
|
||
func multiplyAndDivide(v, m, d int64) int64 { | ||
secs := v / d | ||
dec := v % d | ||
return (secs*m + dec*m/d) | ||
} | ||
|
||
func TestUPNPStuff(t *testing.T) { | ||
ctx := context.Background() | ||
logger := logging.NewTestLogger(t) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do reconfigures/reboot behavior look ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call -- tested reconfigures and shutdown working ok.