@@ -448,6 +448,13 @@ export default abstract class LocalTrack<
448
448
const unlock = await this . processorLock . lock ( ) ;
449
449
try {
450
450
this . log . debug ( 'setting up processor' , this . logContext ) ;
451
+ const processorOptions = {
452
+ kind : this . kind ,
453
+ track : this . _mediaStreamTrack ,
454
+ element : this . processorElement ,
455
+ audioContext : this . audioContext ,
456
+ } ;
457
+ await processor . init ( processorOptions ) ;
451
458
if ( this . processor ) {
452
459
await this . stopProcessor ( ) ;
453
460
}
@@ -466,14 +473,6 @@ export default abstract class LocalTrack<
466
473
this . log . error ( 'failed to play processor element' , { ...this . logContext , error } ) ,
467
474
) ;
468
475
469
- const processorOptions = {
470
- kind : this . kind ,
471
- track : this . _mediaStreamTrack ,
472
- element : this . processorElement ,
473
- audioContext : this . audioContext ,
474
- } ;
475
-
476
- await processor . init ( processorOptions ) ;
477
476
this . processor = processor ;
478
477
if ( this . processor . processedTrack ) {
479
478
for ( const el of this . attachedElements ) {
@@ -510,7 +509,10 @@ export default abstract class LocalTrack<
510
509
this . processor = undefined ;
511
510
this . processorElement ?. remove ( ) ;
512
511
this . processorElement = undefined ;
513
- await this . restart ( ) ;
512
+ // apply original track constraints in case the processor changed them
513
+ await this . _mediaStreamTrack . applyConstraints ( this . _constraints ) ;
514
+ // force re-setting of the mediaStreamTrack on the sender
515
+ await this . setMediaStreamTrack ( this . _mediaStreamTrack , true ) ;
514
516
this . emit ( TrackEvent . TrackProcessorUpdate ) ;
515
517
}
516
518
0 commit comments