mirror of
https://github.com/pion/webrtc.git
synced 2025-11-02 03:32:48 +08:00
Set directions on channels
This commit is contained in:
@@ -6,10 +6,11 @@ import (
|
||||
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pions/webrtc"
|
||||
"github.com/pions/webrtc/examples/gstreamer/gst"
|
||||
"github.com/pions/webrtc/pkg/rtp"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
var trackCount uint64
|
||||
@@ -36,7 +37,7 @@ func startWebrtc(pipeline *gst.Pipeline) {
|
||||
|
||||
// Set a handler for when a new remote track starts, this handler starts a gstreamer pipeline
|
||||
// with the first track and assumes it is VP8 video data.
|
||||
peerConnection.Ontrack = func(mediaType webrtc.MediaType, packets chan *rtp.Packet) {
|
||||
peerConnection.Ontrack = func(mediaType webrtc.MediaType, packets <-chan *rtp.Packet) {
|
||||
go func() {
|
||||
track := atomic.AddUint64(&trackCount, 1)
|
||||
fmt.Printf("Track %d has started \n", track)
|
||||
@@ -69,4 +70,4 @@ func main() {
|
||||
p := gst.CreatePipeline()
|
||||
go startWebrtc(p)
|
||||
p.Start()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user