From fbf22333838a0e7b7e00d19529097728ec09c453 Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Wed, 17 Jan 2024 14:32:38 +0100 Subject: [PATCH 1/9] Add HW support probing --- .../controller/PeerConnectionFactoryController.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ios/Classes/controller/PeerConnectionFactoryController.swift b/ios/Classes/controller/PeerConnectionFactoryController.swift index 77de8fdcf1..15a5b5e560 100644 --- a/ios/Classes/controller/PeerConnectionFactoryController.swift +++ b/ios/Classes/controller/PeerConnectionFactoryController.swift @@ -1,4 +1,5 @@ import Flutter +import VideoToolbox /// Controller of a `PeerConnection` factory management. class PeerConnectionFactoryController { @@ -61,16 +62,18 @@ class PeerConnectionFactoryController { codec: VideoCodec.VP8 ), VideoCodecInfo( - isHardwareAccelerated: false, - codec: VideoCodec.VP9 + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), + kind: VideoCodec.VP9, + mymeType: "video/VP9" ), VideoCodecInfo( isHardwareAccelerated: false, codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: true, - codec: VideoCodec.H264 + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), + kind: VideoCodec.H264, + mymeType: "video/H264" ), ].map { $0.asFlutterResult() From 38bcf79f152fcb37b7a48c54ace5a33d34fa9d5a Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Fri, 19 Jan 2024 10:21:17 +0100 Subject: [PATCH 2/9] Fix probing --- .../controller/PeerConnectionFactoryController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Classes/controller/PeerConnectionFactoryController.swift b/ios/Classes/controller/PeerConnectionFactoryController.swift index 15a5b5e560..5da4e562e4 100644 --- a/ios/Classes/controller/PeerConnectionFactoryController.swift +++ b/ios/Classes/controller/PeerConnectionFactoryController.swift @@ -62,7 +62,7 @@ class PeerConnectionFactoryController { codec: VideoCodec.VP8 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), + isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_VP9), kind: VideoCodec.VP9, mymeType: "video/VP9" ), @@ -71,7 +71,7 @@ class PeerConnectionFactoryController { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), + isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_H264), kind: VideoCodec.H264, mymeType: "video/H264" ), @@ -86,7 +86,7 @@ class PeerConnectionFactoryController { codec: VideoCodec.VP8 ), VideoCodecInfo( - isHardwareAccelerated: false, + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), codec: VideoCodec.VP9 ), VideoCodecInfo( @@ -94,7 +94,7 @@ class PeerConnectionFactoryController { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: true, + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), codec: VideoCodec.H264 ), ].map { From d6f5154323a151b2fee969e2d0444be49866fb88 Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Fri, 19 Jan 2024 11:12:19 +0100 Subject: [PATCH 3/9] More correct probing --- .../PeerConnectionFactoryController.swift | 45 +----------------- .../proxy/PeerConnectionFactoryProxy.swift | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+), 43 deletions(-) diff --git a/ios/Classes/controller/PeerConnectionFactoryController.swift b/ios/Classes/controller/PeerConnectionFactoryController.swift index 5da4e562e4..a3ea341669 100644 --- a/ios/Classes/controller/PeerConnectionFactoryController.swift +++ b/ios/Classes/controller/PeerConnectionFactoryController.swift @@ -1,5 +1,4 @@ import Flutter -import VideoToolbox /// Controller of a `PeerConnection` factory management. class PeerConnectionFactoryController { @@ -56,50 +55,10 @@ class PeerConnectionFactoryController { ) result(peer.asFlutterResult()) case "videoEncoders": - let res = [ - VideoCodecInfo( - isHardwareAccelerated: false, - codec: VideoCodec.VP8 - ), - VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_VP9), - kind: VideoCodec.VP9, - mymeType: "video/VP9" - ), - VideoCodecInfo( - isHardwareAccelerated: false, - codec: VideoCodec.AV1 - ), - VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_H264), - kind: VideoCodec.H264, - mymeType: "video/H264" - ), - ].map { - $0.asFlutterResult() - } + let res = self.peerFactory.videoEncoders().map { $0.asFlutterResult() } result(res) case "videoDecoders": - let res = [ - VideoCodecInfo( - isHardwareAccelerated: false, - codec: VideoCodec.VP8 - ), - VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), - codec: VideoCodec.VP9 - ), - VideoCodecInfo( - isHardwareAccelerated: false, - codec: VideoCodec.AV1 - ), - VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), - codec: VideoCodec.H264 - ), - ].map { - $0.asFlutterResult() - } + let res = self.peerFactory.videoDecoders().map { $0.asFlutterResult() } result(res) case "dispose": self.channel.setMethodCallHandler(nil) diff --git a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift index 5f1b3dbe46..43a0911141 100644 --- a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift +++ b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift @@ -1,3 +1,4 @@ +import VideoToolbox import WebRTC /// Creator of new `PeerConnectionProxy`s. @@ -42,6 +43,52 @@ class PeerConnectionFactoryProxy { return peerProxy } + /// Returns list containing information about video encoders for the different video codecs. + func videoEncoders() -> [VideoCodecInfo] { + [ + VideoCodecInfo( + isHardwareAccelerated: false, + codec: VideoCodec.VP8 + ), + VideoCodecInfo( + isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_VP9), + kind: VideoCodec.VP9, + mymeType: "video/VP9" + ), + VideoCodecInfo( + isHardwareAccelerated: false, + codec: VideoCodec.AV1 + ), + VideoCodecInfo( + isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_H264), + kind: VideoCodec.H264, + mymeType: "video/H264" + ), + ] + } + + /// Returns list containing information about video encoders for the different video codecs. + func audioEncoders() -> [VideoCodecInfo] { + [ + VideoCodecInfo( + isHardwareAccelerated: false, + codec: VideoCodec.VP8 + ), + VideoCodecInfo( + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), + codec: VideoCodec.VP9 + ), + VideoCodecInfo( + isHardwareAccelerated: false, + codec: VideoCodec.AV1 + ), + VideoCodecInfo( + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), + codec: VideoCodec.H264 + ), + ] + } + /// Removes the specified [PeerObserver] from the [peerObservers]. private func remotePeerObserver(id: Int) { self.peerObservers.removeValue(forKey: id) From 0260af569a7940d436872caba624df0a8e2e9627 Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 22 Jan 2024 13:16:37 +0100 Subject: [PATCH 4/9] WIP --- ios/Classes/State.swift | 40 +++++++++++++++++++ .../proxy/PeerConnectionFactoryProxy.swift | 12 +++--- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/ios/Classes/State.swift b/ios/Classes/State.swift index f83f0577cf..be9ffdf5b3 100644 --- a/ios/Classes/State.swift +++ b/ios/Classes/State.swift @@ -1,5 +1,45 @@ import WebRTC +class RTCMyVP8VideoDecoderFactory: NSObject, RTCVideoDecoderFactory { + func supportedCodecs() -> [RTCVideoCodecInfo] { + var codecs: [RTCVideoCodecInfo] = [] + let codecName = kRTCVp8CodecName + + let vp8CodecInfo = RTCVideoCodecInfo(name: codecName) + codecs.append(vp8CodecInfo) + + return codecs + } + + func createDecoder(_ info: RTCVideoCodecInfo) -> RTCVideoDecoder? { + // if (info.name == kRTCVideoCodecVp8Name) { + // return RTCVideoEncoderVP8.vp8Encoder() + // } + + return nil + } +} + +class RTCMyVP8VideoEncoderFactory: NSObject, RTCVideoEncoderFactory { + func supportedCodecs() -> [RTCVideoCodecInfo] { + var codecs: [RTCVideoCodecInfo] = [] + let codecName = kRTCVp8CodecName + + let vp8CodecInfo = RTCVideoCodecInfo(name: codecName) + codecs.append(vp8CodecInfo) + + return codecs + } + + func createEncoder(_ info: RTCVideoCodecInfo) -> RTCVideoEncoder? { + if (info.name == kRTCVideoCodecVp8Name) { + return RTCVideoEncoderVP8.vp8Encoder() + } + + return nil + } +} + /// Global context of the `medea_flutter_webrtc` plugin. /// /// Used for creating tracks/peers. diff --git a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift index 43a0911141..7b09a5ef74 100644 --- a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift +++ b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift @@ -51,24 +51,22 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.VP8 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_VP9), - kind: VideoCodec.VP9, - mymeType: "video/VP9" + isHardwareAccelerated: false, + codec: VideoCodec.VP9 ), VideoCodecInfo( isHardwareAccelerated: false, codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareEncodeSupported(kCMVideoCodecType_H264), - kind: VideoCodec.H264, - mymeType: "video/H264" + isHardwareAccelerated: false, + codec: VideoCodec.H264 ), ] } /// Returns list containing information about video encoders for the different video codecs. - func audioEncoders() -> [VideoCodecInfo] { + func videoDecoders() -> [VideoCodecInfo] { [ VideoCodecInfo( isHardwareAccelerated: false, From 61a4da1b2c89368ce52232cddde6d226674bf14d Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 29 Jan 2024 11:07:06 +0100 Subject: [PATCH 5/9] Impl basic encoder/decoder factories --- ios/Classes/MedeaVideoDecoderFactory.swift | 41 +++++++++++++++++++++ ios/Classes/MedeaVideoEncoderFactory.swift | 42 ++++++++++++++++++++++ ios/Classes/State.swift | 4 +-- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 ios/Classes/MedeaVideoDecoderFactory.swift create mode 100644 ios/Classes/MedeaVideoEncoderFactory.swift diff --git a/ios/Classes/MedeaVideoDecoderFactory.swift b/ios/Classes/MedeaVideoDecoderFactory.swift new file mode 100644 index 0000000000..4672d4d7bb --- /dev/null +++ b/ios/Classes/MedeaVideoDecoderFactory.swift @@ -0,0 +1,41 @@ +import WebRTC + +class MedeaVideoDecoderFactory: NSObject, RTCVideoDecoderFactory { + func supportedCodecs() -> [RTCVideoCodecInfo] { + let constrainedHighParams: [String: String] = [ + "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedHigh, + "level-asymmetry-allowed": "1", + "packetization-mode": "1", + ] + let constrainedHighInfo = RTCVideoCodecInfo( + name: kRTCVideoCodecH264Name, + parameters: constrainedHighParams + ) + + let constrainedBaselineParams: [String: String] = [ + "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, + "level-asymmetry-allowed": "1", + "packetization-mode": "1", + ] + let constrainedBaselineInfo = RTCVideoCodecInfo( + name: kRTCVideoCodecH264Name, + parameters: constrainedBaselineParams + ) + let vp8Info = RTCVideoCodecInfo(name: kRTCVideoCodecVp8Name) + + return [ + constrainedHighInfo, + constrainedBaselineInfo, + ] + } + + func createDecoder(_ info: RTCVideoCodecInfo) -> RTCVideoDecoder? { + if info.name == kRTCVideoCodecH264Name { + return RTCVideoDecoderH264() + } else if info.name == kRTCVideoCodecVp8Name { + return RTCVideoDecoderVP8.vp8Decoder() + } + + return nil + } +} diff --git a/ios/Classes/MedeaVideoEncoderFactory.swift b/ios/Classes/MedeaVideoEncoderFactory.swift new file mode 100644 index 0000000000..237d63c62a --- /dev/null +++ b/ios/Classes/MedeaVideoEncoderFactory.swift @@ -0,0 +1,42 @@ +import WebRTC + +class MedeaVideoEncoderFactory: NSObject, RTCVideoEncoderFactory { + func supportedCodecs() -> [RTCVideoCodecInfo] { + let constrainedHighParams: [String: String] = [ + "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedHigh, + "level-asymmetry-allowed": "1", + "packetization-mode": "1", + ] + let constrainedHighInfo = RTCVideoCodecInfo( + name: kRTCVideoCodecH264Name, + parameters: constrainedHighParams + ) + + let constrainedBaselineParams: [String: String] = [ + "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, + "level-asymmetry-allowed": "1", + "packetization-mode": "1", + ] + let constrainedBaselineInfo = RTCVideoCodecInfo( + name: kRTCVideoCodecH264Name, + parameters: constrainedBaselineParams + ) + let vp8Info = RTCVideoCodecInfo(name: kRTCVideoCodecVp8Name) + + return [ + constrainedHighInfo, + constrainedBaselineInfo, + vp8Info, + ] + } + + func createEncoder(_ info: RTCVideoCodecInfo) -> RTCVideoEncoder? { + if info.name == kRTCVideoCodecH264Name { + return RTCVideoEncoderH264(codecInfo: info) + } else if info.name == kRTCVideoCodecVp8Name { + return RTCVideoEncoderVP8.vp8Encoder() + } + + return nil + } +} diff --git a/ios/Classes/State.swift b/ios/Classes/State.swift index be9ffdf5b3..3ce281c2e9 100644 --- a/ios/Classes/State.swift +++ b/ios/Classes/State.swift @@ -49,8 +49,8 @@ class State { /// Initializes a new `State`. init() { - let decoderFactory = RTCDefaultVideoDecoderFactory() - let encoderFactory = RTCDefaultVideoEncoderFactory() + let decoderFactory = MedeaVideoDecoderFactory() + let encoderFactory = MedeaVideoEncoderFactory() self.factory = RTCPeerConnectionFactory( encoderFactory: encoderFactory, decoderFactory: decoderFactory ) From d4abbcf7b1a6d79a1c15c8f2fd160d9efd4fe68e Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 29 Jan 2024 12:18:52 +0100 Subject: [PATCH 6/9] Minor fixes --- ios/Classes/MedeaVideoDecoderFactory.swift | 1 + ios/Classes/proxy/PeerConnectionFactoryProxy.swift | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ios/Classes/MedeaVideoDecoderFactory.swift b/ios/Classes/MedeaVideoDecoderFactory.swift index 4672d4d7bb..9ba8f3dac7 100644 --- a/ios/Classes/MedeaVideoDecoderFactory.swift +++ b/ios/Classes/MedeaVideoDecoderFactory.swift @@ -26,6 +26,7 @@ class MedeaVideoDecoderFactory: NSObject, RTCVideoDecoderFactory { return [ constrainedHighInfo, constrainedBaselineInfo, + vp8Info, ] } diff --git a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift index 7b09a5ef74..3131207b6c 100644 --- a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift +++ b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift @@ -59,7 +59,7 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: false, + isHardwareAccelerated: true, codec: VideoCodec.H264 ), ] @@ -73,7 +73,7 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.VP8 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_VP9), + isHardwareAccelerated: false, codec: VideoCodec.VP9 ), VideoCodecInfo( From 602c273b33750c2a7f1c58a7141fbad9e68987aa Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 29 Jan 2024 15:18:09 +0100 Subject: [PATCH 7/9] Revert unneeded changes --- ios/Classes/MedeaVideoDecoderFactory.swift | 42 ------------------ ios/Classes/MedeaVideoEncoderFactory.swift | 42 ------------------ ios/Classes/State.swift | 44 +------------------ .../proxy/PeerConnectionFactoryProxy.swift | 4 +- 4 files changed, 4 insertions(+), 128 deletions(-) delete mode 100644 ios/Classes/MedeaVideoDecoderFactory.swift delete mode 100644 ios/Classes/MedeaVideoEncoderFactory.swift diff --git a/ios/Classes/MedeaVideoDecoderFactory.swift b/ios/Classes/MedeaVideoDecoderFactory.swift deleted file mode 100644 index 9ba8f3dac7..0000000000 --- a/ios/Classes/MedeaVideoDecoderFactory.swift +++ /dev/null @@ -1,42 +0,0 @@ -import WebRTC - -class MedeaVideoDecoderFactory: NSObject, RTCVideoDecoderFactory { - func supportedCodecs() -> [RTCVideoCodecInfo] { - let constrainedHighParams: [String: String] = [ - "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedHigh, - "level-asymmetry-allowed": "1", - "packetization-mode": "1", - ] - let constrainedHighInfo = RTCVideoCodecInfo( - name: kRTCVideoCodecH264Name, - parameters: constrainedHighParams - ) - - let constrainedBaselineParams: [String: String] = [ - "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, - "level-asymmetry-allowed": "1", - "packetization-mode": "1", - ] - let constrainedBaselineInfo = RTCVideoCodecInfo( - name: kRTCVideoCodecH264Name, - parameters: constrainedBaselineParams - ) - let vp8Info = RTCVideoCodecInfo(name: kRTCVideoCodecVp8Name) - - return [ - constrainedHighInfo, - constrainedBaselineInfo, - vp8Info, - ] - } - - func createDecoder(_ info: RTCVideoCodecInfo) -> RTCVideoDecoder? { - if info.name == kRTCVideoCodecH264Name { - return RTCVideoDecoderH264() - } else if info.name == kRTCVideoCodecVp8Name { - return RTCVideoDecoderVP8.vp8Decoder() - } - - return nil - } -} diff --git a/ios/Classes/MedeaVideoEncoderFactory.swift b/ios/Classes/MedeaVideoEncoderFactory.swift deleted file mode 100644 index 237d63c62a..0000000000 --- a/ios/Classes/MedeaVideoEncoderFactory.swift +++ /dev/null @@ -1,42 +0,0 @@ -import WebRTC - -class MedeaVideoEncoderFactory: NSObject, RTCVideoEncoderFactory { - func supportedCodecs() -> [RTCVideoCodecInfo] { - let constrainedHighParams: [String: String] = [ - "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedHigh, - "level-asymmetry-allowed": "1", - "packetization-mode": "1", - ] - let constrainedHighInfo = RTCVideoCodecInfo( - name: kRTCVideoCodecH264Name, - parameters: constrainedHighParams - ) - - let constrainedBaselineParams: [String: String] = [ - "profile-level-id": kRTCMaxSupportedH264ProfileLevelConstrainedBaseline, - "level-asymmetry-allowed": "1", - "packetization-mode": "1", - ] - let constrainedBaselineInfo = RTCVideoCodecInfo( - name: kRTCVideoCodecH264Name, - parameters: constrainedBaselineParams - ) - let vp8Info = RTCVideoCodecInfo(name: kRTCVideoCodecVp8Name) - - return [ - constrainedHighInfo, - constrainedBaselineInfo, - vp8Info, - ] - } - - func createEncoder(_ info: RTCVideoCodecInfo) -> RTCVideoEncoder? { - if info.name == kRTCVideoCodecH264Name { - return RTCVideoEncoderH264(codecInfo: info) - } else if info.name == kRTCVideoCodecVp8Name { - return RTCVideoEncoderVP8.vp8Encoder() - } - - return nil - } -} diff --git a/ios/Classes/State.swift b/ios/Classes/State.swift index 3ce281c2e9..f83f0577cf 100644 --- a/ios/Classes/State.swift +++ b/ios/Classes/State.swift @@ -1,45 +1,5 @@ import WebRTC -class RTCMyVP8VideoDecoderFactory: NSObject, RTCVideoDecoderFactory { - func supportedCodecs() -> [RTCVideoCodecInfo] { - var codecs: [RTCVideoCodecInfo] = [] - let codecName = kRTCVp8CodecName - - let vp8CodecInfo = RTCVideoCodecInfo(name: codecName) - codecs.append(vp8CodecInfo) - - return codecs - } - - func createDecoder(_ info: RTCVideoCodecInfo) -> RTCVideoDecoder? { - // if (info.name == kRTCVideoCodecVp8Name) { - // return RTCVideoEncoderVP8.vp8Encoder() - // } - - return nil - } -} - -class RTCMyVP8VideoEncoderFactory: NSObject, RTCVideoEncoderFactory { - func supportedCodecs() -> [RTCVideoCodecInfo] { - var codecs: [RTCVideoCodecInfo] = [] - let codecName = kRTCVp8CodecName - - let vp8CodecInfo = RTCVideoCodecInfo(name: codecName) - codecs.append(vp8CodecInfo) - - return codecs - } - - func createEncoder(_ info: RTCVideoCodecInfo) -> RTCVideoEncoder? { - if (info.name == kRTCVideoCodecVp8Name) { - return RTCVideoEncoderVP8.vp8Encoder() - } - - return nil - } -} - /// Global context of the `medea_flutter_webrtc` plugin. /// /// Used for creating tracks/peers. @@ -49,8 +9,8 @@ class State { /// Initializes a new `State`. init() { - let decoderFactory = MedeaVideoDecoderFactory() - let encoderFactory = MedeaVideoEncoderFactory() + let decoderFactory = RTCDefaultVideoDecoderFactory() + let encoderFactory = RTCDefaultVideoEncoderFactory() self.factory = RTCPeerConnectionFactory( encoderFactory: encoderFactory, decoderFactory: decoderFactory ) diff --git a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift index 3131207b6c..023b1923ea 100644 --- a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift +++ b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift @@ -59,13 +59,13 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: true, + isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), codec: VideoCodec.H264 ), ] } - /// Returns list containing information about video encoders for the different video codecs. + /// Returns list containing information about video decoders for the different video codecs. func videoDecoders() -> [VideoCodecInfo] { [ VideoCodecInfo( From 0cc243fa3951865bd99ad18c26a072bc421fefa1 Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 29 Jan 2024 15:32:03 +0100 Subject: [PATCH 8/9] Upd CHANGELOG --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9429419a0e..d29923fb75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ All user visible changes to this project will be documented in this file. This p ### Added -- `PeerConnection.videoDecoders()` and `PeerConnection.videoEncoders()` methods enumerating available video codecs and their capability of hardware acceleration. ([#144]) +- `PeerConnection.videoDecoders()` and `PeerConnection.videoEncoders()` methods enumerating available video codecs and their capability of hardware acceleration. ([#144], [#148]) - Support for multiple input audio devices usage at one time on desktop platforms. ([#145]) ### Fixed @@ -29,6 +29,7 @@ All user visible changes to this project will be documented in this file. This p [#144]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/144 [#145]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/145 [#146]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/146 +[#148]: https://github.com/instrumentisto/medea-flutter-webrtc/pull/148 From 28328e46065c9f43d94e1099cb21799c3d85d2bc Mon Sep 17 00:00:00 2001 From: evdokimovs Date: Mon, 29 Jan 2024 15:34:46 +0100 Subject: [PATCH 9/9] Swift fmt --- ios/Classes/proxy/PeerConnectionFactoryProxy.swift | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift index 023b1923ea..f7b1f0e6d1 100644 --- a/ios/Classes/proxy/PeerConnectionFactoryProxy.swift +++ b/ios/Classes/proxy/PeerConnectionFactoryProxy.swift @@ -43,7 +43,8 @@ class PeerConnectionFactoryProxy { return peerProxy } - /// Returns list containing information about video encoders for the different video codecs. + /// Returns list containing information about video encoders for the different + /// video codecs. func videoEncoders() -> [VideoCodecInfo] { [ VideoCodecInfo( @@ -59,13 +60,16 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), + isHardwareAccelerated: VTIsHardwareDecodeSupported( + kCMVideoCodecType_H264 + ), codec: VideoCodec.H264 ), ] } - /// Returns list containing information about video decoders for the different video codecs. + /// Returns list containing information about video decoders for the different + /// video codecs. func videoDecoders() -> [VideoCodecInfo] { [ VideoCodecInfo( @@ -81,7 +85,9 @@ class PeerConnectionFactoryProxy { codec: VideoCodec.AV1 ), VideoCodecInfo( - isHardwareAccelerated: VTIsHardwareDecodeSupported(kCMVideoCodecType_H264), + isHardwareAccelerated: VTIsHardwareDecodeSupported( + kCMVideoCodecType_H264 + ), codec: VideoCodec.H264 ), ]