Skip to content

Commit ad4f320

Browse files
authored
Update to m137 with audio engine (flutter-webrtc#1875)
* Update frame cryptor symbol change * Enable audio engine mode * Observe device changes * Lib to 125.6422.09 * Generated * Update lib * Update gitignore * Re-apply gitignore
1 parent 98241e1 commit ad4f320

File tree

19 files changed

+301
-123
lines changed

19 files changed

+301
-123
lines changed

.gitignore

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
*.iml
2-
.idea
3-
.DS_Store
4-
example/pubspec.lock
5-
pubspec.lock
6-
example/ios/Podfile.lock
7-
GeneratedPluginRegistrant.java
8-
example/android/.gradle
9-
WorkspaceSettings.xcsettings
10-
example/.flutter-plugins
11-
example/android/local.properties
12-
.dart_tool/package_config.json
13-
android/.project
14-
example/ios/Runner/GeneratedPluginRegistrant.m
15-
example/ios/Runner/GeneratedPluginRegistrant.h
16-
example/ios/Flutter/Generated.xcconfig
17-
example/ios/Flutter/flutter_export_environment.sh
18-
191
# Miscellaneous
202
*.class
213
*.log
@@ -26,33 +8,24 @@ example/ios/Flutter/flutter_export_environment.sh
268
.buildlog/
279
.history
2810
.svn/
11+
migrate_working_dir/
2912

3013
# IntelliJ related
3114
*.iml
3215
*.ipr
3316
*.iws
3417
.idea/
3518

19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
3624
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
3727
**/doc/api/
3828
.dart_tool/
3929
.flutter-plugins
4030
.flutter-plugins-dependencies
41-
.packages
42-
.pub-cache/
43-
.pub/
44-
/build/
45-
/android/.gradle/
46-
47-
48-
android/.classpath
49-
android/.settings/org.eclipse.buildship.core.prefs
50-
51-
# VSCode
52-
.vscode/
53-
54-
!webrtc_android.iml
55-
!webrtc.iml
56-
57-
# vs
58-
*.pdb
31+
build/

common/darwin/Classes/FlutterRTCFrameCryptor.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,21 +565,21 @@ - (void)keyProviderDispose:(nonnull NSDictionary*)constraints result:(nonnull Fl
565565
result(@{@"result" : @"success"});
566566
}
567567

568-
- (NSString*)stringFromState:(FrameCryptionState)state {
568+
- (NSString*)stringFromState:(RTCFrameCryptorState)state {
569569
switch (state) {
570-
case FrameCryptionStateNew:
570+
case RTCFrameCryptorStateNew:
571571
return @"new";
572-
case FrameCryptionStateOk:
572+
case RTCFrameCryptorStateOk:
573573
return @"ok";
574-
case FrameCryptionStateEncryptionFailed:
574+
case RTCFrameCryptorStateEncryptionFailed:
575575
return @"encryptionFailed";
576-
case FrameCryptionStateDecryptionFailed:
576+
case RTCFrameCryptorStateDecryptionFailed:
577577
return @"decryptionFailed";
578-
case FrameCryptionStateMissingKey:
578+
case RTCFrameCryptorStateMissingKey:
579579
return @"missingKey";
580-
case FrameCryptionStateKeyRatcheted:
580+
case RTCFrameCryptorStateKeyRatcheted:
581581
return @"keyRatcheted";
582-
case FrameCryptionStateInternalError:
582+
case RTCFrameCryptorStateInternalError:
583583
return @"internalError";
584584
default:
585585
return @"unknown";
@@ -590,7 +590,7 @@ - (NSString*)stringFromState:(FrameCryptionState)state {
590590

591591
- (void)frameCryptor:(RTC_OBJC_TYPE(RTCFrameCryptor) *)frameCryptor
592592
didStateChangeWithParticipantId:(NSString*)participantId
593-
withState:(FrameCryptionState)stateChanged {
593+
withState:(RTCFrameCryptorState)stateChanged {
594594
if (frameCryptor.eventSink) {
595595
postEvent(frameCryptor.eventSink, @{
596596
@"event" : @"frameCryptionStateChanged",

common/darwin/Classes/FlutterWebRTCPlugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
2121

2222
@interface FlutterWebRTCPlugin : NSObject <FlutterPlugin,
2323
RTCPeerConnectionDelegate,
24+
RTCAudioDeviceModuleDelegate,
2425
FlutterStreamHandler
2526
#if TARGET_OS_OSX
2627
,

common/darwin/Classes/FlutterWebRTCPlugin.m

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,10 @@ - (instancetype)initWithChannel:(FlutterMethodChannel*)channel
195195
name:AVAudioSessionRouteChangeNotification
196196
object:session];
197197
#endif
198-
#if TARGET_OS_OSX
199-
[_peerConnectionFactory.audioDeviceModule setDevicesUpdatedHandler:^(void) {
200-
NSLog(@"Handle Devices Updated!");
201-
if (self.eventSink) {
202-
postEvent( self.eventSink, @{@"event" : @"onDeviceChange"});
203-
}
204-
}];
205-
#endif
198+
199+
// Observe audio device module events.
200+
_peerConnectionFactory.audioDeviceModule.observer = self;
201+
206202
return self;
207203
}
208204

@@ -257,7 +253,8 @@ - (void)initialize:(NSArray*)networkIgnoreMask
257253
[[VideoEncoderFactorySimulcast alloc] initWithPrimary:encoderFactory fallback:encoderFactory];
258254

259255
_peerConnectionFactory =
260-
[[RTCPeerConnectionFactory alloc] initWithBypassVoiceProcessing:bypassVoiceProcessing
256+
[[RTCPeerConnectionFactory alloc] initWithAudioDeviceModuleType:RTCAudioDeviceModuleTypeAudioEngine
257+
bypassVoiceProcessing:bypassVoiceProcessing
261258
encoderFactory:simulcastFactory
262259
decoderFactory:decoderFactory
263260
audioProcessingModule:_audioManager.audioProcessingModule];
@@ -2379,4 +2376,14 @@ - (FlutterRTCVideoRenderer *)findRendererByTrackId:(NSString *)trackId {
23792376
}
23802377
return nil;
23812378
}
2379+
2380+
#pragma mark - RTCAudioDeviceModuleDelegate methods
2381+
2382+
- (void)audioDeviceModuleDidUpdateDevices:(RTCAudioDeviceModule *)audioDeviceModule {
2383+
NSLog(@"audioDeviceModule did update devices");
2384+
if (self.eventSink) {
2385+
postEvent( self.eventSink, @{@"event" : @"onDeviceChange"});
2386+
}
2387+
}
2388+
23822389
@end

example/.gitignore

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
1114

1215
# IntelliJ related
1316
*.iml
@@ -22,19 +25,23 @@
2225

2326
# Flutter/Dart/Pub related
2427
**/doc/api/
28+
**/ios/Flutter/.last_build_id
2529
.dart_tool/
2630
.flutter-plugins
2731
.flutter-plugins-dependencies
28-
.packages
2932
.pub-cache/
3033
.pub/
3134
/build/
32-
.metadata
33-
34-
# Web related
3535

3636
# Symbolication related
3737
app.*.symbols
3838

39-
# Exceptions to above rules.
40-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
39+
# Obfuscation related
40+
app.*.map.json
41+
42+
# Android Studio will place build artifacts here
43+
/android/app/debug
44+
/android/app/profile
45+
/android/app/release
46+
47+
/pubspec.lock

example/android/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8+
.cxx/
89

910
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
# See https://flutter.dev/to/reference-keystore
1112
key.properties
1213
**/*.keystore
1314
**/*.jks

example/ios/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ Runner/GeneratedPluginRegistrant.*
3232
!default.mode2v3
3333
!default.pbxuser
3434
!default.perspectivev3
35+
36+
/Podfile.lock

0 commit comments

Comments
 (0)