Skip to content

Commit

Permalink
tcp/udp 混合打洞
Browse files Browse the repository at this point in the history
Change-Id: I63e27e873da54a95b3f3a2395a1e34b9972239fc
  • Loading branch information
tonychanchen committed Oct 20, 2023
1 parent 2c256b4 commit 978d23c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
25 changes: 13 additions & 12 deletions Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,15 @@ - (void)viewDidLoad {

[self setupPreViewViews];

[self requestXp2pInfo];

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];
if (errorcode == XP2P_ERR_VERSION) {
UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
}];
[alertC addAction:alertA];
[self presentViewController:alertC animated:YES completion:nil];
}
UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithTitle:@"播放调试面板" style:UIBarButtonItemStylePlain target:self action:@selector(showHudView)];
self.navigationItem.rightBarButtonItem = right;
}
Expand All @@ -138,16 +145,8 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
[self requestCloudStoreVideoList];

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""];

if (errorcode == XP2P_ERR_VERSION) {
UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
}];
[alertC addAction:alertA];
[self presentViewController:alertC animated:YES completion:nil];
}
[self setVieoPlayerStartPlayWith:self.qualityString];

//计算IPC打洞开始时间
self.startIpcP2P = CACurrentMediaTime();
Expand Down Expand Up @@ -1190,7 +1189,8 @@ - (void)refushVideo:(NSNotification *)notify {
self.startPlayer = CACurrentMediaTime();
});
*/
[self setVieoPlayerStartPlayWith:self.qualityString];
[self requestXp2pInfo];
// [self setVieoPlayerStartPlayWith:self.qualityString];

// [self getDeviceStatusWithType:action_live qualityType:self.qualityString];
}
Expand Down Expand Up @@ -1666,6 +1666,7 @@ - (void)appNetWorkBreak {
}

- (void)appNetWorkResume {
return;
if (self.endPlayer == 0) { //正在直播中,断开才响应
return;
}
Expand Down
3 changes: 2 additions & 1 deletion Source/SDK/LinkVideo/FLV/TIoTAVCaptionFLV.mm
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static void record_callback(uint8_t *buffer, int size, void *u)
if (len < 512) {
return;
}

/*
// check vad
int temp;
for(int i = 0; i< FRAME_LEN; i++) {
Expand All @@ -401,6 +401,7 @@ static void record_callback(uint8_t *buffer, int size, void *u)
if (!vc.isVadRecongize) {
return;
}
*/

//pcm=>aac
[vc.pcmRecord addData:&aac_circularBuffer :trae_pcm_buffer :512];
Expand Down
2 changes: 1 addition & 1 deletion TIoTLinkVideo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|

s.source_files = 'Source/SDK/LinkVideo/**/*.{h,m,c,mm}'

s.dependency 'TIoTLinkKit_XP2P', '2.4.37'
s.dependency 'TIoTLinkKit_XP2P', '2.4.38'
s.dependency 'TIoTLinkKit_FLV', '2.2.3'
s.dependency 'CocoaAsyncSocket', '7.6.5'
s.dependency 'TIoTLinkKit_SoundTouch', '1.0.0'
Expand Down

0 comments on commit 978d23c

Please sign in to comment.