diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 808ff7be9e..0d602d1b01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,7 @@ jobs: - macos - windows runs-on: ${{ (matrix.platform == 'windows' && 'windows-latest') - || 'macos-11' }} + || 'macos-13' }} steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@v1 @@ -151,7 +151,7 @@ jobs: # Pin Xcode version for better compatibility. - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: "12.4" + xcode-version: "15.2" if: ${{ matrix.platform == 'macos' }} - run: make cargo.build platform=${{ matrix.platform }} debug=no @@ -217,6 +217,7 @@ jobs: - windows runs-on: ${{ (matrix.platform == 'linux' && 'ubuntu-latest') || (matrix.platform == 'windows' && 'windows-latest') + || (matrix.platform == 'ios' && 'macos-14') || 'macos-13' }} steps: - uses: actions/checkout@v4 @@ -259,6 +260,40 @@ jobs: script: make flutter.test.mobile if: ${{ matrix.platform == 'android' }} + - name: Add TCC permissions on macOS + run: | + configure_user_tccdb () { + local values=$1 + local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db" + local sqlQuery="INSERT OR REPLACE INTO access VALUES($values);" + sqlite3 "$dbPath" "$sqlQuery" + } + + configure_sys_tccdb () { + local values=$1 + local dbPath="/Library/Application Support/com.apple.TCC/TCC.db" + local sqlQuery="INSERT OR REPLACE INTO access VALUES($values);" + sudo sqlite3 "$dbPath" "$sqlQuery" + } + + userValuesArray=( + "'kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159" + "'kTCCServiceCamera','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159" + "'kTCCServiceBluetoothAlways','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159" + ) + for values in "${userValuesArray[@]}"; do + # Sonoma and higher have a few extra values: + # https://github.com/actions/runner-images/blob/main/images/macos/scripts/build/configure-tccdb-macos.sh + if [ "$OSTYPE" = "darwin23" ]; then + configure_user_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}" + configure_sys_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}" + else + configure_user_tccdb "$values" + configure_sys_tccdb "$values" + fi + done + if: ${{ matrix.platform == 'ios' }} + - name: Start iOS simulator id: simulator uses: futureware-tech/simulator-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 84dc7f18ee..860a8b6ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ All user visible changes to this project will be documented in this file. This p ### Changed -- Upgraded [libwebrtc] to [123.0.6312.105] version. ([#155]) +- Upgraded [libwebrtc] to [126.0.6478.182-r2] version. ([#155], [#162]) - Disable [H264] software encoders and decoders. ([#153]) ### Fixed @@ -44,7 +44,8 @@ All user visible changes to this project will be documented in this file. This p [#153]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/153 [#155]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/155 [#156]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/156 -[123.0.6312.105]: https://github.com/instrumentisto/libwebrtc-bin/releases/tag/123.0.6312.105 +[#162]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/162 +[126.0.6478.182-r2]: https://github.com/instrumentisto/libwebrtc-bin/releases/tag/126.0.6478.182-r2 diff --git a/Cargo.lock b/Cargo.lock index abe5d56f1b..1e88c4ce7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -654,7 +654,7 @@ dependencies = [ [[package]] name = "libwebrtc-sys" -version = "0.0.0+123.0.6312.105" +version = "0.0.0+126.0.6478.182-r2" dependencies = [ "anyhow", "cxx", diff --git a/README.md b/README.md index 72b277ed25..a34d5c3503 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Medea Flutter-WebRTC ==================== [![pub](https://img.shields.io/pub/v/medea_flutter_webrtc "pub")](https://pub.dev/packages/medea_flutter_webrtc) -[![libwebrtc](https://img.shields.io/badge/libwebrtc-123.0.6312.105-blue "libwebrtc")](https://github.com/instrumentisto/libwebrtc-bin/releases/tag/123.0.6312.105) +[![libwebrtc](https://img.shields.io/badge/libwebrtc-126.0.6478.182-r2-blue "libwebrtc")](https://github.com/instrumentisto/libwebrtc-bin/releases/tag/126.0.6478.182-r2) [![OpenAL](https://img.shields.io/badge/OpenAL-1.23.1-blue "OpenAL")](https://github.com/kcat/openal-soft/releases/tag/1.23.1) [Changelog](https://github.com/instrumentisto/medea-flutter-webrtc/blob/main/CHANGELOG.md) diff --git a/android/build.gradle b/android/build.gradle index cdc1df3620..98a72c8710 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -53,7 +53,7 @@ android { } dependencies { - implementation 'com.github.instrumentisto:libwebrtc-bin:123.0.6312.105@aar' + implementation 'com.github.instrumentisto:libwebrtc-bin:126.0.6478.182-r2@aar' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' } diff --git a/crates/libwebrtc-sys/Cargo.toml b/crates/libwebrtc-sys/Cargo.toml index 9de18a07fd..6dd9944547 100644 --- a/crates/libwebrtc-sys/Cargo.toml +++ b/crates/libwebrtc-sys/Cargo.toml @@ -1,11 +1,14 @@ [package] name = "libwebrtc-sys" -version = "0.0.0+123.0.6312.105" +version = "0.0.0+126.0.6478.182-r2" edition = "2021" rust-version = "1.62" publish = false links = "webrtc" +[features] +fake-media = [] + [dependencies] anyhow = "1.0" cxx = "1.0" diff --git a/crates/libwebrtc-sys/build.rs b/crates/libwebrtc-sys/build.rs index bfb0207b9b..dda41e46fa 100644 --- a/crates/libwebrtc-sys/build.rs +++ b/crates/libwebrtc-sys/build.rs @@ -23,7 +23,7 @@ use walkdir::{DirEntry, WalkDir}; /// [`libwebrtc-bin`]: https://github.com/instrumentisto/libwebrtc-bin static LIBWEBRTC_URL: &str = "https://github.com/instrumentisto/libwebrtc-bin/releases/download\ - /123.0.6312.105"; + /126.0.6478.182-r2"; /// URL for downloading `openal-soft` source code. static OPENAL_URL: &str = @@ -90,7 +90,7 @@ fn main() -> anyhow::Result<()> { build.flag("-DWEBRTC_WIN").flag("/std:c++20"); } - #[cfg(feature = "fake_media")] + #[cfg(feature = "fake-media")] { build.flag("-DFAKE_MEDIA"); } @@ -120,19 +120,19 @@ fn get_target() -> anyhow::Result { fn get_expected_libwebrtc_hash() -> anyhow::Result<&'static str> { Ok(match get_target()?.as_str() { "aarch64-unknown-linux-gnu" => { - "db6504b732fcc59541ea37279ff1e2ce8bc6c7c7018ac2973b782e69d3702889" + "f35ef4076a4c6a9adce54717f14c7408a5a3e2d9e09c3f112a70a823b7369933" } "x86_64-unknown-linux-gnu" => { - "6b212cc8f91fb1e4ec8358ab1f9c2147e39f0e655bb1f6521df2a84239da95bd" + "9bc1995fcd28d6b26191717a92bae64e13e583d15e8c582322527b43be2b7c84" } "aarch64-apple-darwin" => { - "cac4b30b08c95751ab0c299d1f8bb3552df0b7a50dc90b9741fa893a8f9b412e" + "8e135face9e03b3f90c9fd73d02bc9a024fe9f1ac07fd8aa6d4c1dfaef61de86" } "x86_64-apple-darwin" => { - "f2ed68ac50750b609f3371c7e38d4fd6931a234d36523b36f516b127a5c1fb49" + "0ffcee42398804e27408f1c4acadefce69f88e425ac311eda8a6ff0f9da12eb1" } "x86_64-pc-windows-msvc" => { - "6604e95fe102bc62e45da3230aabfb088cfdf3cc2859f3ced310136466d658b0" + "7dda117194077d0408d9e644014cca499f80dd4df4c78dc069ba09ac4b95549a" } arch => return Err(anyhow::anyhow!("Unsupported target: {arch}")), }) diff --git a/crates/libwebrtc-sys/src/bridge.rs b/crates/libwebrtc-sys/src/bridge.rs index eebf05ef47..0602d62d97 100644 --- a/crates/libwebrtc-sys/src/bridge.rs +++ b/crates/libwebrtc-sys/src/bridge.rs @@ -2811,6 +2811,7 @@ pub(crate) mod webrtc { /// # Safety /// /// Caller must ensure that the provided `buffer` is large enough. + #[allow(clippy::missing_safety_doc)] // false positive pub unsafe fn video_frame_to_abgr(frame: &VideoFrame, buffer: *mut u8); /// Converts the provided [`webrtc::VideoFrame`] pixels to the `ARGB` @@ -2819,6 +2820,7 @@ pub(crate) mod webrtc { /// # Safety /// /// Caller must ensure that the provided `buffer` is large enough. + #[allow(clippy::missing_safety_doc)] // false positive pub unsafe fn video_frame_to_argb( frame: &VideoFrame, argb_stride: i32, diff --git a/crates/native/src/devices.rs b/crates/native/src/devices.rs index 5d478dd982..828464703a 100644 --- a/crates/native/src/devices.rs +++ b/crates/native/src/devices.rs @@ -445,7 +445,10 @@ pub mod linux_device_change { pub struct AudioMonitor { /// [PulseAudio] context. /// - /// [PulseAudio]: https://freedesktop.org/wiki/Software/PulseAudio + /// [PulseAudio]: https://freedesktop.org/wiki/Software/PulseAudio`. + // It's not read, but is required to live for correct destruction of + // the PulseAudio `Context`. + #[allow(dead_code)] // for destruction pub context: Context, /// [PulseAudio] main loop. diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e105df..7c56964006 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index d84196b585..0228b7c211 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,13 +1,11 @@ PODS: - Flutter (1.0.0) - - instrumentisto-libwebrtc-bin (123.0.6312.105) + - instrumentisto-libwebrtc-bin (126.0.6478.182-r2) - integration_test (0.0.1): - Flutter - - libyuv-iOS (1.0.2) - medea_flutter_webrtc (0.10.0-dev): - Flutter - - instrumentisto-libwebrtc-bin (= 123.0.6312.105) - - libyuv-iOS + - instrumentisto-libwebrtc-bin (= 126.0.6478.182-r2) DEPENDENCIES: - Flutter (from `Flutter`) @@ -17,7 +15,6 @@ DEPENDENCIES: SPEC REPOS: trunk: - instrumentisto-libwebrtc-bin - - libyuv-iOS EXTERNAL SOURCES: Flutter: @@ -28,11 +25,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/medea_flutter_webrtc/ios" SPEC CHECKSUMS: - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - instrumentisto-libwebrtc-bin: 295e1721ff9a8ccfc030c0de5f095c7d6b3e53ce - integration_test: 13825b8a9334a850581300559b8839134b124670 - libyuv-iOS: 5a154ccc84ec754029886ecb607512731fe30640 - medea_flutter_webrtc: ca2335744f08d45963f26f8db159c6dcd19a31a3 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + instrumentisto-libwebrtc-bin: 146854184f62ca80d79ff3d95bf9446eff5e54a9 + integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4 + medea_flutter_webrtc: 37c4a65c3d4709bea5a612f655c79b4cf143cee7 PODFILE CHECKSUM: be3ab4e988bb308d23906be69146fcbef66fac55 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 13f4b0ac6f..a31d25a3f4 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -143,7 +143,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a6b826db27..5e31d3d342 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ (OpaquePointer(dst)), - Int32(bytesPerRow), - buffer.width, - buffer.height + RTCYUVHelper.i420( + toARGB: buffer.dataY, + srcStrideY: buffer.strideY, + srcU: buffer.dataU, + srcStrideU: buffer.strideU, + srcV: buffer.dataV, + srcStrideV: buffer.strideV, + dstARGB: UnsafeMutablePointer(OpaquePointer(dst)), + dstStrideARGB: Int32(bytesPerRow), + width: buffer.width, + height: buffer.height ) CVPixelBufferUnlockBaseAddress( self.pixelBuffer!, diff --git a/ios/Classes/MedeaFlutterWebrtcPlugin.h b/ios/Classes/MedeaFlutterWebrtcPlugin.h index 0faf4b60af..ef7fdb93f6 100644 --- a/ios/Classes/MedeaFlutterWebrtcPlugin.h +++ b/ios/Classes/MedeaFlutterWebrtcPlugin.h @@ -4,33 +4,3 @@ @interface MedeaFlutterWebrtcPlugin : NSObject @end -bool libyuv_I420ToARGB( - const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, - int width, - int height -); - -void libyuv_I420Rotate( - const uint8_t* srcY, - int srcStrideY, - const uint8_t* srcU, - int srcStrideU, - const uint8_t* srcV, - int srcStrideV, - uint8_t* dstY, - int dstStrideY, - uint8_t* dstU, - int dstStrideU, - uint8_t* dstV, - int dstStrideV, - int width, - int height, - RTCVideoRotation mode -); diff --git a/ios/Classes/MedeaFlutterWebrtcPlugin.m b/ios/Classes/MedeaFlutterWebrtcPlugin.m index 2e46709b76..7f7f6929e5 100644 --- a/ios/Classes/MedeaFlutterWebrtcPlugin.m +++ b/ios/Classes/MedeaFlutterWebrtcPlugin.m @@ -1,5 +1,4 @@ #import "MedeaFlutterWebrtcPlugin.h" -#include "libyuv.h" #if __has_include() #import #else @@ -15,64 +14,3 @@ + (void)registerWithRegistrar:(NSObject*)registrar { } @end -bool libyuv_I420ToARGB( - const uint8_t* src_y, - int src_stride_y, - const uint8_t* src_u, - int src_stride_u, - const uint8_t* src_v, - int src_stride_v, - uint8_t* dst_argb, - int dst_stride_argb, - int width, - int height -) { - return I420ToARGB( - src_y, - src_stride_y, - src_u, - src_stride_u, - src_v, - src_stride_v, - dst_argb, - dst_stride_argb, - width, - height - ) == 0; -} - -void libyuv_I420Rotate( - const uint8_t* srcY, - int srcStrideY, - const uint8_t* srcU, - int srcStrideU, - const uint8_t* srcV, - int srcStrideV, - uint8_t* dstY, - int dstStrideY, - uint8_t* dstU, - int dstStrideU, - uint8_t* dstV, - int dstStrideV, - int width, - int height, - RTCVideoRotation mode -) { - I420Rotate( - srcY, - srcStrideY, - srcU, - srcStrideU, - srcV, - srcStrideV, - dstY, - dstStrideY, - dstU, - dstStrideU, - dstV, - dstStrideV, - width, - height, - (RotationModeEnum)mode - ); -} diff --git a/ios/Classes/MediaDevices.swift b/ios/Classes/MediaDevices.swift index 8646a54b2d..9af24f5295 100644 --- a/ios/Classes/MediaDevices.swift +++ b/ios/Classes/MediaDevices.swift @@ -18,6 +18,7 @@ class MediaDevices { AVAudioSession.Category.playAndRecord, options: AVAudioSession.CategoryOptions.allowBluetooth ) + try! AVAudioSession.sharedInstance().setActive(true) self.state = state NotificationCenter.default.addObserver( forName: AVAudioSession.routeChangeNotification, object: nil, diff --git a/ios/medea_flutter_webrtc.podspec b/ios/medea_flutter_webrtc.podspec index afb3e4fd6c..edee7bfbe2 100644 --- a/ios/medea_flutter_webrtc.podspec +++ b/ios/medea_flutter_webrtc.podspec @@ -15,8 +15,7 @@ Flutter WebRTC plugin based on Google WebRTC. s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'instrumentisto-libwebrtc-bin', '123.0.6312.105' - s.dependency 'libyuv-iOS' + s.dependency 'instrumentisto-libwebrtc-bin', '126.0.6478.182-r2' s.platform = :ios, '13.0' s.static_framework = true