Skip to content

Commit 5d3cbe5

Browse files
author
eagleychen
committed
update core sdk
1 parent cb3281d commit 5d3cbe5

File tree

6 files changed

+30
-41
lines changed

6 files changed

+30
-41
lines changed

Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ target 'LinkSDKDemo' do
4242
pod 'TIoTLinkKit/LinkRTC', :path => './'
4343

4444
pod 'TIoTLinkVideo', :path => './'
45+
pod 'TIoTLinkKit_XP2P', '2.4.63-beta.202511260501'
4546
pod 'TIoTLinkKit_IJKPlayer', '2.0.16-beta.202502200213'
4647
end
4748

Podfile.lock

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ PODS:
3535
- TIoTLinkKit_SoundTouch (1.0.0)
3636
- TIoTLinkKit_TPNS (1.0.1)
3737
- TIoTLinkKit_WechatOpenSDK (1.0.1)
38-
- TIoTLinkKit_XP2P (2.4.61)
38+
- TIoTLinkKit_XP2P (2.4.63-beta.202511260501)
3939
- TIoTLinkVideo (1.0.0):
4040
- CocoaAsyncSocket (= 7.6.5)
4141
- TIoTLinkKit_FLV (= 2.2.3)
4242
- TIoTLinkKit_GVoiceSE (>= 1.1.1)
4343
- TIoTLinkKit_SoundTouch (= 1.0.0)
44-
- TIoTLinkKit_XP2P (= 2.4.61)
44+
- TIoTLinkKit_XP2P (>= 2.4.61)
4545
- TPCircularBuffer (= 1.6.1)
4646
- TPCircularBuffer (1.6.1)
4747
- TrueTime (5.0.3)
@@ -69,6 +69,7 @@ DEPENDENCIES:
6969
- TIoTLinkKit_IJKPlayer (= 2.0.16-beta.202502200213)
7070
- TIoTLinkKit_TPNS (= 1.0.1)
7171
- TIoTLinkKit_WechatOpenSDK (= 1.0.1)
72+
- TIoTLinkKit_XP2P (= 2.4.63-beta.202511260501)
7273
- TIoTLinkVideo (from `./`)
7374
- TrueTime (= 5.0.3)
7475
- TZImagePickerController (= 3.2.1)
@@ -133,14 +134,14 @@ SPEC CHECKSUMS:
133134
TIoTLinkKit_SoundTouch: cf79ae182b6c2349ff65bac7a338974bc538fa77
134135
TIoTLinkKit_TPNS: 7cea4fc1d20ef6c4c11c4f0b66bbb10ecf4ed968
135136
TIoTLinkKit_WechatOpenSDK: 7822d68cc5c46edf3f6020422202e7b65ea87614
136-
TIoTLinkKit_XP2P: a2521f9f79d4638fba357306756721ddc99e066a
137-
TIoTLinkVideo: e34792f8a70440155e16eb9299d1f15f2a000798
137+
TIoTLinkKit_XP2P: 52acf943d5b0ca7f983d8d6554fddd7be845abef
138+
TIoTLinkVideo: dc379246e619b1f5ff3e880c1da159bc7f940bb1
138139
TPCircularBuffer: c13243556527551c4d320709c7b14a6d20cdc30a
139140
TrueTime: b49551ffafb28a9dee04e51b226f42a416010842
140141
TXLiteAVSDK_TRTC: e3383a81565e8bb2aaaaab4bd099ad5239cd5b2d
141142
TZImagePickerController: bf4c57b98d8707fce41ea6be872414a71c7a8c9d
142143
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
143144

144-
PODFILE CHECKSUM: 92a7d686950802e211919ac3c37c266e3ac9323e
145+
PODFILE CHECKSUM: 2ae70d1d45cf249c7fee5c6bde2bb53f0da644a4
145146

146147
COCOAPODS: 1.16.2

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ - (void)getDeviceStatusWithType:(NSString *)singleType qualityType:(NSString *)q
293293
audio_config.pitch = 0;//tt_pitch; // -6声音会变粗一点; 6声音会变细一点
294294

295295
TIoTCoreVideoConfig *video_config = [TIoTCoreVideoConfig new];
296-
video_config.localView = nil;
296+
video_config.localView = nil;//self.tableView;
297297
video_config.videoPosition = AVCaptureDevicePositionFront;
298-
298+
// [[TIoTCoreXP2PBridge sharedInstance] resolutionRatio:AVCaptureSessionPreset1920x1080];
299299
[[TIoTCoreXP2PBridge sharedInstance] sendVoiceToServer:weakSelf.combinedId channel:channel audioConfig:audio_config videoConfig:video_config];
300300

301301
if(tt_pitch == 6){
@@ -1253,7 +1253,7 @@ - (void)stopPlayMovie {
12531253
self.player = nil;
12541254
}
12551255
}
1256-
NSFileHandle *_fileHandle;
1256+
//NSFileHandle *_fileHandle;
12571257
- (void)configVideo {
12581258

12591259
// 1.通过播放器发起的拉流
@@ -1262,10 +1262,10 @@ - (void)configVideo {
12621262
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
12631263
NSString *documentsDirectory = [paths firstObject];
12641264

1265-
NSString *h264File = [documentsDirectory stringByAppendingPathComponent:@"ijkplayerbbb.pcm"];
1266-
[fileManager removeItemAtPath:h264File error:nil];
1267-
[fileManager createFileAtPath:h264File contents:nil attributes:nil];
1268-
_fileHandle = [NSFileHandle fileHandleForWritingAtPath:h264File];
1265+
// NSString *h264File = [documentsDirectory stringByAppendingPathComponent:@"ijkplayerbbb.pcm"];
1266+
// [fileManager removeItemAtPath:h264File error:nil];
1267+
// [fileManager createFileAtPath:h264File contents:nil attributes:nil];
1268+
// _fileHandle = [NSFileHandle fileHandleForWritingAtPath:h264File];
12691269

12701270
[TIoTCoreXP2PBridge sharedInstance].writeFile = YES;
12711271
[TIoTCoreXP2PBridge recordstream:self.combinedId]; //保存到 document 目录 video.data 文件,需打开writeFile开关

Source/SDK/LinkVideo/FLV/TIoTAVCaptionFLV.mm

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
2-
31
#import "TIoTAVCaptionFLV.h"
42
#import "TIoTAACEncoder.h"
53
#import "TIoTH264Encoder.h"
64

75
#include <string>
6+
#include <memory> // 添加memory头文件以支持std::unique_ptr
87
//#include <flv-writer.h>
98
//#include <flv-muxer.h>
109
#import "flv-writer.h"
@@ -498,18 +497,21 @@ static int flv_onwrite(void *param, const struct flv_vec_t* vec, int n) {
498497
}
499498

500499
// NSLog(@"========= flv_onmuxer total size: %d", total_size);
501-
char* bytes = new char[total_size];
500+
501+
// 使用unique_ptr自动管理内存,确保异常安全
502+
std::unique_ptr<char[]> bytes(new char[total_size]);
502503
for(int i = 0, offset = 0; i < n; i++) {
503-
memcpy(bytes + offset, vec[i].ptr, vec[i].len);
504+
memcpy(bytes.get() + offset, vec[i].ptr, vec[i].len);
504505
offset += vec[i].len;
505506
}
506507

507508
// NSData *ByteHeader = [NSData dataWithBytes:bytes length:total_size];
508509
// [_fileHandle writeData:ByteHeader];
509510

510-
[tAVCaptionFLV.delegate capture:(uint8_t *)bytes len:total_size];
511+
// 传递数据给delegate,确保在函数返回前数据有效
512+
[tAVCaptionFLV.delegate capture:(uint8_t *)bytes.get() len:total_size];
511513

512-
delete[] bytes;
514+
// unique_ptr会自动释放内存,无需手动delete[]
513515
return 0;
514516
}
515517

@@ -521,14 +523,15 @@ int encodeFlvData(int type, NSData *packetData) {
521523
NSLog(@"Please init flv muxer first.");
522524
return -1;
523525
}
524-
__block NSData *blockData = packetData;
526+
// 使用强引用确保数据在异步执行期间不被释放
527+
NSData *strongData = [packetData copy];
525528
dispatch_async(muxerQueue, ^{
526529

527530
CFTimeInterval timestamp = CACurrentMediaTime();
528531
uint32_t pts = timestamp*1000;
529532

530-
const void *c_data = blockData.bytes;
531-
NSUInteger len = blockData.length;
533+
const void *c_data = strongData.bytes;
534+
NSUInteger len = strongData.length;
532535
// NSLog(@"===========================------------ %ld, pts: %u", len, pts);
533536

534537

@@ -564,7 +567,7 @@ -(BOOL) startCapture {
564567
// NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
565568
// NSString *documentsDirectory = [paths firstObject];
566569
//
567-
// NSString *h264File = [documentsDirectory stringByAppendingPathComponent:@"test.aac"];
570+
// NSString *h264File = [documentsDirectory stringByAppendingPathComponent:@"test.h264"];
568571
// [fileManager removeItemAtPath:h264File error:nil];
569572
// [fileManager createFileAtPath:h264File contents:nil attributes:nil];
570573
// _fileHandle = [NSFileHandle fileHandleForWritingAtPath:h264File];

TIoTLinkKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
6D4E1E8A25189BC5003BE1D9 /* Main_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 6D4E1E8C25189BC5003BE1D9 /* Main_logo.png */; };
6363
6D4E1EE12518AE40003BE1D9 /* ConfigHardware_WiFi.png in Resources */ = {isa = PBXBuildFile; fileRef = 6D4E1EE32518AE40003BE1D9 /* ConfigHardware_WiFi.png */; };
6464
6D50E91226B18CE300DF12A5 /* TIoTDemoWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D50E91126B18CE300DF12A5 /* TIoTDemoWebSocketManager.m */; };
65-
6D50E91426B18F0600DF12A5 /* (null) in Sources */ = {isa = PBXBuildFile; };
65+
6D50E91426B18F0600DF12A5 /* BuildFile in Sources */ = {isa = PBXBuildFile; };
6666
6D50E91F26B1911300DF12A5 /* ReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = ED5767162410AED70070D218 /* ReachabilityManager.m */; };
6767
6D50E92426B1924800DF12A5 /* TIoTProductsConfigModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4B39F5F2541767200C0DD6E /* TIoTProductsConfigModel.swift */; };
6868
6D50E92626B192E300DF12A5 /* TIoTBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F4347B2546B2C600C44471 /* TIoTBaseModel.swift */; };
@@ -3516,14 +3516,10 @@
35163516
inputFileListPaths = (
35173517
"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-resources-${CONFIGURATION}-input-files.xcfilelist",
35183518
);
3519-
inputPaths = (
3520-
);
35213519
name = "[CP] Copy Pods Resources";
35223520
outputFileListPaths = (
35233521
"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-resources-${CONFIGURATION}-output-files.xcfilelist",
35243522
);
3525-
outputPaths = (
3526-
);
35273523
runOnlyForDeploymentPostprocessing = 0;
35283524
shellPath = /bin/sh;
35293525
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-resources.sh\"\n";
@@ -3559,14 +3555,10 @@
35593555
inputFileListPaths = (
35603556
"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
35613557
);
3562-
inputPaths = (
3563-
);
35643558
name = "[CP] Embed Pods Frameworks";
35653559
outputFileListPaths = (
35663560
"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
35673561
);
3568-
outputPaths = (
3569-
);
35703562
runOnlyForDeploymentPostprocessing = 0;
35713563
shellPath = /bin/sh;
35723564
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LinkSDKDemo/Pods-LinkSDKDemo-frameworks.sh\"\n";
@@ -3580,14 +3572,10 @@
35803572
inputFileListPaths = (
35813573
"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
35823574
);
3583-
inputPaths = (
3584-
);
35853575
name = "[CP] Embed Pods Frameworks";
35863576
outputFileListPaths = (
35873577
"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
35883578
);
3589-
outputPaths = (
3590-
);
35913579
runOnlyForDeploymentPostprocessing = 0;
35923580
shellPath = /bin/sh;
35933581
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-frameworks.sh\"\n";
@@ -3601,14 +3589,10 @@
36013589
inputFileListPaths = (
36023590
"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-resources-${CONFIGURATION}-input-files.xcfilelist",
36033591
);
3604-
inputPaths = (
3605-
);
36063592
name = "[CP] Copy Pods Resources";
36073593
outputFileListPaths = (
36083594
"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-resources-${CONFIGURATION}-output-files.xcfilelist",
36093595
);
3610-
outputPaths = (
3611-
);
36123596
runOnlyForDeploymentPostprocessing = 0;
36133597
shellPath = /bin/sh;
36143598
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-LinkApp/Pods-LinkApp-resources.sh\"\n";
@@ -3951,7 +3935,7 @@
39513935
6DF0C5AB279AA16700B4FE22 /* TIoTXp2pInfoModel.m in Sources */,
39523936
F4F3D7C524938EBE005D3396 /* FeedbackVC.m in Sources */,
39533937
F477671927C7691D00F37F39 /* TIoTAreaNetworkDeviceCell.m in Sources */,
3954-
6D50E91426B18F0600DF12A5 /* (null) in Sources */,
3938+
6D50E91426B18F0600DF12A5 /* BuildFile in Sources */,
39553939
6D98FE1625C2E6AA00518AC7 /* TIoTCustomCalendarScrollView.m in Sources */,
39563940
6D9D9788268468320085BCC2 /* TIoTDemoVideoVC.m in Sources */,
39573941
6D2049EB2653C189007F6F27 /* TIoTCloudStorageDayTimeListModel.m in Sources */,

TIoTLinkVideo.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
1919
s.source_files = 'Source/SDK/LinkVideo/**/*.{h,m,c,mm}'
2020
s.resource = 'Source/SDK/LinkVideo/FLV/asset/GvoiceSE_v1_239-119-oneref-e.nn'
2121

22-
s.dependency 'TIoTLinkKit_XP2P', '2.4.61'
22+
s.dependency 'TIoTLinkKit_XP2P', '>= 2.4.61'
2323
s.dependency 'TIoTLinkKit_FLV', '2.2.3'
2424
s.dependency 'CocoaAsyncSocket', '7.6.5'
2525
s.dependency 'TIoTLinkKit_SoundTouch', '1.0.0'

0 commit comments

Comments
 (0)