I am currently making a peer-to-peer music app using node.js in my free time. I already had some major hurdles that are now fixed, including forcing the audio to use high bandwidth. However, now the sound, while being good quality, is prone to cutting out and "digitizing" (sounding more link a synth than an instrument, basically like a computer at times).
Is there a way to control the packet loss? If so, would I do it through the SDP?
I already tried googling it, however, WebRTC seems to be sadly lacking documentation for music/high quality purposes.
Thanks a lot!
here is the code I am using to force sdp to high bandwidth:
function changeSDP( offer ) {
let sdp = offer.split('\r\n');//convert to an concatenable array
let new_sdp = '';
let position = null;
sdp = sdp.slice(0, -1); //remove the last comma ','
for(let i = 0; i < sdp.length; i++) {//look if exists already a b=AS:XXX line
if(sdp[i].match('b=AS:')) {
position = i; //mark the position
}
}
if(position) {
sdp.splice(position, 1);//remove if exists
}
for(let i = 0; i < sdp.length; i++) {
if(sdp[i].match('m=video')) {//modify and add the new lines for video
new_sdp += sdp[i] + '\r\n' + 'b=AS:' + 5000 + '\r\n';
}
else {
if(sdp[i].match('m=audio')) { //modify and add the new lines for audio
new_sdp += sdp[i] + '\r\n' + 'b=AS:' + 5000 + '\r\n';
}
else {
new_sdp += sdp[i] + '\r\n';
}
}
}
console.log(new_sdp)
return new_sdp; //return the new sdp
}