Init the FIFOs only when needed.
This commit is contained in:
6 files changed
+30
-27
No files matched your search
+8
-4
@@ -512,12 +512,17 @@
|
||||
NSUInteger tracksImportersCount = trackImportersArray.count;
|
||||
NSUInteger tracksCount = _activeTracks.count;
|
||||
NSMutableArray<MP42Track *> *tracks = [_activeTracks copy];
|
||||
|
||||
NSMutableArray<MP42Track *> *nextTracks = nil;
|
||||
for (;;) {
|
||||
@autoreleasepool {
|
||||
|
||||
usleep(1000);
|
||||
|
||||
if (nextTracks) {
|
||||
tracks = nextTracks;
|
||||
nextTracks = nil;
|
||||
}
|
||||
|
||||
// Iterate the tracks array and mux the samples
|
||||
for (MP42Track *track in tracks) {
|
||||
MP42SampleBuffer *sampleBuffer = nil;
|
||||
@@ -527,9 +532,8 @@
|
||||
|
||||
if (sampleBuffer->flags & MP42SampleBufferFlagEndOfFile) {
|
||||
// Tracks done, remove it from the loop
|
||||
NSMutableArray<MP42Track *> *copy = [tracks mutableCopy];
|
||||
[copy removeObject:track];
|
||||
tracks = copy;
|
||||
NSMutableArray<MP42Track *> *nextTracks = [tracks mutableCopy];
|
||||
[nextTracks removeObject:track];
|
||||
done += 1;
|
||||
}
|
||||
else if (!MP4WriteSample(_fileHandle, trackId,
|
||||
|
||||
Reference in new issue
Block a user