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
|
||||
datachannel *webrtc.DataChannel
|
||||
init *webrtc.DataChannelInit
|
||||
channelOpen chan struct{}
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
@@ -19,6 +20,7 @@ func CreateDataChannel(ctx context.Context, label string, peerConnection *webrtc
|
||||
dc := &DataChannel{
|
||||
label: label,
|
||||
datachannel: nil,
|
||||
channelOpen: make(chan struct{}),
|
||||
ctx: ctx,
|
||||
}
|
||||
|
||||
@@ -63,6 +65,7 @@ func (dataChannel *DataChannel) Close() error {
|
||||
func (dataChannel *DataChannel) onOpen() *DataChannel {
|
||||
dataChannel.datachannel.OnOpen(func() {
|
||||
fmt.Printf("dataChannel Open with Label: %s\n", dataChannel.datachannel.Label())
|
||||
dataChannel.channelOpen <- struct{}{}
|
||||
})
|
||||
return dataChannel
|
||||
}
|
||||
@@ -74,6 +77,10 @@ func (dataChannel *DataChannel) onClose() *DataChannel {
|
||||
return dataChannel
|
||||
}
|
||||
|
||||
func (dataChannel *DataChannel) WaitUntilOpen() <-chan struct{} {
|
||||
return dataChannel.channelOpen
|
||||
}
|
||||
|
||||
func (dataChannel *DataChannel) DataChannel() *webrtc.DataChannel {
|
||||
return dataChannel.datachannel
|
||||
}
|
||||
|
@@ -13,6 +13,9 @@ func WithDataChannelInit(init *webrtc.DataChannelInit) Option {
|
||||
|
||||
var (
|
||||
OrderedTrue = true
|
||||
MaxRetransmits uint16 = 2 // either MaxRetransmits or MaxPacketLifeTime can be specified at once
|
||||
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 {
|
||||
// TODO: WARN: 90 size might be tooo high
|
||||
// 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 {
|
||||
return nil, err
|
||||
|
@@ -12,24 +12,24 @@ func GetRTCConfiguration() webrtc.Configuration {
|
||||
{
|
||||
URLs: []string{os.Getenv("STUN_SERVER_URL")},
|
||||
},
|
||||
// {
|
||||
// URLs: []string{os.Getenv("TURN_UDP_SERVER_URL")},
|
||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
||||
// },
|
||||
// {
|
||||
// URLs: []string{os.Getenv("TURN_TCP_SERVER_URL")},
|
||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
||||
// },
|
||||
// {
|
||||
// URLs: []string{os.Getenv("TURN_TLS_SERVER_URL")},
|
||||
// Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
// Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
// CredentialType: webrtc.ICECredentialTypePassword,
|
||||
// },
|
||||
{
|
||||
URLs: []string{os.Getenv("TURN_UDP_SERVER_URL")},
|
||||
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
CredentialType: webrtc.ICECredentialTypePassword,
|
||||
},
|
||||
{
|
||||
URLs: []string{os.Getenv("TURN_TCP_SERVER_URL")},
|
||||
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
CredentialType: webrtc.ICECredentialTypePassword,
|
||||
},
|
||||
{
|
||||
URLs: []string{os.Getenv("TURN_TLS_SERVER_URL")},
|
||||
Username: os.Getenv("TURN_SERVER_USERNAME"),
|
||||
Credential: os.Getenv("TURN_SERVER_PASSWORD"),
|
||||
CredentialType: webrtc.ICECredentialTypePassword,
|
||||
},
|
||||
},
|
||||
ICETransportPolicy: webrtc.ICETransportPolicyAll,
|
||||
BundlePolicy: webrtc.BundlePolicyMaxCompat,
|
||||
|
Reference in New Issue
Block a user