Migrate SDP generation to Unified Plan

This commit has breaking changes. This API change means we
can no longer support an arbitrary number of receivers. For every track
you want to receive you MUST call PeerConnection.AddTransceiver

We do now support sending an multiple audio/video feeds. You can see
this behavior via gstreamer-receive and gstreamer-send currently.

Resolves #54
This commit is contained in:
Sean DuBois
2019-03-12 23:54:35 -07:00
parent bc94eaa968
commit 1202dbaa06
20 changed files with 340 additions and 169 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"fmt"
"io"
"time"
"github.com/pions/rtcp"
@@ -46,6 +47,11 @@ func main() {
panic(err)
}
// Allow us to receive 1 video track
if _, err = peerConnection.AddTransceiver(webrtc.RTPCodecTypeVideo); err != nil {
panic(err)
}
localTrackChan := make(chan *webrtc.Track)
// Set a handler for when a new remote track starts, this just distributes all our packets
// to connected peers
@@ -75,7 +81,8 @@ func main() {
panic(readErr)
}
if _, err = localTrack.Write(rtpBuf[:i]); err != nil {
// ErrClosedPipe means we don't have any subscribers, this is ok if no peers have connected yet
if _, err = localTrack.Write(rtpBuf[:i]); err != nil && err != io.ErrClosedPipe {
panic(err)
}
}