Skip to content

Commit aa8a84c

Browse files
tonychanchenoldcodefarmer
authored andcommitted
移除0.5延时启动vocie & 修改ijk audiosession
Change-Id: I771b66b7fee1eef855595512e7f33cbd5dad233a
1 parent c8141e4 commit aa8a84c

File tree

8 files changed

+47
-56
lines changed

8 files changed

+47
-56
lines changed

Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ target 'LinkApp' do
3232
pod 'CocoaAsyncSocket', '7.6.5'
3333
pod 'TIoTLinkKit_TPNS', '1.0.1'
3434
pod 'TIoTLinkKit_WechatOpenSDK', '1.0.1'
35-
pod 'TIoTLinkKit_IJKPlayer', '1.0.3'
35+
pod 'TIoTLinkKit_IJKPlayer', '1.0.5'
3636
end
3737

3838

@@ -43,5 +43,5 @@ target 'LinkSDKDemo' do
4343
pod 'TIoTLinkKit/LinkRTC', :path => './'
4444

4545
pod 'TIoTLinkVideo', :path => './'
46-
pod 'TIoTLinkKit_IJKPlayer', '1.0.3'
46+
pod 'TIoTLinkKit_IJKPlayer', '1.0.5'
4747
end

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ PODS:
135135
- TIoTLinkKit_IJKPlayer (1.0.3)
136136
- TIoTLinkKit_TPNS (1.0.1)
137137
- TIoTLinkKit_WechatOpenSDK (1.0.1)
138-
- TIoTLinkKit_XP2P (2.4.5-beta.202201190337)
138+
- TIoTLinkKit_XP2P (2.4.20)
139139
- TIoTLinkVideo (1.0.0):
140140
- TIoTLinkKit_FLV (= 2.2.3)
141-
- TIoTLinkKit_XP2P (= 2.4.5-beta.202201190337)
141+
- TIoTLinkKit_XP2P (= 2.4.20)
142142
- TrueTime (5.0.3)
143143
- TXLiteAVSDK_TRTC (8.0.9644)
144144
- TZImagePickerController (3.2.1)
@@ -257,8 +257,8 @@ SPEC CHECKSUMS:
257257
TIoTLinkKit_IJKPlayer: 68e5627c9b403fe0137b2f7ee950a9eed23a9941
258258
TIoTLinkKit_TPNS: 7cea4fc1d20ef6c4c11c4f0b66bbb10ecf4ed968
259259
TIoTLinkKit_WechatOpenSDK: 7822d68cc5c46edf3f6020422202e7b65ea87614
260-
TIoTLinkKit_XP2P: 135edcb466ba2389dcf7f4d4f62b95723379e23a
261-
TIoTLinkVideo: 279fa0b3114dfb7b4d999ca07727f8e654e6117e
260+
TIoTLinkKit_XP2P: 8ab9aabd50a5445514fd31521dceb23dbccfd59c
261+
TIoTLinkVideo: aa2401600951e068aba7b5b035aa8fdac7a593c1
262262
TrueTime: b49551ffafb28a9dee04e51b226f42a416010842
263263
TXLiteAVSDK_TRTC: e3383a81565e8bb2aaaaab4bd099ad5239cd5b2d
264264
TZImagePickerController: bf4c57b98d8707fce41ea6be872414a71c7a8c9d

Source/LinkApp/Classes/Module/EquipmentPanel/Controller/TIoTAVP2PPlayCaptureVC.m

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -404,32 +404,29 @@ - (void)deviceP2PVideoReport:(NSNotification *)reportInfo {
404404
if (self.isStart == NO) {
405405

406406
self.topView.hidden = YES;
407-
// if (self.isCallIng == NO) {
408-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
409-
NSString *urlString = [[TIoTCoreXP2PBridge sharedInstance] getUrlForHttpFlv:self.deviceName]?:@"";
410-
411-
self.videoUrl = [NSString stringWithFormat:@"%@ipc.flv?action=live",urlString];
412-
413-
[self configVideo];
414-
[self.player prepareToPlay];
415-
[self.player play];
416-
417-
self.startPlayer = CACurrentMediaTime();
418-
});
419-
// }
420-
421-
self.isStart = YES;
422-
423-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
424-
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
425-
[[AVAudioSession sharedInstance] setActive:YES error:nil];
407+
// if (self.isCallIng == NO) {
408+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
409+
NSString *urlString = [[TIoTCoreXP2PBridge sharedInstance] getUrlForHttpFlv:self.deviceName]?:@"";
426410

427-
// [[TIoTTRTCUIManage sharedManager] acceptAppCallingOrCalledEnterRoom];
411+
self.videoUrl = [NSString stringWithFormat:@"%@ipc.flv?action=live",urlString];
428412

413+
[self configVideo];
414+
[self.player prepareToPlay];
415+
[self.player play];
416+
417+
self.startPlayer = CACurrentMediaTime();
418+
// }
419+
420+
self.isStart = YES;
421+
422+
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
423+
[[AVAudioSession sharedInstance] setActive:YES error:nil];
424+
429425
[[TIoTP2PCommunicateUIManage sharedManager] setStatusManager];
430426
[[TIoTP2PCommunicateUIManage sharedManager] p2pCommunicateAcceptAppCallingOrCalledEnterRoom];
431427

432428
[self startAVCapture];
429+
433430
});
434431
}
435432
}
@@ -592,7 +589,6 @@ - (void)configVideo {
592589
#pragma mark 事件
593590
- (void)startAVCapture {
594591

595-
self.isStart = YES;
596592
if (self.callType == TIoTTRTCSessionCallType_audio) {
597593
[[TIoTCoreXP2PBridge sharedInstance] sendVoiceToServer:self.deviceName?:@"" channel:@"channel=0" audioConfig:TIoTAVCaptionFLVAudio_8 withLocalPreviewView:nil];
598594
}else {

Source/LinkApp/Classes/Module/EquipmentPanel/Controller/TIoTPanelVC.m

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3776,19 +3776,13 @@ - (void)refushVideo:(NSNotification *)notify {
37763776

37773777
- (void)responseP2PdisConnect:(NSNotification *)notify {
37783778
NSString *DeviceName = [notify.userInfo objectForKey:@"id"];
3779-
NSString *selectedName = self.deviceName?:@"";
3780-
3781-
if (![DeviceName isEqualToString:selectedName]) {
3782-
return;
3783-
}
3779+
// NSString *selectedName = self.deviceName?:@"";
37843780

3785-
[MBProgressHUD showError:@"通道断开,正在重连"];
3786-
[HXYNotice postP2PVIdeoExit];
3787-
[[TIoTCoreXP2PBridge sharedInstance] stopService: DeviceName];
3788-
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:@""
3789-
sec_key:@""
3790-
pro_id:self.productId?:@""
3791-
dev_name:DeviceName?:@""];
3781+
// if (![DeviceName isEqualToString:selectedName]) {
3782+
// return;
3783+
// }
3784+
NSString *error_message = [NSString stringWithFormat:@"%@通道已断开,请重新拨打",DeviceName];
3785+
[MBProgressHUD showError:error_message];
37923786

37933787
}
37943788
@end

Source/SDK/LinkVideo/FLV/TIoTAACEncoder.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ - (void) encodeSampleBuffer:(CMSampleBufferRef)sampleBuffer completionBlock:(voi
168168
error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
169169
}
170170
if (completionBlock) {
171-
dispatch_async(_callbackQueue, ^{
171+
// dispatch_async(_callbackQueue, ^{
172172
completionBlock(data, error);
173-
});
173+
// });
174174
}
175175
CFRelease(sampleBuffer);
176176
CFRelease(blockBuffer);

Source/SDK/LinkVideo/FLV/TIoTAVCaptionFLV.mm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
__weak static TIoTAVCaptionFLV *tAVCaptionFLV = nil;
1717
static flv_muxer_t* flvMuxer = nullptr;
1818
dispatch_queue_t muxerQueue;
19-
NSFileHandle *_fileHandle;
19+
//NSFileHandle *_fileHandle;
2020

2121
@interface TIoTAVCaptionFLV ()<AVCaptureVideoDataOutputSampleBufferDelegate,AVCaptureAudioDataOutputSampleBufferDelegate,H264EncoderDelegate>
2222
// 负责输如何输出设备之间的数据传递
@@ -216,8 +216,8 @@ - (void)gotEncodedData:(NSData*)data isKeyFrame:(BOOL)isKeyFrame {
216216

217217
// NSLog(@"Video data (%lu):%@", (unsigned long)data.length,data.description);
218218

219-
if (_fileHandle != NULL)
220-
{
219+
// if (_fileHandle != NULL)
220+
// {
221221
const char bytes[] = "\x00\x00\x00\x01";
222222
size_t length = (sizeof bytes) - 1; //string literals have implicit trailing '\0'
223223
NSData *ByteHeader = [NSData dataWithBytes:bytes length:length];
@@ -229,7 +229,7 @@ - (void)gotEncodedData:(NSData*)data isKeyFrame:(BOOL)isKeyFrame {
229229
NSMutableData *fullH264 = [NSMutableData dataWithData:ByteHeader];
230230
[fullH264 appendData:data];
231231
encodeFlvData(1, fullH264);
232-
}
232+
// }
233233

234234
}
235235

@@ -258,8 +258,8 @@ static int flv_onwrite(void *param, const struct flv_vec_t* vec, int n) {
258258
offset += vec[i].len;
259259
}
260260

261-
NSData *ByteHeader = [NSData dataWithBytes:bytes length:total_size];
262-
[_fileHandle writeData:ByteHeader];
261+
// NSData *ByteHeader = [NSData dataWithBytes:bytes length:total_size];
262+
// [_fileHandle writeData:ByteHeader];
263263

264264
[tAVCaptionFLV.delegate capture:(uint8_t *)bytes len:total_size];
265265

@@ -313,10 +313,10 @@ -(BOOL) startCapture {
313313
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
314314
NSString *documentsDirectory = [paths firstObject];
315315

316-
self.h264File = [documentsDirectory stringByAppendingPathComponent:@"lyh.h264.flv"];
317-
[fileManager removeItemAtPath:self.h264File error:nil];
318-
[fileManager createFileAtPath:self.h264File contents:nil attributes:nil];
319-
_fileHandle = [NSFileHandle fileHandleForWritingAtPath:self.h264File];
316+
// self.h264File = [documentsDirectory stringByAppendingPathComponent:@"lyh.h264.flv"];
317+
// [fileManager removeItemAtPath:self.h264File error:nil];
318+
// [fileManager createFileAtPath:self.h264File contents:nil attributes:nil];
319+
// _fileHandle = [NSFileHandle fileHandleForWritingAtPath:self.h264File];
320320

321321
flv_init_load();
322322

@@ -341,8 +341,8 @@ - (void) stopCarmera
341341
// [_h264Encoder End];
342342
[_session stopRunning];
343343

344-
[_fileHandle closeFile];
345-
_fileHandle = NULL;
344+
// [_fileHandle closeFile];
345+
// _fileHandle = NULL;
346346
//
347347
// 获取程序Documents目录路径
348348
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ void XP2PDataMsgHandle(const char *idd, uint8_t* recv_buf, size_t recv_len) {
100100
@interface TIoTCoreXP2PBridge ()<TIoTAVCaptionFLVDelegate>
101101
@property (nonatomic, strong) NSString *dev_name;
102102
@property (nonatomic, assign) BOOL isSending;
103+
@property (nonatomic, assign) long v_index;
103104
@end
104105

105106
@implementation TIoTCoreXP2PBridge {
@@ -124,7 +125,7 @@ - (instancetype)init {
124125
if (self) {
125126
//默认打开log开关
126127
_logEnable = YES;
127-
128+
_v_index = 0;
128129
NSString *logFile = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"TIoTXP2P.log"];
129130
[[NSFileManager defaultManager] removeItemAtPath:logFile error:nil];
130131
[[NSFileManager defaultManager] createFileAtPath:logFile contents:nil attributes:nil];
@@ -269,7 +270,7 @@ - (void)stopService:(NSString *)dev_name {
269270
#pragma mark -AWAVCaptureDelegate
270271
- (void)capture:(uint8_t *)data len:(size_t)size {
271272
if (self.isSending) {
272-
// NSLog(@"vide stream data:%s size:%zu",data,size);
273+
// printf("vide stream data index:%ld, time:%f, size:%zu\n",_v_index++,[[NSDate date] timeIntervalSince1970],size);
273274
dataSend(self.dev_name.UTF8String, data, size);
274275
// NSData *dataTag = [NSData dataWithBytes:data length:size];
275276
// [fileHandle writeData:dataTag];

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.5-beta.202201190337' #~> 2.4.3-beta.1 2.4.4 2.4.3-beta.202201111002 2.4.4-beta.202201170801 2.4.5-beta.202201190337
21+
s.dependency 'TIoTLinkKit_XP2P', '2.4.20' #~> 2.4.3-beta.1
2222
s.dependency 'TIoTLinkKit_FLV', '2.2.3'
2323

2424
s.pod_target_xcconfig = {

0 commit comments

Comments
 (0)