diff --git a/.gitignore b/.gitignore index 0bab26c22a..eb6c05cd3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,3 @@ -*.iml -.idea -.DS_Store -example/pubspec.lock -pubspec.lock -example/ios/Podfile.lock -GeneratedPluginRegistrant.java -example/android/.gradle -WorkspaceSettings.xcsettings -example/.flutter-plugins -example/android/local.properties -.dart_tool/package_config.json -android/.project -example/ios/Runner/GeneratedPluginRegistrant.m -example/ios/Runner/GeneratedPluginRegistrant.h -example/ios/Flutter/Generated.xcconfig -example/ios/Flutter/flutter_export_environment.sh - # Miscellaneous *.class *.log @@ -26,6 +8,7 @@ example/ios/Flutter/flutter_export_environment.sh .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml @@ -33,26 +16,16 @@ example/ios/Flutter/flutter_export_environment.sh *.iws .idea/ +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + # Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock **/doc/api/ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ -/android/.gradle/ - - -android/.classpath -android/.settings/org.eclipse.buildship.core.prefs - -# VSCode -.vscode/ - -!webrtc_android.iml -!webrtc.iml - -# vs -*.pdb \ No newline at end of file +build/ diff --git a/CHANGELOG.md b/CHANGELOG.md index f4687f52a4..edac0eccd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog +[1.0.0] - 2025-07-25 + +* Bump version to 1.0.0 +* [Native] feat: Upgrade libwebrtc to m137. (#1877). +* [Doc] fix: typo in package description (#1895) +* [Android] fix: Video recording crashing and freezing on Android 14 Devices (#1886) +* [Android] fix: Add audio recording for Android Platform (#1884) +* [Dart] fix: Removed outdated code to avoid UI not being displayed in Windows release mode (#1890) +* [Apple] fix: Fix compile warnings (#1887) +* [Apple] feat: Update to m137 with audio engine (#1875) +* [Android] fix: Ensure both video and audio tracks are added before starting the muxer (#1879) + [0.14.2] - 2025-07-01 * [Windows/Linux] feat: Add audio processing and sink API for cpp. (#1867) diff --git a/android/build.gradle b/android/build.gradle index f9b288f868..0d6571a581 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -52,7 +52,7 @@ android { } dependencies { - implementation 'io.github.webrtc-sdk:android:125.6422.03' + implementation 'io.github.webrtc-sdk:android:137.7151.01' implementation 'com.github.davidliu:audioswitch:89582c47c9a04c62f90aa5e57251af4800a62c9a' implementation 'androidx.annotation:annotation:1.1.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java index 0b0998f384..75b85eda4e 100755 --- a/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/GetUserMediaImpl.java @@ -969,64 +969,14 @@ void startRecordingToFile( mediaRecorders.append(id, mediaRecorder); } - void stopRecording(Integer id, String albumName) { - try { - MediaRecorderImpl mediaRecorder = mediaRecorders.get(id); - if (mediaRecorder != null) { - mediaRecorder.stopRecording(); + void stopRecording(Integer id, String albumName, Runnable onFinished) { + MediaRecorderImpl mediaRecorder = mediaRecorders.get(id); + if (mediaRecorder != null) { + mediaRecorder.stopRecording(() -> { mediaRecorders.remove(id); - File file = mediaRecorder.getRecordFile(); - Uri collection; - - if (file != null) { - ContentValues values = new ContentValues(); - values.put(MediaStore.Video.Media.TITLE, file.getName()); - values.put(MediaStore.Video.Media.DISPLAY_NAME, file.getName()); - values.put(MediaStore.Video.Media.ALBUM, albumName); - values.put(MediaStore.Video.Media.MIME_TYPE, "video/mp4"); - values.put(MediaStore.Video.Media.DATE_ADDED, System.currentTimeMillis() / 1000); - values.put(MediaStore.Video.Media.DATE_TAKEN, System.currentTimeMillis()); - - //Android version above 9 MediaStore uses RELATIVE_PATH - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - values.put(MediaStore.Video.Media.RELATIVE_PATH, "Movies/" + albumName); - values.put(MediaStore.Video.Media.IS_PENDING, 1); - - collection = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY); - } else { - //Android version 9 and below MediaStore uses DATA - values.put(MediaStore.Video.Media.DATA, "/storage/emulated/0/Movies/" + albumName + "/" + file.getName()); - - collection = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; - } - - ContentResolver resolver = applicationContext.getContentResolver(); - Uri uriSavedMedia = resolver.insert(collection, values); - - assert uriSavedMedia != null; - ParcelFileDescriptor pfd = resolver.openFileDescriptor(uriSavedMedia, "w"); - assert pfd != null; - FileOutputStream out = new FileOutputStream(pfd.getFileDescriptor()); - - InputStream in = new FileInputStream(file); - - byte[] buf = new byte[8192]; - int len; - - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - - out.close(); - in.close(); - pfd.close(); - values.clear(); - } - } - } catch(Exception e){ - + onFinished.run(); + }); } - } diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java index 8444c0e66b..dfa5de8e7a 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/MethodCallHandlerImpl.java @@ -771,8 +771,7 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) { case "stopRecordToFile": Integer recorderId = call.argument("recorderId"); String albumName = call.argument("albumName"); - getUserMediaImpl.stopRecording(recorderId, albumName); - result.success(null); + getUserMediaImpl.stopRecording(recorderId, albumName, () -> result.success(null)); break; case "captureFrame": { String path = call.argument("path"); diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/record/AudioFileRenderer.java b/android/src/main/java/com/cloudwebrtc/webrtc/record/AudioFileRenderer.java new file mode 100644 index 0000000000..baa4d35d72 --- /dev/null +++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/AudioFileRenderer.java @@ -0,0 +1,258 @@ +package com.cloudwebrtc.webrtc.record; + +import android.media.MediaCodec; +import android.media.MediaCodecInfo; +import android.media.MediaFormat; +import android.media.MediaMuxer; +import android.os.Handler; +import android.os.HandlerThread; +import android.util.Log; + +import org.webrtc.audio.JavaAudioDeviceModule; +import org.webrtc.audio.JavaAudioDeviceModule.SamplesReadyCallback; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +class AudioFileRenderer implements SamplesReadyCallback { + private static final String TAG = "AudioFileRenderer"; + private final HandlerThread audioThread; + private final Handler audioThreadHandler; + private ByteBuffer[] audioInputBuffers; + private ByteBuffer[] audioOutputBuffers; + + private final MediaMuxer mediaMuxer; + private MediaCodec.BufferInfo audioBufferInfo; + private int audioTrackIndex = -1; + private boolean isRunning = true; + private MediaCodec audioEncoder; + private boolean audioEncoderStarted = false; + private volatile boolean muxerStarted = false; + + AudioFileRenderer(String outputFile) throws IOException { + audioThread = new HandlerThread(TAG + "AudioThread"); + audioThread.start(); + audioThreadHandler = new Handler(audioThread.getLooper()); + + // Create a MediaMuxer for audio-only recording + mediaMuxer = new MediaMuxer(outputFile, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4); + } + + /** + * Release all resources. All already posted audio samples will be processed first. + */ + void release() { + isRunning = false; + CountDownLatch latch = new CountDownLatch(1); + + audioThreadHandler.post(() -> { + try { + // First, stop the encoder if it's running + if (audioEncoder != null && audioEncoderStarted) { + try { + // Signal end of stream with timeout + int inputBufferIndex = audioEncoder.dequeueInputBuffer(10000); // 10ms timeout + if (inputBufferIndex >= 0) { + audioEncoder.queueInputBuffer(inputBufferIndex, 0, 0, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM); + } + + // Drain remaining data + drainAudio(); + + audioEncoder.stop(); + audioEncoderStarted = false; + } catch (Exception e) { + Log.e(TAG, "Error stopping audio encoder", e); + } + } + + // Release encoder + if (audioEncoder != null) { + try { + audioEncoder.release(); + } catch (Exception e) { + Log.e(TAG, "Error releasing audio encoder", e); + } + audioEncoder = null; + } + + // Stop and release muxer only if it was properly started + try { + if (muxerStarted && audioTrackIndex != -1) { + mediaMuxer.stop(); + muxerStarted = false; + } + mediaMuxer.release(); + } catch (Exception e) { + Log.e(TAG, "Error stopping/releasing MediaMuxer", e); + } + + } catch (Exception e) { + Log.e(TAG, "Error during release", e); + } finally { + try { + audioThread.quit(); + } catch (Exception e) { + Log.e(TAG, "Error quitting audio thread", e); + } + latch.countDown(); + } + }); + + try { + // Wait for cleanup with timeout to prevent ANR + if (!latch.await(2, java.util.concurrent.TimeUnit.SECONDS)) { + Log.w(TAG, "Release timed out, proceeding anyway"); + } + } catch (InterruptedException e) { + Log.e(TAG, "Release interrupted", e); + Thread.currentThread().interrupt(); + } + } + + private long presTime = 0L; + + private void drainAudio() { + if (audioBufferInfo == null) + audioBufferInfo = new MediaCodec.BufferInfo(); + + while (isRunning && audioEncoder != null) { + int encoderStatus = audioEncoder.dequeueOutputBuffer(audioBufferInfo, 100); // 100ms timeout + if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) { + break; + } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) { + audioOutputBuffers = audioEncoder.getOutputBuffers(); + Log.w(TAG, "audio encoder output buffers changed"); + } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { + MediaFormat newFormat = audioEncoder.getOutputFormat(); + Log.i(TAG, "audio encoder output format changed: " + newFormat); + + if (audioTrackIndex == -1) { + audioTrackIndex = mediaMuxer.addTrack(newFormat); + if (audioTrackIndex != -1 && !muxerStarted) { + mediaMuxer.start(); + muxerStarted = true; + Log.i(TAG, "MediaMuxer started for audio recording"); + } + } + if (!muxerStarted) + break; + } else if (encoderStatus < 0) { + Log.e(TAG, "unexpected result from audio encoder.dequeueOutputBuffer: " + encoderStatus); + } else { // encoderStatus >= 0 + try { + ByteBuffer encodedData = audioOutputBuffers[encoderStatus]; + if (encodedData == null) { + Log.e(TAG, "audio encoderOutputBuffer " + encoderStatus + " was null"); + break; + } + + // Adjust ByteBuffer values to match BufferInfo + encodedData.position(audioBufferInfo.offset); + encodedData.limit(audioBufferInfo.offset + audioBufferInfo.size); + + if (muxerStarted && audioTrackIndex != -1) { + mediaMuxer.writeSampleData(audioTrackIndex, encodedData, audioBufferInfo); + } + + audioEncoder.releaseOutputBuffer(encoderStatus, false); + + if ((audioBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) { + Log.i(TAG, "End of audio stream reached"); + break; + } + } catch (Exception e) { + Log.e(TAG, "Error processing audio data", e); + break; + } + } + } + } + + @Override + public void onWebRtcAudioRecordSamplesReady(JavaAudioDeviceModule.AudioSamples audioSamples) { + if (!isRunning) + return; + + audioThreadHandler.post(() -> { + try { + // Check if we're still running before processing + if (!isRunning) { + return; + } + + // Initialize audio encoder if not already done + if (audioEncoder == null) { + initializeAudioEncoder(audioSamples); + } + + if (audioEncoder == null || !audioEncoderStarted) { + Log.e(TAG, "Failed to initialize audio encoder or encoder not started"); + return; + } + + // Get input buffer and write audio data + int bufferIndex = audioEncoder.dequeueInputBuffer(100); // 100ms timeout + if (bufferIndex >= 0) { + ByteBuffer buffer = audioInputBuffers[bufferIndex]; + buffer.clear(); + + byte[] data = audioSamples.getData(); + if (data.length <= buffer.remaining()) { + buffer.put(data); + + // Calculate presentation time (microseconds) + // Assuming 16-bit samples: data.length bytes / 2 bytes per sample / sample rate * 1000000 + long frameTime = (long) data.length * 1000000L / (2 * audioSamples.getSampleRate() * audioSamples.getChannelCount()); + + audioEncoder.queueInputBuffer(bufferIndex, 0, data.length, presTime, 0); + presTime += frameTime; + } else { + Log.w(TAG, "Audio data too large for buffer: " + data.length + " bytes, buffer capacity: " + buffer.remaining()); + audioEncoder.queueInputBuffer(bufferIndex, 0, 0, presTime, 0); + } + } else { + Log.w(TAG, "No input buffer available for audio data"); + } + + // Drain encoded audio data only if still running + if (isRunning) { + drainAudio(); + } + + } catch (Exception e) { + Log.e(TAG, "Error processing audio samples", e); + } + }); + } + + private void initializeAudioEncoder(JavaAudioDeviceModule.AudioSamples audioSamples) { + try { + audioEncoder = MediaCodec.createEncoderByType("audio/mp4a-latm"); + + MediaFormat format = new MediaFormat(); + format.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm"); + format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, audioSamples.getChannelCount()); + format.setInteger(MediaFormat.KEY_SAMPLE_RATE, audioSamples.getSampleRate()); + format.setInteger(MediaFormat.KEY_BIT_RATE, 128 * 1024); // 128 kbps + format.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC); + + Log.i(TAG, "Configuring audio encoder with format: " + format); + + audioEncoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); + audioEncoder.start(); + + audioInputBuffers = audioEncoder.getInputBuffers(); + audioOutputBuffers = audioEncoder.getOutputBuffers(); + audioEncoderStarted = true; + + Log.i(TAG, "Audio encoder initialized successfully"); + + } catch (IOException e) { + Log.e(TAG, "Failed to create audio encoder", e); + audioEncoder = null; + } + } +} diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/record/MediaRecorderImpl.java b/android/src/main/java/com/cloudwebrtc/webrtc/record/MediaRecorderImpl.java index f1c45357bc..634d14d1ae 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/record/MediaRecorderImpl.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/MediaRecorderImpl.java @@ -8,6 +8,8 @@ import org.webrtc.VideoTrack; import java.io.File; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class MediaRecorderImpl { @@ -15,10 +17,12 @@ public class MediaRecorderImpl { private final VideoTrack videoTrack; private final AudioSamplesInterceptor audioInterceptor; private VideoFileRenderer videoFileRenderer; + private AudioFileRenderer audioFileRenderer; private boolean isRunning = false; private File recordFile; - public MediaRecorderImpl(Integer id, @Nullable VideoTrack videoTrack, @Nullable AudioSamplesInterceptor audioInterceptor) { + public MediaRecorderImpl(Integer id, @Nullable VideoTrack videoTrack, + @Nullable AudioSamplesInterceptor audioInterceptor) { this.id = id; this.videoTrack = videoTrack; this.audioInterceptor = audioInterceptor; @@ -29,36 +33,59 @@ public void startRecording(File file) throws Exception { if (isRunning) return; isRunning = true; - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored file.getParentFile().mkdirs(); if (videoTrack != null) { videoFileRenderer = new VideoFileRenderer( - file.getAbsolutePath(), - EglUtils.getRootEglBaseContext(), - audioInterceptor != null - ); + file.getAbsolutePath(), + EglUtils.getRootEglBaseContext(), + audioInterceptor != null); videoTrack.addSink(videoFileRenderer); if (audioInterceptor != null) audioInterceptor.attachCallback(id, videoFileRenderer); } else { - Log.e(TAG, "Video track is null"); + Log.d(TAG, "Video track is null - checking for audio-only recording"); if (audioInterceptor != null) { - //TODO(rostopira): audio only recording - throw new Exception("Audio-only recording not implemented yet"); + // Audio-only recording implementation + audioFileRenderer = new AudioFileRenderer(file.getAbsolutePath()); + audioInterceptor.attachCallback(id, audioFileRenderer); + } else { + throw new Exception("Both video track and audio interceptor are null - cannot record"); } } } - public File getRecordFile() { return recordFile; } + public File getRecordFile() { + return recordFile; + } + + private final ExecutorService releaseExecutor = Executors.newSingleThreadExecutor(); - public void stopRecording() { + public void stopRecording(Runnable onStopped) { isRunning = false; if (audioInterceptor != null) audioInterceptor.detachCallback(id); if (videoTrack != null && videoFileRenderer != null) { videoTrack.removeSink(videoFileRenderer); - videoFileRenderer.release(); - videoFileRenderer = null; + releaseExecutor.submit(() -> { + videoFileRenderer.release(); + videoFileRenderer = null; + if (onStopped != null) + onStopped.run(); + releaseExecutor.shutdown(); // libera o executor + }); + } else { + if (onStopped != null) + onStopped.run(); + releaseExecutor.shutdown(); + } + if (audioFileRenderer != null) { + audioFileRenderer.release(); + audioFileRenderer = null; + } + if (audioFileRenderer != null) { + audioFileRenderer.release(); + audioFileRenderer = null; } } diff --git a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java index 030c36bf16..275b33264a 100644 --- a/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java +++ b/android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java @@ -89,20 +89,29 @@ private void initVideoEncoder() { format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE); format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL); + format.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, 0); // Para Surface input + format.setInteger(MediaFormat.KEY_PRIORITY, 0); // Background priority + format.setInteger(MediaFormat.KEY_PROFILE, MediaCodecInfo.CodecProfileLevel.AVCProfileBaseline); // AVC baseline + // Create a MediaCodec encoder, and configure it with our format. Get a Surface // we can use for input and wrap it with a class that handles the EGL work. try { encoder = MediaCodec.createEncoderByType(MIME_TYPE); encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); + + CountDownLatch latch = new CountDownLatch(1); renderThreadHandler.post(() -> { eglBase = EglBase.create(sharedContext, EglBase.CONFIG_RECORDABLE); surface = encoder.createInputSurface(); eglBase.createSurface(surface); eglBase.makeCurrent(); drawer = new GlRectDrawer(); + latch.countDown(); }); + latch.await(); // espera EGL estar pronto } catch (Exception e) { Log.wtf(TAG, e); + Thread.currentThread().interrupt(); } } @@ -118,6 +127,12 @@ public void onFrame(VideoFrame frame) { } private void renderFrameOnRenderThread(VideoFrame frame) { + if (drawer == null) { + Log.e(TAG, "drawer is null — skipping frame render"); + frame.release(); + return; + } + if (frameDrawer == null) { frameDrawer = new VideoFrameDrawer(); } @@ -154,7 +169,10 @@ void release() { encoder.stop(); encoder.release(); } - eglBase.release(); + if (eglBase != null) { + eglBase.release(); + eglBase = null; + } if (muxerStarted) { mediaMuxer.stop(); mediaMuxer.release(); @@ -200,7 +218,9 @@ private void drainEncoder() { Log.e(TAG, "encoder output format changed: " + newFormat); trackIndex = mediaMuxer.addTrack(newFormat); - if (trackIndex != -1 && !muxerStarted) { + // Start Signify modification + if (trackIndex != -1 && audioTrackIndex != -1 && !muxerStarted) { + // End Signify modification mediaMuxer.start(); muxerStarted = true; } @@ -256,7 +276,9 @@ private void drainAudio() { Log.w(TAG, "encoder output format changed: " + newFormat); audioTrackIndex = mediaMuxer.addTrack(newFormat); - if (audioTrackIndex != -1 && !muxerStarted) { + // Start Signify modification + if (trackIndex != -1 && audioTrackIndex != -1 && !muxerStarted) { + // End Signify modification mediaMuxer.start(); muxerStarted = true; } diff --git a/common/darwin/Classes/FlutterRTCFrameCryptor.m b/common/darwin/Classes/FlutterRTCFrameCryptor.m index b75afc12aa..6196ffcf26 100644 --- a/common/darwin/Classes/FlutterRTCFrameCryptor.m +++ b/common/darwin/Classes/FlutterRTCFrameCryptor.m @@ -565,21 +565,21 @@ - (void)keyProviderDispose:(nonnull NSDictionary*)constraints result:(nonnull Fl result(@{@"result" : @"success"}); } -- (NSString*)stringFromState:(FrameCryptionState)state { +- (NSString*)stringFromState:(RTCFrameCryptorState)state { switch (state) { - case FrameCryptionStateNew: + case RTCFrameCryptorStateNew: return @"new"; - case FrameCryptionStateOk: + case RTCFrameCryptorStateOk: return @"ok"; - case FrameCryptionStateEncryptionFailed: + case RTCFrameCryptorStateEncryptionFailed: return @"encryptionFailed"; - case FrameCryptionStateDecryptionFailed: + case RTCFrameCryptorStateDecryptionFailed: return @"decryptionFailed"; - case FrameCryptionStateMissingKey: + case RTCFrameCryptorStateMissingKey: return @"missingKey"; - case FrameCryptionStateKeyRatcheted: + case RTCFrameCryptorStateKeyRatcheted: return @"keyRatcheted"; - case FrameCryptionStateInternalError: + case RTCFrameCryptorStateInternalError: return @"internalError"; default: return @"unknown"; @@ -590,7 +590,7 @@ - (NSString*)stringFromState:(FrameCryptionState)state { - (void)frameCryptor:(RTC_OBJC_TYPE(RTCFrameCryptor) *)frameCryptor didStateChangeWithParticipantId:(NSString*)participantId - withState:(FrameCryptionState)stateChanged { + withState:(RTCFrameCryptorState)stateChanged { if (frameCryptor.eventSink) { postEvent(frameCryptor.eventSink, @{ @"event" : @"frameCryptionStateChanged", diff --git a/common/darwin/Classes/FlutterRTCPeerConnection.m b/common/darwin/Classes/FlutterRTCPeerConnection.m index d37eafde10..29f2e90a94 100644 --- a/common/darwin/Classes/FlutterRTCPeerConnection.m +++ b/common/darwin/Classes/FlutterRTCPeerConnection.m @@ -843,8 +843,15 @@ - (void)transceiverSetCodecPreferences:(nonnull NSDictionary*)argsMap [codecCaps addObject:codec]; } } - [transcevier setCodecPreferences:codecCaps]; - result(nil); + NSError *error = nil; + [transcevier setCodecPreferences:codecCaps error:&error]; + if (error) { + result([FlutterError errorWithCode:@"SetCodecPreferencesError" + message:error.localizedDescription + details:nil]); + } else { + result(nil); + } } @end diff --git a/common/darwin/Classes/FlutterWebRTCPlugin.h b/common/darwin/Classes/FlutterWebRTCPlugin.h index ee39d6345f..6ca5f3dbb2 100644 --- a/common/darwin/Classes/FlutterWebRTCPlugin.h +++ b/common/darwin/Classes/FlutterWebRTCPlugin.h @@ -21,6 +21,7 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler); @interface FlutterWebRTCPlugin : NSObject >* _Nullable localTracks; @property(nonatomic, strong) NSMutableDictionary* _Nullable renders; -@property(nonatomic, strong) NSMutableDictionary* recorders; +@property(nonatomic, strong) NSMutableDictionary* _Nonnull recorders; @property(nonatomic, strong) NSMutableDictionary* _Nullable videoCapturerStopHandlers; @@ -71,7 +72,7 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler); peerConnectionId:(NSString* _Nullable)peerConnectionId; - (RTCMediaStreamTrack* _Nullable)trackForId:(NSString* _Nonnull)trackId peerConnectionId:(NSString* _Nullable)peerConnectionId; -- (NSString*)audioTrackIdForVideoTrackId:(NSString*)videoTrackId; +- (NSString* _Nullable)audioTrackIdForVideoTrackId:(NSString* _Nonnull)videoTrackId; - (RTCRtpTransceiver* _Nullable)getRtpTransceiverById:(RTCPeerConnection* _Nonnull)peerConnection Id:(NSString* _Nullable)Id; - (NSDictionary* _Nullable)mediaStreamToMap:(RTCMediaStream* _Nonnull)stream diff --git a/common/darwin/Classes/FlutterWebRTCPlugin.m b/common/darwin/Classes/FlutterWebRTCPlugin.m index 73f01aebe1..e7102173d3 100644 --- a/common/darwin/Classes/FlutterWebRTCPlugin.m +++ b/common/darwin/Classes/FlutterWebRTCPlugin.m @@ -195,14 +195,10 @@ - (instancetype)initWithChannel:(FlutterMethodChannel*)channel name:AVAudioSessionRouteChangeNotification object:session]; #endif -#if TARGET_OS_OSX - [_peerConnectionFactory.audioDeviceModule setDevicesUpdatedHandler:^(void) { - NSLog(@"Handle Devices Updated!"); - if (self.eventSink) { - postEvent( self.eventSink, @{@"event" : @"onDeviceChange"}); - } - }]; -#endif + + // Observe audio device module events. + _peerConnectionFactory.audioDeviceModule.observer = self; + return self; } @@ -257,7 +253,8 @@ - (void)initialize:(NSArray*)networkIgnoreMask [[VideoEncoderFactorySimulcast alloc] initWithPrimary:encoderFactory fallback:encoderFactory]; _peerConnectionFactory = - [[RTCPeerConnectionFactory alloc] initWithBypassVoiceProcessing:bypassVoiceProcessing + [[RTCPeerConnectionFactory alloc] initWithAudioDeviceModuleType:RTCAudioDeviceModuleTypeAudioEngine + bypassVoiceProcessing:bypassVoiceProcessing encoderFactory:simulcastFactory decoderFactory:decoderFactory audioProcessingModule:_audioManager.audioProcessingModule]; @@ -2379,4 +2376,14 @@ - (FlutterRTCVideoRenderer *)findRendererByTrackId:(NSString *)trackId { } return nil; } + +#pragma mark - RTCAudioDeviceModuleDelegate methods + +- (void)audioDeviceModuleDidUpdateDevices:(RTCAudioDeviceModule *)audioDeviceModule { + NSLog(@"audioDeviceModule did update devices"); + if (self.eventSink) { + postEvent( self.eventSink, @{@"event" : @"onDeviceChange"}); + } +} + @end diff --git a/elinux/CMakeLists.txt b/elinux/CMakeLists.txt index 3454f57da4..f642680e1e 100644 --- a/elinux/CMakeLists.txt +++ b/elinux/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.15) set(PROJECT_NAME "flutter_webrtc") project(${PROJECT_NAME} LANGUAGES CXX) +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + +# Add the libwebrtc dependency +include("${CMAKE_CURRENT_SOURCE_DIR}/../third_party/CMakeLists.txt") + # This value is used when generating builds using this plugin, so it must # not be changed set(PLUGIN_NAME "flutter_webrtc_plugin") diff --git a/example/.gitignore b/example/.gitignore index f70e6e8ce0..250ac63817 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -5,9 +5,12 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ +migrate_working_dir/ # IntelliJ related *.iml @@ -22,19 +25,23 @@ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies -.packages .pub-cache/ .pub/ /build/ -.metadata - -# Web related # Symbolication related app.*.symbols -# Exceptions to above rules. -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +/pubspec.lock diff --git a/example/android/.gitignore b/example/android/.gitignore index 6f568019d3..be3943c96d 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -5,9 +5,10 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java +.cxx/ # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/example/ios/.gitignore b/example/ios/.gitignore index 7a7f9873ad..a4fb6c644f 100644 --- a/example/ios/.gitignore +++ b/example/ios/.gitignore @@ -32,3 +32,5 @@ Runner/GeneratedPluginRegistrant.* !default.mode2v3 !default.pbxuser !default.perspectivev3 + +/Podfile.lock diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index d974dc02cf..63fb3d8487 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,8 +8,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 21C4A0A0C4EDAF82A00D8B64 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AE117A2B715E98F15C6AA714 /* libPods-Runner.a */; }; 331C80F4294D02FB00263BE5 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 331C80F3294D02FB00263BE5 /* RunnerTests.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 561F5A80E4F57894D232B226 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BB083770F6094D4927342A6 /* libPods-RunnerTests.a */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -41,11 +43,15 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0581965BF29AE67BDD6BDBC8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2F289A70F4F3CAE9189F4318 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 331C80F1294D02FB00263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80F3294D02FB00263BE5 /* RunnerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerTests.m; sourceTree = ""; }; + 35A64DA8F8FD8FFEF0D223F2 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 7501B8354B037085FF020F73 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -57,6 +63,10 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9BB083770F6094D4927342A6 /* libPods-RunnerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RunnerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + AE117A2B715E98F15C6AA714 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B7283ABB02AC53C40B5DFEBD /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + E49E01D129BB9C508D596C64 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -64,6 +74,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 561F5A80E4F57894D232B226 /* libPods-RunnerTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -71,6 +82,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 21C4A0A0C4EDAF82A00D8B64 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -85,6 +97,20 @@ path = RunnerTests; sourceTree = ""; }; + 7BC7F4882507197B5103CBF1 /* Pods */ = { + isa = PBXGroup; + children = ( + 0581965BF29AE67BDD6BDBC8 /* Pods-Runner.debug.xcconfig */, + 7501B8354B037085FF020F73 /* Pods-Runner.release.xcconfig */, + E49E01D129BB9C508D596C64 /* Pods-Runner.profile.xcconfig */, + 2F289A70F4F3CAE9189F4318 /* Pods-RunnerTests.debug.xcconfig */, + 35A64DA8F8FD8FFEF0D223F2 /* Pods-RunnerTests.release.xcconfig */, + B7283ABB02AC53C40B5DFEBD /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -103,6 +129,8 @@ 97C146F01CF9000F007C117D /* Runner */, 331C80F2294D02FB00263BE5 /* RunnerTests */, 97C146EF1CF9000F007C117D /* Products */, + 7BC7F4882507197B5103CBF1 /* Pods */, + E3B30162DA11C9F0FC10EA5D /* Frameworks */, ); sourceTree = ""; }; @@ -139,6 +167,15 @@ name = "Supporting Files"; sourceTree = ""; }; + E3B30162DA11C9F0FC10EA5D /* Frameworks */ = { + isa = PBXGroup; + children = ( + AE117A2B715E98F15C6AA714 /* libPods-Runner.a */, + 9BB083770F6094D4927342A6 /* libPods-RunnerTests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -146,6 +183,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80F7294D02FB00263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 86EF18A6F1E0EDCAD32BFA56 /* [CP] Check Pods Manifest.lock */, 331C80ED294D02FB00263BE5 /* Sources */, 331C80EE294D02FB00263BE5 /* Frameworks */, 331C80EF294D02FB00263BE5 /* Resources */, @@ -164,12 +202,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 09FAB8CF715A50452F67A49C /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + DFD38EC3328043709D723FCC /* [CP] Copy Pods Resources */, + E22CA7B7D654F592DA4282CC /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -186,7 +227,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80F0294D02FB00263BE5 = { @@ -239,6 +280,28 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 09FAB8CF715A50452F67A49C /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -255,6 +318,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 86EF18A6F1E0EDCAD32BFA56 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -270,6 +355,40 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + DFD38EC3328043709D723FCC /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + E22CA7B7D654F592DA4282CC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -362,7 +481,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -383,7 +502,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample"; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -391,12 +510,13 @@ }; 331C80F8294D02FB00263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 2F289A70F4F3CAE9189F4318 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; @@ -404,12 +524,13 @@ }; 331C80F9294D02FB00263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 35A64DA8F8FD8FFEF0D223F2 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; @@ -417,12 +538,13 @@ }; 331C80FA294D02FB00263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B7283ABB02AC53C40B5DFEBD /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample.RunnerTests"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; }; @@ -475,7 +597,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -524,7 +646,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -545,7 +667,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample"; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -563,7 +685,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample; + PRODUCT_BUNDLE_IDENTIFIER = "com.cloudwebrtc.flutter-flutter-example.flutterWebrtcExample"; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index f7213505ac..d7417c13ce 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed..21a3cc14c7 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/lib/main.dart b/example/lib/main.dart index 64bfc07d0c..53d6da088f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,10 +1,7 @@ import 'dart:core'; -import 'package:flutter/foundation.dart' - show debugDefaultTargetPlatformOverride; import 'package:flutter/material.dart'; import 'package:flutter_background/flutter_background.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:flutter_webrtc_example/src/capture_frame_sample.dart'; import 'src/device_enumeration_sample.dart'; @@ -17,11 +14,6 @@ import 'src/route_item.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); - if (WebRTC.platformIsDesktop) { - debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; - } else if (WebRTC.platformIsAndroid) { - //startForegroundService(); - } runApp(MyApp()); } diff --git a/example/macos/.gitignore b/example/macos/.gitignore index 746adbb6b9..0a70cf5ea1 100644 --- a/example/macos/.gitignore +++ b/example/macos/.gitignore @@ -5,3 +5,5 @@ # Xcode-related **/dgph **/xcuserdata/ + +/Podfile.lock diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index e2c46d9f3f..809ab956ed 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -27,6 +27,8 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 4FEA11646F548743A74CF884 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F84E6BB3DEB1D95AD50AD969 /* Pods_Runner.framework */; }; + E60EFA22891D643DD979D09A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DF45159536E6832DBB2AF10 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -60,6 +62,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 1C3E69E23559F194216F462C /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; @@ -76,8 +79,15 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3DF45159536E6832DBB2AF10 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 499F14907F020AB5800848DC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 77E25E1D5007D619ED498B41 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 7A0F103C3A872AFC09BF3C20 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 9FC08AA1A7BC3B41A49B50A5 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + ECD43F0A89650285C7114ED0 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + F84E6BB3DEB1D95AD50AD969 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -85,6 +95,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + E60EFA22891D643DD979D09A /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,12 +103,27 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4FEA11646F548743A74CF884 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 27E22E23872DE5166316BE6B /* Pods */ = { + isa = PBXGroup; + children = ( + 7A0F103C3A872AFC09BF3C20 /* Pods-Runner.debug.xcconfig */, + 499F14907F020AB5800848DC /* Pods-Runner.release.xcconfig */, + 77E25E1D5007D619ED498B41 /* Pods-Runner.profile.xcconfig */, + 1C3E69E23559F194216F462C /* Pods-RunnerTests.debug.xcconfig */, + 9FC08AA1A7BC3B41A49B50A5 /* Pods-RunnerTests.release.xcconfig */, + ECD43F0A89650285C7114ED0 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 331C80D6294CF71000263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -125,6 +151,7 @@ 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 27E22E23872DE5166316BE6B /* Pods */, ); sourceTree = ""; }; @@ -175,6 +202,8 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + F84E6BB3DEB1D95AD50AD969 /* Pods_Runner.framework */, + 3DF45159536E6832DBB2AF10 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -186,6 +215,7 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + ADB10355CEE869680D2A307C /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -204,11 +234,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + D6EB234D8B4FB7DD0ADA837E /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 0303EE9BD0286223B62FD2E5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -227,7 +259,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -290,6 +322,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 0303EE9BD0286223B62FD2E5 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -328,6 +377,50 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + ADB10355CEE869680D2A307C /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + D6EB234D8B4FB7DD0ADA837E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -379,6 +472,7 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 1C3E69E23559F194216F462C /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -393,6 +487,7 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9FC08AA1A7BC3B41A49B50A5 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -407,6 +502,7 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = ECD43F0A89650285C7114ED0 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a4df20256a..b8278cb762 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16ed..21a3cc14c7 100644 --- a/example/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift index 8e02df2888..b3c1761412 100644 --- a/example/macos/Runner/AppDelegate.swift +++ b/example/macos/Runner/AppDelegate.swift @@ -6,4 +6,8 @@ class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } } diff --git a/ios/flutter_webrtc.podspec b/ios/flutter_webrtc.podspec index 778368a8a0..5ebc220adf 100644 --- a/ios/flutter_webrtc.podspec +++ b/ios/flutter_webrtc.podspec @@ -3,7 +3,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_webrtc' - s.version = '0.14.0' + s.version = '1.0.0' s.summary = 'Flutter WebRTC plugin for iOS.' s.description = <<-DESC A new flutter plugin project. @@ -15,7 +15,7 @@ A new flutter plugin project. s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' - s.dependency 'WebRTC-SDK', '125.6422.07' + s.dependency 'WebRTC-SDK', '137.7151.02' s.ios.deployment_target = '13.0' s.static_framework = true s.pod_target_xcconfig = { diff --git a/lib/src/desktop_capturer.dart b/lib/src/desktop_capturer.dart index 1780cb593c..c44037cbf9 100644 --- a/lib/src/desktop_capturer.dart +++ b/lib/src/desktop_capturer.dart @@ -1,10 +1,7 @@ import 'dart:async'; import 'dart:typed_data'; -enum SourceType { - Screen, - Window, -} +enum SourceType { Screen, Window } final desktopSourceTypeToString = { SourceType.Screen: 'screen', @@ -32,7 +29,7 @@ abstract class DesktopCapturerSource { /// chromeMediaSourceId constraint when calling String get id; - /// A screen source will be named either Entire Screen or Screen , + /// A screen source will be named either Entire Screen or Screen index, /// while the name of a window source will match the window title. String get name; @@ -63,8 +60,10 @@ abstract class DesktopCapturer { throw UnimplementedError(); ///Get the screen source of the specified types - Future> getSources( - {required List types, ThumbnailSize? thumbnailSize}); + Future> getSources({ + required List types, + ThumbnailSize? thumbnailSize, + }); /// Updates the list of screen sources of the specified types Future updateSources({required List types}); diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 8adc01ed33..46dccedb66 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.10) set(PROJECT_NAME "flutter_webrtc") project(${PROJECT_NAME} LANGUAGES CXX) +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + +# Add the libwebrtc dependency +include("${CMAKE_CURRENT_SOURCE_DIR}/../third_party/CMakeLists.txt") + set(PLUGIN_NAME "${PROJECT_NAME}_plugin") set (CMAKE_EXPORT_COMPILE_COMMANDS ON ) set(CMAKE_CXX_STANDARD 17) diff --git a/macos/flutter_webrtc.podspec b/macos/flutter_webrtc.podspec index 7baf7ea75f..673097f0c7 100644 --- a/macos/flutter_webrtc.podspec +++ b/macos/flutter_webrtc.podspec @@ -3,7 +3,7 @@ # Pod::Spec.new do |s| s.name = 'flutter_webrtc' - s.version = '0.14.0' + s.version = '1.0.0' s.summary = 'Flutter WebRTC plugin for macOS.' s.description = <<-DESC A new flutter plugin project. @@ -15,6 +15,6 @@ A new flutter plugin project. s.source_files = ['Classes/**/*'] s.dependency 'FlutterMacOS' - s.dependency 'WebRTC-SDK', '125.6422.07' - s.osx.deployment_target = '10.14' + s.dependency 'WebRTC-SDK', '137.7151.02' + s.osx.deployment_target = '10.15' end diff --git a/pubspec.yaml b/pubspec.yaml index a0c02d06ee..3fa077509b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_webrtc -description: Flutter WebRTC plugin for iOS/Android/Destkop/Web, based on GoogleWebRTC. -version: 0.14.2 +description: Flutter WebRTC plugin for iOS/Android/Desktop/Web, based on GoogleWebRTC. +version: 1.0.0 homepage: https://github.com/cloudwebrtc/flutter-webrtc environment: sdk: ">=3.3.0 <4.0.0" @@ -8,7 +8,7 @@ environment: dependencies: collection: ^1.17.0 - dart_webrtc: ^1.5.3+hotfix.2 + dart_webrtc: ^1.5.3+hotfix.3 flutter: sdk: flutter path_provider: ^2.0.2 diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 0000000000..5afd943325 --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1,25 @@ +include(ExternalProject) + +set(ZIPFILE "${CMAKE_CURRENT_LIST_DIR}/downloads/libwebrtc.zip") +set(DOWNLOAD_URL "https://github.com/flutter-webrtc/flutter-webrtc/releases/download/v1.0.0/libwebrtc.zip") + +if(NOT EXISTS "${ZIPFILE}") + message(NOTICE "download: ${DOWNLOAD_URL}") + file(DOWNLOAD "${DOWNLOAD_URL}" + ${ZIPFILE} + STATUS download_status + LOG download_log) + + if(NOT download_status EQUAL 0) + message(FATAL_ERROR "Failed to download dependency: ${download_log}") + endif() + + file(ARCHIVE_EXTRACT INPUT ${ZIPFILE} DESTINATION "${CMAKE_CURRENT_LIST_DIR}") +else() + if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/libwebrtc") + message(NOTICE "libwebrtc directory does not exist after extraction.") + file(ARCHIVE_EXTRACT INPUT ${ZIPFILE} DESTINATION "${CMAKE_CURRENT_LIST_DIR}") + endif() + message(TRACE "libwebrtc already downloaded.") +endif() + diff --git a/third_party/libwebrtc/include/base/atomicops.h b/third_party/libwebrtc/include/base/atomicops.h deleted file mode 100644 index 4a3b79916a..0000000000 --- a/third_party/libwebrtc/include/base/atomicops.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef LIB_WEBRTC_ATOMICOPS_H_ -#define LIB_WEBRTC_ATOMICOPS_H_ - -#if defined(WIN32) || defined(_WINDOWS) -// Include winsock2.h before including to maintain consistency with -// win32.h. We can't include win32.h directly here since it pulls in -// headers such as basictypes.h which causes problems in Chromium where webrtc -// exists as two separate projects, webrtc and libjingle. -#include -#endif // defined(WIN32) - -namespace libwebrtc { -class AtomicOps { - public: -#if defined(WIN32) || defined(_WINDOWS) - // Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64. - static int Increment(volatile int* i) { - return ::InterlockedIncrement(reinterpret_cast(i)); - } - static int Decrement(volatile int* i) { - return ::InterlockedDecrement(reinterpret_cast(i)); - } - static int AcquireLoad(volatile const int* i) { return *i; } - static void ReleaseStore(volatile int* i, int value) { *i = value; } - static int CompareAndSwap(volatile int* i, int old_value, int new_value) { - return ::InterlockedCompareExchange(reinterpret_cast(i), - new_value, old_value); - } - // Pointer variants. - template - static T* AcquireLoadPtr(T* volatile* ptr) { - return *ptr; - } - template - static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { - return static_cast(::InterlockedCompareExchangePointer( - reinterpret_cast(ptr), new_value, old_value)); - } -#else - static int Increment(volatile int* i) { return __sync_add_and_fetch(i, 1); } - static int Decrement(volatile int* i) { return __sync_sub_and_fetch(i, 1); } - static int AcquireLoad(volatile const int* i) { - return __atomic_load_n(i, __ATOMIC_ACQUIRE); - } - static void ReleaseStore(volatile int* i, int value) { - __atomic_store_n(i, value, __ATOMIC_RELEASE); - } - static int CompareAndSwap(volatile int* i, int old_value, int new_value) { - return __sync_val_compare_and_swap(i, old_value, new_value); - } - // Pointer variants. - template - static T* AcquireLoadPtr(T* volatile* ptr) { - return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); - } - template - static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) { - return __sync_val_compare_and_swap(ptr, old_value, new_value); - } -#endif -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_ATOMICOPS_H_ diff --git a/third_party/libwebrtc/include/base/fixed_size_function.h b/third_party/libwebrtc/include/base/fixed_size_function.h deleted file mode 100644 index 1070b45232..0000000000 --- a/third_party/libwebrtc/include/base/fixed_size_function.h +++ /dev/null @@ -1,296 +0,0 @@ -// -// Copyright (c) 2014-2016 Pavel Medvedev. All rights reserved. -// -// Distributed under the MIT software license, see the accompanying -// file LICENSE - -#ifndef FIXED_SIZE_FUNCTION_HPP_INCLUDED -#define FIXED_SIZE_FUNCTION_HPP_INCLUDED - -#include -#include -#include -#include - -enum class construct_type { - none, - copy, - move, - copy_and_move, -}; - -namespace details { - -// V-table implementation -template -struct fixed_function_vtable_base { - Ret (*call)(void*, Args&&...) = nullptr; - void (*destroy)(void*) = nullptr; -}; - -template -struct fixed_function_vtable; - -template -struct fixed_function_vtable - : fixed_function_vtable_base {}; - -template -struct fixed_function_vtable - : fixed_function_vtable_base { - void (*copy)(const void*, void*) = nullptr; -}; - -template -struct fixed_function_vtable - : fixed_function_vtable_base { - void (*move)(void*, void*) = nullptr; -}; - -template -struct fixed_function_vtable - : fixed_function_vtable_base { - void (*copy)(const void*, void*) = nullptr; - void (*move)(void*, void*) = nullptr; -}; - -} // namespace details - -template -class fixed_size_function; - -template -class fixed_size_function { - public: - // Compile-time information - - using is_copyable = - std::integral_constant; - using is_movable = - std::integral_constant; - - using result_type = Ret; - - static const std::size_t arity = sizeof...(Args); - - template - struct argument { - static_assert(N < arity, "invalid argument index"); - using type = typename std::tuple_element>::type; - }; - - public: - template - fixed_size_function(fixed_size_function const&) = delete; - template - fixed_size_function(fixed_size_function&) = delete; - template - fixed_size_function(fixed_size_function&&) = delete; - template - fixed_size_function& operator=(fixed_size_function const&) = delete; - template - fixed_size_function& operator=(fixed_size_function&) = delete; - template - fixed_size_function& operator=(fixed_size_function&&) = delete; - template - void assign(fixed_size_function const&) = delete; - template - void assign(fixed_size_function&) = delete; - template - void assign(fixed_size_function&&) = delete; - - fixed_size_function() {} - - ~fixed_size_function() { reset(); } - - fixed_size_function(std::nullptr_t) {} - - fixed_size_function& operator=(std::nullptr_t) { - reset(); - return *this; - } - - fixed_size_function(fixed_size_function const& src) { copy(src); } - - fixed_size_function& operator=(fixed_size_function const& src) { - assign(src); - return *this; - } - - fixed_size_function(fixed_size_function& src) { copy(src); } - - fixed_size_function& operator=(fixed_size_function& src) { - assign(src); - return *this; - } - - fixed_size_function(fixed_size_function&& src) { - move(std::move(src), is_movable()); - } - - fixed_size_function& operator=(fixed_size_function&& src) { - assign(std::move(src)); - return *this; - } - - template - fixed_size_function(Functor&& f) { - create(std::forward(f)); - } - - template - fixed_size_function& operator=(Functor&& f) { - assign(std::forward(f)); - return *this; - } - - void assign(fixed_size_function const& src) { - reset(); - copy(src); - } - - void assign(fixed_size_function& src) { - reset(); - copy(src); - } - - void assign(fixed_size_function&& src) { - reset(); - move(std::move(src), is_movable()); - } - - template - void assign(Functor&& f) { - reset(); - create(std::forward(f)); - } - - void reset() { - auto destroy = vtable_.destroy; - if (destroy) { - vtable_ = vtable(); - destroy(&storage_); - } - } - - explicit operator bool() const { return vtable_.call != nullptr; } - - Ret operator()(Args... args) { - return vtable_.call ? vtable_.call(&storage_, std::forward(args)...) - : (Ret) nullptr; - } - - void swap(fixed_size_function& other) { - fixed_size_function tmp = std::move(other); - other = std::move(*this); - *this = std::move(tmp); - } - - friend void swap(fixed_size_function& lhs, fixed_size_function& rhs) { - lhs.swap(rhs); - } - - friend bool operator==(std::nullptr_t, fixed_size_function const& f) { - return !f; - } - - friend bool operator==(fixed_size_function const& f, std::nullptr_t) { - return !f; - } - - friend bool operator!=(std::nullptr_t, fixed_size_function const& f) { - return f; - } - - friend bool operator!=(fixed_size_function const& f, std::nullptr_t) { - return f; - } - - private: - template - void create(Functor&& f) { - using functor_type = typename std::decay::type; - static_assert(sizeof(functor_type) <= StorageSize, - "Functor must be smaller than storage buffer"); - - new (&storage_) functor_type(std::forward(f)); - - vtable_.call = &call_impl; - vtable_.destroy = &destroy_impl; - init_copy(is_copyable()); - init_move(is_movable()); - } - - void copy(fixed_size_function const& src) { - if (src.vtable_.copy) { - src.vtable_.copy(&src.storage_, &storage_); - vtable_ = src.vtable_; - } - } - - void move(fixed_size_function&& src, std::true_type movable) { - if (src.vtable_.move) { - src.vtable_.move(&src.storage_, &storage_); - vtable_ = src.vtable_; - src.reset(); - } - } - - void move(fixed_size_function const& src, std::false_type movable) { - copy(src); - } - - private: - template - static Ret call_impl(void* functor, Args&&... args) { - return (*static_cast(functor))(std::forward(args)...); - } - - template - static void destroy_impl(void* functor) { - static_cast(functor)->~Functor(); - } - - template - static void copy_impl(void const* functor, void* dest) { - new (dest) Functor(*static_cast(functor)); - } - - template - static void move_impl(void* functor, void* dest) { - new (dest) Functor(std::move(*static_cast(functor))); - } - - template - void init_copy(std::true_type /*copyable*/) { - vtable_.copy = ©_impl; - } - - template - void init_copy(std::false_type /*copyable*/) {} - - template - void init_move(std::true_type /*movable*/) { - vtable_.move = &move_impl; - } - - template - void init_move(std::false_type /*movable*/) {} - - private: - using vtable = - details::fixed_function_vtable; - static const size_t StorageSize = MaxSize - sizeof(vtable); - using storage = typename std::aligned_storage::type; - - vtable vtable_; - storage storage_; -}; - -#endif // FIXED_SIZE_FUNCTION_HPP_INCLUDED \ No newline at end of file diff --git a/third_party/libwebrtc/include/base/portable.h b/third_party/libwebrtc/include/base/portable.h deleted file mode 100644 index b403af9cd3..0000000000 --- a/third_party/libwebrtc/include/base/portable.h +++ /dev/null @@ -1,439 +0,0 @@ -#ifndef INFINISPAN_HOTROD_PORTABLE_H -#define INFINISPAN_HOTROD_PORTABLE_H - -#ifdef LIB_WEBRTC_API_EXPORTS -#define LIB_PORTABLE_API __declspec(dllexport) -#elif defined(LIB_WEBRTC_API_DLL) -#define LIB_PORTABLE_API __declspec(dllimport) -#elif !defined(WIN32) -#define LIB_PORTABLE_API __attribute__((visibility("default"))) -#else -#define LIB_PORTABLE_API -#endif - -#include -#include -#include -#include -#include - -/** - * This file defines structures that can be passed across shared library/DLL - * boundary. - * - * Besides memory layout, the class must be destroyed in the same library as - * created. None of these classes is thread-safe. The classes are not optimized - * for performance. - */ - -namespace portable { - -#ifdef _MSC_VER -#define strncpy_safe strncpy_s -#else -#ifndef _TRUNCATE -#define _TRUNCATE ((size_t)-1) -#endif // _TRUNCATE -#endif - -#define PORTABLE_STRING_BUF_SIZE 48 - -class string { - private: - char m_buf[PORTABLE_STRING_BUF_SIZE]; - char* m_dynamic; - size_t m_length; - - public: - LIB_PORTABLE_API string(); - LIB_PORTABLE_API void init(const char* str, size_t len); - LIB_PORTABLE_API void destroy(); - - inline string(const char* str) { init(str, strlen(str)); } - - inline string(const std::string& str) { init(str.c_str(), str.length()); } - - inline string(const string& o) { - init(o.m_dynamic == 0 ? o.m_buf : o.m_dynamic, o.m_length); - } - - inline string& operator=(const string& o) { - destroy(); - init(o.m_dynamic == 0 ? o.m_buf : o.m_dynamic, o.m_length); - return *this; - } - - LIB_PORTABLE_API ~string(); - - inline string& operator=(const std::string& str) { - destroy(); - init(str.c_str(), str.length()); - return *this; - } - - inline size_t size() { return m_length; } - - inline const char* c_string() const { - return m_dynamic == 0 ? m_buf : m_dynamic; - } - - inline std::string std_string() const { - return std::string(m_dynamic == 0 ? m_buf : m_dynamic, m_length); - } -}; - -inline std::string to_std_string(const string& str) { return str.std_string(); } - -template -class identity { - T operator()(const T& x) { return x; } -}; - -template -class vector { - protected: - using raw_type = typename std::aligned_storage::type; - - private: - T* m_array; - size_t m_size; - - public: - class move_ref { - friend class vector; - - private: - vector& m_ref; - move_ref(vector& ref) : m_ref(ref) {} - }; - - vector() : m_array(0), m_size(0) {} - vector(T* array, size_t s) : m_array(array), m_size(s) {} - - template - vector(const Iterable& v) { - m_size = v.size(); - if (v.size() == 0) { - m_array = 0; - } else { - m_array = new T[v.size()]; - size_t i = 0; - for (typename Iterable::const_iterator it = v.begin(); it != v.end(); - ++it) { - m_array[i++] = *it; - } - } - } - - template - vector(const Iterable& v, Converter convert) { - m_size = v.size(); - if (v.size() == 0) { - m_array = 0; - } else { - m_array = new T[v.size()]; - size_t i = 0; - for (typename Iterable::const_iterator it = v.begin(); it != v.end(); - ++it) { - m_array[i++] = convert(*it); - } - } - } - - vector(const vector& o) { - m_size = o.m_size; - if (m_size != 0) { - m_array = new T[o.m_size]; - for (size_t i = 0; i < o.m_size; ++i) { - m_array[i] = o.m_array[i]; - } - } - } - - ~vector() { destroy_all(); } - - vector& operator=(const vector& o) { - if (m_size < o.m_size) { - destroy_all(); - m_array = new T[o.m_size]; - } else if (o.m_size == 0 && m_size != 0) { - destroy_all(); - } - m_size = o.m_size; - for (size_t i = 0; i < o.m_size; ++i) { - m_array[i] = o.m_array[i]; - } - return *this; - } - - vector(move_ref mr) : m_array(mr.m_ref.m_array), m_size(mr.m_ref.m_size) {} - vector& operator=(move_ref mr) { - if (m_size != 0) { - destroy_all(); - } - m_size = mr.m_ref.m_size; - m_array = mr.m_ref.m_array; - mr.m_ref.m_size = 0; - mr.m_ref.m_array = 0; - return *this; - } - /** - * Not really safe - can't be used as vector(something).move(), - * but vector tmp(something); other = tmp.move(); - */ - move_ref move() { return move_ref(*this); } - - std::vector std_vector() const { - std::vector v; - v.reserve(m_size); - for (size_t i = 0; i < m_size; ++i) { - v.push_back(m_array[i]); - } - return v; - } - - const T* data() const { return m_array; } - - size_t size() const { return m_size; } - - T& operator[](size_t i) { return m_array[i]; } - - const T& operator[](size_t i) const { return m_array[i]; } - - void clear() { destroy_all(); } - - protected: - void destroy(T* rt) { reinterpret_cast(rt)->~T(); } - - void destroy_all() { - for (size_t i = 0; i < m_size; ++i) { - destroy(&m_array[i]); - } - m_size = 0; - } -}; - -template -class pair { - public: - K key; - V value; -}; - -template -class map { - private: - typedef pair my_pair; - - vector m_vec; - - /*template - static pair *to_array(const std::map &m, - K (*convertKey)(const K2 &), - V (*convertValue)(const V2 &)) - { - my_pair *data = new my_pair[m.size()]; - my_pair *dp = data; - for (std::map::const_iterator it = m.begin(); it != m.end(); ++it) - { dp->key = convertKey(it->first); dp->value = convertValue(it->second); - ++dp; - } - return data; - }*/ - - template - static my_pair* to_array(const std::map& m, KC convertKey, - VC convertValue) { - my_pair* data = new my_pair[m.size()]; - my_pair* dp = data; - for (typename std::map::const_iterator it = m.begin(); - it != m.end(); ++it) { - dp->key = convertKey(it->first); - dp->value = convertValue(it->second); - ++dp; - } - return data; - } - - public: - class move_ref { - friend class map; - - private: - map& m_ref; - move_ref(map& ref) : m_ref(ref) {} - }; - - map() {} - - /* template map(const std::map &m, - K (*convertKey)(const K2 &) = identity, - V (*convertValue)(const V2 &) = identity): - m_vec(to_array(m, convertKey, convertValue), m.size()) {}*/ - - map(const std::map& m) - : m_vec(to_array(m, identity(), identity()), m.size()) {} - - template - map(const std::map& m, KC convertKey = identity(), - VC convertValue = identity()) - : m_vec(to_array(m, convertKey, convertValue), m.size()) {} - - map(const map& o) { m_vec = o.m_vec; } - - map& operator=(const map& o) { - m_vec = o.m_vec; - return *this; - } - - map(move_ref mr) : m_vec(mr.m_ref.m_vec.move()) {} - map& operator=(move_ref mr) { - m_vec = mr.m_ref.m_vec.move(); - return *this; - } - move_ref move() { return move_ref(*this); } - - std::map std_map() const { - std::map m; - for (size_t i = 0; i < m_vec.size(); ++i) { - const my_pair* dp = m_vec.data() + i; - m[dp->key] = dp->value; - } - return m; - } - - template - std::map std_map(KC convertKey, VC convertValue) const { - std::map m; - for (size_t i = 0; i < m_vec.size(); ++i) { - const my_pair* dp = m_vec.data() + i; - m[convertKey(dp->key)] = convertValue(dp->value); - } - return m; - } - - template - const my_pair* get(K2 key, int (*cmp)(K2, const K&)) const { - for (size_t i = 0; i < m_vec.size(); ++i) { - const my_pair* dp = m_vec.data() + i; - if (!cmp(key, dp->key)) return dp; - } - return 0; - } - - const my_pair* data() const { return m_vec.data(); } - - size_t size() const { return m_vec.size(); } -}; - -/* Invasive reference counting */ -template -class counting_ptr; - -class counted_object { - template - friend class counting_ptr; - - private: - int m_counter; - - public: - counted_object() : m_counter(0) {} - virtual ~counted_object() {} -}; - -template -class counted_wrapper : public counted_object { - private: - T m_object; - - public: - counted_wrapper(const T& o) : m_object(o) {} - T& operator()() { return m_object; } -}; - -template -class counting_ptr { - public: - typedef void (*destroy)(T*); - - private: - counted_object* m_ptr; - destroy m_destroy; - - inline void dec_and_destroy() { - if (m_ptr != 0 && --(m_ptr->m_counter) == 0) { - if (m_destroy == 0) { - delete m_ptr; - } else { - m_destroy((T*)m_ptr); - } - } - } - - public: - counting_ptr() : m_ptr(0), m_destroy(0) {} - counting_ptr(T* obj, destroy d = 0) : m_ptr(obj), m_destroy(d) { - counted_object* rc = obj; // no cast required - if (rc != 0) { - rc->m_counter++; - } - } - ~counting_ptr() { dec_and_destroy(); } - counting_ptr(const counting_ptr& o) : m_ptr(o.m_ptr), m_destroy(o.m_destroy) { - if (m_ptr != 0) { - m_ptr->m_counter++; - } - } - counting_ptr& operator=(const counting_ptr& o) { - dec_and_destroy(); - m_ptr = o.m_ptr; - m_destroy = o.m_destroy; - if (m_ptr != 0) { - m_ptr->m_counter++; - } - return *this; - } - counting_ptr& operator=(T* rc) { return reset(rc, 0); } - counting_ptr& reset(T* rc, destroy d) { - dec_and_destroy(); - m_ptr = rc; - m_destroy = d; - if (rc != 0) { - rc->m_counter++; - } - return *this; - } - T* get() { return (T*)m_ptr; } - const T* get() const { return (T*)m_ptr; } - T* operator->() { return (T*)m_ptr; } - const T* operator->() const { return (const T*)m_ptr; } -}; - -template -class local_ptr { - private: - typedef void (*destroy)(T*); - T* m_ptr; - destroy m_destroy; - - public: - local_ptr() : m_ptr(0), m_destroy(0) {} - local_ptr(const local_ptr&) - : m_ptr(0), m_destroy(0) {} // copying does not persist value - local_ptr& operator=(const local_ptr&) { return *this; } - ~local_ptr() { - if (m_ptr) m_destroy(m_ptr); - } - const T* get() const { return m_ptr; } - T* get() { return m_ptr; } - void set(T* ptr, void (*dtor)(T*)) { - if (m_ptr) m_destroy(m_ptr); - m_ptr = ptr; - m_destroy = dtor; - } -}; - -} // namespace portable - -#endif // INFINISPAN_HOTROD_PORTABLE_H \ No newline at end of file diff --git a/third_party/libwebrtc/include/base/refcount.h b/third_party/libwebrtc/include/base/refcount.h deleted file mode 100644 index 6e3360e87b..0000000000 --- a/third_party/libwebrtc/include/base/refcount.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef LIB_WEBRTC_REFCOUNT_H_ -#define LIB_WEBRTC_REFCOUNT_H_ - -#include "refcountedobject.h" - -namespace libwebrtc { - -// Reference count interface. -class RefCountInterface { - public: - virtual int AddRef() const = 0; - virtual int Release() const = 0; - - protected: - virtual ~RefCountInterface() {} -}; - -} // namespace libwebrtc - -#endif // WEBRTC_BASE_REFCOUNT_H_ diff --git a/third_party/libwebrtc/include/base/refcountedobject.h b/third_party/libwebrtc/include/base/refcountedobject.h deleted file mode 100644 index 9beea333f2..0000000000 --- a/third_party/libwebrtc/include/base/refcountedobject.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2016 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#ifndef LIB_WEBRTC_REFCOUNTEDOBJECT_H_ -#define LIB_WEBRTC_REFCOUNTEDOBJECT_H_ - -#include - -#include "atomicops.h" - -namespace libwebrtc { - -template -class RefCountedObject : public T { - public: - RefCountedObject() {} - - template - explicit RefCountedObject(P0&& p0) : T(std::forward(p0)) {} - - template - RefCountedObject(P0&& p0, P1&& p1, Args&&... args) - : T(std::forward(p0), std::forward(p1), - std::forward(args)...) {} - - virtual int AddRef() const { return AtomicOps::Increment(&ref_count_); } - - virtual int Release() const { - int count = AtomicOps::Decrement(&ref_count_); - if (!count) { - delete this; - } - return count; - } - - // Return whether the reference count is one. If the reference count is used - // in the conventional way, a reference count of 1 implies that the current - // thread owns the reference and no other thread shares it. This call - // performs the test for a reference count of one, and performs the memory - // barrier needed for the owning thread to act on the object, knowing that it - // has exclusive access to the object. - virtual bool HasOneRef() const { - return AtomicOps::AcquireLoad(&ref_count_) == 1; - } - - protected: - virtual ~RefCountedObject() {} - - mutable volatile int ref_count_ = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_REFCOUNTEDOBJECT_H_ diff --git a/third_party/libwebrtc/include/base/scoped_ref_ptr.h b/third_party/libwebrtc/include/base/scoped_ref_ptr.h deleted file mode 100644 index 9f00839cbe..0000000000 --- a/third_party/libwebrtc/include/base/scoped_ref_ptr.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2011 The WebRTC Project Authors. All rights reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -// Originally these classes are from Chromium. -// http://src.chromium.org/viewvc/chrome/trunk/src/base/memory/ref_counted.h?view=markup - -// -// A smart pointer class for reference counted objects. Use this class instead -// of calling AddRef and Release manually on a reference counted object to -// avoid common memory leaks caused by forgetting to Release an object -// reference. Sample usage: -// -// class MyFoo : public RefCounted { -// ... -// }; -// -// void some_function() { -// scoped_refptr foo = new MyFoo(); -// foo->Method(param); -// // |foo| is released when this function returns -// } -// -// void some_other_function() { -// scoped_refptr foo = new MyFoo(); -// ... -// foo = NULL; // explicitly releases |foo| -// ... -// if (foo) -// foo->Method(param); -// } -// -// The above examples show how scoped_refptr acts like a pointer to T. -// Given two scoped_refptr classes, it is also possible to exchange -// references between the two objects, like so: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b.swap(a); -// // now, |b| references the MyFoo object, and |a| references NULL. -// } -// -// To make both |a| and |b| in the above example reference the same MyFoo -// object, simply use the assignment operator: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b = a; -// // now, |a| and |b| each own a reference to the same MyFoo object. -// } -// - -#ifndef LIB_WEBRTC_SCOPED_REF_PTR_H_ -#define LIB_WEBRTC_SCOPED_REF_PTR_H_ - -#include - -namespace libwebrtc { - -template -class scoped_refptr { - public: - scoped_refptr() : ptr_(NULL) {} - - scoped_refptr(T* p) : ptr_(p) { - if (ptr_) ptr_->AddRef(); - } - - scoped_refptr(const scoped_refptr& r) : ptr_(r.ptr_) { - if (ptr_) ptr_->AddRef(); - } - - template - scoped_refptr(const scoped_refptr& r) : ptr_(r.get()) { - if (ptr_) ptr_->AddRef(); - } - - // Move constructors. - scoped_refptr(scoped_refptr&& r) : ptr_(r.release()) {} - - template - scoped_refptr(scoped_refptr&& r) : ptr_(r.release()) {} - - ~scoped_refptr() { - if (ptr_) ptr_->Release(); - } - - T* get() const { return ptr_; } - operator T*() const { return ptr_; } - T* operator->() const { return ptr_; } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - T* release() { - T* retVal = ptr_; - ptr_ = NULL; - return retVal; - } - - scoped_refptr& operator=(T* p) { - // AddRef first so that self assignment should work - if (p) p->AddRef(); - if (ptr_) ptr_->Release(); - ptr_ = p; - return *this; - } - - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.ptr_; - } - - template - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.get(); - } - - scoped_refptr& operator=(scoped_refptr&& r) { - scoped_refptr(std::move(r)).swap(*this); - return *this; - } - - template - scoped_refptr& operator=(scoped_refptr&& r) { - scoped_refptr(std::move(r)).swap(*this); - return *this; - } - - void swap(T** pp) { - T* p = ptr_; - ptr_ = *pp; - *pp = p; - } - - void swap(scoped_refptr& r) { swap(&r.ptr_); } - - protected: - T* ptr_; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_SCOPED_REF_PTR_H_ diff --git a/third_party/libwebrtc/include/helper.h b/third_party/libwebrtc/include/helper.h deleted file mode 100644 index aa467afa91..0000000000 --- a/third_party/libwebrtc/include/helper.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef HELPER_HXX -#define HELPER_HXX - -#include "rtc_types.h" - -namespace libwebrtc { -/** - * @brief A helper class with static methods for generating random UUIDs. - * - */ -class Helper { - public: - /** - * @brief Generates a random UUID string. - * - * @return The generated UUID string. - */ - LIB_WEBRTC_API static string CreateRandomUuid(); -}; -} // namespace libwebrtc - -#endif // HELPER_HXX diff --git a/third_party/libwebrtc/include/libwebrtc.h b/third_party/libwebrtc/include/libwebrtc.h deleted file mode 100644 index f17af394c0..0000000000 --- a/third_party/libwebrtc/include/libwebrtc.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef LIB_WEBRTC_HXX -#define LIB_WEBRTC_HXX - -#include "rtc_peerconnection_factory.h" -#include "rtc_types.h" - -namespace libwebrtc { - -/** - * @class LibWebRTC - * @brief Provides static methods for initializing, creating and terminating - * the WebRTC PeerConnectionFactory and threads. - * - * This class provides static methods for initializing, creating and terminating - * the WebRTC PeerConnectionFactory and threads. These methods are thread-safe - * and can be called from any thread. This class is not meant to be - * instantiated. - * - */ -class LibWebRTC { - public: - /** - * @brief Initializes the WebRTC PeerConnectionFactory and threads. - * - * Initializes the WebRTC PeerConnectionFactory and threads. This method is - * thread-safe and can be called from any thread. It initializes SSL and - * creates three threads: worker_thread, signaling_thread and network_thread. - * - * @return true if initialization is successful, false otherwise. - */ - LIB_WEBRTC_API static bool Initialize(); - - /** - * @brief Creates a new WebRTC PeerConnectionFactory. - * - * Creates a new WebRTC PeerConnectionFactory. This method is thread-safe and - * can be called from any thread. It creates a new instance of the - * RTCPeerConnectionFactoryImpl class and initializes it. - * - * @return A scoped_refptr object that points to the newly created - * RTCPeerConnectionFactory. - */ - LIB_WEBRTC_API static scoped_refptr - CreateRTCPeerConnectionFactory(); - - /** - * @brief Terminates the WebRTC PeerConnectionFactory and threads. - * - * Terminates the WebRTC PeerConnectionFactory and threads. This method is - * thread-safe and can be called from any thread. It cleans up SSL and stops - * and destroys the three threads: worker_thread, signaling_thread and - * network_thread. - * - */ - LIB_WEBRTC_API static void Terminate(); -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_HXX diff --git a/third_party/libwebrtc/include/rtc_audio_device.h b/third_party/libwebrtc/include/rtc_audio_device.h deleted file mode 100644 index cff7b4a6ac..0000000000 --- a/third_party/libwebrtc/include/rtc_audio_device.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_AUDIO_DEVICE_HXX -#define LIB_WEBRTC_RTC_AUDIO_DEVICE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -/** - * The RTCAudioDevice class is an abstract class used for managing the audio - * devices used by WebRTC. It provides methods for device enumeration and - * selection. - */ -class RTCAudioDevice : public RefCountInterface { - public: - typedef fixed_size_function OnDeviceChangeCallback; - - public: - static const int kAdmMaxDeviceNameSize = 128; - static const int kAdmMaxFileNameSize = 512; - static const int kAdmMaxGuidSize = 128; - - public: - /** - * Returns the number of playout devices available. - * - * @return int16_t - The number of playout devices available. - */ - virtual int16_t PlayoutDevices() = 0; - - /** - * Returns the number of recording devices available. - * - * @return int16_t - The number of recording devices available. - */ - virtual int16_t RecordingDevices() = 0; - - /** - * Retrieves the name and GUID of the specified playout device. - * - * @param index - The index of the device. - * @param name - The device name. - * @param guid - The device GUID. - * @return int32_t - 0 if successful, otherwise an error code. - */ - virtual int32_t PlayoutDeviceName(uint16_t index, - char name[kAdmMaxDeviceNameSize], - char guid[kAdmMaxGuidSize]) = 0; - - /** - * Retrieves the name and GUID of the specified recording device. - * - * @param index - The index of the device. - * @param name - The device name. - * @param guid - The device GUID. - * @return int32_t - 0 if successful, otherwise an error code. - */ - virtual int32_t RecordingDeviceName(uint16_t index, - char name[kAdmMaxDeviceNameSize], - char guid[kAdmMaxGuidSize]) = 0; - - /** - * Sets the playout device to use. - * - * @param index - The index of the device. - * @return int32_t - 0 if successful, otherwise an error code. - */ - virtual int32_t SetPlayoutDevice(uint16_t index) = 0; - - /** - * Sets the recording device to use. - * - * @param index - The index of the device. - * @return int32_t - 0 if successful, otherwise an error code. - */ - virtual int32_t SetRecordingDevice(uint16_t index) = 0; - - /** - * Registers a listener to be called when audio devices are added or removed. - * - * @param listener - The callback function to register. - * @return int32_t - 0 if successful, otherwise an error code. - */ - virtual int32_t OnDeviceChange(OnDeviceChangeCallback listener) = 0; - - virtual int32_t SetMicrophoneVolume(uint32_t volume) = 0; - - virtual int32_t MicrophoneVolume(uint32_t& volume) = 0; - - virtual int32_t SetSpeakerVolume(uint32_t volume) = 0; - - virtual int32_t SpeakerVolume(uint32_t& volume) = 0; - - protected: - virtual ~RTCAudioDevice() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_AUDIO_DEVICE_HXX diff --git a/third_party/libwebrtc/include/rtc_audio_frame.h b/third_party/libwebrtc/include/rtc_audio_frame.h deleted file mode 100644 index 7774f0c787..0000000000 --- a/third_party/libwebrtc/include/rtc_audio_frame.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_AUDIO_FRAME_HXX -#define LIB_WEBRTC_RTC_AUDIO_FRAME_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class AudioFrame : public RefCountInterface { - public: - /** - * @brief Creates a new instance of AudioFrame. - * @return AudioFrame*: a pointer to the newly created AudioFrame. - */ - LIB_WEBRTC_API static AudioFrame* Create(); - - /** - * @brief Creates a new instance of AudioFrame with specified parameters. - * @param id: the unique identifier of the frame. - * @param timestamp: the timestamp of the frame. - * @param data: a pointer to the audio data buffer. - * @param samples_per_channel: the number of samples per channel. - * @param sample_rate_hz: the sample rate in Hz. - * @param num_channels: the number of audio channels. - * @return AudioFrame*: a pointer to the newly created AudioFrame. - */ - LIB_WEBRTC_API static AudioFrame* Create(int id, uint32_t timestamp, - const int16_t* data, - size_t samples_per_channel, - int sample_rate_hz, - size_t num_channels = 1); - - public: - /** - * @brief Updates the audio frame with specified parameters. - * @param id: the unique identifier of the frame. - * @param timestamp: the timestamp of the frame. - * @param data: a pointer to the audio data buffer. - * @param samples_per_channel: the number of samples per channel. - * @param sample_rate_hz: the sample rate in Hz. - * @param num_channels: the number of audio channels. - */ - virtual void UpdateFrame(int id, uint32_t timestamp, const int16_t* data, - size_t samples_per_channel, int sample_rate_hz, - size_t num_channels = 1) = 0; - - /** - * @brief Copies the contents of another AudioFrame. - * @param src: the source AudioFrame to copy from. - */ - virtual void CopyFrom(const AudioFrame& src) = 0; - - /** - * @brief Adds another AudioFrame to this one. - * @param frame_to_add: the AudioFrame to add. - */ - virtual void Add(const AudioFrame& frame_to_add) = 0; - - /** - * @brief Mutes the audio data in this AudioFrame. - */ - virtual void Mute() = 0; - - /** - * @brief Returns a pointer to the audio data buffer. - * @return const int16_t*: a pointer to the audio data buffer. - */ - virtual const int16_t* data() = 0; - - /** - * @brief Returns the number of samples per channel. - * @return size_t: the number of samples per channel. - */ - virtual size_t samples_per_channel() = 0; - - /** - * @brief Returns the sample rate in Hz. - * @return int: the sample rate in Hz. - */ - virtual int sample_rate_hz() = 0; - - /** - * @brief Returns the number of audio channels. - * @return size_t: the number of audio channels. - */ - virtual size_t num_channels() = 0; - - /** - * @brief Returns the timestamp of the AudioFrame. - * @return uint32_t: the timestamp of the AudioFrame. - */ - virtual uint32_t timestamp() = 0; - - /** - * @brief Returns the unique identifier of the AudioFrame. - * @return int: the unique identifier of the AudioFrame. - */ - - virtual int id() = 0; -}; - -}; // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_AUDIO_FRAME_HXX diff --git a/third_party/libwebrtc/include/rtc_audio_processing.h b/third_party/libwebrtc/include/rtc_audio_processing.h deleted file mode 100644 index 908a16a380..0000000000 --- a/third_party/libwebrtc/include/rtc_audio_processing.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_AUDIO_PROCESSING_HXX -#define LIB_WEBRTC_RTC_AUDIO_PROCESSING_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCAudioProcessing : public RefCountInterface { - public: - class CustomProcessing { - public: - virtual void Initialize(int sample_rate_hz, int num_channels) = 0; - - virtual void Process(int num_bands, int num_frames, int buffer_size, - float* buffer) = 0; - - virtual void Reset(int new_rate) = 0; - - virtual void Release() = 0; - - protected: - virtual ~CustomProcessing() {} - }; - - public: - virtual void SetCapturePostProcessing( - CustomProcessing* capture_post_processing) = 0; - - virtual void SetRenderPreProcessing( - CustomProcessing* render_pre_processing) = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_AUDIO_PROCESSING_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_audio_source.h b/third_party/libwebrtc/include/rtc_audio_source.h deleted file mode 100644 index e2f98fca0f..0000000000 --- a/third_party/libwebrtc/include/rtc_audio_source.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_AUDIO_SOURCE_HXX -#define LIB_WEBRTC_RTC_AUDIO_SOURCE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -/** - * The RTCAudioSource class is a base class for audio sources in WebRTC. - * Audio sources represent the source of audio data in WebRTC, such as a - * microphone or a file. This class provides a base interface for audio - * sources to implement, allowing them to be used with WebRTC's audio - * processing and transmission mechanisms. - */ -class RTCAudioSource : public RefCountInterface { - public: - enum SourceType { kMicrophone, kCustom }; - - public: - virtual void CaptureFrame(const void* audio_data, int bits_per_sample, - int sample_rate, size_t number_of_channels, - size_t number_of_frames) = 0; - - virtual SourceType GetSourceType() const = 0; - - protected: - /** - * The destructor for the RTCAudioSource class. - */ - virtual ~RTCAudioSource() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_AUDIO_TRACK_HXX diff --git a/third_party/libwebrtc/include/rtc_audio_track.h b/third_party/libwebrtc/include/rtc_audio_track.h deleted file mode 100644 index 82459005d1..0000000000 --- a/third_party/libwebrtc/include/rtc_audio_track.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_AUDIO_TRACK_HXX -#define LIB_WEBRTC_RTC_AUDIO_TRACK_HXX - -#include "rtc_media_track.h" -#include "rtc_types.h" - -namespace libwebrtc { - -/** - * The RTCAudioTrack class represents an audio track in WebRTC. - * Audio tracks are used to transmit audio data over a WebRTC peer connection. - * This class is a subclass of the RTCMediaTrack class, which provides a base - * interface for all media tracks in WebRTC. - */ -class RTCAudioTrack : public RTCMediaTrack { - public: - // volume in [0-10] - virtual void SetVolume(double volume) = 0; - - virtual void AddSink(AudioTrackSink* sink) = 0; - - virtual void RemoveSink(AudioTrackSink* sink) = 0; - - protected: - /** - * The destructor for the RTCAudioTrack class. - */ - virtual ~RTCAudioTrack() {} -}; -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_AUDIO_TRACK_HXX diff --git a/third_party/libwebrtc/include/rtc_data_channel.h b/third_party/libwebrtc/include/rtc_data_channel.h deleted file mode 100644 index e1351959f2..0000000000 --- a/third_party/libwebrtc/include/rtc_data_channel.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_DATA_CHANNEL_HXX -#define LIB_WEBRTC_RTC_DATA_CHANNEL_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -/** - * The RTCDataChannelState enum represents the possible states of a WebRTC data - * channel. Data channels are used to transmit non-audio/video data over a - * WebRTC peer connection. The possible states are: connecting, open, closing, - * and closed. - */ -enum RTCDataChannelState { - RTCDataChannelConnecting, - RTCDataChannelOpen, - RTCDataChannelClosing, - RTCDataChannelClosed, -}; - -/** - * The RTCDataChannelInit struct represents the configuration options for a - * WebRTC data channel. These options include whether the channel is ordered and - * reliable, the maximum retransmit time and number of retransmits, the protocol - * to use (sctp or quic), whether the channel is negotiated, and the channel ID. - */ -struct RTCDataChannelInit { - bool ordered = true; - bool reliable = true; - int maxRetransmitTime = -1; - int maxRetransmits = -1; - string protocol = {"sctp"}; // sctp | quic - bool negotiated = false; - int id = 0; -}; - -/** - * The RTCDataChannelObserver class is an interface for receiving events related - * to a WebRTC data channel. These events include changes in the channel's state - * and incoming messages. - */ -class RTCDataChannelObserver { - public: - /** - * Called when the state of the data channel changes. - * The new state is passed as a parameter. - */ - virtual void OnStateChange(RTCDataChannelState state) = 0; - - /** - * Called when a message is received on the data channel. - * The message buffer, its length, and a boolean indicating whether the - * message is binary are passed as parameters. - */ - virtual void OnMessage(const char* buffer, int length, bool binary) = 0; - - protected: - /** - * The destructor for the RTCDataChannelObserver class. - */ - virtual ~RTCDataChannelObserver() = default; -}; - -/** - * The RTCDataChannel class represents a data channel in WebRTC. - * Data channels are used to transmit non-audio/video data over a WebRTC peer - * connection. This class provides a base interface for data channels to - * implement, allowing them to be used with WebRTC's data channel mechanisms. - */ -class RTCDataChannel : public RefCountInterface { - public: - /** - * Sends data over the data channel. - * The data buffer, its size, and a boolean indicating whether the data is - * binary are passed as parameters. - */ - virtual void Send(const uint8_t* data, uint32_t size, - bool binary = false) = 0; - - /** - * Closes the data channel. - */ - virtual void Close() = 0; - - /** - * Registers an observer for events related to the data channel. - * The observer object is passed as a parameter. - */ - virtual void RegisterObserver(RTCDataChannelObserver* observer) = 0; - - /** - * Unregisters the current observer for the data channel. - */ - virtual void UnregisterObserver() = 0; - - /** - * Returns the label of the data channel. - */ - virtual const string label() const = 0; - - /** - * Returns the ID of the data channel. - */ - virtual int id() const = 0; - - /** - * Returns the amount of data buffered in the data channel. - * - * @return uint64_t - */ - virtual uint64_t buffered_amount() const = 0; - - /** - * Returns the state of the data channel. - */ - virtual RTCDataChannelState state() = 0; - - protected: - virtual ~RTCDataChannel() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_DATA_CHANNEL_HXX diff --git a/third_party/libwebrtc/include/rtc_desktop_capturer.h b/third_party/libwebrtc/include/rtc_desktop_capturer.h deleted file mode 100644 index 9d2e955ab3..0000000000 --- a/third_party/libwebrtc/include/rtc_desktop_capturer.h +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @file rtc_desktop_capturer.h - * This header file defines the interface for capturing desktop media. - */ - -#ifndef LIB_WEBRTC_RTC_DESKTOP_CAPTURER_HXX -#define LIB_WEBRTC_RTC_DESKTOP_CAPTURER_HXX - -#include "rtc_desktop_media_list.h" -#include "rtc_types.h" -#include "rtc_video_device.h" - -namespace libwebrtc { - -class DesktopCapturerObserver; - -/** - * @brief The interface for capturing desktop media. - * - * This interface defines methods for registering and deregistering observer - * for desktop capture events, starting and stopping desktop capture, and - * retrieving the current capture state and media source. - */ -class RTCDesktopCapturer : public RefCountInterface { - public: - /** - * @brief Enumeration for the possible states of desktop capture. - */ - enum CaptureState { CS_RUNNING, CS_STOPPED, CS_FAILED }; - - public: - /** - * @brief Registers the given observer for desktop capture events. - * - * @param observer Pointer to the observer to be registered. - */ - virtual void RegisterDesktopCapturerObserver( - DesktopCapturerObserver* observer) = 0; - - /** - * @brief Deregisters the currently registered desktop capture observer. - */ - virtual void DeRegisterDesktopCapturerObserver() = 0; - - /** - * @brief Starts desktop capture with the given frame rate. - * - * @param fps The desired frame rate. - * - * @return The current capture state after attempting to start capture. - */ - virtual CaptureState Start(uint32_t fps) = 0; - - /** - * @brief Starts desktop capture with the given frame rate and capture - * dimensions. - * - * @param fps The desired frame rate. - * @param x The left-most pixel coordinate of the capture region. - * @param y The top-most pixel coordinate of the capture region. - * @param w The width of the capture region. - * @param h The height of the capture region. - * - * @return The current capture state after attempting to start capture. - */ - virtual CaptureState Start(uint32_t fps, uint32_t x, uint32_t y, uint32_t w, - uint32_t h) = 0; - - /** - * @brief Stops desktop capture. - */ - virtual void Stop() = 0; - - /** - * @brief Checks if desktop capture is currently running. - * - * @return True if capture is running, false otherwise. - */ - virtual bool IsRunning() = 0; - - /** - * @brief Retrieves the media source for the current desktop capture. - * - * @return A scoped_refptr representing the current capture - * media source. - */ - virtual scoped_refptr source() = 0; - - /** - * @brief Destroys the RTCDesktopCapturer object. - */ - virtual ~RTCDesktopCapturer() {} -}; - -/** - * @brief Observer interface for desktop capturer events. - * - * This class defines the interface for an observer of the DesktopCapturer - * class, allowing clients to be notified of events such as when capturing - * begins or ends, and when an error occurs. - */ -class DesktopCapturerObserver { - public: - /** - * @brief Called when desktop capture starts. - * - * @param capturer A reference to the capturer that started capturing. - */ - virtual void OnStart(scoped_refptr capturer) = 0; - - /** - * @brief Called when desktop capture is paused. - * - * @param capturer A reference to the capturer that paused capturing. - */ - virtual void OnPaused(scoped_refptr capturer) = 0; - - /** - * @brief Called when desktop capture stops. - * - * @param capturer A reference to the capturer that stopped capturing. - */ - virtual void OnStop(scoped_refptr capturer) = 0; - - /** - * @brief Called when an error occurs during desktop capture. - * - * @param capturer A reference to the capturer that encountered an error. - */ - virtual void OnError(scoped_refptr capturer) = 0; - - protected: - ~DesktopCapturerObserver() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_DESKTOP_CAPTURER_HXX diff --git a/third_party/libwebrtc/include/rtc_desktop_device.h b/third_party/libwebrtc/include/rtc_desktop_device.h deleted file mode 100644 index e3e4c6fab1..0000000000 --- a/third_party/libwebrtc/include/rtc_desktop_device.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_DESKTOP_DEVICE_HXX -#define LIB_WEBRTC_RTC_DESKTOP_DEVICE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class MediaSource; -class RTCDesktopCapturer; -class RTCDesktopMediaList; - -class RTCDesktopDevice : public RefCountInterface { - public: - virtual scoped_refptr CreateDesktopCapturer( - scoped_refptr source) = 0; - virtual scoped_refptr GetDesktopMediaList( - DesktopType type) = 0; - - protected: - virtual ~RTCDesktopDevice() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_DEVICE_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_desktop_media_list.h b/third_party/libwebrtc/include/rtc_desktop_media_list.h deleted file mode 100644 index 48faf2a959..0000000000 --- a/third_party/libwebrtc/include/rtc_desktop_media_list.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_DESKTOP_MEDIA_LIST_HXX -#define LIB_WEBRTC_RTC_DESKTOP_MEDIA_LIST_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class MediaSource : public RefCountInterface { - public: - // source id - virtual string id() const = 0; - - // source name - virtual string name() const = 0; - - // Returns the thumbnail of the source, jpeg format. - virtual portable::vector thumbnail() const = 0; - - virtual DesktopType type() const = 0; - - virtual bool UpdateThumbnail() = 0; - - protected: - virtual ~MediaSource() {} -}; - -class MediaListObserver { - public: - virtual void OnMediaSourceAdded(scoped_refptr source) = 0; - - virtual void OnMediaSourceRemoved(scoped_refptr source) = 0; - - virtual void OnMediaSourceNameChanged(scoped_refptr source) = 0; - - virtual void OnMediaSourceThumbnailChanged( - scoped_refptr source) = 0; - - protected: - virtual ~MediaListObserver() {} -}; - -class RTCDesktopMediaList : public RefCountInterface { - public: - virtual void RegisterMediaListObserver(MediaListObserver* observer) = 0; - - virtual void DeRegisterMediaListObserver() = 0; - - virtual DesktopType type() const = 0; - - virtual int32_t UpdateSourceList(bool force_reload = false, - bool get_thumbnail = true) = 0; - - virtual int GetSourceCount() const = 0; - - virtual scoped_refptr GetSource(int index) = 0; - - virtual bool GetThumbnail(scoped_refptr source, - bool notify = false) = 0; - - protected: - ~RTCDesktopMediaList() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_DESKTOP_MEDIA_LIST_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_dtls_transport.h b/third_party/libwebrtc/include/rtc_dtls_transport.h deleted file mode 100644 index fe7adad7f0..0000000000 --- a/third_party/libwebrtc/include/rtc_dtls_transport.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef LIB_WEBRTC_DTLS_TRANSPORT_H_ -#define LIB_WEBRTC_DTLS_TRANSPORT_H_ - -#include "base/refcount.h" -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCDtlsTransportInformation : public RefCountInterface { - public: - enum class RTCDtlsTransportState { - kNew, // Has not started negotiating yet. - kConnecting, // In the process of negotiating a secure connection. - kConnected, // Completed negotiation and verified fingerprints. - kClosed, // Intentionally closed. - kFailed, // Failure due to an error or failing to verify a remote - // fingerprint. - kNumValues - }; - virtual RTCDtlsTransportInformation& operator=( - scoped_refptr c) = 0; - - virtual RTCDtlsTransportState state() const = 0; - virtual int ssl_cipher_suite() const = 0; - virtual int srtp_cipher_suite() const = 0; -}; - -class RTCDtlsTransportObserver { - public: - virtual void OnStateChange(RTCDtlsTransportInformation info) = 0; - - virtual void OnError(const int type, const char* message) = 0; - - protected: - virtual ~RTCDtlsTransportObserver() = default; -}; - -class RTCDtlsTransport : public RefCountInterface { - LIB_WEBRTC_API static scoped_refptr Create(); - - public: - virtual scoped_refptr GetInformation() = 0; - - virtual void RegisterObserver(RTCDtlsTransportObserver* observer) = 0; - - virtual void UnregisterObserver() = 0; -}; - -} // namespace libwebrtc - -#endif // API_DTLS_TRANSPORT_INTERFACE_H_ diff --git a/third_party/libwebrtc/include/rtc_dtmf_sender.h b/third_party/libwebrtc/include/rtc_dtmf_sender.h deleted file mode 100644 index 7f42cc56b5..0000000000 --- a/third_party/libwebrtc/include/rtc_dtmf_sender.h +++ /dev/null @@ -1,47 +0,0 @@ - -#ifndef LIB_WEBRTC_DTMF_SENDER__H_ -#define LIB_WEBRTC_DTMF_SENDER__H_ - -#include "base/refcount.h" -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCDtmfSenderObserver { - public: - virtual void OnToneChange(const string tone, const string tone_buffer) = 0; - - virtual void OnToneChange(const string tone) = 0; - - protected: - virtual ~RTCDtmfSenderObserver() = default; -}; - -class RTCDtmfSender : public RefCountInterface { - public: - static const int kDtmfDefaultCommaDelayMs = 2000; - - virtual void RegisterObserver(RTCDtmfSenderObserver* observer) = 0; - - virtual void UnregisterObserver() = 0; - - virtual bool InsertDtmf(const string tones, int duration, - int inter_tone_gap) = 0; - - virtual bool InsertDtmf(const string tones, int duration, int inter_tone_gap, - int comma_delay) = 0; - - virtual bool CanInsertDtmf() = 0; - - virtual const string tones() const = 0; - - virtual int duration() const = 0; - - virtual int inter_tone_gap() const = 0; - - virtual int comma_delay() const = 0; -}; - -} // namespace libwebrtc - -#endif // API_DTMF_SENDER__H_ diff --git a/third_party/libwebrtc/include/rtc_frame_cryptor.h b/third_party/libwebrtc/include/rtc_frame_cryptor.h deleted file mode 100644 index 47f3a409b7..0000000000 --- a/third_party/libwebrtc/include/rtc_frame_cryptor.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef LIB_RTC_FRAME_CYRPTOR_H_ -#define LIB_RTC_FRAME_CYRPTOR_H_ - -#include "base/refcount.h" -#include "rtc_peerconnection_factory.h" -#include "rtc_rtp_receiver.h" -#include "rtc_rtp_sender.h" -#include "rtc_types.h" - -namespace libwebrtc { - -enum class Algorithm { - kAesGcm = 0, - kAesCbc, -}; - -#define DEFAULT_KEYRING_SIZE 16 -#define MAX_KEYRING_SIZE 255 - -struct KeyProviderOptions { - bool shared_key; - vector ratchet_salt; - vector uncrypted_magic_bytes; - int ratchet_window_size; - int failure_tolerance; - // The size of the key ring. between 1 and 255. - int key_ring_size; - bool discard_frame_when_cryptor_not_ready; - KeyProviderOptions() - : shared_key(false), - ratchet_salt(vector()), - ratchet_window_size(0), - failure_tolerance(-1), - key_ring_size(DEFAULT_KEYRING_SIZE), - discard_frame_when_cryptor_not_ready(false) {} - KeyProviderOptions(KeyProviderOptions& copy) - : shared_key(copy.shared_key), - ratchet_salt(copy.ratchet_salt), - ratchet_window_size(copy.ratchet_window_size), - failure_tolerance(copy.failure_tolerance), - key_ring_size(copy.key_ring_size) {} -}; - -/// Shared secret key for frame encryption. -class KeyProvider : public RefCountInterface { - public: - LIB_WEBRTC_API static scoped_refptr Create(KeyProviderOptions*); - - virtual bool SetSharedKey(int index, vector key) = 0; - - virtual vector RatchetSharedKey(int key_index) = 0; - - virtual vector ExportSharedKey(int key_index) = 0; - - /// Set the key at the given index. - virtual bool SetKey(const string participant_id, int index, - vector key) = 0; - - virtual vector RatchetKey(const string participant_id, - int key_index) = 0; - - virtual vector ExportKey(const string participant_id, - int key_index) = 0; - - virtual void SetSifTrailer(vector trailer) = 0; - - protected: - virtual ~KeyProvider() {} -}; - -enum RTCFrameCryptionState { - kNew = 0, - kOk, - kEncryptionFailed, - kDecryptionFailed, - kMissingKey, - kKeyRatcheted, - kInternalError, -}; - -class RTCFrameCryptorObserver : public RefCountInterface { - public: - virtual void OnFrameCryptionStateChanged(const string participant_id, - RTCFrameCryptionState state) = 0; - - protected: - virtual ~RTCFrameCryptorObserver() {} -}; - -/// Frame encryption/decryption. -/// -class RTCFrameCryptor : public RefCountInterface { - public: - /// Enable/Disable frame crypto for the sender or receiver. - virtual bool SetEnabled(bool enabled) = 0; - - /// Get the enabled state for the sender or receiver. - virtual bool enabled() const = 0; - - /// Set the key index for the sender or receiver. - /// If the key index is not set, the key index will be set to 0. - virtual bool SetKeyIndex(int index) = 0; - - /// Get the key index for the sender or receiver. - virtual int key_index() const = 0; - - virtual const string participant_id() const = 0; - - virtual void RegisterRTCFrameCryptorObserver( - scoped_refptr observer) = 0; - - virtual void DeRegisterRTCFrameCryptorObserver() = 0; - - protected: - virtual ~RTCFrameCryptor() {} -}; - -class FrameCryptorFactory { - public: - /// Create a frame cyrptor for [RTCRtpSender]. - LIB_WEBRTC_API static scoped_refptr - frameCryptorFromRtpSender(scoped_refptr factory, - const string participant_id, - scoped_refptr sender, - Algorithm algorithm, - scoped_refptr key_provider); - - /// Create a frame cyrptor for [RTCRtpReceiver]. - LIB_WEBRTC_API static scoped_refptr - frameCryptorFromRtpReceiver(scoped_refptr factory, - const string participant_id, - scoped_refptr receiver, - Algorithm algorithm, - scoped_refptr key_provider); -}; - -} // namespace libwebrtc - -#endif // LIB_RTC_FRAME_CYRPTOR_H_ \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_ice_candidate.h b/third_party/libwebrtc/include/rtc_ice_candidate.h deleted file mode 100644 index 82da46edb4..0000000000 --- a/third_party/libwebrtc/include/rtc_ice_candidate.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_ICE_CANDIDATE_HXX -#define LIB_WEBRTC_RTC_ICE_CANDIDATE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCIceCandidate : public RefCountInterface { - public: - static LIB_WEBRTC_API scoped_refptr Create( - const string sdp, const string sdp_mid, int sdp_mline_index, - SdpParseError* error); - - public: - virtual const string candidate() const = 0; - - virtual const string sdp_mid() const = 0; - - virtual int sdp_mline_index() const = 0; - - virtual bool ToString(string& out) = 0; - - protected: - virtual ~RTCIceCandidate() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_ICE_CANDIDATE_HXX diff --git a/third_party/libwebrtc/include/rtc_ice_transport.h b/third_party/libwebrtc/include/rtc_ice_transport.h deleted file mode 100644 index 645f305b2d..0000000000 --- a/third_party/libwebrtc/include/rtc_ice_transport.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2019 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef LIB_WEBRTC_RTC_ICE_TRANSPORT_H_ -#define LIB_WEBRTC_RTC_ICE_TRANSPORT_H_ - -#include - -#include "api/async_dns_resolver.h" -#include "api/async_resolver_factory.h" -#include "api/rtc_error.h" -#include "api/rtc_event_log/rtc_event_log.h" -#include "api/scoped_refptr.h" -#include "rtc_base/ref_count.h" - -namespace libwebrtc { - -class IceTransport : public RefCountInterface { - public: - virtual IceTransport* internal() = 0; -}; - -class IceTransportInit final { - public: - IceTransportInit() = default; - IceTransportInit(const IceTransportInit&) = delete; - IceTransportInit(IceTransportInit&&) = default; - IceTransportInit& operator=(const IceTransportInit&) = delete; - IceTransportInit& operator=(IceTransportInit&&) = default; - - cricket::PortAllocator* port_allocator() { return port_allocator_; } - void set_port_allocator(cricket::PortAllocator* port_allocator) { - port_allocator_ = port_allocator; - } - - AsyncDnsResolverFactoryInterface* async_dns_resolver_factory() { - return async_dns_resolver_factory_; - } - void set_async_dns_resolver_factory( - AsyncDnsResolverFactoryInterface* async_dns_resolver_factory) { - RTC_DCHECK(!async_resolver_factory_); - async_dns_resolver_factory_ = async_dns_resolver_factory; - } - AsyncResolverFactory* async_resolver_factory() { - return async_resolver_factory_; - } - ABSL_DEPRECATED("bugs.webrtc.org/12598") - void set_async_resolver_factory( - AsyncResolverFactory* async_resolver_factory) { - RTC_DCHECK(!async_dns_resolver_factory_); - async_resolver_factory_ = async_resolver_factory; - } - - RtcEventLog* event_log() { return event_log_; } - void set_event_log(RtcEventLog* event_log) { event_log_ = event_log; } -}; - -class IceTransportFactory { - public: - virtual ~IceTransportFactory() = default; - - virtual scoped_refptr CreateIceTransport( - const std::string& transport_name, int component, - IceTransportInit init) = 0; -}; - -} // namespace libwebrtc -#endif // API_ICE_TRANSPORT_INTERFACE_H_ diff --git a/third_party/libwebrtc/include/rtc_media_stream.h b/third_party/libwebrtc/include/rtc_media_stream.h deleted file mode 100644 index 17c04d1ba4..0000000000 --- a/third_party/libwebrtc/include/rtc_media_stream.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_MEDIA_STREAM_HXX -#define LIB_WEBRTC_RTC_MEDIA_STREAM_HXX - -#include "rtc_audio_track.h" -#include "rtc_types.h" -#include "rtc_video_track.h" - -namespace libwebrtc { - -class RTCMediaStream : public RefCountInterface { - public: - virtual bool AddTrack(scoped_refptr track) = 0; - - virtual bool AddTrack(scoped_refptr track) = 0; - - virtual bool RemoveTrack(scoped_refptr track) = 0; - - virtual bool RemoveTrack(scoped_refptr track) = 0; - - virtual vector> audio_tracks() = 0; - - virtual vector> video_tracks() = 0; - - virtual vector> tracks() = 0; - - virtual scoped_refptr FindAudioTrack( - const string track_id) = 0; - - virtual scoped_refptr FindVideoTrack( - const string track_id) = 0; - - virtual const string label() = 0; - - virtual const string id() = 0; - - protected: - ~RTCMediaStream() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_MEDIA_STREAM_HXX diff --git a/third_party/libwebrtc/include/rtc_media_track.h b/third_party/libwebrtc/include/rtc_media_track.h deleted file mode 100644 index d971c89d27..0000000000 --- a/third_party/libwebrtc/include/rtc_media_track.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_MEDIA_TRACK_HXX -#define LIB_WEBRTC_RTC_MEDIA_TRACK_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class AudioTrackSink { - public: - virtual void OnData(const void* audio_data, int bits_per_sample, - int sample_rate, size_t number_of_channels, - size_t number_of_frames) = 0; - protected: - virtual ~AudioTrackSink() {} -}; - -/*Media Track interface*/ -class RTCMediaTrack : public RefCountInterface { - public: - enum RTCTrackState { - kLive, - kEnded, - }; - virtual RTCTrackState state() const = 0; - - /*track type: audio/video*/ - virtual const string kind() const = 0; - - /*track id*/ - virtual const string id() const = 0; - - virtual bool enabled() const = 0; - - /*mute track*/ - virtual bool set_enabled(bool enable) = 0; - - protected: - ~RTCMediaTrack() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_MEDIA_TRACK_HXX diff --git a/third_party/libwebrtc/include/rtc_mediaconstraints.h b/third_party/libwebrtc/include/rtc_mediaconstraints.h deleted file mode 100644 index 2596e6153f..0000000000 --- a/third_party/libwebrtc/include/rtc_mediaconstraints.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_MEDIA_CONSTRAINTS_HXX -#define LIB_WEBRTC_RTC_MEDIA_CONSTRAINTS_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCMediaConstraints : public RefCountInterface { - public: - // These keys are google specific. - LIB_WEBRTC_API static const char* - kGoogEchoCancellation; // googEchoCancellation - - LIB_WEBRTC_API static const char* - kExtendedFilterEchoCancellation; // googEchoCancellation2 - LIB_WEBRTC_API static const char* - kDAEchoCancellation; // googDAEchoCancellation - LIB_WEBRTC_API static const char* kAutoGainControl; // googAutoGainControl - LIB_WEBRTC_API static const char* kNoiseSuppression; // googNoiseSuppression - LIB_WEBRTC_API static const char* kHighpassFilter; // googHighpassFilter - LIB_WEBRTC_API static const char* kAudioMirroring; // googAudioMirroring - LIB_WEBRTC_API static const char* - kAudioNetworkAdaptorConfig; // goodAudioNetworkAdaptorConfig - - // Constraint keys for CreateOffer / CreateAnswer - // Specified by the W3C PeerConnection spec - LIB_WEBRTC_API static const char* - kOfferToReceiveVideo; // OfferToReceiveVideo - LIB_WEBRTC_API static const char* - kOfferToReceiveAudio; // OfferToReceiveAudio - LIB_WEBRTC_API static const char* - kVoiceActivityDetection; // VoiceActivityDetection - LIB_WEBRTC_API static const char* kIceRestart; // IceRestart - // These keys are google specific. - LIB_WEBRTC_API static const char* kUseRtpMux; // googUseRtpMUX - - // Constraints values. - LIB_WEBRTC_API static const char* kValueTrue; // true - LIB_WEBRTC_API static const char* kValueFalse; // false - - // PeerConnection constraint keys. - // Temporary pseudo-constraints used to enable DataChannels - LIB_WEBRTC_API static const char* - kEnableRtpDataChannels; // Enable RTP DataChannels - // Google-specific constraint keys. - // Temporary pseudo-constraint for enabling DSCP through JS. - LIB_WEBRTC_API static const char* kEnableDscp; // googDscp - // Constraint to enable IPv6 through JS. - LIB_WEBRTC_API static const char* kEnableIPv6; // googIPv6 - // Temporary constraint to enable suspend below min bitrate feature. - LIB_WEBRTC_API static const char* kEnableVideoSuspendBelowMinBitrate; - // googSuspendBelowMinBitrate - // Constraint to enable combined audio+video bandwidth estimation. - //LIB_WEBRTC_API static const char* - // kCombinedAudioVideoBwe; // googCombinedAudioVideoBwe - LIB_WEBRTC_API static const char* - kScreencastMinBitrate; // googScreencastMinBitrate - LIB_WEBRTC_API static const char* - kCpuOveruseDetection; // googCpuOveruseDetection - - // Specifies number of simulcast layers for all video tracks - // with a Plan B offer/answer - // (see RTCOfferAnswerOptions::num_simulcast_layers). - LIB_WEBRTC_API static const char* kNumSimulcastLayers; - - public: - LIB_WEBRTC_API static scoped_refptr Create(); - - virtual void AddMandatoryConstraint(const string key, const string value) = 0; - - virtual void AddOptionalConstraint(const string key, const string value) = 0; - - protected: - virtual ~RTCMediaConstraints() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_MEDIA_CONSTRAINTS_HXX diff --git a/third_party/libwebrtc/include/rtc_peerconnection.h b/third_party/libwebrtc/include/rtc_peerconnection.h deleted file mode 100644 index 35ea2ad3ea..0000000000 --- a/third_party/libwebrtc/include/rtc_peerconnection.h +++ /dev/null @@ -1,273 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_PEERCONNECTION_HXX -#define LIB_WEBRTC_RTC_PEERCONNECTION_HXX - -#include "rtc_audio_track.h" -#include "rtc_data_channel.h" -#include "rtc_ice_candidate.h" -#include "rtc_media_stream.h" -#include "rtc_mediaconstraints.h" -#include "rtc_rtp_sender.h" -#include "rtc_rtp_transceiver.h" -#include "rtc_session_description.h" -#include "rtc_video_source.h" -#include "rtc_video_track.h" - -namespace libwebrtc { - -enum SessionDescriptionErrorType { - kPeerConnectionInitFailed = 0, - kCreatePeerConnectionFailed, - kSDPParseFailed, -}; - -enum RTCPeerConnectionState { - RTCPeerConnectionStateNew, - RTCPeerConnectionStateConnecting, - RTCPeerConnectionStateConnected, - RTCPeerConnectionStateDisconnected, - RTCPeerConnectionStateFailed, - RTCPeerConnectionStateClosed, -}; - -enum RTCSignalingState { - RTCSignalingStateStable, - RTCSignalingStateHaveLocalOffer, - RTCSignalingStateHaveRemoteOffer, - RTCSignalingStateHaveLocalPrAnswer, - RTCSignalingStateHaveRemotePrAnswer, - RTCSignalingStateClosed -}; - -enum RTCIceGatheringState { - RTCIceGatheringStateNew, - RTCIceGatheringStateGathering, - RTCIceGatheringStateComplete -}; - -enum RTCIceConnectionState { - RTCIceConnectionStateNew, - RTCIceConnectionStateChecking, - RTCIceConnectionStateCompleted, - RTCIceConnectionStateConnected, - RTCIceConnectionStateFailed, - RTCIceConnectionStateDisconnected, - RTCIceConnectionStateClosed, - RTCIceConnectionStateMax, -}; - -class RTCStatsMember : public RefCountInterface { - public: - // Member value types. - enum Type { - kBool, // bool - kInt32, // int32_t - kUint32, // uint32_t - kInt64, // int64_t - kUint64, // uint64_t - kDouble, // double - kString, // std::string - - kSequenceBool, // std::vector - kSequenceInt32, // std::vector - kSequenceUint32, // std::vector - kSequenceInt64, // std::vector - kSequenceUint64, // std::vector - kSequenceDouble, // std::vector - kSequenceString, // std::vector - - kMapStringUint64, // std::map - kMapStringDouble, // std::map - }; - - public: - virtual string GetName() const = 0; - virtual Type GetType() const = 0; - virtual bool IsDefined() const = 0; - - virtual bool ValueBool() const = 0; - virtual int32_t ValueInt32() const = 0; - virtual uint32_t ValueUint32() const = 0; - virtual int64_t ValueInt64() const = 0; - virtual uint64_t ValueUint64() const = 0; - virtual double ValueDouble() const = 0; - virtual string ValueString() const = 0; - virtual vector ValueSequenceBool() const = 0; - virtual vector ValueSequenceInt32() const = 0; - virtual vector ValueSequenceUint32() const = 0; - virtual vector ValueSequenceInt64() const = 0; - virtual vector ValueSequenceUint64() const = 0; - virtual vector ValueSequenceDouble() const = 0; - virtual vector ValueSequenceString() const = 0; - virtual map ValueMapStringUint64() const = 0; - virtual map ValueMapStringDouble() const = 0; - - protected: - virtual ~RTCStatsMember() {} -}; - -class MediaRTCStats : public RefCountInterface { - public: - virtual const string id() = 0; - - virtual const string type() = 0; - - virtual int64_t timestamp_us() = 0; - - virtual const string ToJson() = 0; - - virtual const vector> Members() = 0; -}; - -typedef fixed_size_function> reports)> - OnStatsCollectorSuccess; - -typedef fixed_size_function OnStatsCollectorFailure; - -typedef fixed_size_function - OnSdpCreateSuccess; - -typedef fixed_size_function OnSdpCreateFailure; - -typedef fixed_size_function OnSetSdpSuccess; - -typedef fixed_size_function OnSetSdpFailure; - -typedef fixed_size_function - OnGetSdpSuccess; - -typedef fixed_size_function OnGetSdpFailure; - -class RTCPeerConnectionObserver { - public: - virtual void OnSignalingState(RTCSignalingState state) = 0; - - virtual void OnPeerConnectionState(RTCPeerConnectionState state) = 0; - - virtual void OnIceGatheringState(RTCIceGatheringState state) = 0; - - virtual void OnIceConnectionState(RTCIceConnectionState state) = 0; - - virtual void OnIceCandidate(scoped_refptr candidate) = 0; - - virtual void OnAddStream(scoped_refptr stream) = 0; - - virtual void OnRemoveStream(scoped_refptr stream) = 0; - - virtual void OnDataChannel(scoped_refptr data_channel) = 0; - - virtual void OnRenegotiationNeeded() = 0; - - virtual void OnTrack(scoped_refptr transceiver) = 0; - - virtual void OnAddTrack(vector> streams, - scoped_refptr receiver) = 0; - - virtual void OnRemoveTrack(scoped_refptr receiver) = 0; - - protected: - virtual ~RTCPeerConnectionObserver() {} -}; - -class RTCPeerConnection : public RefCountInterface { - public: - virtual int AddStream(scoped_refptr stream) = 0; - - virtual int RemoveStream(scoped_refptr stream) = 0; - - virtual scoped_refptr CreateLocalMediaStream( - const string stream_id) = 0; - - virtual scoped_refptr CreateDataChannel( - const string label, RTCDataChannelInit* dataChannelDict) = 0; - - virtual void CreateOffer(OnSdpCreateSuccess success, - OnSdpCreateFailure failure, - scoped_refptr constraints) = 0; - - virtual void CreateAnswer(OnSdpCreateSuccess success, - OnSdpCreateFailure failure, - scoped_refptr constraints) = 0; - - virtual void RestartIce() = 0; - - virtual void Close() = 0; - - virtual void SetLocalDescription(const string sdp, const string type, - OnSetSdpSuccess success, - OnSetSdpFailure failure) = 0; - - virtual void SetRemoteDescription(const string sdp, const string type, - OnSetSdpSuccess success, - OnSetSdpFailure failure) = 0; - - virtual void GetLocalDescription(OnGetSdpSuccess success, - OnGetSdpFailure failure) = 0; - - virtual void GetRemoteDescription(OnGetSdpSuccess success, - OnGetSdpFailure failure) = 0; - - virtual void AddCandidate(const string mid, int mid_mline_index, - const string candiate) = 0; - - virtual void RegisterRTCPeerConnectionObserver( - RTCPeerConnectionObserver* observer) = 0; - - virtual void DeRegisterRTCPeerConnectionObserver() = 0; - - virtual vector> local_streams() = 0; - - virtual vector> remote_streams() = 0; - - virtual bool GetStats(scoped_refptr sender, - OnStatsCollectorSuccess success, - OnStatsCollectorFailure failure) = 0; - - virtual bool GetStats(scoped_refptr receiver, - OnStatsCollectorSuccess success, - OnStatsCollectorFailure failure) = 0; - - virtual void GetStats(OnStatsCollectorSuccess success, - OnStatsCollectorFailure failure) = 0; - - virtual scoped_refptr AddTransceiver( - scoped_refptr track, - scoped_refptr init) = 0; - - virtual scoped_refptr AddTransceiver( - scoped_refptr track) = 0; - - virtual scoped_refptr AddTrack( - scoped_refptr track, const vector streamIds) = 0; - - virtual scoped_refptr AddTransceiver( - RTCMediaType media_type) = 0; - - virtual scoped_refptr AddTransceiver( - RTCMediaType media_type, scoped_refptr init) = 0; - - virtual bool RemoveTrack(scoped_refptr render) = 0; - - virtual vector> senders() = 0; - - virtual vector> transceivers() = 0; - - virtual vector> receivers() = 0; - - virtual RTCSignalingState signaling_state() = 0; - - virtual RTCIceConnectionState ice_connection_state() = 0; - - virtual RTCIceConnectionState standardized_ice_connection_state() = 0; - - virtual RTCPeerConnectionState peer_connection_state() = 0; - - virtual RTCIceGatheringState ice_gathering_state() = 0; - - protected: - virtual ~RTCPeerConnection() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_PEERCONNECTION_HXX diff --git a/third_party/libwebrtc/include/rtc_peerconnection_factory.h b/third_party/libwebrtc/include/rtc_peerconnection_factory.h deleted file mode 100644 index 1b6b8c1aec..0000000000 --- a/third_party/libwebrtc/include/rtc_peerconnection_factory.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_PEERCONNECTION_FACTORY_HXX -#define LIB_WEBRTC_RTC_PEERCONNECTION_FACTORY_HXX - -#include "rtc_audio_source.h" -#include "rtc_audio_track.h" -#include "rtc_types.h" -#ifdef RTC_DESKTOP_DEVICE -#include "rtc_desktop_device.h" -#endif -#include "rtc_media_stream.h" -#include "rtc_mediaconstraints.h" -#include "rtc_video_device.h" -#include "rtc_video_source.h" - -namespace libwebrtc { - -class RTCPeerConnection; -class RTCAudioDevice; -class RTCAudioProcessing; -class RTCVideoDevice; -class RTCRtpCapabilities; - -class RTCPeerConnectionFactory : public RefCountInterface { - public: - virtual bool Initialize() = 0; - - virtual bool Terminate() = 0; - - virtual scoped_refptr Create( - const RTCConfiguration& configuration, - scoped_refptr constraints) = 0; - - virtual void Delete(scoped_refptr peerconnection) = 0; - - virtual scoped_refptr GetAudioDevice() = 0; - - virtual scoped_refptr GetAudioProcessing() = 0; - - virtual scoped_refptr GetVideoDevice() = 0; -#ifdef RTC_DESKTOP_DEVICE - virtual scoped_refptr GetDesktopDevice() = 0; -#endif - virtual scoped_refptr CreateAudioSource( - const string audio_source_label, - RTCAudioSource::SourceType source_type = - RTCAudioSource::SourceType::kMicrophone) = 0; - - virtual scoped_refptr CreateVideoSource( - scoped_refptr capturer, const string video_source_label, - scoped_refptr constraints) = 0; -#ifdef RTC_DESKTOP_DEVICE - virtual scoped_refptr CreateDesktopSource( - scoped_refptr capturer, - const string video_source_label, - scoped_refptr constraints) = 0; -#endif - virtual scoped_refptr CreateAudioTrack( - scoped_refptr source, const string track_id) = 0; - - virtual scoped_refptr CreateVideoTrack( - scoped_refptr source, const string track_id) = 0; - - virtual scoped_refptr CreateStream( - const string stream_id) = 0; - - virtual scoped_refptr GetRtpSenderCapabilities( - RTCMediaType media_type) = 0; - - virtual scoped_refptr GetRtpReceiverCapabilities( - RTCMediaType media_type) = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_PEERCONNECTION_FACTORY_HXX diff --git a/third_party/libwebrtc/include/rtc_rtp_capabilities.h b/third_party/libwebrtc/include/rtc_rtp_capabilities.h deleted file mode 100644 index 39b49765fc..0000000000 --- a/third_party/libwebrtc/include/rtc_rtp_capabilities.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef LIB_WBBRTC_RTC_RTP_CAPABILITIES_HXX -#define LIB_WBBRTC_RTC_RTP_CAPABILITIES_HXX - -#include "base/refcount.h" -#include "base/scoped_ref_ptr.h" -#include "rtc_rtp_parameters.h" -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCRtpCodecCapability : public RefCountInterface { - public: - LIB_WEBRTC_API static scoped_refptr Create(); - - virtual void set_mime_type(const string& mime_type) = 0; - virtual void set_clock_rate(int clock_rate) = 0; - virtual void set_channels(int channels) = 0; - virtual void set_sdp_fmtp_line(const string& sdp_fmtp_line) = 0; - - virtual string mime_type() const = 0; - virtual int clock_rate() const = 0; - virtual int channels() const = 0; - virtual string sdp_fmtp_line() const = 0; - - protected: - virtual ~RTCRtpCodecCapability() {} -}; - -class RTCRtpHeaderExtensionCapability : public RefCountInterface { - public: - virtual const string uri() = 0; - virtual void set_uri(const string uri) = 0; - - virtual int preferred_id() = 0; - virtual void set_preferred_id(int value) = 0; - - virtual bool preferred_encrypt() = 0; - virtual void set_preferred_encrypt(bool value) = 0; -}; - -class RTCRtpCapabilities : public RefCountInterface { - public: - virtual const vector> codecs() = 0; - virtual void set_codecs( - const vector> codecs) = 0; - - virtual const vector> - header_extensions() = 0; - - virtual void set_header_extensions( - const vector> - header_extensions) = 0; - - // virtual const vector> fec() = 0; - // virtual void set_fec(const vector> fec) = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WBBRTC_RTC_RTP_CAPABILITIES_HXX diff --git a/third_party/libwebrtc/include/rtc_rtp_parameters.h b/third_party/libwebrtc/include/rtc_rtp_parameters.h deleted file mode 100644 index 3ef87155d5..0000000000 --- a/third_party/libwebrtc/include/rtc_rtp_parameters.h +++ /dev/null @@ -1,243 +0,0 @@ -#ifndef LIB_WBBRTC_RTC_RTP_PARAMETERS_HXX -#define LIB_WBBRTC_RTC_RTP_PARAMETERS_HXX - -#include "base/refcount.h" -#include "base/scoped_ref_ptr.h" -#include "rtc_types.h" - -namespace libwebrtc { - -enum class RTCRtpTransceiverDirection { - kSendRecv, - kSendOnly, - kRecvOnly, - kInactive, - kStopped, -}; - -enum class RTCFecMechanism { - RED, - RED_AND_ULPFEC, - FLEXFEC, -}; - -enum class RTCRtcpFeedbackType { - CCM, - LNTF, - NACK, - REMB, - TRANSPORT_CC, -}; - -enum class RTCRtcpFeedbackMessageType { - GENERIC_NACK, - PLI, - FIR, -}; - -enum class RTCDtxStatus { - DISABLED, - ENABLED, -}; - -enum class RTCDegradationPreference { - DISABLED, - MAINTAIN_FRAMERATE, - MAINTAIN_RESOLUTION, - BALANCED, -}; - -class RTCRtcpFeedback : public RefCountInterface { - virtual RTCRtcpFeedbackType type() = 0; - virtual void set_type(RTCRtcpFeedbackType value) = 0; - - virtual RTCRtcpFeedbackMessageType message_type() = 0; - virtual void set_message_type(RTCRtcpFeedbackMessageType value) = 0; - - virtual bool operator==(scoped_refptr o) = 0; - virtual bool operator!=(scoped_refptr o) = 0; -}; - -class RTCRtpExtension : public RefCountInterface { - public: - enum RTCFilter { - kDiscardEncryptedExtension, - kPreferEncryptedExtension, - kRequireEncryptedExtension, - }; - - virtual const string ToString() const = 0; - virtual bool operator==(scoped_refptr o) const = 0; - - virtual const string uri() = 0; - virtual void set_uri(const string uri) = 0; - - virtual int id() = 0; - virtual void set_id(int value) = 0; - - virtual bool encrypt() = 0; - virtual void set_encrypt(bool value) = 0; -}; - -class RtpFecParameters : public RefCountInterface { - virtual uint32_t ssrc() = 0; - virtual void set_ssrc(uint32_t value) = 0; - - virtual RTCFecMechanism mechanism() = 0; - virtual void set_mechanism(RTCFecMechanism value) = 0; - - virtual bool operator==(const RtpFecParameters& o) const = 0; - virtual bool operator!=(const RtpFecParameters& o) const = 0; -}; - -class RTCRtpRtxParameters : public RefCountInterface { - virtual uint32_t ssrc() = 0; - virtual void set_ssrc(uint32_t value) = 0; - - virtual bool operator==(scoped_refptr o) const = 0; - - virtual bool operator!=(scoped_refptr o) const = 0; -}; - -class RTCRtpCodecParameters : public RefCountInterface { - public: - virtual const string mime_type() const = 0; - - virtual const string name() = 0; - virtual void set_name(const string name) = 0; - - virtual RTCMediaType kind() = 0; - virtual void set_kind(RTCMediaType value) = 0; - - virtual int payload_type() = 0; - virtual void set_payload_type(int value) = 0; - - virtual int clock_rate() = 0; - virtual void set_clock_rate(int value) = 0; - - virtual int num_channels() = 0; - virtual void set_num_channels(int value) = 0; - - virtual int max_ptime() = 0; - virtual void set_max_ptime(int value) = 0; - - virtual int ptime() = 0; - virtual void set_ptime(int value) = 0; - - virtual const vector> rtcp_feedback() = 0; - virtual void set_rtcp_feedback( - const vector> feecbacks) = 0; - - virtual const vector> parameters() = 0; - virtual void set_parameters(const map parameters) = 0; - - virtual bool operator==(scoped_refptr o) = 0; - virtual bool operator!=(scoped_refptr o) = 0; - - protected: - virtual ~RTCRtpCodecParameters() {} -}; - -class RTCRtcpParameters : public RefCountInterface { - public: - virtual uint32_t ssrc() = 0; - virtual void set_ssrc(uint32_t value) = 0; - - virtual const string cname() = 0; - virtual void set_cname(const string) = 0; - - virtual bool reduced_size() = 0; - virtual void set_reduced_size(bool value) = 0; - - virtual bool mux() = 0; - virtual void set_mux(bool value) = 0; - - virtual bool operator==(scoped_refptr o) const = 0; - virtual bool operator!=(scoped_refptr o) const = 0; -}; - -enum class RTCPriority { - kVeryLow, - kLow, - kMedium, - kHigh, -}; - -class RTCRtpEncodingParameters : public RefCountInterface { - public: - LIB_WEBRTC_API static scoped_refptr Create(); - - virtual uint32_t ssrc() = 0; - virtual void set_ssrc(uint32_t value) = 0; - - virtual double bitrate_priority() = 0; - virtual void set_bitrate_priority(double value) = 0; - - virtual RTCPriority network_priority() = 0; - virtual void set_network_priority(RTCPriority value) = 0; - - virtual int max_bitrate_bps() = 0; - virtual void set_max_bitrate_bps(int value) = 0; - - virtual int min_bitrate_bps() = 0; - virtual void set_min_bitrate_bps(int value) = 0; - - virtual double max_framerate() = 0; - virtual void set_max_framerate(double value) = 0; - - virtual int num_temporal_layers() = 0; - virtual void set_num_temporal_layers(int value) = 0; - - virtual double scale_resolution_down_by() = 0; - virtual void set_scale_resolution_down_by(double value) = 0; - - virtual const string scalability_mode() = 0; - virtual void set_scalability_mode(const string mode) = 0; - - virtual bool active() = 0; - virtual void set_active(bool value) = 0; - - virtual const string rid() = 0; - virtual void set_rid(const string rid) = 0; - - virtual bool adaptive_ptime() = 0; - virtual void set_adaptive_ptime(bool value) = 0; - - virtual bool operator==(scoped_refptr o) const = 0; - virtual bool operator!=(scoped_refptr o) const = 0; -}; - -struct RTCRtpParameters : public RefCountInterface { - public: - // static scoped_refptr Create(); - virtual const string transaction_id() = 0; - virtual void set_transaction_id(const string id) = 0; - - virtual const string mid() = 0; - virtual void set_mid(const string mid) = 0; - - virtual const vector> codecs() = 0; - virtual void set_codecs( - const vector> codecs) = 0; - - virtual const vector> header_extensions() = 0; - virtual void set_header_extensions( - const vector> header_extensions) = 0; - - virtual const vector> encodings() = 0; - virtual void set_encodings( - const vector> encodings) = 0; - - virtual scoped_refptr rtcp_parameters() = 0; - virtual void set_rtcp_parameters( - scoped_refptr rtcp_parameters) = 0; - - virtual RTCDegradationPreference GetDegradationPreference() = 0; - virtual void SetDegradationPreference(RTCDegradationPreference value) = 0; - - virtual bool operator==(scoped_refptr o) const = 0; - virtual bool operator!=(scoped_refptr o) const = 0; -}; - -} // namespace libwebrtc -#endif // LIB_WBBRTC_RTC_RTP_PARAMETERS_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_rtp_receiver.h b/third_party/libwebrtc/include/rtc_rtp_receiver.h deleted file mode 100644 index a72f2b8a06..0000000000 --- a/third_party/libwebrtc/include/rtc_rtp_receiver.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef LIB_WEBRTC_RTP_RECEIVER_HXX -#define LIB_WEBRTC_RTP_RECEIVER_HXX - -#include "base/refcount.h" -#include "base/scoped_ref_ptr.h" -#include "rtc_rtp_parameters.h" -#include "rtc_types.h" - -// #include "rtc_frame_decryptor.h" -// #include "rtc_frame_encryptor.h" - -namespace libwebrtc { - -class RTCMediaTrack; -class RTCMediaStream; -class RTCDtlsTransport; - -class RTCRtpReceiverObserver { - public: - virtual void OnFirstPacketReceived(RTCMediaType media_type) = 0; - - protected: - virtual ~RTCRtpReceiverObserver() {} -}; - -class RTCRtpReceiver : public RefCountInterface { - public: - virtual scoped_refptr track() const = 0; - - virtual scoped_refptr dtls_transport() const = 0; - - virtual const vector stream_ids() const = 0; - - virtual vector> streams() const = 0; - - virtual RTCMediaType media_type() const = 0; - - virtual const string id() const = 0; - - virtual scoped_refptr parameters() const = 0; - - virtual bool set_parameters(scoped_refptr parameters) = 0; - - virtual void SetObserver(RTCRtpReceiverObserver* observer) = 0; - - virtual void SetJitterBufferMinimumDelay(double delay_seconds) = 0; - - // virtual Vector GetSources() const = 0; - - // virtual void SetFrameDecryptor( - // scoped_refptr frame_decryptor); - - // virtual scoped_refptr GetFrameDecryptor() const = 0; - - // virtual void SetDepacketizerToDecoderFrameTransformer( - // scoped_refptr frame_transformer) = 0; -}; - -} // namespace libwebrtc - -#endif // !LIB_WEBRTC_RTP_RECEIVER_H_ \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_rtp_sender.h b/third_party/libwebrtc/include/rtc_rtp_sender.h deleted file mode 100644 index 9c2f73249b..0000000000 --- a/third_party/libwebrtc/include/rtc_rtp_sender.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_RTP_SENDER_HXX -#define LIB_WEBRTC_RTC_RTP_SENDER_HXX - -#include "base/refcount.h" -#include "base/scoped_ref_ptr.h" -#include "rtc_rtp_parameters.h" -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCMediaTrack; -class RTCDtlsTransport; -class RTCDtmfSender; - -class RTCRtpSender : public RefCountInterface { - public: - virtual bool set_track(scoped_refptr track) = 0; - - virtual scoped_refptr track() const = 0; - - virtual scoped_refptr dtls_transport() const = 0; - - virtual uint32_t ssrc() const = 0; - - virtual RTCMediaType media_type() const = 0; - - virtual const string id() const = 0; - - virtual const vector stream_ids() const = 0; - - virtual void set_stream_ids(const vector stream_ids) const = 0; - - virtual const vector> - init_send_encodings() const = 0; - - virtual scoped_refptr parameters() const = 0; - - virtual bool set_parameters( - const scoped_refptr parameters) = 0; - - virtual scoped_refptr dtmf_sender() const = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_TYPES_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_rtp_transceiver.h b/third_party/libwebrtc/include/rtc_rtp_transceiver.h deleted file mode 100644 index ecf24f45b6..0000000000 --- a/third_party/libwebrtc/include/rtc_rtp_transceiver.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_RTP_TRANSCEIVER_HXX -#define LIB_WEBRTC_RTC_RTP_TRANSCEIVER_HXX - -#include "base/refcount.h" -#include "rtc_rtp_capabilities.h" -#include "rtc_rtp_parameters.h" -#include "rtc_rtp_receiver.h" -#include "rtc_rtp_sender.h" -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCRtpTransceiverInit : public RefCountInterface { - public: - LIB_WEBRTC_API static scoped_refptr Create( - RTCRtpTransceiverDirection direction, const vector stream_ids, - const vector> encodings); - - virtual RTCRtpTransceiverDirection direction() = 0; - virtual void set_direction(RTCRtpTransceiverDirection value) = 0; - - virtual const vector stream_ids() = 0; - virtual void set_stream_ids(const vector ids) = 0; - - virtual const vector> - send_encodings() = 0; - virtual void set_send_encodings( - const vector> send_encodings) = 0; -}; - -class RTCRtpTransceiver : public RefCountInterface { - public: - virtual RTCMediaType media_type() const = 0; - - virtual const string mid() const = 0; - - virtual scoped_refptr sender() const = 0; - - virtual scoped_refptr receiver() const = 0; - - virtual bool Stopped() const = 0; - - virtual bool Stopping() const = 0; - - virtual RTCRtpTransceiverDirection direction() const = 0; - - virtual const string SetDirectionWithError( - RTCRtpTransceiverDirection new_direction) = 0; - - virtual RTCRtpTransceiverDirection current_direction() const = 0; - - virtual RTCRtpTransceiverDirection fired_direction() const = 0; - - virtual const string StopStandard() = 0; - - virtual void StopInternal() = 0; - - virtual void SetCodecPreferences( - vector> codecs) = 0; - - virtual const string transceiver_id() const = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_TYPES_HXX diff --git a/third_party/libwebrtc/include/rtc_session_description.h b/third_party/libwebrtc/include/rtc_session_description.h deleted file mode 100644 index 84aa2abbc9..0000000000 --- a/third_party/libwebrtc/include/rtc_session_description.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_SESSION_DESCRIPTION_HXX -#define LIB_WEBRTC_RTC_SESSION_DESCRIPTION_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCSessionDescription : public RefCountInterface { - public: - enum SdpType { kOffer = 0, kPrAnswer, kAnswer }; - - static LIB_WEBRTC_API scoped_refptr Create( - const string type, const string sdp, SdpParseError* error); - - public: - virtual const string sdp() const = 0; - - virtual const string type() = 0; - - virtual SdpType GetType() = 0; - - virtual bool ToString(string& out) = 0; - - protected: - virtual ~RTCSessionDescription() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_SESSION_DESCRIPTION_HXX \ No newline at end of file diff --git a/third_party/libwebrtc/include/rtc_types.h b/third_party/libwebrtc/include/rtc_types.h deleted file mode 100644 index 017386d071..0000000000 --- a/third_party/libwebrtc/include/rtc_types.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_TYPES_HXX -#define LIB_WEBRTC_RTC_TYPES_HXX - -#ifdef LIB_WEBRTC_API_EXPORTS -#define LIB_WEBRTC_API __declspec(dllexport) -#elif defined(LIB_WEBRTC_API_DLL) -#define LIB_WEBRTC_API __declspec(dllimport) -#elif !defined(WIN32) -#define LIB_WEBRTC_API __attribute__((visibility("default"))) -#else -#define LIB_WEBRTC_API -#endif - -#include "base/fixed_size_function.h" -#include "base/portable.h" -#include "base/refcount.h" -#include "base/scoped_ref_ptr.h" - -namespace libwebrtc { - -enum { kMaxIceServerSize = 8 }; - -// template -// using vector = bsp::inlined_vector; - -template -using map = std::map; - -enum class MediaSecurityType { kSRTP_None = 0, kSDES_SRTP, kDTLS_SRTP }; - -enum class RTCMediaType { AUDIO, VIDEO, DATA, UNSUPPORTED }; - -using string = portable::string; - -// template -// using map = portable::map; - -template -using vector = portable::vector; - -struct IceServer { - string uri; - string username; - string password; -}; - -enum class IceTransportsType { kNone, kRelay, kNoHost, kAll }; - -enum class TcpCandidatePolicy { - kTcpCandidatePolicyEnabled, - kTcpCandidatePolicyDisabled -}; - -enum class CandidateNetworkPolicy { - kCandidateNetworkPolicyAll, - kCandidateNetworkPolicyLowCost -}; - -enum class RtcpMuxPolicy { - kRtcpMuxPolicyNegotiate, - kRtcpMuxPolicyRequire, -}; - -enum BundlePolicy { - kBundlePolicyBalanced, - kBundlePolicyMaxBundle, - kBundlePolicyMaxCompat -}; - -enum class SdpSemantics { kPlanB, kUnifiedPlan }; - -struct RTCConfiguration { - IceServer ice_servers[kMaxIceServerSize]; - IceTransportsType type = IceTransportsType::kAll; - BundlePolicy bundle_policy = BundlePolicy::kBundlePolicyBalanced; - RtcpMuxPolicy rtcp_mux_policy = RtcpMuxPolicy::kRtcpMuxPolicyRequire; - CandidateNetworkPolicy candidate_network_policy = - CandidateNetworkPolicy::kCandidateNetworkPolicyAll; - TcpCandidatePolicy tcp_candidate_policy = - TcpCandidatePolicy::kTcpCandidatePolicyEnabled; - - int ice_candidate_pool_size = 0; - - MediaSecurityType srtp_type = MediaSecurityType::kDTLS_SRTP; - SdpSemantics sdp_semantics = SdpSemantics::kUnifiedPlan; - bool offer_to_receive_audio = true; - bool offer_to_receive_video = true; - - bool disable_ipv6 = false; - bool disable_ipv6_on_wifi = false; - int max_ipv6_networks = 5; - bool disable_link_local_networks = false; - int screencast_min_bitrate = -1; - - // private - bool use_rtp_mux = true; - uint32_t local_audio_bandwidth = 128; - uint32_t local_video_bandwidth = 512; -}; - -struct SdpParseError { - public: - // The sdp line that causes the error. - string line; - // Explains the error. - string description; -}; - -enum DesktopType { kScreen, kWindow }; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_TYPES_HXX diff --git a/third_party/libwebrtc/include/rtc_video_device.h b/third_party/libwebrtc/include/rtc_video_device.h deleted file mode 100644 index 130849767c..0000000000 --- a/third_party/libwebrtc/include/rtc_video_device.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_VIDEO_DEVICE_HXX -#define LIB_WEBRTC_RTC_VIDEO_DEVICE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCVideoCapturer : public RefCountInterface { - public: - virtual ~RTCVideoCapturer() {} - - virtual bool StartCapture() = 0; - - virtual bool CaptureStarted() = 0; - - virtual void StopCapture() = 0; -}; - -class RTCVideoDevice : public RefCountInterface { - public: - virtual uint32_t NumberOfDevices() = 0; - - virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8, - uint32_t deviceNameLength, - char* deviceUniqueIdUTF8, - uint32_t deviceUniqueIdUTF8Length, - char* productUniqueIdUTF8 = 0, - uint32_t productUniqueIdUTF8Length = 0) = 0; - - virtual scoped_refptr Create(const char* name, - uint32_t index, size_t width, - size_t height, - size_t target_fps) = 0; - - protected: - virtual ~RTCVideoDevice() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_DEVICE_HXX diff --git a/third_party/libwebrtc/include/rtc_video_frame.h b/third_party/libwebrtc/include/rtc_video_frame.h deleted file mode 100644 index a69023f052..0000000000 --- a/third_party/libwebrtc/include/rtc_video_frame.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_VIDEO_FRAME_HXX -#define LIB_WEBRTC_RTC_VIDEO_FRAME_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCVideoFrame : public RefCountInterface { - public: - enum class Type { kARGB, kBGRA, kABGR, kRGBA }; - - enum VideoRotation { - kVideoRotation_0 = 0, - kVideoRotation_90 = 90, - kVideoRotation_180 = 180, - kVideoRotation_270 = 270 - }; - - public: - LIB_WEBRTC_API static scoped_refptr Create( - int width, int height, const uint8_t* buffer, int length); - - LIB_WEBRTC_API static scoped_refptr Create( - int width, int height, const uint8_t* data_y, int stride_y, - const uint8_t* data_u, int stride_u, const uint8_t* data_v, int stride_v); - - virtual scoped_refptr Copy() = 0; - - // The resolution of the frame in pixels. For formats where some planes are - // subsampled, this is the highest-resolution plane. - virtual int width() const = 0; - virtual int height() const = 0; - - virtual VideoRotation rotation() = 0; - - // Returns pointer to the pixel data for a given plane. The memory is owned by - // the VideoFrameBuffer object and must not be freed by the caller. - virtual const uint8_t* DataY() const = 0; - virtual const uint8_t* DataU() const = 0; - virtual const uint8_t* DataV() const = 0; - - // Returns the number of bytes between successive rows for a given plane. - virtual int StrideY() const = 0; - virtual int StrideU() const = 0; - virtual int StrideV() const = 0; - - virtual int ConvertToARGB(Type type, uint8_t* dst_argb, int dst_stride_argb, - int dest_width, int dest_height) = 0; - - protected: - virtual ~RTCVideoFrame() {} -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_FRAME_HXX diff --git a/third_party/libwebrtc/include/rtc_video_renderer.h b/third_party/libwebrtc/include/rtc_video_renderer.h deleted file mode 100644 index 7e81d463f6..0000000000 --- a/third_party/libwebrtc/include/rtc_video_renderer.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_VIDEO_RENDERER_HXX -#define LIB_WEBRTC_RTC_VIDEO_RENDERER_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -template -class RTCVideoRenderer { - public: - virtual ~RTCVideoRenderer() {} - - virtual void OnFrame(VideoFrameT frame) = 0; -}; - -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_RENDERER_HXX diff --git a/third_party/libwebrtc/include/rtc_video_source.h b/third_party/libwebrtc/include/rtc_video_source.h deleted file mode 100644 index cb61abbb49..0000000000 --- a/third_party/libwebrtc/include/rtc_video_source.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_VIDEO_SOURCE_HXX -#define LIB_WEBRTC_RTC_VIDEO_SOURCE_HXX - -#include "rtc_types.h" - -namespace libwebrtc { - -class RTCVideoSource : public RefCountInterface { - public: - ~RTCVideoSource() {} -}; -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_SOURCE_HXX diff --git a/third_party/libwebrtc/include/rtc_video_track.h b/third_party/libwebrtc/include/rtc_video_track.h deleted file mode 100644 index 46850c5861..0000000000 --- a/third_party/libwebrtc/include/rtc_video_track.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LIB_WEBRTC_RTC_VIDEO_TRACK_HXX -#define LIB_WEBRTC_RTC_VIDEO_TRACK_HXX - -#include "rtc_media_track.h" -#include "rtc_types.h" -#include "rtc_video_frame.h" -#include "rtc_video_renderer.h" - -namespace libwebrtc { - -class RTCVideoTrack : public RTCMediaTrack { - public: - virtual void AddRenderer( - RTCVideoRenderer>* renderer) = 0; - - virtual void RemoveRenderer( - RTCVideoRenderer>* renderer) = 0; - - protected: - ~RTCVideoTrack() {} -}; -} // namespace libwebrtc - -#endif // LIB_WEBRTC_RTC_VIDEO_TRACK_HXX diff --git a/third_party/libwebrtc/lib/elinux-arm64/libwebrtc.so b/third_party/libwebrtc/lib/elinux-arm64/libwebrtc.so deleted file mode 120000 index 6f27e3aef9..0000000000 --- a/third_party/libwebrtc/lib/elinux-arm64/libwebrtc.so +++ /dev/null @@ -1 +0,0 @@ -../linux-arm64/libwebrtc.so \ No newline at end of file diff --git a/third_party/libwebrtc/lib/elinux-x64/libwebrtc.so b/third_party/libwebrtc/lib/elinux-x64/libwebrtc.so deleted file mode 120000 index 8d3fde68ca..0000000000 --- a/third_party/libwebrtc/lib/elinux-x64/libwebrtc.so +++ /dev/null @@ -1 +0,0 @@ -../linux-x64/libwebrtc.so \ No newline at end of file diff --git a/third_party/libwebrtc/lib/linux-arm64/libwebrtc.so b/third_party/libwebrtc/lib/linux-arm64/libwebrtc.so deleted file mode 100755 index 9ff7018adb..0000000000 Binary files a/third_party/libwebrtc/lib/linux-arm64/libwebrtc.so and /dev/null differ diff --git a/third_party/libwebrtc/lib/linux-x64/libwebrtc.so b/third_party/libwebrtc/lib/linux-x64/libwebrtc.so deleted file mode 100755 index 19e93a1662..0000000000 Binary files a/third_party/libwebrtc/lib/linux-x64/libwebrtc.so and /dev/null differ diff --git a/third_party/libwebrtc/lib/win64/libwebrtc.dll b/third_party/libwebrtc/lib/win64/libwebrtc.dll deleted file mode 100644 index 665183e7b6..0000000000 Binary files a/third_party/libwebrtc/lib/win64/libwebrtc.dll and /dev/null differ diff --git a/third_party/libwebrtc/lib/win64/libwebrtc.dll.lib b/third_party/libwebrtc/lib/win64/libwebrtc.dll.lib deleted file mode 100644 index c982e9577b..0000000000 Binary files a/third_party/libwebrtc/lib/win64/libwebrtc.dll.lib and /dev/null differ diff --git a/webrtc.iml b/webrtc.iml deleted file mode 100644 index dc7eab90a0..0000000000 --- a/webrtc.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/webrtc_android.iml b/webrtc_android.iml deleted file mode 100644 index 0ebb6c9fe7..0000000000 --- a/webrtc_android.iml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index bb6405767f..8410fd79c2 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 3.15) set(PROJECT_NAME "flutter_webrtc") project(${PROJECT_NAME} LANGUAGES CXX) +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + +# Add the libwebrtc dependency +include("${CMAKE_CURRENT_SOURCE_DIR}/../third_party/CMakeLists.txt") + # This value is used when generating builds using this plugin, so it must # not be changed set(PLUGIN_NAME "flutter_webrtc_plugin")