video latency on mobile device
I am working on an application that connects two peers in audio/video using rtmfp.
When a peer wants to talk with another, first it exchanges peer-id and stream-name with the other and then publishes its microphone/camera (in “live” mode) and plays the other peer stream. As usual in Flash platform. Message exchange in my application is server directed (I am using FMS 4), stream connection is peer-to-peer.
Now, all works fine when the two peer run on Adobe AIR for PC. But when one or both run on a mobile platform (iOS 4.3.3 for example) I experience a strange random latency. Sometime latency on the mobile side is near zero, sometime it grows to 3 even 5 or more seconds. So the communication is not really possible.
I tried to narrow down latency by testing different values of bufferTime both on incoming and on outgoing stream: bufferTime = 0 does not work fine on mobile side; using bufferTime = 0 in the output stream and bufferTime=0.3 on incoming stream works better. With this values when video is not involved all works fine. But when one of the two peer attaches a camera then the result is not always the same: sometime latency is acceptable sometime it is not: bufferLength of the incoming stream (playing stream) grows to 3 or more seconds and then it goes up and down. Using bufferTimeMax do not improve latency. On the pc side bufferLength is near zero.
I noted that on the pc side sometime I got a NetStream.Buffer.Empty on the incoming stream so I am thinking that the problem is related to cpu resources on mobile side (I am using an iPhone 4). To lower resource consumption I set Camera.setQuality(0,100) and Camera.setMode(80,60,3). Microphone is configured to use Speex with encodeQuality = 6. But the problem remains.
Is the video playback of Flash Air on mobile device fast enough?
The two peer in my test are on the same LAN and the mobile device use Wi-Fi access. I use Flash CS 5.5 and AIR 2.7.
Does anyone have an explanation of this behavior?
Thanks
Michelangelo
