Skip to content

Commit

Permalink
webrtc: documentation on raw audio packet times
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Oct 23, 2023
1 parent 327acae commit 672f01f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/webrtc/src/ffmpeg-to-wrtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export async function createTrackForwarder(options: {
const audioRtpTrack: RtpTrack = {
codecCopy: audioCodecCopy,
onRtp: buffer => {
if (false && audioTransceiver.sender.codec.mimeType === "audio/opus") {
if (false && audioTransceiver.sender.codec.mimeType?.toLowerCase() === "audio/opus") {
// this will use 3 20ms frames, 60ms. seems to work up to 6/120ms
if (!opusRepacketizer)
opusRepacketizer = new OpusRepacketizer(3);
Expand All @@ -229,6 +229,8 @@ export async function createTrackForwarder(options: {
}
}
else {
// pcm audio can be concatenated.
// hikvision seems to send 40ms duration packets, so 25 packets per second.
audioTransceiver.sender.sendRtp(buffer);
}
},
Expand Down

0 comments on commit 672f01f

Please sign in to comment.