Commit 76cce0cc by suolong

修复线上奔溃信息。

parent 8ed0da73
...@@ -35,6 +35,10 @@ ...@@ -35,6 +35,10 @@
// 视频帧是否回调 // 视频帧是否回调
@property (nonatomic, assign) BOOL openVideoFrameCallBack; @property (nonatomic, assign) BOOL openVideoFrameCallBack;
@property (nonatomic, strong) FUSTTStreamPlayer *retainSelfWhileClosing;
@property (nonatomic, strong) TVLManager *asyncClosingManager;
@end @end
@implementation FUSTTStreamPlayer @implementation FUSTTStreamPlayer
...@@ -155,28 +159,28 @@ ...@@ -155,28 +159,28 @@
} }
- (void)fus_destroyPlayer { - (void)fus_destroyPlayer {
[self fus_destroyPlayerAsync:YES]; [self fus_destroyPlayerAsync:NO];
} }
- (void)fus_destroyPlayerAsync:(BOOL)async { - (void)fus_destroyPlayerAsync:(BOOL)async {
if (self.liveManager && !self.isAsyncClosing) { if (self.liveManager && !self.isAsyncClosing) {
TVLManager *manager = self.liveManager;
self.isAsyncClosing = YES; self.isAsyncClosing = YES;
@try { @try {
if (self.liveManager.isPlaying if (manager.isPlaying
|| self.liveManager.playerLoadState == TVLPlayerLoadStateStalled || manager.playerLoadState == TVLPlayerLoadStateStalled
|| self.liveManager.playerLoadState == TVLPlayerLoadStatePlayable) { || manager.playerLoadState == TVLPlayerLoadStatePlayable) {
[self.liveManager setMuted:YES]; [manager setMuted:YES];
} }
[self.liveManager.playerView removeFromSuperview]; [manager.playerView removeFromSuperview];
if (async) { if (async) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{ self.retainSelfWhileClosing = self;
[self.liveManager stop]; self.asyncClosingManager = manager;
}); [manager closeAsync];
[self.liveManager closeAsync];
} else { } else {
[self.liveManager stop]; [manager stop];
[self.liveManager close]; [manager close];
} }
} @catch (NSException *exception) { } @catch (NSException *exception) {
} @finally { } @finally {
...@@ -186,6 +190,8 @@ ...@@ -186,6 +190,8 @@
_liveManager.delegate = nil; _liveManager.delegate = nil;
_liveManager = nil; _liveManager = nil;
self.isAsyncClosing = NO; self.isAsyncClosing = NO;
self.asyncClosingManager = nil;
self.retainSelfWhileClosing = nil;
} }
} }
} }
...@@ -465,8 +471,12 @@ ...@@ -465,8 +471,12 @@
[self fus_removeKVOIfNeeded]; [self fus_removeKVOIfNeeded];
self.liveManager = nil; self.liveManager = nil;
} }
if (manager == self.asyncClosingManager) {
self.asyncClosingManager = nil;
}
manager = nil; manager = nil;
self.isAsyncClosing = NO; self.isAsyncClosing = NO;
self.retainSelfWhileClosing = nil;
} }
#pragma mark - VeLivePlayerObserver #pragma mark - VeLivePlayerObserver
...@@ -547,6 +557,7 @@ ...@@ -547,6 +557,7 @@
} }
- (void)dealloc { - (void)dealloc {
_liveManager.delegate = nil;
[self fus_removeKVOIfNeeded]; [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