mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 20:52:20 +00:00
Copy track SSRC and payload, working webrtc!
This commit is contained in:
parent
e8f4cd7683
commit
2a3b79734a
@ -68,7 +68,6 @@ func ingestFrom(inputChannel chan srt.Packet) {
|
|||||||
// Receive video
|
// Receive video
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
// Listen for a single RTP Packet, we need this to determine the SSRC
|
|
||||||
inboundRTPPacket := make([]byte, 1500) // UDP MTU
|
inboundRTPPacket := make([]byte, 1500) // UDP MTU
|
||||||
n, _, err := videoListener.ReadFromUDP(inboundRTPPacket)
|
n, _, err := videoListener.ReadFromUDP(inboundRTPPacket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -79,7 +78,12 @@ func ingestFrom(inputChannel chan srt.Packet) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
log.Printf("[Video] %s", packet)
|
log.Printf("[Video] %s", packet)
|
||||||
|
|
||||||
|
// Write RTP packet to all video tracks
|
||||||
|
// Adapt payload and SSRC to match destination
|
||||||
for _, videoTrack := range videoTracks {
|
for _, videoTrack := range videoTracks {
|
||||||
|
packet.Header.PayloadType = videoTrack.PayloadType()
|
||||||
|
packet.Header.SSRC = videoTrack.SSRC()
|
||||||
if writeErr := videoTrack.WriteRTP(packet); writeErr != nil {
|
if writeErr := videoTrack.WriteRTP(packet); writeErr != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -90,7 +94,6 @@ func ingestFrom(inputChannel chan srt.Packet) {
|
|||||||
// Receive audio
|
// Receive audio
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
// Listen for a single RTP Packet, we need this to determine the SSRC
|
|
||||||
inboundRTPPacket := make([]byte, 1500) // UDP MTU
|
inboundRTPPacket := make([]byte, 1500) // UDP MTU
|
||||||
n, _, err := audioListener.ReadFromUDP(inboundRTPPacket)
|
n, _, err := audioListener.ReadFromUDP(inboundRTPPacket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -102,6 +105,8 @@ func ingestFrom(inputChannel chan srt.Packet) {
|
|||||||
}
|
}
|
||||||
log.Printf("[Audio] %s", packet)
|
log.Printf("[Audio] %s", packet)
|
||||||
for _, audioTrack := range audioTracks {
|
for _, audioTrack := range audioTracks {
|
||||||
|
packet.Header.PayloadType = audioTrack.PayloadType()
|
||||||
|
packet.Header.SSRC = audioTrack.SSRC()
|
||||||
if writeErr := audioTrack.WriteRTP(packet); writeErr != nil {
|
if writeErr := audioTrack.WriteRTP(packet); writeErr != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user