Add a lock around access to output PTS variable
This locking should help, but I don't know why visualization jumps around now. Signed-off-by: Christopher Snowhill <kode54@gmail.com>xcode15
parent
b3d10bdd4d
commit
4c4f479fb6
|
@ -373,7 +373,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
if(bufferRef) {
|
||||
CMTime chunkDuration = CMSampleBufferGetDuration(bufferRef);
|
||||
|
||||
[currentPtsLock lock];
|
||||
outputPts = CMTimeAdd(outputPts, chunkDuration);
|
||||
[currentPtsLock unlock];
|
||||
trackPts = CMTimeAdd(trackPts, chunkDuration);
|
||||
|
||||
[audioRenderer enqueueSampleBuffer:bufferRef];
|
||||
|
@ -1092,8 +1094,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
|
|||
if(timeAdded > 0) {
|
||||
[outputController incrementAmountPlayed:timeAdded];
|
||||
}
|
||||
|
||||
[lock lock];
|
||||
CMTime latencyTime = CMTimeSubtract(*outputPts, time);
|
||||
[lock unlock];
|
||||
double latencySeconds = CMTimeGetSeconds(latencyTime);
|
||||
double latencyVis = 0.0;
|
||||
[lock lock];
|
||||
|
|
Loading…
Reference in New Issue