Skip to content

Commit 4cc6ac7

Browse files
author
jeffgaogao
committed
docs(TcgSdk): release 3.9.1
1 parent 2dde0da commit 4cc6ac7

File tree

13 files changed

+278
-1352
lines changed

13 files changed

+278
-1352
lines changed

Demo/TCRDemo/TCGDemo/TCGDemoGamePlayVC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef void(^tGameStopBlk)(void);
1919

2020
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession;
2121
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession loadingView:(UIView *)loadingView;
22-
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession loadingView:(UIView *)loadingView captureWidth:(int)captureWidth captureHeight:(int)captureHeight captureFps:(int)captureFps;
22+
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession loadingView:(UIView *)loadingView enableSendCustomVideo:(BOOL)enableSendCustomVideo enableSendCustomAudio:(BOOL)enableSendCustomAudio captureWidth:(int)captureWidth captureHeight:(int)captureHeight captureFps:(int)captureFps;
2323
- (instancetype)initWithPlay:(TcrSession *)play experienceCode:(NSDictionary *)params;
2424

2525
@end

Demo/TCRDemo/TCGDemo/TCGDemoGamePlayVC.m

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ @interface TCGDemoGamePlayVC () <TcrSessionObserver, TCGDemoTextFieldDelegate, C
5757
@property (nonatomic, assign) int captureHeight;
5858
@property (nonatomic, assign) int captureFps;
5959
@property (nonatomic, assign) BOOL enableSendCustomVideo;
60+
@property (nonatomic, assign) BOOL enableSendCustomAudio;
6061
@end
6162

6263
@implementation TCGDemoGamePlayVC
@@ -80,7 +81,7 @@ - (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remote
8081
return self;
8182
}
8283

83-
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession loadingView:(UIView *)loadingView captureWidth:(int)captureWidth captureHeight:(int)captureHeight captureFps:(int)captureFps {
84+
- (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remoteSession loadingView:(UIView *)loadingView enableSendCustomVideo:(BOOL)enableSendCustomVideo enableSendCustomAudio:(BOOL)enableSendCustomAudio captureWidth:(int)captureWidth captureHeight:(int)captureHeight captureFps:(int)captureFps; {
8485
self = [super init];
8586
if (self) {
8687
self.session = play;
@@ -90,7 +91,8 @@ - (instancetype)initWithPlay:(TcrSession *)play remoteSession:(NSString *)remote
9091
self.captureWidth = captureWidth;
9192
self.captureHeight = captureHeight;
9293
self.captureFps = captureFps;
93-
self.enableSendCustomVideo = true;
94+
self.enableSendCustomVideo = enableSendCustomVideo;
95+
self.enableSendCustomAudio = enableSendCustomAudio;
9496
[self.session setTcrSessionObserver:self];
9597
}
9698
return self;
@@ -154,6 +156,15 @@ - (void)viewDidLoad {
154156
// self.imageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
155157
// [self.view addSubview:self.imageView];
156158
self.isMobile = NO; // 云端应用为手机应用还是windows应用
159+
160+
[[TCGDemoAudioCapturor shared]setAudioDataHandler:^(NSData * _Nonnull data, uint64_t timestamp) {
161+
162+
if ([self.session sendCustomAudioData:data captureTimeNs:timestamp]) {
163+
NSLog(@"send custom audio data");
164+
} else {
165+
NSLog(@"send custom audio data failed.");
166+
}
167+
}];
157168
}
158169

159170
- (void)viewDidAppear:(BOOL)animated {
@@ -481,6 +492,13 @@ - (void)pauseResumeGame:(BOOL)doPause {
481492
}
482493

483494
- (void)onEnableLocalAudio:(BOOL)enable {
495+
if (_enableSendCustomAudio) {
496+
if (enable) {
497+
[[TCGDemoAudioCapturor shared] startCapture];
498+
} else {
499+
[[TCGDemoAudioCapturor shared] stopCapture];
500+
}
501+
}
484502
[self.session setEnableLocalAudio:enable];
485503
}
486504

File renamed without changes.

Demo/TCRDemo/TCGDemo/TCGDemoAudioCapturor.m renamed to Demo/TCRDemo/TCGDemo/audio_capture/TCGDemoAudioCapturor.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#import "TCGDemoAudioCapturor.h"
22
#import <os/lock.h>
3+
#import <AVFoundation/AVFoundation.h>
34

45
static const UInt32 kInputBus = 1;
56
static const UInt32 kOutputBus = 0;
@@ -63,6 +64,21 @@ - (void)startCapture {
6364
if (!_audioUnit) {
6465
[self _setupAudioUnit]; // 延迟初始化
6566
}
67+
NSError *error = nil;
68+
69+
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
70+
withOptions:AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker
71+
error:&error];
72+
if (error) {
73+
NSLog(@"AVAudioSession setCategory failed");
74+
return;
75+
}
76+
77+
[[AVAudioSession sharedInstance] setActive:YES error:&error];
78+
if (error) {
79+
NSLog(@"AVAudioSession setActive failed");
80+
return;
81+
}
6682

6783
OSStatus status = AudioOutputUnitStart(_audioUnit);
6884
if (status == noErr) {

Demo/TCRDemo/TCGDemo/experience/TCGDemoExperienceVC.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#import "TCGDemoGamePlayVC.h"
1515
#import "TCGDemoLoadingView.h"
1616
#import "TCGDemoInputDelegate.h"
17-
#import "../TCGDemoAudioCapturor.h"
17+
#import "../audio_capture/TCGDemoAudioCapturor.h"
1818
#import <AVFoundation/AVFoundation.h>
1919

2020

@@ -172,7 +172,7 @@ - (void)initSubviews {
172172

173173
_loadingView = [[TCGDemoLoadingView alloc] initWithFrame:self.view.bounds process:0];
174174
_loadingView.hidden = YES;
175-
_enableCustomAudioCapture = false;
175+
_enableCustomAudioCapture = true;
176176
_enableCustomVideoCapture = true;
177177
}
178178

@@ -533,7 +533,7 @@ - (void)gotoGameplayVC:(NSString *)remoteSession {
533533
if (_enableCustomVideoCapture) {
534534
subVC = [[TCGDemoGamePlayVC alloc] initWithPlay:self.session
535535
remoteSession:remoteSession
536-
loadingView:_loadingView captureWidth:_captureWidth captureHeight:_captureHeight captureFps:_captureFps];
536+
loadingView:_loadingView enableSendCustomVideo:_enableCustomVideoCapture enableSendCustomAudio:_enableCustomAudioCapture captureWidth:_captureWidth captureHeight:_captureHeight captureFps:_captureFps];
537537
} else {
538538
subVC = [[TCGDemoGamePlayVC alloc] initWithPlay:self.session
539539
remoteSession:remoteSession

Demo/TCRDemo/TCRDemo.xcodeproj/project.pbxproj

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
/* Begin PBXBuildFile section */
1010
112D167A2AD67A7F003C292E /* TCGDemoMultiSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 112D16792AD67A7F003C292E /* TCGDemoMultiSettingView.m */; };
1111
11D9EB592A83734E0099CF95 /* AudioQueuePlay.m in Sources */ = {isa = PBXBuildFile; fileRef = 11D9EB582A83734E0099CF95 /* AudioQueuePlay.m */; };
12-
4D580E2A2ADD23BF00CE04DC /* TCGDemoAudioCapturor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D580E292ADD23BF00CE04DC /* TCGDemoAudioCapturor.m */; };
12+
4DD7C5B42E58B0020030D82E /* TCGDemoAudioCapturor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5A62E58B0020030D82E /* TCGDemoAudioCapturor.m */; };
13+
4DD7C5B52E58B0020030D82E /* AVCaptureSession+DevicePosition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5A92E58B0020030D82E /* AVCaptureSession+DevicePosition.mm */; };
14+
4DD7C5B62E58B0020030D82E /* gcd_helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5AB2E58B0020030D82E /* gcd_helpers.m */; };
15+
4DD7C5B72E58B0020030D82E /* TCGCameraVideoCapturer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5AD2E58B0020030D82E /* TCGCameraVideoCapturer.m */; };
16+
4DD7C5B82E58B0020030D82E /* TCGDispatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5AF2E58B0020030D82E /* TCGDispatcher.m */; };
17+
4DD7C5B92E58B0020030D82E /* UIDevice+TCGDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4DD7C5B22E58B0020030D82E /* UIDevice+TCGDevice.mm */; };
1318
8A3A055A259AC9FB001E8A34 /* TCGDemoGameListView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A3A0559259AC9FB001E8A34 /* TCGDemoGameListView.m */; };
1419
8A4F628B259C222600AA2DE9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8A4F6289259C222500AA2DE9 /* Main.storyboard */; };
1520
8A4F6293259C268900AA2DE9 /* TCGDemoSettingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A4F6292259C268900AA2DE9 /* TCGDemoSettingView.m */; };
@@ -51,8 +56,19 @@
5156
112D16792AD67A7F003C292E /* TCGDemoMultiSettingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TCGDemoMultiSettingView.m; sourceTree = "<group>"; };
5257
11D9EB572A83734E0099CF95 /* AudioQueuePlay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AudioQueuePlay.h; sourceTree = "<group>"; };
5358
11D9EB582A83734E0099CF95 /* AudioQueuePlay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AudioQueuePlay.m; sourceTree = "<group>"; };
54-
4D580E272ADD238600CE04DC /* TCGDemoAudioCapturor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TCGDemoAudioCapturor.h; sourceTree = "<group>"; };
55-
4D580E292ADD23BF00CE04DC /* TCGDemoAudioCapturor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TCGDemoAudioCapturor.m; sourceTree = "<group>"; };
59+
4DD7C5A52E58B0020030D82E /* TCGDemoAudioCapturor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCGDemoAudioCapturor.h; sourceTree = "<group>"; };
60+
4DD7C5A62E58B0020030D82E /* TCGDemoAudioCapturor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCGDemoAudioCapturor.m; sourceTree = "<group>"; };
61+
4DD7C5A82E58B0020030D82E /* AVCaptureSession+DevicePosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "AVCaptureSession+DevicePosition.h"; sourceTree = "<group>"; };
62+
4DD7C5A92E58B0020030D82E /* AVCaptureSession+DevicePosition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "AVCaptureSession+DevicePosition.mm"; sourceTree = "<group>"; };
63+
4DD7C5AA2E58B0020030D82E /* gcd_helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gcd_helpers.h; sourceTree = "<group>"; };
64+
4DD7C5AB2E58B0020030D82E /* gcd_helpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = gcd_helpers.m; sourceTree = "<group>"; };
65+
4DD7C5AC2E58B0020030D82E /* TCGCameraVideoCapturer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCGCameraVideoCapturer.h; sourceTree = "<group>"; };
66+
4DD7C5AD2E58B0020030D82E /* TCGCameraVideoCapturer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCGCameraVideoCapturer.m; sourceTree = "<group>"; };
67+
4DD7C5AE2E58B0020030D82E /* TCGDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCGDispatcher.h; sourceTree = "<group>"; };
68+
4DD7C5AF2E58B0020030D82E /* TCGDispatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCGDispatcher.m; sourceTree = "<group>"; };
69+
4DD7C5B02E58B0020030D82E /* TCGDispatcher+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TCGDispatcher+Private.h"; sourceTree = "<group>"; };
70+
4DD7C5B12E58B0020030D82E /* UIDevice+TCGDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIDevice+TCGDevice.h"; sourceTree = "<group>"; };
71+
4DD7C5B22E58B0020030D82E /* UIDevice+TCGDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIDevice+TCGDevice.mm"; sourceTree = "<group>"; };
5672
8A3A0558259AC9EC001E8A34 /* TCGDemoGameListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TCGDemoGameListView.h; sourceTree = "<group>"; };
5773
8A3A0559259AC9FB001E8A34 /* TCGDemoGameListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TCGDemoGameListView.m; sourceTree = "<group>"; };
5874
8A4F628A259C222500AA2DE9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -115,6 +131,33 @@
115131
path = Pods;
116132
sourceTree = "<group>";
117133
};
134+
4DD7C5A72E58B0020030D82E /* audio_capture */ = {
135+
isa = PBXGroup;
136+
children = (
137+
4DD7C5A52E58B0020030D82E /* TCGDemoAudioCapturor.h */,
138+
4DD7C5A62E58B0020030D82E /* TCGDemoAudioCapturor.m */,
139+
);
140+
path = audio_capture;
141+
sourceTree = "<group>";
142+
};
143+
4DD7C5B32E58B0020030D82E /* video_capture */ = {
144+
isa = PBXGroup;
145+
children = (
146+
4DD7C5A82E58B0020030D82E /* AVCaptureSession+DevicePosition.h */,
147+
4DD7C5A92E58B0020030D82E /* AVCaptureSession+DevicePosition.mm */,
148+
4DD7C5AA2E58B0020030D82E /* gcd_helpers.h */,
149+
4DD7C5AB2E58B0020030D82E /* gcd_helpers.m */,
150+
4DD7C5AC2E58B0020030D82E /* TCGCameraVideoCapturer.h */,
151+
4DD7C5AD2E58B0020030D82E /* TCGCameraVideoCapturer.m */,
152+
4DD7C5AE2E58B0020030D82E /* TCGDispatcher.h */,
153+
4DD7C5AF2E58B0020030D82E /* TCGDispatcher.m */,
154+
4DD7C5B02E58B0020030D82E /* TCGDispatcher+Private.h */,
155+
4DD7C5B12E58B0020030D82E /* UIDevice+TCGDevice.h */,
156+
4DD7C5B22E58B0020030D82E /* UIDevice+TCGDevice.mm */,
157+
);
158+
path = video_capture;
159+
sourceTree = "<group>";
160+
};
118161
8A7ECDDE26A666060092A918 /* Frameworks */ = {
119162
isa = PBXGroup;
120163
children = (
@@ -168,6 +211,8 @@
168211
8A97C1C8258B9C7E005AA486 /* TCGDemo */ = {
169212
isa = PBXGroup;
170213
children = (
214+
4DD7C5A72E58B0020030D82E /* audio_capture */,
215+
4DD7C5B32E58B0020030D82E /* video_capture */,
171216
8A863F7326830A9C0072417D /* experience */,
172217
8A97C1C9258B9C7E005AA486 /* AppDelegate.h */,
173218
8A97C1CA258B9C7E005AA486 /* AppDelegate.m */,
@@ -191,8 +236,6 @@
191236
8A4F6289259C222500AA2DE9 /* Main.storyboard */,
192237
11D9EB572A83734E0099CF95 /* AudioQueuePlay.h */,
193238
11D9EB582A83734E0099CF95 /* AudioQueuePlay.m */,
194-
4D580E272ADD238600CE04DC /* TCGDemoAudioCapturor.h */,
195-
4D580E292ADD23BF00CE04DC /* TCGDemoAudioCapturor.m */,
196239
);
197240
path = TCGDemo;
198241
sourceTree = "<group>";
@@ -268,9 +311,14 @@
268311
files = (
269312
8A5EDB7E26806E4500B4C96F /* TCGDemoGameListVC.m in Sources */,
270313
8A863F7926830A9C0072417D /* TCGDemoExperienceInputText.m in Sources */,
314+
4DD7C5B82E58B0020030D82E /* TCGDispatcher.m in Sources */,
315+
4DD7C5B62E58B0020030D82E /* gcd_helpers.m in Sources */,
316+
4DD7C5B72E58B0020030D82E /* TCGCameraVideoCapturer.m in Sources */,
271317
8A97C216258BAC5A005AA486 /* TCGDemoGamePlayVC.m in Sources */,
272318
8A863F7C268314B70072417D /* TCGDemoUtils.m in Sources */,
273-
4D580E2A2ADD23BF00CE04DC /* TCGDemoAudioCapturor.m in Sources */,
319+
4DD7C5B42E58B0020030D82E /* TCGDemoAudioCapturor.m in Sources */,
320+
4DD7C5B92E58B0020030D82E /* UIDevice+TCGDevice.mm in Sources */,
321+
4DD7C5B52E58B0020030D82E /* AVCaptureSession+DevicePosition.mm in Sources */,
274322
8AC0C3BF269E918900883D6C /* TCGDemoLoadingView.m in Sources */,
275323
8A4F6293259C268900AA2DE9 /* TCGDemoSettingView.m in Sources */,
276324
8AA931492698371900409D56 /* TCGDemoRaidoButton.m in Sources */,

Doc/Release_Notes_EN-US.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[中文文档](历史版本.md)
22

3+
### Version 3.9.1 (2025-8.2)
4+
Bug Fixes
5+
- Fix and optimize some known issues
6+
37
### Version 3.9.0 (2025-8.20)
48
Features
59
- The new TcrSession sendCustomVideoPixelBuffer:rotation:captureTimeNsinterface is used to send custom captured video frames. This capability must be enabled and take effect through the enableCustomVideoCapture field in TcrSession initWithParams.

Doc/历史版本.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[English document](Release_Notes_EN-US.md)
22

3+
### Version 3.9.1 (2025-8.22)
4+
Bug Fixes
5+
- 修复和优化一些已知问题
6+
37
### Version 3.9.0 (2025-8.20)
48
Features
59
- 新增TcrSession sendCustomVideoPixelBuffer:rotation:captureTimeNs接口,用于发送自定义采集视频帧。此能力需要通过TcrSession initWithParams的enableCustomVideoCapture字段开启生效。

0 commit comments

Comments
 (0)