Skip to content

Commit 978d23c

Browse files
committed
tcp/udp 混合打洞
Change-Id: I63e27e873da54a95b3f3a2395a1e34b9972239fc
1 parent 2c256b4 commit 978d23c

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,15 @@ - (void)viewDidLoad {
126126

127127
[self setupPreViewViews];
128128

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

140147
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
141-
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];
142148
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" sec_id:env.cloudSecretId sec_key:env.cloudSecretKey xp2pinfo:xp2pInfo?:@""];
143-
144-
if (errorcode == XP2P_ERR_VERSION) {
145-
UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"APP SDK 版本与设备端 SDK 版本号不匹配,版本号需前两位保持一致" message:nil preferredStyle:(UIAlertControllerStyleAlert)];
146-
UIAlertAction *alertA = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
147-
}];
148-
[alertC addAction:alertA];
149-
[self presentViewController:alertC animated:YES completion:nil];
150-
}
149+
[self setVieoPlayerStartPlayWith:self.qualityString];
151150

152151
//计算IPC打洞开始时间
153152
self.startIpcP2P = CACurrentMediaTime();
@@ -1190,7 +1189,8 @@ - (void)refushVideo:(NSNotification *)notify {
11901189
self.startPlayer = CACurrentMediaTime();
11911190
});
11921191
*/
1193-
[self setVieoPlayerStartPlayWith:self.qualityString];
1192+
[self requestXp2pInfo];
1193+
// [self setVieoPlayerStartPlayWith:self.qualityString];
11941194

11951195
// [self getDeviceStatusWithType:action_live qualityType:self.qualityString];
11961196
}
@@ -1666,6 +1666,7 @@ - (void)appNetWorkBreak {
16661666
}
16671667

16681668
- (void)appNetWorkResume {
1669+
return;
16691670
if (self.endPlayer == 0) { //正在直播中,断开才响应
16701671
return;
16711672
}

Source/SDK/LinkVideo/FLV/TIoTAVCaptionFLV.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static void record_callback(uint8_t *buffer, int size, void *u)
382382
if (len < 512) {
383383
return;
384384
}
385-
385+
/*
386386
// check vad
387387
int temp;
388388
for(int i = 0; i< FRAME_LEN; i++) {
@@ -401,6 +401,7 @@ static void record_callback(uint8_t *buffer, int size, void *u)
401401
if (!vc.isVadRecongize) {
402402
return;
403403
}
404+
*/
404405

405406
//pcm=>aac
406407
[vc.pcmRecord addData:&aac_circularBuffer :trae_pcm_buffer :512];

TIoTLinkVideo.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818

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

21-
s.dependency 'TIoTLinkKit_XP2P', '2.4.37'
21+
s.dependency 'TIoTLinkKit_XP2P', '2.4.38'
2222
s.dependency 'TIoTLinkKit_FLV', '2.2.3'
2323
s.dependency 'CocoaAsyncSocket', '7.6.5'
2424
s.dependency 'TIoTLinkKit_SoundTouch', '1.0.0'

0 commit comments

Comments
 (0)