From 01f11fc095bd4d33a221b04044de8c124e39c4a3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 20 Jan 2014 23:48:06 -0500 Subject: [PATCH] Delay frame drawing for a 30 FPS target. Change rendering configuration for faster drawing. Perform the segue after the URL request returns. --- Limelight-iOS/MainFrameViewController.m | 4 ++-- Limelight-iOS/StreamView.m | 4 +++- Limelight-iOS/VideoRenderer.m | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Limelight-iOS/MainFrameViewController.m b/Limelight-iOS/MainFrameViewController.m index 86e692a..d251f1a 100644 --- a/Limelight-iOS/MainFrameViewController.m +++ b/Limelight-iOS/MainFrameViewController.m @@ -33,8 +33,6 @@ static NSString* hostAddr; hostAddr = self.HostField.text; NSString* host = [NSString stringWithFormat:@"http://%@:47989/launch?uniqueid=0&appid=67339056", self.HostField.text]; NSLog(@"host: %@", host); - - [self performSegueWithIdentifier:@"createStreamFrame" sender:self]; NSURL* url = [[NSURL alloc] initWithString:host]; NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url]; @@ -42,6 +40,8 @@ static NSString* hostAddr; NSURLResponse* response = nil; NSData *response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:NULL]; NSLog(@"url response: %@", response1); + + [self performSegueWithIdentifier:@"createStreamFrame" sender:self]; } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component diff --git a/Limelight-iOS/StreamView.m b/Limelight-iOS/StreamView.m index 552ab24..8bc2546 100644 --- a/Limelight-iOS/StreamView.m +++ b/Limelight-iOS/StreamView.m @@ -56,7 +56,9 @@ image = CGBitmapContextCreateImage(bitmapContext); struct CGContext* context = UIGraphicsGetCurrentContext(); - + + CGContextSetBlendMode(context, kCGBlendModeCopy); + CGContextSetInterpolationQuality(context, kCGInterpolationNone); CGContextRotateCTM(context, -M_PI_2); CGContextScaleCTM(context, -(float)self.frame.size.width/self.frame.size.height, (float)self.frame.size.height/self.frame.size.width); CGContextDrawImage(context, rect, image); diff --git a/Limelight-iOS/VideoRenderer.m b/Limelight-iOS/VideoRenderer.m index 1fb3683..2dfbed2 100644 --- a/Limelight-iOS/VideoRenderer.m +++ b/Limelight-iOS/VideoRenderer.m @@ -27,7 +27,7 @@ static bool render = false; if (render) { [self.renderTarget performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:NULL waitUntilDone:TRUE]; - usleep(5000); + usleep(25000); } else { sleep(1); }