Skip to content

Instantly share code, notes, and snippets.

View Sean-Der's full-sized avatar
🙈
Lexi is the love of my life, I love her more then Daisy loves cheese

Sean DuBois Sean-Der

🙈
Lexi is the love of my life, I love her more then Daisy loves cheese
View GitHub Profile
@Sean-Der
Sean-Der / main.go
Created September 30, 2022 17:45
Pion rtpdump to disk
peerConnection, err := webrtc.NewPeerConnection(webrtc.Configuration{})
if err != nil {
panic(err)
}
// Allow us to receive 1 audio track, and 1 video track
if _, err = peerConnection.AddTransceiverFromKind(webrtc.RTPCodecTypeAudio, webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionRecvonly}); err != nil {
panic(err)
} else if _, err = peerConnection.AddTransceiverFromKind(webrtc.RTPCodecTypeVideo, webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionRecvonly}); err != nil {
panic(err)
@Sean-Der
Sean-Der / main.js
Created May 28, 2022 18:26
Example of Preferring H264 as a Receiver in JS
const H264Codecs = RTCRtpReceiver.getCapabilities('video').codecs.sort((a, b) => {
if (a.mimeType.includes('H264') && b.mimeType.includes('H264')) {
return 0
} else if (a.mimeType.includes('H264')) {
return -1
} else {
return 1
}
})
@Sean-Der
Sean-Der / go.mod
Created May 28, 2022 18:22
Only allow H264 as a receiver
module set-receiver-codec
go 1.18
require github.com/pion/webrtc/v3 v3.1.41
require (
github.com/google/uuid v1.3.0 // indirect
github.com/pion/datachannel v1.5.2 // indirect
github.com/pion/dtls/v2 v2.1.5 // indirect
module srtp
go 1.15
require (
github.com/pion/rtp v1.6.1
github.com/pion/srtp v1.5.2
github.com/pion/webrtc/v3 v3.0.0-beta.13
)
@Sean-Der
Sean-Der / ivfwriter.go
Created April 9, 2022 03:54
Pion IVFWriter for AV1
package main
import (
"encoding/binary"
"errors"
"io"
"os"
"github.com/pion/rtp/v2"
"github.com/pion/rtp/v2/codecs"
commit c8ae82a0bdca9171d297b6fa9739225f4d2f399a
Author: Sean DuBois <sean@siobud.com>
Date: Mon Mar 21 14:28:00 2022 -0400
Unlock on error in internal/mux
Resolves #2154
commit 24c1ad6abcab1cb874a0767ec7a4d26a6a5e78d8
Author: Pion <59523206+pionbot@users.noreply.github.com>
diff --git a/Live.go b/Live.go
index 0096cb7..0051ef4 100644
--- a/Live.go
+++ b/Live.go
@@ -8,6 +8,7 @@ import (
"runtime/debug"
"sync"
+ "github.com/pion/rtcp"
"github.com/pion/webrtc/v3"
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
@Sean-Der
Sean-Der / out.patch
Last active November 5, 2021 17:25
DataChannel race
diff --git a/peerconnection.go b/peerconnection.go
index a5d50ee..5dbf46e 100644
--- a/peerconnection.go
+++ b/peerconnection.go
@@ -1313,28 +1313,6 @@ func (pc *PeerConnection) startSCTP() {
return
}
-
- // DataChannels that need to be opened now that SCTP is available
diff --git a/server/main.go b/server/main.go
index 3f5b52f..fecd6c5 100644
--- a/server/main.go
+++ b/server/main.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
+ "net"
"net/http"