Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-15-2011, 11:03 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 1
bbrooks is on a distinguished road
Default Unreasonable WiFi UDP broadcast packet loss

We are attempting to stream audio packets via a local WiFi network. We are broadcasting UDP packets - one 200 byte packet every 10ms. At times the iphone4 will receive acceptable packets with a few lost packets and audio quality is more than adequate for our purposes but when there is WiFi noise above 10% as noted with iStumbler, packet loss is unacceptable.

Most Android devices receive packets fine with very low packet loss under the same conditions.
We discovered that most WiFi routers queue up UDP packets when experiencing noisy RF conditions and then broadcast them in bursts when appropriate, the iPhone seems to have a serious problem with these bursts of broadcasted UDP traffic whereas most Android devices handle these just fine.

iPads handle these conditions much better than the iPhone but still below par as compared with most Android devices we have tested.

The question is:
Is there a lower level CFNetworking or other function that we might incorporate in our code to handle this very likely-to-happen bursty UDP traffic.
We have an adequate jitter buffer in-place but the problem is that we are not receiving the bursty packets at all from CFNetworkStream using Berkley sockets or other CFNetwork methods.

Here is a simple Sockets sample we were using to note packet loss within a 100 packet sample but have noticed the same thing using CFNetworking frameworks calls:
Since the server side is sending one packet per 10ms without fail 100 packets should take approx. 1000ms but we are seeing in the neighborhood of 1500-1700ms when wifi noise is present.
The typical Android device sees maybe 1050ms per 100 packets at most..

*//launch method from application didFinishLaunchingWithOptions
We are attempting to stream audio packets via a local WiFi network. We are broadcasting UDP packets - one 200 byte packet every 10ms. At times the iphone4 will receive acceptable packets with few lost packets and audio quality is more than adequate for our purposes but when there is WiFi noise above 10% as noted with iStumbler, packet loss is unacceptable.

Most Android devices receive packets fine with very low packet loss under the same conditions.
We discovered that most WiFi routers queue up packets when experiencing noisy RF conditions and then broadcast them in bursts when appropriate, the iPhone seems to have a serious problem with these bursts of broadcasted UDP traffic whereas most Android devices handle these just fine.

iPads handle these conditions much better than the iPhone but still below par as compared with most Android devices we have tested.

The question is:
Is there a lower level CFNetworking or other function that we might incorporate in our code to handle this very likely-to-happen bursty UDP traffic.
We have an adequate jitter buffer in-place but the problem is that we are not receiving the bursty packets at all from CFNetworkStream using Berkley sockets or other CFNetwork methods.

Here is a simple Sockets sample we were using to note packet loss within a 100 packet sample but have noticed the same thing using CFNetworking frameworks calls:
Since the server side is sending one packet per 10ms without fail 100 packets should take approx. 1000ms but we are seeing in the neighborhood of 1500-1700ms when wifi noise is present.
The typical Android device sees maybe 1050ms per 100 packets at most..

*//launch method from application didFinishLaunchingWithOptions
Code:
* [NSThread detachNewThreadSelector:@selector(startServer) toTarget:self withObject:nil];

- (void)startServer {

* * NSAutoreleasePool *pool;
* * pool = [[NSAutoreleasePool alloc] init];
* * int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
* * struct sockaddr_in sa;
* * char buffer[524];
* * size_t recsize;
* * socklen_t fromlen;
* * packetCounter = 0;

* * memset(&sa, 0, sizeof(sa));
* * sa.sin_family = AF_INET;
* * sa.sin_addr.s_addr = INADDR_ANY;
* * sa.sin_port = htons([udpPort intValue]);

* * // bind the socket to our address
* * if (-1 == bind(sock,(struct sockaddr *)&sa, sizeof(struct sockaddr)))
* * * * {
* * * * * * perror("error bind failed");
* * * * * * close(sock);
* * * * * * exit(EXIT_FAILURE);
* * * * * * }*

* * for (;;)
* * * * {
* * * * * * recsize = recvfrom(sock, (void *)buffer, 524, 0, (struct sockaddr *)&sa, &fromlen);

* * * * * * //packetCounter++;
* * * * * * if (recsize < 0)
* * * * * * * * NSLog(@"Packet size less than 0");
* * * * * * else packetCounter++;//Metric for counting num of AA packets, raw input
* * * * * * if(packetCounter >= 100) {
* * * * * * * * uint64_t stop = mach_absolute_time();
* * * * * * * * uint64_t oneHundredPacketTime = stop-startBaseTime;
* * * * * * * * oneHundredPacketTime *= timebaseInfo.numer;
* * * * * * * * oneHundredPacketTime /= timebaseInfo.denom;
* * * * * * * * packetCounter = 0;
* * * * * * * * startBaseTime =* mach_absolute_time();
* * * * * * * * //NSLog(@"oneHundredPacket Time = %f ms",oneHundredPacketTime*0.000001);
* * * * * * * * [_mainViewController performSelectorOnMainThread:@selector(addText:)
** * * * * * * * * * * * * * * * * * * * withObject:[NSString stringWithFormat:@"100 Packet Time = %1.0f ms",oneHundredPacketTime*0.000001]
* * * * * * * * * * * * * * * * * * * waitUntilDone:NO];

* * * * * * }

* * * * }
* * [pool release];
}
bbrooks is offline   Reply With Quote
Reply

Bookmarks

Tags
broadcast, datagram, loss, udp

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 395
14 members and 381 guests
7twenty7, AppsBlogger, Creativ, Dalia, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, Sami Gh, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0