@@ -23,8 +23,7 @@ @interface TIoTCoreXP2PBridge ()<TIoTAVCaptionFLVDelegate>
2323@property (nonatomic , assign ) BOOL isSending;
2424@property (nonatomic , strong ) AVCaptureSessionPreset resolution;
2525@property (nonatomic , strong ) NSTimer *getBufTimer;
26- @property (nonatomic , assign ) NSInteger startTime;
27- @property (nonatomic , assign ) NSInteger startVoiceTime;
26+ @property (nonatomic , strong ) NSMutableDictionary *uniReqStartTime;
2827@property (nonatomic , strong ) TIoTCoreLogger *logger;
2928- (void )cancelTimer ;
3029- (void )doTick : (data_report_t )data_buf ;
@@ -216,6 +215,8 @@ - (instancetype)init {
216215 [[NSFileManager defaultManager ] removeItemAtPath: logFile error: nil ];
217216 [[NSFileManager defaultManager ] createFileAtPath: logFile contents: nil attributes: nil ];
218217 p2pOutLogFile = fopen (logFile.UTF8String , " wb" );
218+
219+ _uniReqStartTime = [NSMutableDictionary dictionary ];
219220 }
220221 return self;
221222}
@@ -622,7 +623,7 @@ - (void)doTick:(data_report_t)data_buf {
622623 }
623624
624625 NSData *body = [NSData dataWithBytes: data_buf.report_buf length: data_buf.report_size];
625- NSURL *urlString = [NSURL URLWithString: @" http ://log.qvb.qcloud.com/reporter/vlive" ];
626+ NSURL *urlString = [NSURL URLWithString: @" https ://log.qvb.qcloud.com/reporter/vlive" ];
626627 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: urlString cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 5 ];
627628 [request setValue: @" application/octet-stream" forHTTPHeaderField: @" Content-Type" ];
628629 request.HTTPMethod = @" POST" ;
@@ -644,14 +645,14 @@ - (void)reportUserList:(data_report_t)report {
644645 NSString *dataaction = [NSString stringWithCString: (const char *)report.data_action encoding: NSASCIIStringEncoding];
645646
646647 if ([status isEqualToString: @" start" ]) {
647- if ([dataaction isEqualToString: @" voice" ]) {
648- self.startVoiceTime = [[TIoTCoreXP2PBridge getNowTimeTimestamp ] integerValue ];
649- }else {
650- self.startTime = [[TIoTCoreXP2PBridge getNowTimeTimestamp ] integerValue ];
651- }
648+ [self .uniReqStartTime setObject: [TIoTCoreXP2PBridge getNowTimeTimestamp ] forKey: reqid];
649+ }
650+
651+ NSInteger startTime = [[self .uniReqStartTime objectForKey: reqid] integerValue ];
652+ if (startTime == 0 ) {
653+ return ;
652654 }
653655
654- NSInteger startTime = [dataaction isEqualToString: @" voice" ]? self.startVoiceTime :self.startTime ;
655656 NSMutableDictionary *accessParam = [NSMutableDictionary dictionary ];
656657 [accessParam setValue: @" P2PReport" forKey: @" Action" ];
657658 [accessParam setValue: status forKey: @" Status" ];
@@ -680,6 +681,10 @@ - (void)reportUserList:(data_report_t)report {
680681 }
681682 }];
682683 [tasklog resume ];
684+
685+ if ([status isEqualToString: @" end" ]) {
686+ [self .uniReqStartTime removeObjectForKey: reqid];
687+ }
683688}
684689
685690+ (NSString *)getSDKVersion {
0 commit comments