git » sdk » commit 0bfd4be

Timestamp advances *after* we send

author Stephen Paul Weber
2024-04-17 14:53:21 UTC
committer Stephen Paul Weber
2024-04-17 14:53:21 UTC
parent 856474046515b2a47e60ed05e183b187f008147c

Timestamp advances *after* we send

snikket/jingle/PeerConnection.cpp.hx +1 -1

diff --git a/snikket/jingle/PeerConnection.cpp.hx b/snikket/jingle/PeerConnection.cpp.hx
index 7730c15..8c66b8b 100644
--- a/snikket/jingle/PeerConnection.cpp.hx
+++ b/snikket/jingle/PeerConnection.cpp.hx
@@ -440,7 +440,6 @@ class MediaStreamTrack {
 			if (track.ref.isClosed()) return;
 			rtpPacketizationConfig.ref.payloadType = format.payloadType;
 			rtpPacketizationConfig.ref.clockRate = clockRate;
-			rtpPacketizationConfig.ref.timestamp = rtpPacketizationConfig.ref.timestamp + Std.int(pcm.length / channels); // timestamp is in samples
 			if (format.format == "PCMU") {
 				track.ref.send(cpp.Pointer.ofArray(pcm.map(pcmToUlaw)).reinterpret(), pcm.length);
 			} else if (format.format == "opus") {
@@ -457,6 +456,7 @@ class MediaStreamTrack {
 			} else {
 				trace("Ignoring audio meant to go out as", format.format, format.clockRate, format.channels);
 			}
+			rtpPacketizationConfig.ref.timestamp = rtpPacketizationConfig.ref.timestamp + Std.int(pcm.length / channels); // timestamp is in samples
 			notifyReadyForData(false);
 		});
 	}