fix: metal renderer stuck when disconnect and resume stream
This commit is contained in:
1 parent
55ac533718
commit
4fb3f7fa97
4 files changed
+19
-2
No files matched your search
@@ -125,6 +125,7 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size,
|
|||||||
|
|
||||||
_parameterSetBuffers = [[NSMutableArray alloc] init];
|
_parameterSetBuffers = [[NSMutableArray alloc] init];
|
||||||
_frameQueue = [FrameQueue sharedInstance];
|
_frameQueue = [FrameQueue sharedInstance];
|
||||||
|
[_frameQueue start];
|
||||||
_maxRefreshRate = [[UIScreen mainScreen] maximumFramesPerSecond];
|
_maxRefreshRate = [[UIScreen mainScreen] maximumFramesPerSecond];
|
||||||
|
|
||||||
DataManager* dataMan = [[DataManager alloc] init];
|
DataManager* dataMan = [[DataManager alloc] init];
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (int)currentSoftCap;
|
- (int)currentSoftCap;
|
||||||
- (void)waitForEnqueue;
|
- (void)waitForEnqueue;
|
||||||
- (void)shutdown;
|
- (void)shutdown;
|
||||||
|
- (void)start;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -287,10 +287,15 @@
|
|||||||
return [self count] == 0;
|
return [self count] == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)clear {
|
- (void)_clear_unsafe {
|
||||||
os_unfair_lock_lock(&_lock);
|
|
||||||
_head = _tail = _count = 0;
|
_head = _tail = _count = 0;
|
||||||
_frameDropMetrics = [[FloatBuffer alloc] initWithCapacity:512];
|
_frameDropMetrics = [[FloatBuffer alloc] initWithCapacity:512];
|
||||||
|
}
|
||||||
|
|
||||||
|
// The public clear method now safely calls the unsafe version.
|
||||||
|
- (void)clear {
|
||||||
|
os_unfair_lock_lock(&_lock);
|
||||||
|
[self _clear_unsafe];
|
||||||
os_unfair_lock_unlock(&_lock);
|
os_unfair_lock_unlock(&_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,6 +336,14 @@
|
|||||||
dispatch_semaphore_signal(_frameSemaphore);
|
dispatch_semaphore_signal(_frameSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)start {
|
||||||
|
os_unfair_lock_lock(&_lock);
|
||||||
|
[self _clear_unsafe]; // Use the version without the lock
|
||||||
|
self.isStopping = NO;
|
||||||
|
os_unfair_lock_unlock(&_lock);
|
||||||
|
Log(LOG_I, @"FrameQueue (re)started");
|
||||||
|
}
|
||||||
|
|
||||||
// For use with NSLog("%@", franeQueue);
|
// For use with NSLog("%@", franeQueue);
|
||||||
- (NSString *)description {
|
- (NSString *)description {
|
||||||
__block NSMutableArray *parts = [NSMutableArray arrayWithCapacity:_count];
|
__block NSMutableArray *parts = [NSMutableArray arrayWithCapacity:_count];
|
||||||
|
|||||||
@@ -745,7 +745,9 @@
|
|||||||
_inactivityTimer = nil;
|
_inactivityTimer = nil;
|
||||||
}
|
}
|
||||||
if (self.metalViewController) {
|
if (self.metalViewController) {
|
||||||
|
[self.metalViewController shutdown];
|
||||||
[self.metalViewController.view removeFromSuperview];
|
[self.metalViewController.view removeFromSuperview];
|
||||||
|
[self.metalViewController removeFromParentViewController];
|
||||||
self.metalViewController = nil;
|
self.metalViewController = nil;
|
||||||
NSLog(@"Metal renderer stopped and cleaned up.");
|
NSLog(@"Metal renderer stopped and cleaned up.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user