mirror of
https://github.com/pion/webrtc.git
synced 2025-10-15 19:50:42 +08:00
DTLS is fast enough now that we don't need PLI
Remove temporary fix that only existed when handshaking was slow Resolves #204
This commit is contained in:
@@ -2,13 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/pions/webrtc"
|
"github.com/pions/webrtc"
|
||||||
"github.com/pions/webrtc/examples/gstreamer-receive/gst"
|
"github.com/pions/webrtc/examples/gstreamer-receive/gst"
|
||||||
"github.com/pions/webrtc/examples/util"
|
"github.com/pions/webrtc/examples/util"
|
||||||
"github.com/pions/webrtc/pkg/ice"
|
"github.com/pions/webrtc/pkg/ice"
|
||||||
"github.com/pions/webrtc/pkg/rtcp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -34,21 +32,8 @@ func main() {
|
|||||||
// Set a handler for when a new remote track starts, this handler creates a gstreamer pipeline
|
// Set a handler for when a new remote track starts, this handler creates a gstreamer pipeline
|
||||||
// for the given codec
|
// for the given codec
|
||||||
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
|
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
|
||||||
// Send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval
|
fmt.Printf("Track has started, of type %d: %s \n", track.PayloadType, track.Codec.Name)
|
||||||
// This is a temporary fix until we implement incoming RTCP events, then we would push a PLI only when a viewer requests it
|
pipeline := gst.CreatePipeline(track.Codec.Name)
|
||||||
go func() {
|
|
||||||
ticker := time.NewTicker(time.Second * 3)
|
|
||||||
for range ticker.C {
|
|
||||||
err := peerConnection.SendRTCP(&rtcp.PictureLossIndication{MediaSSRC: track.Ssrc})
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
codec := track.Codec
|
|
||||||
fmt.Printf("Track has started, of type %d: %s \n", track.PayloadType, codec.Name)
|
|
||||||
pipeline := gst.CreatePipeline(codec.Name)
|
|
||||||
pipeline.Start()
|
pipeline.Start()
|
||||||
for {
|
for {
|
||||||
p := <-track.Packets
|
p := <-track.Packets
|
||||||
|
@@ -2,13 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/pions/webrtc"
|
"github.com/pions/webrtc"
|
||||||
"github.com/pions/webrtc/examples/util"
|
"github.com/pions/webrtc/examples/util"
|
||||||
"github.com/pions/webrtc/pkg/ice"
|
"github.com/pions/webrtc/pkg/ice"
|
||||||
"github.com/pions/webrtc/pkg/media/ivfwriter"
|
"github.com/pions/webrtc/pkg/media/ivfwriter"
|
||||||
"github.com/pions/webrtc/pkg/rtcp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -36,18 +34,6 @@ func main() {
|
|||||||
// an ivf file, since we could have multiple video tracks we provide a counter.
|
// an ivf file, since we could have multiple video tracks we provide a counter.
|
||||||
// In your application this is where you would handle/process video
|
// In your application this is where you would handle/process video
|
||||||
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
|
peerConnection.OnTrack(func(track *webrtc.RTCTrack) {
|
||||||
// Send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval
|
|
||||||
// This is a temporary fix until we implement incoming RTCP events, then we would push a PLI only when a viewer requests it
|
|
||||||
go func() {
|
|
||||||
ticker := time.NewTicker(time.Second * 3)
|
|
||||||
for range ticker.C {
|
|
||||||
err := peerConnection.SendRTCP(&rtcp.PictureLossIndication{MediaSSRC: track.Ssrc})
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if track.Codec.Name == webrtc.VP8 {
|
if track.Codec.Name == webrtc.VP8 {
|
||||||
fmt.Println("Got VP8 track, saving to disk as output.ivf")
|
fmt.Println("Got VP8 track, saving to disk as output.ivf")
|
||||||
i, err := ivfwriter.New("output.ivf")
|
i, err := ivfwriter.New("output.ivf")
|
||||||
|
Reference in New Issue
Block a user