mamburu: Fixed InputNode's thread not being stopped at all
parent
56848daad6
commit
1b818bcaa7
|
@ -57,7 +57,6 @@
|
||||||
output = [[OutputNode alloc] initWithController:self previous:nil];
|
output = [[OutputNode alloc] initWithController:self previous:nil];
|
||||||
[output setup];
|
[output setup];
|
||||||
[output setVolume: volume];
|
[output setVolume: volume];
|
||||||
|
|
||||||
@synchronized(chainQueue) {
|
@synchronized(chainQueue) {
|
||||||
for (id anObject in chainQueue)
|
for (id anObject in chainQueue)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +64,6 @@
|
||||||
}
|
}
|
||||||
[chainQueue removeAllObjects];
|
[chainQueue removeAllObjects];
|
||||||
endOfInputReached = NO;
|
endOfInputReached = NO;
|
||||||
|
|
||||||
if (bufferChain)
|
if (bufferChain)
|
||||||
{
|
{
|
||||||
[bufferChain setShouldContinue:NO];
|
[bufferChain setShouldContinue:NO];
|
||||||
|
@ -73,7 +71,7 @@
|
||||||
[bufferChain release];
|
[bufferChain release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||||
[self notifyStreamChanged:userInfo];
|
[self notifyStreamChanged:userInfo];
|
||||||
|
|
||||||
|
@ -97,7 +95,7 @@
|
||||||
|
|
||||||
bufferChain = [[BufferChain alloc] initWithController:self];
|
bufferChain = [[BufferChain alloc] initWithController:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
[bufferChain setUserInfo:userInfo];
|
[bufferChain setUserInfo:userInfo];
|
||||||
|
|
||||||
[self setShouldContinue:YES];
|
[self setShouldContinue:YES];
|
||||||
|
|
|
@ -122,6 +122,10 @@
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
|
[[inputNode exitAtTheEndOfTheStream] signal];
|
||||||
|
[[inputNode semaphore] signal];
|
||||||
|
[[inputNode exitAtTheEndOfTheStream] wait]; // wait for decoder to be closed (see InputNode's -(void)process )
|
||||||
|
|
||||||
[rgInfo release];
|
[rgInfo release];
|
||||||
[userInfo release];
|
[userInfo release];
|
||||||
[streamURL release];
|
[streamURL release];
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
Semaphore *exitAtTheEndOfTheStream;
|
Semaphore *exitAtTheEndOfTheStream;
|
||||||
}
|
}
|
||||||
|
@property(readonly) Semaphore *exitAtTheEndOfTheStream;
|
||||||
|
|
||||||
- (BOOL)openWithSource:(id<CogSource>)source;
|
- (BOOL)openWithSource:(id<CogSource>)source;
|
||||||
- (BOOL)openWithDecoder:(id<CogDecoder>) d;
|
- (BOOL)openWithDecoder:(id<CogDecoder>) d;
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#import "Logging.h"
|
#import "Logging.h"
|
||||||
|
|
||||||
@implementation InputNode
|
@implementation InputNode
|
||||||
|
@synthesize exitAtTheEndOfTheStream;
|
||||||
|
|
||||||
|
|
||||||
- (id)initWithController:(id)c previous:(id)p {
|
- (id)initWithController:(id)c previous:(id)p {
|
||||||
self = [super initWithController:c previous:p];
|
self = [super initWithController:c previous:p];
|
||||||
|
@ -174,6 +176,8 @@
|
||||||
free(inputBuffer);
|
free(inputBuffer);
|
||||||
|
|
||||||
[exitAtTheEndOfTheStream signal];
|
[exitAtTheEndOfTheStream signal];
|
||||||
|
|
||||||
|
DLog("Input node thread stopping");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)seek:(long)frame
|
- (void)seek:(long)frame
|
||||||
|
@ -203,16 +207,13 @@
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
DLog(@"Input Node dealloc");
|
DLog(@"Input Node dealloc");
|
||||||
[exitAtTheEndOfTheStream signal];
|
|
||||||
[exitAtTheEndOfTheStream wait]; // wait for decoder to be closed (see -(void)process )
|
|
||||||
[exitAtTheEndOfTheStream release];
|
|
||||||
|
|
||||||
[decoder removeObserver:self forKeyPath:@"properties"];
|
[decoder removeObserver:self forKeyPath:@"properties"];
|
||||||
[decoder removeObserver:self forKeyPath:@"metadata"];
|
[decoder removeObserver:self forKeyPath:@"metadata"];
|
||||||
|
|
||||||
[decoder release];
|
[decoder release];
|
||||||
|
|
||||||
[super dealloc];
|
[exitAtTheEndOfTheStream release];
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSDictionary *) properties
|
- (NSDictionary *) properties
|
||||||
|
|
Loading…
Reference in New Issue