1 Reply Latest reply: Nov 26, 2014 9:49 AM by kenmckaba2 RSS

    Audio echo cancellation not working using RTMP

    kenmckaba2 Community Member

      I'm doing a audio conferencing app, using RTMP to our server (freeswitch) and getting a bad echo from anyone using speakers & mic- headsets don't cause the echo.  I've also tried 3rd party audio chat apps and they have echo too.

       

      I'm using getEnhancedMicrophone() and have played with all the Microphone & MicrophoneEnhancedOptions I can find.  I followed this article carefully: Best practices for acoustic echo cancellation in Flash Player | Adobe Developer Connection

       

      Does echo cancellation work over RTMP or only over RTMFP?

       

      Here's code I use to connect to send and receive our server's stream:

       

      netConnection = new NetConnection();

      netConnection.connect("rtmp://whatever.com/phone");

      incomingNetStream = new NetStream(netConnection);
      incomingNetStream.client = this;
      incomingNetStream.bufferTime = 0.2;
      incomingNetStream.play("play");
      incomingNetStream.receiveAudio(true);

       

      outgoingNetStream = new NetStream(netConnection);
      outgoingNetStream.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
      outgoingNetStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);

      outgoingNetStream.bufferTime = 0;

      outgoingNetStream.attachAudio(mic);
      outgoingNetStream.publish("publish", "live");

       

      Is anyone successfully using RTMP with echo cancellation?  Can you send a link so I can try it?

       

      Any other ideas?

       

      Thanks,

      Ken

        • 1. Re: Audio echo cancellation not working using RTMP
          kenmckaba2 Community Member

          More complete code:

          netConnection = new NetConnection();
          netConnection
          .connect("rtmp://whatever.com/phone");

          incomingNetStream
          = new NetStream(netConnection);
          incomingNetStream
          .client = this;
          incomingNetStream
          .bufferTime = 0.2;
          incomingNetStream
          .play("play");
          incomingNetStream
          .receiveAudio(true);

          outgoingNetStream
          = new NetStream(netConnection);
          outgoingNetStream
          .bufferTime = 0;
          mic
          = Microphone.getEnhancedMicrophone();
          mic
          .codex = SoundCodec.SPEEX;
          mic
          .framesPerPacket = 1;
          mic
          .setSilenceLevel(0);
          var options:MicrophoneEnhancedOptions = new MicrophoneEnhancedOptions; 
          options
          .echoPath = 256; 
          options
          .nonLinearProcessing = true;
          mic
          .enhancedOptions = options; 

          outgoingNetStream
          .attachAudio(mic);
          outgoingNetStream
          .publish("publish", "live");