Compare commits

...

3 Commits

Author SHA1 Message Date
Cédric Verstraeten
6aad8b7b35 Merge pull request #164 from kerberos-io/fix/webrtc-packettimestamp
Fix / WebRTC skip AAC audio + introduce packet timestamps
2025-02-06 10:38:40 +01:00
Cedric Verstraeten
9ce037fdc0 Update main.go 2025-02-06 10:35:36 +01:00
Cedric Verstraeten
0eb77ccd16 Update main.go 2025-02-06 10:15:47 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ import (
"github.com/kerberos-io/agent/machinery/src/models"
)
const VERSION = "3.3.4"
const VERSION = "3.3.5"
const letterBytes = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

View File

@@ -401,7 +401,7 @@ func WriteToTrack(livestreamCursor *packets.QueueCursor, configuration *models.C
if pkt.IsVideo {
// Calculate the difference
bufferDuration := int64(pkt.TimeLegacy) - previousTimeVideo
bufferDuration := pkt.Time - previousTimeVideo
previousTimeVideo = pkt.Time
// Start at the first keyframe
@@ -410,7 +410,7 @@ func WriteToTrack(livestreamCursor *packets.QueueCursor, configuration *models.C
}
if start {
bufferDurationCasted := time.Duration(bufferDuration) * time.Millisecond
sample := pionMedia.Sample{Data: pkt.Data, Duration: bufferDurationCasted}
sample := pionMedia.Sample{Data: pkt.Data, Duration: bufferDurationCasted, PacketTimestamp: uint32(pkt.Time)}
//sample = pionMedia.Sample{Data: pkt.Data, Duration: time.Second}
if config.Capture.ForwardWebRTC == "true" {
// We will send the video to a remote peer
@@ -431,15 +431,16 @@ func WriteToTrack(livestreamCursor *packets.QueueCursor, configuration *models.C
// We will transcode the audio
// TODO..
//d := fdkaac.NewAacDecoder()
continue
}
// Calculate the difference
bufferDuration := int64(pkt.TimeLegacy) - previousTimeAudio
bufferDuration := pkt.Time - previousTimeAudio
previousTimeAudio = pkt.Time
// We will send the audio
bufferDurationCasted := time.Duration(bufferDuration) * time.Millisecond
sample := pionMedia.Sample{Data: pkt.Data, Duration: bufferDurationCasted}
sample := pionMedia.Sample{Data: pkt.Data, Duration: bufferDurationCasted, PacketTimestamp: uint32(pkt.Time)}
//sample = pionMedia.Sample{Data: pkt.Data, Duration: time.Second}
if err := audioTrack.WriteSample(sample); err != nil && err != io.ErrClosedPipe {
log.Log.Error("webrtc.main.WriteToTrack(): something went wrong while writing sample: " + err.Error())