Only dispatch_async on limelight-common's threads

This commit is contained in:
Cameron Gutman
2015-01-09 16:58:18 -05:00
parent 600560d9e3
commit 61401b3e7b
5 changed files with 20 additions and 2 deletions

View File

@@ -27,6 +27,7 @@
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks;
-(void) terminate;
-(void) terminateInternal;
-(void) main;
@end

View File

@@ -275,7 +275,7 @@ void ClDisplayTransientMessage(char* message)
[_callbacks displayTransientMessage: message];
}
-(void) terminate
-(void) terminateInternal
{
// We dispatch this async to get out because this can be invoked
// on a thread inside common and we don't want to deadlock
@@ -285,6 +285,13 @@ void ClDisplayTransientMessage(char* message)
});
}
-(void) terminate
{
// We're guaranteed to not be on a limelight-common thread
// here so it's safe to call stop directly
LiStopConnection();
}
-(id) initWithConfig:(StreamConfiguration*)config renderer:(VideoDecoderRenderer*)myRenderer connectionCallbacks:(id<ConnectionCallbacks>)callbacks
{
self = [super init];

View File

@@ -14,5 +14,6 @@
- (id) initWithConfig:(StreamConfiguration*)config renderView:(UIView*)view connectionCallbacks:(id<ConnectionCallbacks>)callback;
- (void) stopStream;
- (void) stopStreamInternal;
@end

View File

@@ -79,11 +79,20 @@
[opQueue addOperation:_connection];
}
// This should NEVER be called from within a thread
// owned by limelight-common
- (void) stopStream
{
[_connection terminate];
}
// This should only be called from within a thread
// owned by limelight-common
- (void) stopStreamInternal
{
[_connection terminateInternal];
}
- (BOOL) launchApp:(HttpManager*)hMan {
NSData* launchResp = [hMan executeRequestSynchronously:
[hMan newLaunchRequest:_config.appID

View File

@@ -88,7 +88,7 @@
}]];
[self presentViewController:conTermAlert animated:YES completion:nil];
[_streamMan stopStream];
[_streamMan stopStreamInternal];
}
- (void) stageStarting:(char*)stageName {