File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,10 @@ class VoiceConnection extends EventEmitter {
561561
562562 registerReceiveEventHandler ( ) {
563563 this . udpSocket . on ( "message" , ( msg ) => {
564+ if ( msg [ 1 ] !== 0x78 ) { // unknown payload type, ignore
565+ return ;
566+ }
567+
564568 const nonce = Buffer . alloc ( 24 ) ;
565569 msg . copy ( nonce , 0 , 0 , 12 ) ;
566570 let data ;
@@ -586,11 +590,7 @@ class VoiceConnection extends EventEmitter {
586590 // Not a RFC5285 One Byte Header Extension (not negotiated)
587591 if ( hasExtension ) { // RFC3550 5.3.1: RTP Header Extension
588592 const l = data [ 2 ] << 8 | data [ 3 ] ;
589- let index = 4 + l * 4 ;
590- while ( data [ index ] == 0 ) {
591- ++ index ;
592- }
593- data = data . subarray ( index ) ;
593+ data = data . subarray ( 4 + l * 4 ) ;
594594 }
595595 if ( this . receiveStreamOpus ) {
596596 /**
You can’t perform that action at this time.
0 commit comments