[Audio Output] Fix serious deadlock issue
There was a serious deadlock issue. Now it is fixed. Whew. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
ab13b66755
commit
36c82a61e7
|
@ -62,6 +62,7 @@
|
|||
[self waitUntilCallbacksExit];
|
||||
if(output) {
|
||||
[output setShouldContinue:NO];
|
||||
[output close];
|
||||
}
|
||||
if(!output) {
|
||||
output = [[OutputNode alloc] initWithController:self previous:nil];
|
||||
|
@ -136,6 +137,7 @@
|
|||
}
|
||||
if(output) {
|
||||
[output setShouldContinue:NO];
|
||||
[output close];
|
||||
}
|
||||
output = nil;
|
||||
}
|
||||
|
|
|
@ -156,10 +156,6 @@
|
|||
}
|
||||
|
||||
- (void)setShouldContinue:(BOOL)s {
|
||||
if(output && !s) {
|
||||
[output stop];
|
||||
}
|
||||
|
||||
[super setShouldContinue:s];
|
||||
|
||||
// if (s == NO)
|
||||
|
|
|
@ -301,7 +301,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
}
|
||||
|
||||
- (BOOL)signalEndOfStream:(double)latency {
|
||||
stopped = YES;
|
||||
BOOL ret = [outputController selectNextBuffer];
|
||||
stopped = ret;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(NSEC_PER_SEC * latency)), dispatch_get_main_queue(), ^{
|
||||
[self->outputController endOfInputPlayed];
|
||||
[self->outputController resetAmountPlayed];
|
||||
|
@ -1009,9 +1011,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
|
||||
- (void)doStop {
|
||||
if(stopInvoked) {
|
||||
while(!stopCompleted) {
|
||||
usleep(5000);
|
||||
}
|
||||
stopFlush = NO;
|
||||
return;
|
||||
}
|
||||
@synchronized(self) {
|
||||
|
@ -1060,7 +1060,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
compareVal = CMTimeCompare(outputPts, currentPts);
|
||||
[currentPtsLock unlock];
|
||||
usleep(5000);
|
||||
} while(compareVal > 0);
|
||||
} while(stopFlush && compareVal > 0);
|
||||
}
|
||||
[self removeSynchronizerBlock];
|
||||
[renderSynchronizer setRate:0];
|
||||
|
|
Loading…
Reference in New Issue