accept durations expressed as days (i.e. '1d') (#4094)

This commit is contained in:
Alessandro Ros 2025-01-02 12:44:15 +01:00 committed by GitHub
parent 8cbbbc05c3
commit b49acb1e00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 378 additions and 257 deletions

View file

@ -72,8 +72,8 @@ type PeerConnection struct {
ICEServers []webrtc.ICEServer
ICEUDPMux ice.UDPMux
ICETCPMux ice.TCPMux
HandshakeTimeout conf.StringDuration
TrackGatherTimeout conf.StringDuration
HandshakeTimeout conf.Duration
TrackGatherTimeout conf.Duration
LocalRandomUDP bool
IPsFromInterfaces bool
IPsFromInterfacesList []string

View file

@ -14,8 +14,8 @@ import (
func TestPeerConnectionCloseImmediately(t *testing.T) {
pc := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: false,
@ -37,8 +37,8 @@ func TestPeerConnectionCloseImmediately(t *testing.T) {
// test that an audio codec is present regardless of the fact that an audio track is.
func TestPeerConnectionFallbackCodecs(t *testing.T) {
pc1 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: false,
@ -49,8 +49,8 @@ func TestPeerConnectionFallbackCodecs(t *testing.T) {
defer pc1.Close()
pc2 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: true,

View file

@ -336,8 +336,8 @@ func TestToStream(t *testing.T) {
for _, ca := range toFromStreamCases {
t.Run(ca.name, func(t *testing.T) {
pc1 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: true,
@ -351,8 +351,8 @@ func TestToStream(t *testing.T) {
defer pc1.Close()
pc2 := &PeerConnection{
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: false,

View file

@ -46,8 +46,8 @@ func (c *Client) Publish(
c.pc = &webrtc.PeerConnection{
ICEServers: iceServers,
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: true,
@ -122,8 +122,8 @@ func (c *Client) Read(ctx context.Context) ([]*webrtc.IncomingTrack, error) {
c.pc = &webrtc.PeerConnection{
ICEServers: iceServers,
HandshakeTimeout: conf.StringDuration(10 * time.Second),
TrackGatherTimeout: conf.StringDuration(2 * time.Second),
HandshakeTimeout: conf.Duration(10 * time.Second),
TrackGatherTimeout: conf.Duration(2 * time.Second),
LocalRandomUDP: true,
IPsFromInterfaces: true,
Publish: false,