Skip to content

Commit

Permalink
Upgrade libwebrtc to 123.0.6312.105 version (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogurotus committed May 3, 2024
1 parent c742876 commit 041267d
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ doc-valid-idents = [
"OAuth", "OpenAL", "OpenGL", "OpenSSH", "OpenSSL", "OpenStreetMap",
"TrueType",
"iOS", "macOS", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW",
"AOMedia",
"BigInt64Array", "BigUint64Array",
"ConstrainDOMString", "ConstrainULong",
"DisplayMediaStreamConstraints",
Expand All @@ -20,6 +21,7 @@ doc-valid-idents = [
"MediaTrackConstraints",
"MessageEvent",
"PulseAudio",
"RtcP",
"RTCAudioSenderStats",
"RTCBundlePolicy",
"RTCConfiguration",
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ All user visible changes to this project will be documented in this file. This p

### Changed

- Upgraded [libwebrtc] to [122.0.6261.94] version. ([#137])
- Upgraded [libwebrtc] to [123.0.6312.105] version. ([#155])

### Fixed

Expand All @@ -39,7 +39,8 @@ All user visible changes to this project will be documented in this file. This p
[#146]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/146
[#149]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/149
[#151]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/151
[122.0.6261.94]: https://github.com/instrumentisto/libwebrtc-bin/releases/tag/122.0.6261.94
[#155]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/155
[123.0.6312.105]: https://github.com/instrumentisto/libwebrtc-bin/releases/tag/123.0.6312.105



Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-122.0.6261.94-blue "libwebrtc")](https://github.com/instrumentisto/libwebrtc-bin/releases/tag/122.0.6261.94)
[![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)
[![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)
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {
}

dependencies {
implementation 'com.github.instrumentisto:libwebrtc-bin:122.0.6261.94@aar'
implementation 'com.github.instrumentisto:libwebrtc-bin:123.0.6312.105@aar'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package com.instrumentisto.medea_flutter_webrtc.model
*/
data class HeaderExtensionCapability(
val uri: String,
val preferredId: Int,
val preferredId: Int?,
val preferredEncrypted: Boolean,
) {
companion object {
Expand All @@ -30,9 +30,11 @@ data class HeaderExtensionCapability(
* Converts this [HeaderExtensionCapability] into a [Map] which can be returned to the Flutter
* side.
*/
fun asFlutterResult(): Map<String, Any> {
fun asFlutterResult(): Map<String, Any?> {
return mapOf(
"uri" to uri, "preferredId" to preferredId, "preferredEncrypted" to preferredEncrypted)
"uri" to uri,
"preferredId" to preferredId as Any?,
"preferredEncrypted" to preferredEncrypted)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/libwebrtc-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libwebrtc-sys"
version = "0.0.0+122.0.6261.94"
version = "0.0.0+123.0.6312.105"
edition = "2021"
rust-version = "1.62"
publish = false
Expand Down
12 changes: 6 additions & 6 deletions crates/libwebrtc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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\
/122.0.6261.94";
/123.0.6312.105";

/// URL for downloading `openal-soft` source code.
static OPENAL_URL: &str =
Expand Down Expand Up @@ -121,19 +121,19 @@ fn get_target() -> anyhow::Result<String> {
fn get_expected_libwebrtc_hash() -> anyhow::Result<&'static str> {
Ok(match get_target()?.as_str() {
"aarch64-unknown-linux-gnu" => {
"eaea5e677d6815f1f6933db3211ba3ebf5f78e081ee2dc7bff253281b87d4c0e"
"db6504b732fcc59541ea37279ff1e2ce8bc6c7c7018ac2973b782e69d3702889"
}
"x86_64-unknown-linux-gnu" => {
"9f9069c7e5d5eb1af5a79705bde54e7f6cb0a2508b5d5c7e1fea86d30d99494c"
"6b212cc8f91fb1e4ec8358ab1f9c2147e39f0e655bb1f6521df2a84239da95bd"
}
"aarch64-apple-darwin" => {
"738eb716752164c0e56654db361593fff6064bd4f753bfa1ea5d7609d85ff6f6"
"cac4b30b08c95751ab0c299d1f8bb3552df0b7a50dc90b9741fa893a8f9b412e"
}
"x86_64-apple-darwin" => {
"f786b7c840750ef68e1d5fc499a3c496b8526f08d0a1c81cc0839b7b3824c431"
"f2ed68ac50750b609f3371c7e38d4fd6931a234d36523b36f516b127a5c1fb49"
}
"x86_64-pc-windows-msvc" => {
"2ed26bdfc523bc54168daf647c5f2a5afd0a4ee151850ff6f8c2b9373feb6d37"
"6604e95fe102bc62e45da3230aabfb088cfdf3cc2859f3ced310136466d658b0"
}
arch => return Err(anyhow::anyhow!("Unsupported target: {arch}")),
})
Expand Down
1 change: 1 addition & 0 deletions crates/libwebrtc-sys/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2220,6 +2220,7 @@ pub(crate) mod webrtc {
);
}

#[allow(dead_code)]
#[rustfmt::skip]
unsafe extern "C++" {
pub type RTCMediaSourceStats;
Expand Down
8 changes: 0 additions & 8 deletions example/integration_test/webrtc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ void main() {
var offer = (await pc1.createOffer()).description;

var codecs = ['VP8/90000', 'VP9/90000', 'AV1/90000'];
if (!Platform.isAndroid) {
codecs.add('H264/90000');
}

for (var codec in codecs) {
var reg = RegExp(r'a=rtpmap:\d{2,3} ' + codec);
Expand Down Expand Up @@ -239,11 +236,6 @@ void main() {
if (!Platform.isAndroid && !Platform.isIOS) {
var capabilities = await RtpSender.getCapabilities(MediaKind.video);

expect(
capabilities.codecs
.where((cap) => cap.mimeType == 'video/H264')
.firstOrNull,
isNotNull);
expect(
capabilities.codecs
.where((cap) => cap.mimeType == 'video/VP9')
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- Flutter (1.0.0)
- instrumentisto-libwebrtc-bin (122.0.6261.94)
- instrumentisto-libwebrtc-bin (123.0.6312.105)
- integration_test (0.0.1):
- Flutter
- libyuv-iOS (1.0.2)
- medea_flutter_webrtc (0.10.0-dev):
- Flutter
- instrumentisto-libwebrtc-bin (= 122.0.6261.94)
- instrumentisto-libwebrtc-bin (= 123.0.6312.105)
- libyuv-iOS

DEPENDENCIES:
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/controller/RtpTransceiverController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RtpTransceiverController {
codec["preferredPayloadType"] as? NSNumber
capability.clockRate = codec["clockRate"] as? NSNumber
capability.kind =
MediaType(rawValue: codec["kind"] as! Int)!.intoWebRtc()
MediaType(rawValue: codec["kind"] as! Int)!.toString()
capability.numChannels = codec["numChannels"] as? NSNumber
capability.parameters = codec["parameters"] as! [String: String]
return capability
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/model/Capabilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class HeaderExtensionCapability {
var uri: String

/// Preferred value of ID that goes in the packet.
var preferredId: Int
var preferredId: Int?

/// If `true`, it's preferred that the value in the header is encrypted.
var preferredEncrypted: Bool

init(uri: String, preferredId: Int, preferredEncrypted: Bool) {
init(uri: String, preferredId: Int?, preferredEncrypted: Bool) {
self.uri = uri
self.preferredId = preferredId
self.preferredEncrypted = preferredEncrypted
Expand Down
31 changes: 25 additions & 6 deletions ios/Classes/model/MediaType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,27 @@ enum MediaType: Int {
/// Video media.
case video

static func fromWebRtc(kind: RTCRtpMediaType)
-> MediaType
{
/// Converts the provided `RTCRtpMediaType` into a `MediaType`.
static func fromWebRtc(kind: RTCRtpMediaType) -> MediaType? {
switch kind {
case .audio:
return MediaType.audio
case .video:
return MediaType.video
case .data:
return MediaType.video
case .unsupported:
default:
return nil
}
}

/// Creates this `RTCRTPMediaType` from `String`.
static func fromString(kind: String) -> MediaType? {
switch kind {
case "audio":
return MediaType.audio
case "video":
return MediaType.video
default:
return nil
}
}

Expand All @@ -32,4 +41,14 @@ enum MediaType: Int {
return RTCRtpMediaType.video
}
}

/// Converts this `MediaType` into a `String`.
func toString() -> String {
switch self {
case .audio:
return "audio"
case .video:
return "video"
}
}
}
16 changes: 10 additions & 6 deletions ios/Classes/proxy/PeerConnectionFactoryProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ class PeerConnectionFactoryProxy {

/// Returns sender capabilities of this factory.
func rtpSenderCapabilities(kind: RTCRtpMediaType) -> RtpCapabilities {
var capabilities = self.factory
.rtpSenderCapabilities(for: kind)
var capabilities =
self.factory
.rtpSenderCapabilities(
forKind: MediaType.fromWebRtc(kind: kind)!.toString()
)

return RtpCapabilities(
codecs: capabilities.codecs.map { codec -> CodecCapability in
var preferredPayloadType: Int = (codec.preferredPayloadType != nil) ?
Int(codec.preferredPayloadType!) : 0
var kind = MediaType.fromWebRtc(kind: codec.kind)
var kind = MediaType.fromString(kind: codec.kind)!
var clockRate = (codec.clockRate != nil) ? Int(codec.clockRate!) : 0
var numChannels: Int? = (codec.numChannels != nil) ?
Int(codec.numChannels!) : nil
Expand All @@ -42,13 +45,14 @@ class PeerConnectionFactoryProxy {
mimeType: codec.mimeType
)
},
headerExtensions: capabilities.header_extensions
headerExtensions: capabilities.headerExtensions
.map { header -> HeaderExtensionCapability in
var preferredId = Int(header.preferred_id)
var preferredId =
(header.preferredId != nil) ? Int(header.preferredId!) : nil
return HeaderExtensionCapability(
uri: header.uri,
preferredId: preferredId,
preferredEncrypted: header.preferred_encrypt
preferredEncrypted: header.isPreferredEncrypted
)
}
)
Expand Down
2 changes: 1 addition & 1 deletion ios/medea_flutter_webrtc.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Flutter WebRTC plugin based on Google WebRTC.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'instrumentisto-libwebrtc-bin', '122.0.6261.94'
s.dependency 'instrumentisto-libwebrtc-bin', '123.0.6312.105'
s.dependency 'libyuv-iOS'
s.platform = :ios, '13.0'
s.static_framework = true
Expand Down

0 comments on commit 041267d

Please sign in to comment.