Live video stream

Options
Hi,

Currently I try to implement a live video transmission using the RaiseEvent functionality of PUN and the Photon Cloud. Here is a sample snippet code:

textureToSend.SetPixels(webCamTexture.GetPixels());
var bytes = textureToSend.EncodeToJPG(50);

byte evCode = 0;
RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.Others };
SendOptions sendOptions = new SendOptions { Reliability = false };
PhotonNetwork.RaiseEvent(evCode, bytes, raiseEventOptions, SendOptions.SendUnreliable);


The encodeToJPG results in a 16kb array in my case. Sending 10-15 frames per second would therefore produce ~200kb of data p/s. Unfortunately, my application always disconnects from the room after sending the first few frames. Is this due to the amount of data? If so, are there any known optimization tweaks?

Comments

  • OneManArmy
    Options
    From FAQ

    Can I send a huge message using Photon?

    We do not recommend transferring large data (i.e. files) using Photon unless you know what you are doing. We advise you to optimize the data you exchange and get in touch with us if you really have to send a very big message.

    Photon Cloud has a server side limit for client buffers which is 500KB. So depending on the context a message could be considered:

    "too big" for our per client buffer size on Photon Cloud > 500KB. If a client hits this limit in a short period of time, it will be disconnected by the server.
    "too big" to be sent with UDP without resulting in an amount of fragments that might cause problems > 100KB.
    "too big" to be sent without splitting it up into multiple UDP packets > 1.2KB (including protocols overhead).

    For messages that get sent very regularly (10 times a second or even more often) we would recommend to keep their size below 1KB.

    If a message only get sent rarely (for example once at the start of a match), then a size of multiple KB is still fine, but we still would recommend to keep it below 10KB.

    In exceptional cases something like 20KB or even 50KB might make sense. But usually messages that big indicate that there is something wrong and you should review what you are doing and reconsider your options.
  • vadim
    Options
    Hi,

    Try to send less frequently or smaller size images. That way you will find the bandwidth which works for you,
    Check logs for disconnection reason.
    Use video codec like vpx instead of jpeg to significantly reduce required bandwidth w/o quality degradation.
  • aiursrage2k
    Options
    Is there anyway to increase the client buffer size?