Further improvements to seeking.
parent
2d8ea06321
commit
dfe73fd554
|
@ -78,8 +78,24 @@
|
||||||
NSLog(@"SEEKING IN BUFFERCHIAN");
|
NSLog(@"SEEKING IN BUFFERCHIAN");
|
||||||
[inputNode seek:time];
|
[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];
|
[converterNode resetBuffer];
|
||||||
[inputNode resetBuffer];
|
[inputNode resetBuffer];
|
||||||
|
|
||||||
|
[[inputNode writeLock] unlock];
|
||||||
|
[[inputNode readLock] unlock];
|
||||||
|
|
||||||
|
[[converterNode writeLock] unlock];
|
||||||
|
[[converterNode readLock] unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)endOfInputReached
|
- (void)endOfInputReached
|
||||||
|
|
|
@ -153,14 +153,7 @@
|
||||||
|
|
||||||
- (void)resetBuffer
|
- (void)resetBuffer
|
||||||
{
|
{
|
||||||
[readLock lock];
|
|
||||||
[writeLock lock];
|
|
||||||
[semaphore signal];
|
|
||||||
|
|
||||||
[buffer empty];
|
[buffer empty];
|
||||||
|
|
||||||
[writeLock unlock];
|
|
||||||
[readLock unlock];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSLock *)readLock
|
- (NSLock *)readLock
|
||||||
|
|
|
@ -448,7 +448,6 @@ static inline signed int scale (mad_fixed_t sample)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remainder = 0;
|
remainder = 0;
|
||||||
_seekSkip = NO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
len = fread(_inputBuffer+remainder, 1, INPUT_BUFFER_SIZE-remainder, _inFd);
|
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);
|
mad_stream_buffer(&_stream, _inputBuffer, len);
|
||||||
_stream.error = 0;
|
_stream.error = 0;
|
||||||
|
|
||||||
/* if (_seekSkip)
|
if (_seekSkip)
|
||||||
{
|
{
|
||||||
int skip = 2;
|
int skip = 2;
|
||||||
do
|
do
|
||||||
|
@ -486,7 +485,7 @@ static inline signed int scale (mad_fixed_t sample)
|
||||||
|
|
||||||
_seekSkip = NO;
|
_seekSkip = NO;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if (mad_frame_decode(&_frame, &_stream) == -1) {
|
if (mad_frame_decode(&_frame, &_stream) == -1) {
|
||||||
if (!MAD_RECOVERABLE (_stream.error))
|
if (!MAD_RECOVERABLE (_stream.error))
|
||||||
|
|
Loading…
Reference in New Issue