mirror of
https://github.com/harshabose/client.git
synced 2025-09-26 19:31:20 +08:00
added all turn serer credentials
This commit is contained in:
@@ -12,6 +12,7 @@ type DataChannel struct {
|
|||||||
label string
|
label string
|
||||||
datachannel *webrtc.DataChannel
|
datachannel *webrtc.DataChannel
|
||||||
init *webrtc.DataChannelInit
|
init *webrtc.DataChannelInit
|
||||||
|
channelOpen chan struct{}
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ func CreateDataChannel(ctx context.Context, label string, peerConnection *webrtc
|
|||||||
dc := &DataChannel{
|
dc := &DataChannel{
|
||||||
label: label,
|
label: label,
|
||||||
datachannel: nil,
|
datachannel: nil,
|
||||||
|
channelOpen: make(chan struct{}),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +65,7 @@ func (dataChannel *DataChannel) Close() error {
|
|||||||
func (dataChannel *DataChannel) onOpen() *DataChannel {
|
func (dataChannel *DataChannel) onOpen() *DataChannel {
|
||||||
dataChannel.datachannel.OnOpen(func() {
|
dataChannel.datachannel.OnOpen(func() {
|
||||||
fmt.Printf("dataChannel Open with Label: %s\n", dataChannel.datachannel.Label())
|
fmt.Printf("dataChannel Open with Label: %s\n", dataChannel.datachannel.Label())
|
||||||
|
dataChannel.channelOpen <- struct{}{}
|
||||||
})
|
})
|
||||||
return dataChannel
|
return dataChannel
|
||||||
}
|
}
|
||||||
@@ -74,6 +77,10 @@ func (dataChannel *DataChannel) onClose() *DataChannel {
|
|||||||
return dataChannel
|
return dataChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dataChannel *DataChannel) WaitUntilOpen() <-chan struct{} {
|
||||||
|
return dataChannel.channelOpen
|
||||||
|
}
|
||||||
|
|
||||||
func (dataChannel *DataChannel) DataChannel() *webrtc.DataChannel {
|
func (dataChannel *DataChannel) DataChannel() *webrtc.DataChannel {
|
||||||
return dataChannel.datachannel
|
return dataChannel.datachannel
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,10 @@ func WithDataChannelInit(init *webrtc.DataChannelInit) Option {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
OrderedTrue = true
|
OrderedTrue = true
|
||||||
NegotiatedTrue = true
|
MaxRetransmits uint16 = 2 // either MaxRetransmits or MaxPacketLifeTime can be specified at once
|
||||||
IDOne uint16 = 1
|
MaxPacketLifeTime uint16 = 50 // milliseconds
|
||||||
|
Protocol = "binary"
|
||||||
|
NegotiatedTrue = true
|
||||||
|
IDOne uint16 = 1
|
||||||
)
|
)
|
||||||
|
@@ -136,7 +136,7 @@ func NewMultiUpdateEncoder(ctx context.Context, config MultiConfig, builder *Gen
|
|||||||
for _, bitrate := range encoder.bitrates {
|
for _, bitrate := range encoder.bitrates {
|
||||||
// TODO: WARN: 90 size might be tooo high
|
// TODO: WARN: 90 size might be tooo high
|
||||||
// TODO: Frame pool could be abstracted away
|
// TODO: Frame pool could be abstracted away
|
||||||
producer := newDummyMediaFrameProducer(buffer.CreateChannelBuffer(ctx2, 90, buffer.CreateFramePool()), describer)
|
producer := newDummyMediaFrameProducer(buffer.CreateChannelBuffer(ctx2, 10, buffer.CreateFramePool()), describer)
|
||||||
|
|
||||||
if err := builder.UpdateBitrate(bitrate); err != nil {
|
if err := builder.UpdateBitrate(bitrate); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@@ -12,24 +12,24 @@ func GetRTCConfiguration() webrtc.Configuration {
|
|||||||
{
|
{
|
||||||
URLs: []string{os.Getenv("STUN_SERVER_URL")},
|
URLs: []string{os.Getenv("STUN_SERVER_URL")},
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// URLs: []string{os.Getenv("TURN_UDP_SERVER_URL")},
|
URLs: []string{os.Getenv("TURN_UDP_SERVER_URL")},
|
||||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
CredentialType: webrtc.ICECredentialTypePassword,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// URLs: []string{os.Getenv("TURN_TCP_SERVER_URL")},
|
URLs: []string{os.Getenv("TURN_TCP_SERVER_URL")},
|
||||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
CredentialType: webrtc.ICECredentialTypePassword,
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// URLs: []string{os.Getenv("TURN_TLS_SERVER_URL")},
|
URLs: []string{os.Getenv("TURN_TLS_SERVER_URL")},
|
||||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
CredentialType: webrtc.ICECredentialTypePassword,
|
||||||
// },
|
},
|
||||||
},
|
},
|
||||||
ICETransportPolicy: webrtc.ICETransportPolicyAll,
|
ICETransportPolicy: webrtc.ICETransportPolicyAll,
|
||||||
BundlePolicy: webrtc.BundlePolicyMaxCompat,
|
BundlePolicy: webrtc.BundlePolicyMaxCompat,
|
||||||
|
Reference in New Issue
Block a user