5 Replies Latest reply on Feb 10, 2015 3:13 AM by pluton99

    onPeerConnect sometimes never being called

    whather Level 1

      I have a conferencing application which uses RTMFP for video/audio and has an RTMP fallback if a client is using Flash 9 or can't connect to Stratus. I'm having problems with connecting to some users, as their onPeerConnect method never gets called after playing their netStream. I'll explain how I manage my RTMFP connections:

       

      So I used to only have one publishing netstream per client which listened for connections via NetStream.Connect.Success. If it found a connection, it would then connect to the connectee's netStream. This worked flawlessly locally but had problems with some clients remotely. I then decided to switch to the listener/controller method where each client publishes two netStreams: one that only listens for incoming connections and another that publishes purely audio/video (inspired by adobe's sample apps and this site: http://www.influxis.com/seantron/StratusSessions.html). Here's how it currently works:

       

      1. Before the client enters the conference, he connects to Stratus and after hitting NetConnection.Connect.Success, he creates and publishes both a Listener stream and audio/video stream.
      2. Client then enters conference. If there are any existing users in the conference, the client plays each user's Listening stream and Audio/Video stream.
      3. The existing users in the conference should have onPeerConnect called on their listening stream, and then they immediately start playing the connecting user's Audio/Video stream. This is working perfectly locally and on a lot of remote clients, but not everyone.

       

      First of all, is this the recommended/correct way to handle an RTMFP many-to-many conference? Why would a user sometimes never have their onPeerConnect called when another user plays their stream?

       

      A couple of notes:

      • Yes, I do set the Listening stream's client object before I call publish().
      • The net connection sets maxPeerConnections to 16 to avoid hitting the connection limit.
      • The guy who's onPeerConnect never gets called, it works fine for him locally. Also, my onPeerConnect does get called if I'm in the conference first and he connects to me. It's always the other way around (when he's in the conference first and I connect to him) where it fails.

       

      I've attached logs of one of our test conferences. Client 1 is the first in the conference, and never gets onPeerConnect called even though Client 2 and Client 3 play the stream. Although, local clients 2 and 3 connect to each other fine when joining the same conference.

       

      Any clues? Thanks!

       

      -Wes

        • 1. Re: onPeerConnect sometimes never being called
          whather Level 1

          So it turns out I get the same problem with Adobe's Sample Stratus Application (http://labs.adobe.com/technologies/stratus/samples/). Ben never receives my connect requests, however he successfully connects to Stratus and can successfully connect to me. It doesn't seem like this is a firewall issue on Ben's side because he can successfully connect to Stratus. Is the only way to create an RTMP fallback timer and start sending RTMP after no response after 10 seconds or so? What would cause this? Here are our logs from the Sample Stratus Application:

           

          /********************************************************

            Me trying to connect to Ben. The netstream times

            out after a minute or two and closes, hanging up the call.

          *********************************************************/

           

          MY LOGS:

          Connecting to rtmfp://stratus.adobe.com

          NetConnection event: NetConnection.Connect.Success

          Connected, my ID: ffe3ba510550c49935b10000609b94f4ae7a0ab70d66d9379c009bfd2c08ec11

          ID event: registerSuccess

          Listener event: NetStream.Publish.Start

          ID event: lookupSuccess

          Calling ben, id: e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793

          Outgoing stream event: NetStream.Publish.Start

          NetConnection event: NetStream.Connect.Closed

          Hanging up call

          Incoming stream event: NetStream.Play.Stop

          Outgoing stream event: NetStream.Unpublish.Success

          Control event: NetStream.Play.Stop

          NetConnection event: NetStream.Connect.Closed

          Hanging up call

           

          BEN'S LOGS:

          Connecting to rtmfp://stratus.adobe.com
          NetConnection event:  NetConnection.Connect.Success
          Connected, my ID:  e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793
          ID event:  registerSuccess
          Listener event: NetStream.Publish.Start

           

           

          /**************************************************

            Ben connects to me successfully.

          ***************************************************/

           

          MY LOGS:

          Connecting to rtmfp://stratus.adobe.com

          NetConnection event: NetConnection.Connect.Success

          Connected, my ID: 80155d3ec8ea749ea776a99bbd2b5ed8c885bbb1192a546348d820ea7b2047be

          ID event: registerSuccess

          Listener event: NetStream.Publish.Start

          NetConnection event: NetStream.Connect.Success

          Connection from: e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793

          NetConnection event: NetStream.Connect.Success

          Connection from: e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793

          Caller connecting to listener stream: e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793

          Listener event: NetStream.Play.Reset

          Listener event: NetStream.Play.Start

          Incoming stream event: NetStream.Play.Reset

          Incoming stream event: NetStream.Play.Start

          Incoming call from: ben

          Outgoing stream event: NetStream.Publish.Start

           

          BEN'S LOGS:

          Connecting to rtmfp://stratus.adobe.com
          NetConnection event:  NetConnection.Connect.Success
          Connected, my ID:  e35ac5a4078360d61709acf5c83339cb9ce925d14995da9371125c981146d793
          ID event:  registerSuccess
          Listener event: NetStream.Publish.Start
          ID event:  lookupSuccess
          Calling whather, id:  80155d3ec8ea749ea776a99bbd2b5ed8c885bbb1192a546348d820ea7b2047be
          Outgoing  stream event: NetStream.Publish.Start
          NetConnection event:  NetStream.Connect.Success
          Connection from:  80155d3ec8ea749ea776a99bbd2b5ed8c885bbb1192a546348d820ea7b2047be
          Callee  connecting to media stream:  80155d3ec8ea749ea776a99bbd2b5ed8c885bbb1192a546348d820ea7b2047be
          Outgoing  stream event: NetStream.Play.Reset
          Outgoing stream event:  NetStream.Play.Start
          Control event: NetStream.Play.Reset
          Control event:  NetStream.Play.Start
          Incoming stream event:  NetStream.Play.PublishNotify
          Incoming stream event:  NetStream.Play.PublishNotify
          Call accepted by whather

          • 2. Re: onPeerConnect sometimes never being called
            kRizzl0r

            whather, how did you get a custom onPeerConnect() to work at all?!

             

            haven't played around with rtmfp for a few month now. i'm almost 100% certain the onPeerConnect()-thing worked back then.

            i've just looked up my old code and found that it worked with an Object with a dynamically added onPeerConnect()-function - even then it did NOT work via a separate client-class to handle things like this. (i know because i wrote a comment. unbelievable!)

             

            now it seems there is no way at all to have a custom onPeerConnect() called.. :/

             

            the only workaround seems to listen to the corresponding NetConnection instance' NetStream.Connect.Success and then check the peers via NetStream.peerStreams - that sucks because like that you have a tighter coupling between NetConnection and NetStream. in my use case i'd like to keep both apart. well well.

             

            adobe, go!

             

            -> guess it's the same issue here.

             

            cheers

             

            edit: of course i stumbled upon a strange workaround right after rambling on here.. *sigh*

            • 3. Re: onPeerConnect sometimes never being called
              whather Level 1

              That's not the problem I'm having. I'm getting the problem without modifying any code, just using Adobe's VideoPhone application (http://labs.adobe.com/technologies/stratus/samples/). I ran a WireShark trace on Ben's machine and I'm getting "ICMP Destination unreachable (Port unreachable)" packets when trying to connect.

               

              Packet traffic:

               

              192.168.1.100 76.74.170.51 UDP Source port: 61968  Destination port: documentum

              76.74.170.51 192.168.1.100 UDP Source port: documentum  Destination port: 61968

              192.168.1.100 76.74.170.52 UDP Source port: 61968  Destination port: documentum_s

              192.168.1.100 192.168.11.2 UDP Source port: 61968  Destination port: 61020

              192.168.1.100 192.168.56.1 UDP Source port: 61968  Destination port: 61020

              192.168.1.100 98.248.163.75 UDP Source port: 61968  Destination port: 1024

              76.74.170.52 192.168.1.100 UDP Source port: documentum_s  Destination port: 61968

              98.248.163.75 192.168.1.100 ICMP Destination unreachable (Port unreachable)

               

              Is this a firewall issue?

              • 4. Re: onPeerConnect sometimes never being called
                AA44 Level 1

                whather,

                 

                Did you manage to find the solution to this? I seem to having a similar problem. Local connections work every time, remote connections fail every time.

                 

                Any idea why using a "Listener" stream helps? I simply have a stream for audio, and one for video, and as soon as one client accepts a call from the other, they both try to connect to each others publishing streams.

                 

                I have no idea why waiting for onPeerConnect to execute would help.

                 

                Cam

                • 5. Re: onPeerConnect sometimes never being called
                  pluton99 Level 1

                  Hi.

                  I am in same problem.

                   

                  cirrus has a bug for a long time

                   

                  Did you solve the problem?

                  Would you help me?