Commit 76cce0cc by suolong

修复线上奔溃信息。

parent 8ed0da73
......@@ -35,6 +35,10 @@
// 视频帧是否回调
@property (nonatomic, assign) BOOL openVideoFrameCallBack;
@property (nonatomic, strong) FUSTTStreamPlayer *retainSelfWhileClosing;
@property (nonatomic, strong) TVLManager *asyncClosingManager;
@end
@implementation FUSTTStreamPlayer
......@@ -155,28 +159,28 @@
}
- (void)fus_destroyPlayer {
[self fus_destroyPlayerAsync:YES];
[self fus_destroyPlayerAsync:NO];
}
- (void)fus_destroyPlayerAsync:(BOOL)async {
if (self.liveManager && !self.isAsyncClosing) {
TVLManager *manager = self.liveManager;
self.isAsyncClosing = YES;
@try {
if (self.liveManager.isPlaying
|| self.liveManager.playerLoadState == TVLPlayerLoadStateStalled
|| self.liveManager.playerLoadState == TVLPlayerLoadStatePlayable) {
[self.liveManager setMuted:YES];
if (manager.isPlaying
|| manager.playerLoadState == TVLPlayerLoadStateStalled
|| manager.playerLoadState == TVLPlayerLoadStatePlayable) {
[manager setMuted:YES];
}
[self.liveManager.playerView removeFromSuperview];
[manager.playerView removeFromSuperview];
if (async) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self.liveManager stop];
});
[self.liveManager closeAsync];
self.retainSelfWhileClosing = self;
self.asyncClosingManager = manager;
[manager closeAsync];
} else {
[self.liveManager stop];
[self.liveManager close];
[manager stop];
[manager close];
}
} @catch (NSException *exception) {
} @finally {
......@@ -186,6 +190,8 @@
_liveManager.delegate = nil;
_liveManager = nil;
self.isAsyncClosing = NO;
self.asyncClosingManager = nil;
self.retainSelfWhileClosing = nil;
}
}
}
......@@ -465,8 +471,12 @@
[self fus_removeKVOIfNeeded];
self.liveManager = nil;
}
if (manager == self.asyncClosingManager) {
self.asyncClosingManager = nil;
}
manager = nil;
self.isAsyncClosing = NO;
self.retainSelfWhileClosing = nil;
}
#pragma mark - VeLivePlayerObserver
......@@ -547,6 +557,7 @@
}
- (void)dealloc {
_liveManager.delegate = nil;
[self fus_removeKVOIfNeeded];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment