Commit e7fb740d by pidan

1、fixed 直播间卡死的问题

2、fixed 上传到AppStore报bitcode相关报错的问题
parent 7b6a86ca
......@@ -32,10 +32,10 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
@property (nonatomic, strong) NSMutableDictionary <NSString *, FUSStreamPlayer> *previewDictionary;
// 是否应该重载视频的数据字典
@property (nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *>*reloadStateDict;
//@property (nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *>*reloadStateDict;
// 重载次数
@property (nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *>*reloadTimesDict;
//@property (nonatomic, strong) NSMutableDictionary <NSString *, NSNumber *>*reloadTimesDict;
// 循环检测码率 Timer
//@property (nonatomic, strong) NSTimer *loopCheckBitrateTimer;
......@@ -60,7 +60,7 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
if (self) {
_previewDictionary = [NSMutableDictionary dictionary];
_reloadTimesDict = [NSMutableDictionary dictionary];
// _reloadTimesDict = [NSMutableDictionary dictionary];
_videoFrameCallBackIdSet = [NSMutableSet set];
[self registerNotification];
......@@ -462,8 +462,8 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
[player fus_destroyPlayer];
player.delegate = nil;
[_previewDictionary removeObjectForKey:uid];
[_reloadStateDict removeObjectForKey:uid];
[_reloadTimesDict removeObjectForKey:uid];
// [_reloadStateDict removeObjectForKey:uid];
// [_reloadTimesDict removeObjectForKey:uid];
}
- (void)fus_destroyAllPlayer
......@@ -477,8 +477,8 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
}
[_previewDictionary removeAllObjects];
[_reloadStateDict removeAllObjects];
[_reloadTimesDict removeAllObjects];
// [_reloadStateDict removeAllObjects];
// [_reloadTimesDict removeAllObjects];
[self fus_updatePlayersFrame];
[_videoFrameCallBackIdSet removeAllObjects];
}
......@@ -742,9 +742,9 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
case FUSVideoPlayerPlayStatePlaying: {
FUSLogInfo(@"uid:%@ FUSStreamPlayView 状态变化:正在播放状态。",player.videoId);
_reloadStateDict[player.videoId] = @(NO);
// _reloadStateDict[player.videoId] = @(NO);
[self fus_playingStatusDidChangedHandler:YES player:player];
self.reloadTimesDict[player.videoId] = @(0);
// self.reloadTimesDict[player.videoId] = @(0);
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
if (player.videoId) {
......@@ -803,15 +803,15 @@ typedef id<FUSVideoPlayerProtocal> FUSStreamPlayer;
}
#pragma mark - Setter and Getter
- (NSMutableDictionary<NSString *,NSNumber *> *)reloadStateDict
{
if (!_reloadStateDict) {
_reloadStateDict = [NSMutableDictionary dictionary];
}
return _reloadStateDict;
}
//- (NSMutableDictionary<NSString *,NSNumber *> *)reloadStateDict
//{
// if (!_reloadStateDict) {
//
// _reloadStateDict = [NSMutableDictionary dictionary];
//
// }
// return _reloadStateDict;
//}
#pragma mark - Other
......
......@@ -150,11 +150,11 @@
}
- (void)fus_stopPlayer {
[self fus_destroyPlayerAsync:NO];
[self fus_destroyPlayerAsync:YES];
}
- (void)fus_destroyPlayer {
[self fus_destroyPlayerAsync:NO];
[self fus_destroyPlayerAsync:YES];
}
- (void)fus_destroyPlayerAsync:(BOOL)async {
......@@ -168,13 +168,15 @@
[self.liveManager setMuted:YES];
}
[self.liveManager.playerView removeFromSuperview];
[self.liveManager stop];
if (async) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self.liveManager stop];
});
[self.liveManager closeAsync];
} else {
[self.liveManager stop];
[self.liveManager close];
}
[self fus_removeKVOIfNeeded];
} @catch (NSException *exception) {
} @finally {
}
......@@ -224,7 +226,7 @@
TVLManager *liveManager = [[TVLManager alloc] initWithOwnPlayer:YES];
[liveManager setDelegate:self]; // TVLProtocol代理设置
[liveManager setProjectKey:@"Fusi"]; // 标识产品
liveManager.commonTag = @"test";
liveManager.commonTag = @"ios";
[liveManager setRetryTimeInternal:5]; // 重试间隔
[liveManager setRetryCountLimit:INT_MAX]; // 重试最大次数
[liveManager setRetryTimeLimit:INT_MAX]; // 单次重试最大时长
......
......@@ -107,23 +107,42 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
- (void)handleRouteChangeNotification:(NSNotification *)notification {
NSNumber* reasonNumber =
notification.userInfo[AVAudioSessionRouteChangeReasonKey];
AVAudioSessionRouteChangeReason reason =
(AVAudioSessionRouteChangeReason)reasonNumber.unsignedIntegerValue;
if (reason == AVAudioSessionRouteChangeReasonCategoryChange) {
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionCategory currentCategory = [AVAudioSession sharedInstance].category;
// //在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
if (currentCategoryOptions != categoryOptions) {
[[AVAudioSession sharedInstance] setCategory:currentCategory withOptions:categoryOptions error:nil];
}
//
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];
}
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSNumber* reasonNumber =
notification.userInfo[AVAudioSessionRouteChangeReasonKey];
AVAudioSessionRouteChangeReason reason =
(AVAudioSessionRouteChangeReason)reasonNumber.unsignedIntegerValue;
if (reason == AVAudioSessionRouteChangeReasonCategoryChange) {
AVAudioSessionCategoryOptions currentCategoryOptions = [AVAudioSession sharedInstance].categoryOptions;
AVAudioSessionCategory currentCategory = [AVAudioSession sharedInstance].category;
// //在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
if (currentCategoryOptions != categoryOptions) {
[[AVAudioSession sharedInstance] setCategory:currentCategory withOptions:categoryOptions error:nil];
}
[[AVAudioSession sharedInstance] setActive:YES error:nil];
} else if (reason == AVAudioSessionRouteChangeReasonRouteConfigurationChange) {
AVAudioSessionRouteDescription *currentRoute = [AVAudioSession sharedInstance].currentRoute;
BOOL needForceToSpeaker = NO;
for (AVAudioSessionPortDescription *port in currentRoute.outputs) {
/// 连麦不通过听筒播放
if (port.portType == AVAudioSessionPortBuiltInReceiver) {
needForceToSpeaker = YES;
}
}
if (needForceToSpeaker) {
[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
}
}
});}
- (void)fus_switchRole:(AgoraClientRole)role{
......@@ -166,6 +185,11 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
success:(void(^)(void))success
failure:(void(^)(void))failure
{
if (FUSLiveHelper.shareInstance.roomInfoModel.channelId.integerValue != channelId.integerValue) {
FUSLogVerbose(@"pp===中断加入频道 %@", channelId);
FUSLogVerbose(@"pp===当前channelid %@", FUSLiveHelper.shareInstance.roomInfoModel.channelId);
return;
}
[self delayUpdateToSpeakerPlay];
_joinChannelSuccessBlock = success;
FUSLogVerbose(@"连麦:开始加入频道");
......@@ -235,6 +259,11 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
success:(void(^)(void))success
failure:(void(^)(void))failure{
if (FUSLiveHelper.shareInstance.roomInfoModel.channelId.integerValue != channelId.integerValue) {
FUSLogVerbose(@"pp===中断加入频道 %@", channelId);
FUSLogVerbose(@"pp===当前channelid %@", FUSLiveHelper.shareInstance.roomInfoModel.channelId);
return;
}
_myselfIsOnMic = YES;
[self delayUpdateToSpeakerPlay];
......@@ -367,6 +396,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[self fus_stopRTCStreamingWithCompletion:^{
[AgoraRtcEngineKit destroy];
self.agoraEngine = nil;
self->_role = AgoraClientRoleAudience;
}];
}
......@@ -426,7 +456,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
open = NO;
}
// [_agoraEngine muteLocalAudioStream:!open];
[_agoraEngine muteLocalAudioStream:!open];
//TODO: ludy:对应bugYBCH-28179 連麥的時候,開麥閉麥會断一下。 7580版本因为测试时间有限,先不改,下版本直接打开下面的注释,把上面的代码注释,修改测试
// [_agoraEngine enableLocalAudio:open];
......
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