Basic overview how CRC finds partners, connecting to a user, etc.



  • Hi, I purchased CRC (4.1) a while back and I really haven't seen it working as stable as I expected it would. I currently have it running on a Red5 server, after seeing it unstable on a Stratus setup, but that doesn't seem to solve anything.

    The problem is, say 10 people are online, when 4 of us are the only ones clicking 'Next' and the other 6 just waits, 2 out of the 4 people looking for partners couldn't find any. Also, 'connect to a user' doesn't seem to work even if that user I want to connect to is online and just waiting. I've read in another thread that a more stable scenario is having more than 20 users online. The problem with that is I couldn't invite people to use my service if they couldn't connect to each other, and then think that it doesn't work.

    I have some background in PHP-MySql programming, and I managed to wrap CRC in CodeIgniter Framework. Requests are going in and out smoothly (I compared those with the "unadulterized" version) What I could not grasp is what the queries are expected to output, and how they are supposed to work. So, if it's possible, I would like to see the flowchart/data flow of CRC. That would help me understand and make modifications wherever it's needed. I would gladly give back to the community and to your team whatever improvements I could make.

    Many thanks in advance!



  • The main problem is with the synchronization (Stratus). If it would be done in real time, it would create too many queries to the database and this would cause high load on most servers. First thing, we can do is to move the connection related settings to the configuration file so everyone can fine-tune the connection. The second is an additional, different approach to connection handling. Both will be included in version 4.3. About Red5, here everything should be OK. We also had problems (server going down and some times miss connection) but these are the results of Red5 (0.8). We (and some other hosting companies) did not find anything in the logs.



  • @'JabberCam':

    The main problem is with the synchronization (Stratus). If it would be done in real time, it would create too many queries to the database and this would cause high load on most servers. First thing, we can do is to move the connection related settings to the configuration file so everyone can fine-tune the connection. The second is an additional, different approach to connection handling. Both will be included in version 4.3. About Red5, here everything should be OK. We also had problems (server going down and some times miss connection) but these are the results of Red5 (0.8). We (and some other hosting companies) did not find anything in the logs.

    Thanks. I wasn't able to respond promptly since I was away for weeks. Anyway, Is there any tool or just any thing I could do to monitor the performance of CRC on Red5? I want to compare the difference in performance between different setups (Stratus and Red5).

    Also, when I looked at the Java source inside the Red5 application, I found SQL statements. I assume they are the same as with the php client. Does that mean that the Red5 server directly queries the database and that the CRC client no longer needs to send requests to the php client? Also, if I do update the SQL statements in the php client, do I also need to update the SQL statements inside the Red5 client?



  • Hi, the performance is obvious. Red5 is much faster (because you're the only one using it when Stratus is used by tens of thousands), Stratus is way better at the moment. The java application connects to the database, php is not needed (except config).



  • @'JabberCam':

    Hi, the performance is obvious. Red5 is much faster (because you're the only one using it when Stratus is used by tens of thousands), Stratus is way better at the moment. The java application connects to the database, php is not needed (except config).

    Alright, that clears things up. Many thanks!



  • this is weird
    i got the rvc5.6
    red5 is up and running
    centos 5.5
    2.8gh server with 2giga memry

    when i conecto to someone i cussed randomly

    when i succeed all is good but when i fail
    he hears the conncetion beep the chat area goes blank he hears me but see the add instead
    while i see and hear him

    what could be the cause? server? memory? hardisk? madness?!



  • This could be a bug in the software but we could'n figure out the exact cause, yet. Seems like the connection is realized and user A is not sending video signal (or it doesn't go trough) while user B sends both audio and video. Since B does not receive signal he is "not connected" and chat is not available. This is one of the issues, we cannot figure out if it is the software or the server. Did you encounter the same issue with Cirrus?



  • well it happens half of the time
    more interesting things
    user A and B is sending and recieving
    the reason B sooesnt see a is the "add" if you remove it
    you see clearly that both sound and video happy sent and recieved

    also note that moving:
    (userManager as Red5CCUserManager).connectToPeer(mOtherId);
    in function connectToOther();

    the upper you put it the more time it connects
    however putting this line to delay of more than 1 miliseconds
    results in failure to connect at all times while video is running

    i suspect that it doesnt open the stream in time of the publishing
    any idias on that?
    so it seems to miss the sending of text data….
    i sugest to let the red5 send data to the onpeerconnect function and go around the instream data sending


    Ok here is your solution:

    when the server send connection it creates stream
    then it uses the stream to send data needed to recognize username sex etc
    now sometimes it takes little bit more time to create that stream but since the program
    doesnt really care for that it send the data anyway causing the data to float in to the unknown
    after that stream created and then there is video and audio streaming on both ends
    note that the jabbercam addvert simply stands over the video sometims

    also to get max results from the server via video quality
    instead of the default
    camera.setMode(320, 240, 15);
    camera.setQuality(0, something);
    do this
    camera.setMode(320, 240, 30);
    camera.setQuality(0, 95);

    will work wonders on the speed and delay
    jabbercam developers….please see this to improve your program
    for more info just leave a message or contact me directly via mail.

    here is the altered function

    this is the altered function connectToOther()
    jabberCam.as line 1626

    private function connectToOther():void
    {
    if (mOtherId == null || mOtherId.length != 64)
    {
    ccCallState = CCCallReady;
    return;
    }

    ccCallState = CCCallCalling;
    mAutoFindActive = false;

    trace("connectToOther() line 624");
    // caller subsrcibes to callee's listener stream
    if(!serverIsRed5) {
    gracefulDisconnect = false;
    if(controlStream) {
    controlStream.removeEventListener(NetStatusEvent.NET_STATUS, controlHandler);
    try {
    controlStream.close();
    controlStream = null;
    } catch(e : Error) {

    }
    }
    controlStream = new NetStream(netConnection, mOtherId);
    controlStream.addEventListener(NetStatusEvent.NET_STATUS, controlHandler);
    controlStream.play("ChatRouletteClone");

    // caller publishes media stream
    if(outgoingStream) {
    outgoingStream.removeEventListener(NetStatusEvent.NET_STATUS, outgoingStreamHandler);
    try {
    outgoingStream.close();
    } catch(e : Error) {

    }
    }
    outgoingStream = new NetStream(netConnection, NetStream.DIRECT_CONNECTIONS);
    outgoingStream.addEventListener(NetStatusEvent.NET_STATUS, outgoingStreamHandler);
    outgoingStream.publish("media-requester");

    if(incomingStream) {
    incomingStream.removeEventListener(NetStatusEvent.NET_STATUS, incomingStreamHandler);
    try {
    incomingStream.close();
    } catch(e : Error) {

    }
    }
    var o:Object = new Object
    o.onPeerConnect = function(caller:NetStream):Boolean // called on the requester side
    {
    // if(ccCallState == CCCallEstablished || ccCallState == CCCallCalling)
    // return false;

    // caller subscribes to callee's media stream
    incomingStream = new NetStream(netConnection, caller.farID);
    incomingStream.addEventListener(NetStatusEvent.NET_STATUS, incomingStreamHandler);
    incomingStream.play("media-responder");

    // set volume for incoming stream
    var st:SoundTransform = new SoundTransform(speakerVolumeSlider.value); // TODO: volume settings
    incomingStream.soundTransform = st;

    incomingStream.receiveAudio(true);
    incomingStream.receiveVideo(true);

    var i:Object = new Object;
    i.onIm = onMessageReceived;
    i.sendSex = function(sex:String):void
    {
    mOtherSex = sex;
    }
    i.sendAge = function(age:int): void {
    // lookupAge.value = age;
    }
    i.gotBanned = gotBanned;
    i.gracefullyDisconnect = function(id : String) : void {
    trace('gracefullyDisconnect: '+id);
    gracefulDisconnect = true;
    };
    i.sendUsername = partnerUsernameReceived;
    i.gotReported = gotReported;
    i.onPeerCameraAllowed = onPeerCameraAllowed;

    incomingStream.client = i;

    if(!remoteVideo) {
    remoteVideo = new Video();
    remoteVideo.width = 320;
    remoteVideo.height = 240;
    vidOther.addChild(remoteVideo);
    }

    remoteVideo.attachNetStream(incomingStream);

    clearTaChat();
    setConnectionSuccess();
    setCallEstablished();
    return true;
    }
    outgoingStream.client = o;

    mConnectionTimeoutTimer = new Timer(1000 * CONNECTION_TIMEOUT_SECONDS, 1);
    mConnectionTimeoutTimer.addEventListener(TimerEvent.TIMER, onConnectionTimeoutTimer);
    mConnectionTimeoutTimer.start();
    } else {
    //**************************************************************
    // i have moved the connectToPeer up simly to give it more time to do it's job nothing else

    (userManager as Red5CCUserManager).connectToPeer(mOtherId);
    //**************************************************************

    if(outgoingStream) {
    outgoingStream.removeEventListener(NetStatusEvent.NET_STATUS, outgoingStreamHandler);
    try {
    outgoingStream.close();
    } catch(e : Error) {

    }
    }
    outgoingStream = new NetStream(netConnection);
    outgoingStream.addEventListener(NetStatusEvent.NET_STATUS, outgoingStreamHandler);
    outgoingStream.publish(mId);

    //**************************************************************
    // moved it near the bottom ///
    //**************************************************************
    // set volume for incoming stream
    var st:SoundTransform = new SoundTransform(speakerVolumeSlider.value); // TODO: volume settings
    incomingStream.soundTransform = st;

    incomingStream.receiveAudio(true);
    incomingStream.receiveVideo(true);

    var i:Object = new Object;
    i.onIm = onMessageReceived;
    i.sendSex = function(sex:String):void
    {
    mOtherSex = sex;
    }
    i.sendAge = function(age:int): void {
    // lookupAge.value = age;
    };
    i.sendUsername = partnerUsernameReceived;
    i.gotReported = gotReported;
    i.onPeerCameraAllowed = onPeerCameraAllowed;

    incomingStream.client = i;

    if(!remoteVideo) {
    remoteVideo = new Video();
    remoteVideo.width = 320;
    remoteVideo.height = 240;
    vidOther.addChild(remoteVideo);
    }

    remoteVideo.attachNetStream(incomingStream);

    //**************************************************************
    //note that by movig the publish here i give it more time to establish stream before i use it

    incomingStream = new NetStream(netConnection);
    incomingStream.addEventListener(NetStatusEvent.NET_STATUS, incomingStreamHandler);
    incomingStream.play(mOtherId);

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

    clearTaChat();
    setConnectionSuccess();
    setCallEstablished();
    }

    startAudio();
    startVideo();
    }



  • also if you could help e with red5 error
    org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Unknown object type: 2
    when it shows the next time i press next it failes and shows me bunch of weird decoder errors
    red5 0.9rc1
    centos



    • by "add" you mean the advertisement (ad)? try to remove the ad by simply emptying /media/ads/blankscreen
    • moving pieces of code in order to be processed sooner (and later) doesn't seem like a solution at first sight, however, you may have right! Those fractures of milliseconds could end up in a much higher value (close to a second) in case a response is expected.
    • about the quality settings and server-response coherence, someone, who is more into the media server connections and Red5 will take a look (did it work for you and with Red5 only or Cirrus as well?)
    • the reason we gave up our own Red5 server was the time we spent on keeping it up and running these errors will give you a headache, did you try the Red5 1.0 RC Build?

    *please send me a PM with your e-mail address



  • the video quality on the cirrus and red5 improved after setting frames from 15 to 30…. infact it helped so much that connection p2p threw cirrus was close to skype quality

    also i achived some level of success by playing aroud with buffers
    seems that if buffer is full it will threw an exeption and die
    threw my google-reasurch on this i found that if the buffer is full at the time i start a new stream it fails

    rtmp.host = your.server.com
    rtmp.port = 1935
    rtmp.event_threads_core=16
    rtmp.event_threads_max=32
    // i am not sure about the core threads and what they do fo a living
    // but i increased them anyway try to find the right components

    event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue

    rtmp.event_threads_queue=-1
    rtmp.event_threads_keepalive=60

    rtmp.send_buffer_size=271360
    rtmp.receive_buffer_size=65536
    //making it more seem to give the server more variety of movement and handling better video

    rtmp.ping_interval=5000
    rtmp.max_inactivity=60000

    also stumbled upon file called
    red5-highperf.sh

    witch defines the speed ,mem usage , etc… of red5 etc playing a little with that brought to a success

    also for the finals
    red5 1.0 goes down with
    "cannot start without instance id"
    something related to java and paths
    and you can no longer install red5 under ver 0.8 due to java-ant
    laque of compatibility or so it seems.....



  • did you install tomcat with Red5 1.0 (it is not included by default any more), RVC runs in tomcat



  • i istalled red5 java1.6.26 and ant 1.8.2 before instaling the red5



  • @'volchkov':

    also to get max results from the server via video quality
    instead of the default
    camera.setMode(320, 240, 15);
    camera.setQuality(0, something);
    do this
    camera.setMode(320, 240, 30);
    camera.setQuality(0, 95);

    Seems that the 95 video quality performs best and about the user_cam.setMode setting you are right again.

    By setting the camera to user_cam.setMode(320, 240, 30, true), this is what happens:

    • the camera is set to try 320x240 area, where the priority is set to the area (true) and a frame rate of 30 (without priority). In this case, a camera capable of 25fps will run the 320x240 with 25fps native mode after passing 320x288-25, 320x240-25, 352x288-15 and 320x288-25, 320x240-25; 6 passes. The same with priority set to 15fps (RVC default) would take over 10 passes. If you set the priority to the frame-rate (false) the result could be very different. More info here: http://flash-communications.net/technotes/setMode/index.html

Log in to reply
 

© 2108 H7 | Powered by NodeBB

Looks like your connection to H7 was lost, please wait while we try to reconnect.