Skip to content

Commit

Permalink
Remove problematic and outdated "heapdump" dep
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Nov 22, 2023
1 parent c47c032 commit cf18771
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 29 deletions.
38 changes: 38 additions & 0 deletions server/lib/Room.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const EventEmitter = require('events').EventEmitter;
const protoo = require('protoo-server');
// const rtp = require('rtp.js');
const throttle = require('@sitespeed.io/throttle');
const Logger = require('./Logger');
const config = require('../config');
Expand Down Expand Up @@ -1157,6 +1158,43 @@ class Room extends EventEmitter
});
}

/* Test rtpjs lib. */

// const directTransport = await this._mediasoupRouter.createDirectTransport();

// directTransport.on('rtcp', (buffer) =>
// {
// const rtcpPacket =
// new rtp.packets.CompoundPacket(rtp.utils.nodeBufferToDataView(buffer));

// logger.info('RTCP packet');
// logger.info(rtcpPacket.dump());
// });

// const directConsumer = await directTransport.consume(
// {
// producerId : producer.id,
// rtpCapabilities : this._mediasoupRouter.rtpCapabilities
// }
// );

// const directProducer = await directTransport.produce(
// {
// kind : directConsumer.kind,
// rtpParameters : directConsumer.rtpParameters
// });

// directConsumer.on('rtp', (buffer) =>
// {
// const rtpPacket =
// new rtp.packets.RtpPacket(rtp.utils.nodeBufferToDataView(buffer));

// // logger.info('RTP packet');
// // logger.info(rtpPacket.dump());

// directProducer.send(buffer);
// });

// Add into the AudioLevelObserver and ActiveSpeakerObserver.
if (producer.kind === 'audio')
{
Expand Down
26 changes: 0 additions & 26 deletions server/lib/interactiveServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const fs = require('fs');
const mediasoup = require('mediasoup');
const colors = require('colors/safe');
const pidusage = require('pidusage');
const heapdump = require('heapdump');

const SOCKET_PATH_UNIX = '/tmp/mediasoup-demo.sock';
const SOCKET_PATH_WIN = path.join('\\\\?\\pipe', process.cwd(), 'mediasoup-demo');
Expand Down Expand Up @@ -91,7 +90,6 @@ class Interactive
this.log('- sc, statsConsumer [id] : get stats for mediasoup Consumer with given id (or the latest created one)');
this.log('- sdp, statsDataProducer [id] : get stats for mediasoup DataProducer with given id (or the latest created one)');
this.log('- sdc, statsDataConsumer [id] : get stats for mediasoup DataConsumer with given id (or the latest created one)');
this.log('- hs, heapsnapshot : write a heapdump snapshot to file');
this.log('- t, terminal : open Node REPL Terminal');
this.log('');
readStdin();
Expand Down Expand Up @@ -508,30 +506,6 @@ class Interactive
break;
}

case 'hs':
case 'heapsnapshot':
{
const filename =
`${process.env.SNAPSHOT_DIR || '/tmp'}/${Date.now()}-mediasoup-demo.heapsnapshot`;

// eslint-disable-next-line no-shadow
heapdump.writeSnapshot(filename, (error, filename) =>
{
if (!error)
{
this.log(`heapdump snapshot writen to ${filename}`);
this.log(
'learn how to use it at https://github.com/bnoordhuis/node-heapdump');
}
else
{
this.error(`heapdump snapshot failed: ${error}`);
}
});

break;
}

case 't':
case 'terminal':
{
Expand Down
3 changes: 2 additions & 1 deletion server/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ exports.clone = function(value)
else if (typeof structuredClone === 'function')
{
// Available in Node >= 18.
// eslint-disable-next-line no-undef
return structuredClone(value);
}
else
{
return JSON.parse(JSON.stringify(value));
}
}
};
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"colors": "^1.4.0",
"debug": "^4.3.1",
"express": "^4.17.1",
"heapdump": "^0.3.15",
"mediasoup": "github:versatica/mediasoup#v3",
"pidusage": "^2.0.21",
"protoo-server": "^4.0.5"
"protoo-server": "^4.0.5",
"rtp.js": "^0.11.4"
},
"devDependencies": {
"eslint": "^6.8.0",
Expand Down

0 comments on commit cf18771

Please sign in to comment.