Further improvements to seeking.

CQTexperiment
vspader 2007-02-17 15:42:59 +00:00
parent 2d8ea06321
commit dfe73fd554
3 changed files with 18 additions and 10 deletions

View File

@ -78,8 +78,24 @@
NSLog(@"SEEKING IN BUFFERCHIAN");
[inputNode seek:time];
[[converterNode readLock] lock];
[[converterNode writeLock] lock];
[[inputNode readLock] lock];
[[inputNode writeLock] lock];
//Signal so its waiting when we unlock
[[converterNode semaphore] signal];
[[inputNode semaphore] signal];
[converterNode resetBuffer];
[inputNode resetBuffer];
[[inputNode writeLock] unlock];
[[inputNode readLock] unlock];
[[converterNode writeLock] unlock];
[[converterNode readLock] unlock];
}
- (void)endOfInputReached

View File

@ -153,14 +153,7 @@
- (void)resetBuffer
{
[readLock lock];
[writeLock lock];
[semaphore signal];
[buffer empty];
[writeLock unlock];
[readLock unlock];
}
- (NSLock *)readLock

View File

@ -448,7 +448,6 @@ static inline signed int scale (mad_fixed_t sample)
else
{
remainder = 0;
_seekSkip = NO;
}
len = fread(_inputBuffer+remainder, 1, INPUT_BUFFER_SIZE-remainder, _inFd);
@ -469,7 +468,7 @@ static inline signed int scale (mad_fixed_t sample)
mad_stream_buffer(&_stream, _inputBuffer, len);
_stream.error = 0;
/* if (_seekSkip)
if (_seekSkip)
{
int skip = 2;
do
@ -486,7 +485,7 @@ static inline signed int scale (mad_fixed_t sample)
_seekSkip = NO;
}
*/
}
if (mad_frame_decode(&_frame, &_stream) == -1) {
if (!MAD_RECOVERABLE (_stream.error))