Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 3504fdd950ac38f3e8dad8d83ddc2c5b78ac8057
Merge: 4d2f7c4 7ae1aa5
Author: Ronny Falk <[email protected]>
Date:   Tue Jan 9 11:56:55 2024 -0800

    Merge branch 'upstream_main' into ronnyf/sdk-update

commit 4d2f7c4e25631a53312e87d721313b20de676b28
Merge: 4887e20 55085d4
Author: Ronny Falk <[email protected]>
Date:   Mon Jan 8 19:45:21 2024 -0800

    Merge branch 'upstream_main' into ronnyf/sdk-update

commit 7ae1aa5
Author: Hiroshi Horie <[email protected]>
Date:   Wed Jan 10 02:25:37 2024 +0900

    change async room.sid to method

    This way ObjC can be supported

commit aed9406
Author: Hiroshi Horie <[email protected]>
Date:   Wed Jan 10 02:16:08 2024 +0900

    Async room id (livekit#296)

commit ffcec8f
Author: Hiroshi Horie <[email protected]>
Date:   Tue Jan 9 22:21:08 2024 +0900

    Support concurrent waiting for `AsyncCompleter` (livekit#298)

commit 4887e20a701f8c7e1215499b4c3db6b990390bbb
Author: Ronny Falk <[email protected]>
Date:   Mon Jan 8 18:30:35 2024 -0800

    WIP

commit da703ae
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 23:44:18 2024 +0900

    fix minor compile warnings

commit 55085d4
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 23:18:45 2024 +0900

    Organize delegates (livekit#294)

commit 98cb93d
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 20:06:48 2024 +0900

    Delayed room id (Protocol 12) (livekit#293)

commit 233fda7
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 20:01:04 2024 +0900

    New `ConnectionQuality.lost` case (Protocol 11) (livekit#292)

    Reference: livekit/client-sdk-js#961

commit 1461398
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 19:59:55 2024 +0900

    Sync streams (Protocol 10) (livekit#291)

    Reference: livekit/client-sdk-js#881
    Protocol is already set to v10.

commit 67401d6
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 04:28:10 2024 +0900

    add protocol versions

commit 1d3af63
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 04:20:43 2024 +0900

    update proto

commit ca8c79e
Author: Hiroshi Horie <[email protected]>
Date:   Mon Jan 8 03:53:04 2024 +0900

    update header

commit 0ff7852952080c1f419f2c1848235b1e67c3da69
Author: Ronny Falk <[email protected]>
Date:   Thu Nov 30 16:21:51 2023 -0800

    CP-2413: DataChannels stuck on connecting

commit 402f58f42dc9d146d7be950652faaa4e824c8a10
Author: Ronny Falk <[email protected]>
Date:   Wed Nov 29 12:35:37 2023 -0800

    CP-0000: package fix

commit 11749588a637ec237265c449861ab03829f51f85
Author: Ronny Falk <[email protected]>
Date:   Wed Nov 29 11:54:17 2023 -0800

    CP0000: build fix

commit c270d8200244e06cda43e9e3275e5efa5967cb72
Author: Ronny Falk <[email protected]>
Date:   Wed Nov 29 11:00:11 2023 -0800

    CP-2307: Audio Fixes and Logging updates

commit a7d0ae9b133f1f2bd262178b4d37f189c7491ffb
Author: Ronny Falk <[email protected]>
Date:   Wed Nov 29 10:46:29 2023 -0800

    CP-2421: WebRTC update to M119

    this fixes audio derlivery issues

commit 3d16d88e211ad01a0c5e9af0269192403a102143
Author: Ronny Falk <[email protected]>
Date:   Wed Nov 15 12:14:39 2023 -0800

    CP-2364: Capture audio from WebRTC

commit d8dd38e7e1c320f28113b94022eab84b37648556
Author: Ronny Falk <[email protected]>
Date:   Mon Nov 13 18:32:14 2023 -0800

    CP2346: Submit Audio Mute state to LiveKit

commit ee7ebd109b5249d3111cd81d340935cb93e11644
Author: Ronny Falk <[email protected]>
Date:   Mon Nov 13 18:22:52 2023 -0800

    CP-2345 refactor video-publishing to VideoTransmitter

commit 47f46d17b3e6419364fbe2ceceacdce46b6263d6
Author: Ronny Falk <[email protected]>
Date:   Fri Nov 10 13:10:42 2023 -0800

    keep the lights on for the viewer

commit 4f57d8759d0439fda6a97dd6ea2d3195bc5afd84
Author: Ronny Falk <[email protected]>
Date:   Fri Nov 10 08:43:19 2023 -0800

    CP-2335: added active speaker(s) publisher,

    also I snuck in a quick fix for remote participants, filtering the local participant out a nicer
    https://jirap.corp.ebay.com/browse/CP-2335

commit 8b4ff38250dfdb56ffb3ca07520640ce30308096
Author: Aleksander Posobiec <[email protected]>
Date:   Fri Nov 10 11:45:01 2023 +0100

    Update PeerConnection.swift

commit aa6a79a79d7ed1b6d11e383445173bf9f3cb0d7b
Author: Aleksander Posobiec <[email protected]>
Date:   Thu Nov 9 15:39:44 2023 +0100

    Update PeerConnection.swift

commit 236ec81b829fc5804b03f24aa989f0d2ab5de999
Author: Aleksander Posobiec <[email protected]>
Date:   Thu Nov 9 15:33:42 2023 +0100

    Update PeerConnection.swift

commit 930a9688bcd8b0691684f17b8dcadee0d97a67ba
Author: Aleksander Posobiec <[email protected]>
Date:   Wed Nov 8 15:07:31 2023 +0100

    Update PeerConnection.swift

commit aee251bd9cd82b9eabac7bd522082b20935076e2
Author: Aleksander Posobiec <[email protected]>
Date:   Wed Nov 8 15:02:34 2023 +0100

    Update PeerConnection.swift

commit 20e4c799997987d141d36b54eba77a724783e98e
Author: Aleksander Posobiec <[email protected]>
Date:   Mon Nov 6 13:38:43 2023 +0100

    Update PeerConnection.swift

commit cb99d849dc9bb45e88adc48e212923c1b28e337c
Author: Ronny Falk <[email protected]>
Date:   Fri Oct 27 14:13:03 2023 -0700

    formatting and more logging

commit cf060ee03f23934bc03a7cfe9f0d167e400720f3
Author: Ronny Falk <[email protected]>
Date:   Thu Nov 9 08:07:07 2023 -0800

    alternative webrtc framework without changes by the livekit team

commit 6107db2e6b195327a978c98f3baef59a1ca4e7ee
Author: Ronny Falk <[email protected]>
Date:   Tue Nov 7 16:59:58 2023 -0800

    CP-2254 AudioDevice (RTCAudioDevice) to control send/receive of audio

commit e1efea1ac4c8b4de6003eeafc4979da77758424f
Author: Ronny Falk <[email protected]>
Date:   Tue Nov 7 16:58:31 2023 -0800

    CP-2253 refactor audio-publish-result to AudioTransmitter

commit fa50e7164def8a96c88f2041ae1d561fecbb14df
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 30 15:03:15 2023 -0700

    sending data packets and negotiating prior in case ...

commit 678dc11ad9c92582d3d63adf2b9d0057942f9f9b
Author: Ronny Falk <[email protected]>
Date:   Fri Oct 27 14:13:03 2023 -0700

    formatting and more logging

    removing a double buffer - that's not needed

commit d8523902eb1d5007b118442ea4f71af5cb443237
Author: Ronny Falk <[email protected]>
Date:   Fri Oct 27 14:13:03 2023 -0700

    formatting the code with tabs to shut the ebay main repo linter up

commit dd854062090866c295aaefe0793f21858cf61ba3
Author: Ronny Falk <[email protected]>
Date:   Thu Oct 26 21:00:40 2023 -0700

    added public logging, fixed a leak

commit 0927a2ffac5f64aba3a28494c413f9e08c16f5c8
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 23 17:16:00 2023 -0700

    CP-2173: added public logging options so console logs actually contain some information

commit 6403a3f6392f0a3a8b33a4cb0c28f71338ffab60
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 23 17:18:08 2023 -0700

    CP-2172: removed DispatchSerialQueue in favor of DisptachQueue, the documentation states to not create those types directly.

commit aac2f3a1dff3a761b012fe76b8472458da07ad52
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 23 17:30:23 2023 -0700

    CP-2174: publish connection state(s)

commit f0f08a9952a46362499aa14372c2da274569a0e2
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 9 17:56:04 2023 -0700

    optimized queue isolation for webrtc types, split streams, receivers, and participants to being them all together again in livestream

commit cc660c147a1b6fbc97b71852352f5d605cb2dcb2
Author: Ronny Falk <[email protected]>
Date:   Thu Oct 5 16:21:02 2023 -0700

    some testing

commit a54a8b341370a675d6dccfb07094f1765241388a
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 9 17:56:04 2023 -0700

    CP-2120_connection_quality

commit 0a9f72b3ce9a182712b5837deaddca61f1bdf807
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 9 10:18:53 2023 -0700

    CP-2117_video_rotation

commit c1c3037a89dc0f433af83037fa47eb450206db9f
Author: Ronny Falk <[email protected]>
Date:   Mon Oct 9 10:18:53 2023 -0700

    CP-2102 local participant publisher

commit a40494cfdf10df4738a437e9acfeb46b221b6530
Author: Ronny Falk <[email protected]>
Date:   Thu Oct 5 15:19:47 2023 -0700

    removed _Publishing

commit 95103e251190f1aac418abe447640fb7bfc3e61e
Author: Ronny Falk <[email protected]>
Date:   Wed Mar 22 20:25:04 2023 -0700

    Hello LiveKitCore!

commit 3959ff6
Author: Hiroshi Horie <[email protected]>
Date:   Wed Jan 3 11:13:30 2024 +0900

    individual connection state delegates

commit 0a3e95f
Author: Hiroshi Horie <[email protected]>
Date:   Wed Jan 3 00:58:59 2024 +0900

    fix QueueActor

commit ac357a9
Author: Hiroshi Horie <[email protected]>
Date:   Tue Jan 2 01:00:35 2024 +0900

    Fix reconnect (livekit#286)

commit 45550c1
Author: Hiroshi Horie <[email protected]>
Date:   Tue Jan 2 00:33:50 2024 +0900

    fix WebSocket close logic & tests

commit 3c0e5ca
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 25 20:14:24 2023 +0900

    update websocket URLSessionConfiguration

commit f587f36
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 25 17:49:31 2023 +0900

    Thread safe E2EE (livekit#284)

commit d3f83a3
Author: Hiroshi Horie <[email protected]>
Date:   Sat Dec 23 11:34:08 2023 +0900

    make Participant.name non-optional

commit a0b27d0
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 18 18:41:29 2023 +0900

    update TrackDelegate

commit 30cf935
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 18 18:20:30 2023 +0900

    consistent bool property naming

commit 81a5ff4
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 18 18:06:02 2023 +0900

    Explicit delegate signatures (livekit#283)

    A few delegates had the same signatures (by using overloading) such as:

    `room(_ room: Room, didUpdate speakers: [Participant])`
    `room(_ room: Room, didUpdate metadata: String?)`
    `room(_ room: Room, didUpdate isRecording: Bool)`

    This pattern will break if add another method of the same type will be
    added in the future:
    `room(_ room: Room, didUpdate isSomeExampleFlag: Bool)`

    Additionally, since labels can be omitted in Swift, the implementation
    side can be ambiguous:
    ```Swift
    func room(_: Room, didUpdate _: String?) {
      // ...
    }

    func room(_: Room, didUpdate _: Bool) {
      // ...
    }
    ```

    This PR makes delegate signatures explicit and future-proof by including
    the label in the signature:

    `room(_ room: Room, didUpdateSpeakingParticipants participants:
    [Participant])`
    `room(_ room: Room, didUpdateMetadata metadata: String?)`
    `room(_ room: Room, didUpdateIsRecording isRecording: Bool)`

    I can deprecate the old methods, but since this will be part of v2
    release maybe it's not required to deprecate.

commit e901d1e
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 18 15:53:19 2023 +0900

    refactor internal delegates

commit 3eb2bf4
Author: Hiroshi Horie <[email protected]>
Date:   Sun Dec 17 18:44:14 2023 +0900

    refactor internal engine delegate

commit 66bd743
Author: Hiroshi Horie <[email protected]>
Date:   Sun Dec 17 18:04:44 2023 +0900

    Simplify error type (livekit#282)

commit 5bd432c
Author: Hiroshi Horie <[email protected]>
Date:   Thu Dec 14 03:01:02 2023 +0900

    fix ObjC RoomOptions

commit 6c4f191
Author: Hiroshi Horie <[email protected]>
Date:   Thu Dec 14 02:47:05 2023 +0900

    fix AudioBuffer symbol conflict with CoreAudio

commit 1134a64
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 13 20:59:38 2023 +0900

    update webrtc repo url

commit 01d62cf
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 13 15:13:08 2023 +0900

    silence publish warnings

commit 010c28e
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 13 15:12:55 2023 +0900

    use dynamic prefixed lib

commit 14b8400
Author: Hiroshi Horie <[email protected]>
Date:   Tue Dec 12 00:56:28 2023 +0900

    fix: initial RemoteTrackPublication muted state

commit 0ad9342
Author: Hiroshi Horie <[email protected]>
Date:   Tue Dec 12 00:39:09 2023 +0900

    fix: use actor for DataChannelPair

commit 7d8a661
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 19:13:30 2023 +0900

    set default protocol ver to v10

commit e1c89f1
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 19:08:45 2023 +0900

    remove unused files

commit c6dd350
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 18:59:31 2023 +0900

    minor CompleterMapActor optimization

commit aefdb84
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 18:50:13 2023 +0900

    fix: allParticipants return identity instead of sid

commit be48ea9
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 18:46:29 2023 +0900

    data channel thread safety optimizations

commit 7a371b6
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 14:19:43 2023 +0900

    update protos

commit efd8b59
Author: Hiroshi Horie <[email protected]>
Date:   Mon Dec 11 14:13:50 2023 +0900

    bump dependencies

commit 64f3363
Author: Hiroshi Horie <[email protected]>
Date:   Thu Dec 7 01:19:39 2023 +0900

    fix: macOS screen share scale

commit 196a439
Author: Hiroshi Horie <[email protected]>
Date:   Thu Dec 7 00:29:18 2023 +0900

    thread safe async completer

commit c25ce2d
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 20:59:14 2023 +0900

    fix property name trackPublications

commit 5bf6799
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 19:28:08 2023 +0900

    v2 API changes (livekit#280)

commit 6ee16e9
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 16:56:39 2023 +0900

    bump ver 2.0.0

commit 949bff1
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 16:43:41 2023 +0900

    silent signal client connect warning

commit f95b811
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 16:00:33 2023 +0900

    fix: iOS screen share

commit dbe6741
Author: Hiroshi Horie <[email protected]>
Date:   Wed Dec 6 15:57:16 2023 +0900

    fix: iOS compile

commit bb81f19
Author: Hiroshi Horie <[email protected]>
Date:   Tue Dec 5 15:53:04 2023 +0900

    Multi-codec v2 (livekit#275)

    Support for `VP9`, `AV1`, `VP8`, `H264` codecs.
    v2 compatible version of
    livekit#176

commit d4044d9
Author: Hiroshi Horie <[email protected]>
Date:   Tue Dec 5 08:37:35 2023 +0900

    remove unnecessary async

commit 2832f26
Author: Hiroshi Horie <[email protected]>
Date:   Wed Nov 29 00:32:53 2023 +0900

    fix: bitrate calc crash

commit beda14d
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 28 08:40:22 2023 +0900

    fix: pass report stats option for simplified api

commit 95db12f
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 28 08:32:22 2023 +0900

    report track stats option

commit 353b12a
Author: Hiroshi Horie <[email protected]>
Date:   Mon Nov 27 18:48:06 2023 +0900

    apply swiftformat

commit 8bcfd9d
Author: creativecbr <[email protected]>
Date:   Mon Nov 27 10:45:46 2023 +0100

    Support app sharing in screen capture (livekit#276)

    Hello everyone, my issue revolves around the inability to share app
    content during screen sharing. I attempted to use
    MacOSScreenCapturer.sources with the parameter includeCurrentApplication
    set to true, but unfortunately, it did not yield the desired outcome.

    In order to address this issue, I made the following pull request (PR)
    changes. In these changes, I introduced the includeCurrentApplication
    parameter to ScreenShareCaptureOptions and utilized it to exclude the
    app filter in MacOSScreenCapturer. This modification enables the
    retrieval of sources as demonstrated in the following code snippet:

    ```
    _ = MacOSScreenCapturer.mainDisplaySource().then { displaySource in
        Task {
            let options = ScreenShareCaptureOptions(dimensions: .h720_43,
                                                    fps: 5,
                                                    includeCurrentApplication: true)

            let mainTrack = LocalVideoTrack.createMacOSScreenShareTrack(source: displaySource, options: options)

            Task { @mainactor in
                self.tracks = [mainTrack]
            }

            await withThrowingTaskGroup(of: Void.self) { group in
                group.addTask {
                    try await mainTrack.start()
                }
            }
        }
    }

    ```

    This solution consistently works and provides a convenient resolution.
    If there is a misunderstanding on my part, and the issue can be resolved
    without these changes, please reach out to me and provide an
    explanation.

    Thank you in advance!

commit 08229eb
Author: Hiroshi Horie <[email protected]>
Date:   Mon Nov 20 22:41:52 2023 +0800

    use ServerInfo proto

commit 12ac942
Author: Hiroshi Horie <[email protected]>
Date:   Thu Nov 16 09:29:12 2023 +0800

    improve SignalClient cancel flow and code

commit fabc152
Author: Hiroshi Horie <[email protected]>
Date:   Thu Nov 16 08:57:40 2023 +0800

    strip unused code

commit 6b1aff5
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 14 15:21:38 2023 +0800

    fix start/stop track flow

commit 2d44fcd
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 14 13:01:11 2023 +0800

    cancellable publish

commit cc6e480
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 14 12:19:15 2023 +0800

    rename SampleBufferVideoRenderer

commit 29d61f1
Author: Hiroshi Horie <[email protected]>
Date:   Thu Nov 9 20:57:20 2023 +0800

    Make `Room.connect` cancellable (livekit#273)

    * engine connect

    * connect flow

    * cancellable completer

    * cancellable WebSocket

    * completer cancel test

    * comment

    * check cancel for queue actor

commit 3a07312
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 7 01:59:43 2023 +0800

    Make `LocalParticipant` non-Optional (livekit#272)

    * impl

    * identity and name are optional

commit 36a7d34
Author: Hiroshi Horie <[email protected]>
Date:   Tue Nov 7 00:23:28 2023 +0800

    change connect signature

commit 0270af7
Author: Hiroshi Horie <[email protected]>
Date:   Sat Nov 4 00:46:31 2023 +0800

    remove use of objc_setAssociatedObject

commit 2273be4
Author: Hiroshi Horie <[email protected]>
Date:   Sat Nov 4 00:04:34 2023 +0800

    update proto

commit 4a026c3
Author: Hiroshi Horie <[email protected]>
Date:   Fri Nov 3 23:56:55 2023 +0800

    apply swiftformat

commit 4b2df99
Author: Hiroshi Horie <[email protected]>
Date:   Fri Nov 3 22:24:12 2023 +0800

    Completely remove `Promises` dependency (migrate to async/await) (livekit#271)

    * engine rewrite

    * impl

    * reconnect attempts

    * remove Promises from Engine

    * progress

    * remove Promises

    * remove Promises package

    * macOS screen sharing

    * resend frame timer

    * objC

    * fix iOS

    * clean up

commit 75dc6cf
Author: Hiroshi Horie <[email protected]>
Date:   Wed Nov 1 13:36:38 2023 +0800

    Migrate `Transport` to async/await (livekit#270)

    * impl

    * use AsyncQueueActor for pending candidates

    * minor optimization

commit 00e4947
Author: Hiroshi Horie <[email protected]>
Date:   Wed Nov 1 04:53:03 2023 +0800

    async: Engine.sendSyncState

commit e399562
Author: Hiroshi Horie <[email protected]>
Date:   Wed Nov 1 04:45:28 2023 +0800

    remove unnecessary import Promises

commit 96ac437
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 18:47:35 2023 +0800

    CompleterMapActor pattern

commit ec42d30
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 18:28:08 2023 +0800

    Actor pattern for `SignalClient`'s request / response queue (livekit#269)

    * impl

    * doc

commit 33b32f8
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 15:52:09 2023 +0800

    Migrate SignalClient to async/await (livekit#268)

    * improve http request helper

    * impl

    * impl

commit 0e06a60
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 13:19:25 2023 +0800

    improve http request helper

commit 27b33d2
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 12:46:40 2023 +0800

    async to promise helper

commit 35d4932
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 02:29:54 2023 +0800

    Remove Promises dependency for internal completers (livekit#267)

    * AsyncCompleter

    * remove Completer

    * clean up default timeouts

    * fix logic

    * refactor error

commit e94fa5b
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 02:20:13 2023 +0800

    fix: missing @_implementationOnly

commit 0d1597e
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 31 02:16:00 2023 +0800

    fix OnDidMutate generic warning

commit b9bb1da
Author: Hiroshi Horie <[email protected]>
Date:   Mon Oct 30 19:52:10 2023 +0800

    make DataChannelPair.close sync

commit c1cd410
Author: Hiroshi Horie <[email protected]>
Date:   Mon Oct 30 19:46:01 2023 +0800

    minor DataChannelPair clean up

commit 4b8468c
Author: Hiroshi Horie <[email protected]>
Date:   Mon Oct 30 19:41:35 2023 +0800

    async: configureTransports

commit 19af0f8
Author: Hiroshi Horie <[email protected]>
Date:   Mon Oct 30 18:54:05 2023 +0800

    Prepare for v2 release (livekit#265)

    * data delegates

    * remove legacy stats

    * remove reportStats option from RoomConnection

    * remove deprecated macos screenshare code

    * remove deprecated dimensions

    * remove deprecated connect related code

    * remove deprecated data publish method

    * update publish(data:) method

    * set(reportStatistics:)

commit 347a27b
Author: Hiroshi Horie <[email protected]>
Date:   Thu Oct 26 17:42:39 2023 +0900

    Don't export WebRTC (livekit#251)

    * progress

    * progress

    * hide RTCDefaultAudioProcessingModule and RTCAudioDeviceModule

    * video renderer

    * RTCFrameCryptorDelegate adapter

    * adapter for RTCVideoCapturerDelegate

    * VideoCaptureInterceptor

    * VideoRotation

    * video view rendering

    * rendering

    * replace all imports with implementationOnly

    * fix compile

    * fix ios compile

    * use static

    * prefix

    * fix macos

    * update package and symbols

    * minor optimization

    * implement AudioRenderer

    * fix compile

    * iceServers on ConnectOptions

    * AudioCustomProcessingDelegate

    * hide LKRTCVideoCapturerDelegate

    * audio device

    * Update AudioManager.swift

    * Update VideoRenderer.swift

commit 980146b
Author: Hiroshi Horie <[email protected]>
Date:   Thu Oct 26 17:38:47 2023 +0900

    WebSocket: Migrate to async/await from Promises lib (livekit#245)

    * progress

    * format

    * progress

    * clean up

    * ref

    * optimize

    * optimize

commit ec36cc3
Author: Hiroshi Horie <[email protected]>
Date:   Thu Oct 26 17:08:20 2023 +0900

    v1.1.3

commit 0173ea2
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 24 12:40:25 2023 +0900

    make Engine.State internal

commit eeb4bf7
Author: Hiroshi Horie <[email protected]>
Date:   Sat Oct 21 19:32:21 2023 +0900

    Fix: `CameraCapturer` report actual frame dimensions (livekit#263)

    * fix

    * comment

commit cc56faa
Author: Hiroshi Horie <[email protected]>
Date:   Sat Oct 21 15:33:57 2023 +0900

    fix legacy connection delegate

commit 0b78389
Author: Hiroshi Horie <[email protected]>
Date:   Sat Oct 21 00:34:45 2023 +0900

    Fix initial `Track.dimensions` (livekit#261)

commit 510af17
Author: Hiroshi Horie <[email protected]>
Date:   Fri Oct 20 14:40:21 2023 +0900

    fix audio category options (livekit#260)

commit d221a2d
Author: Hiroshi Horie <[email protected]>
Date:   Fri Oct 20 13:12:53 2023 +0900

    fix default protocol version for ConnectOptions

commit 54f9489
Author: Hiroshi Horie <[email protected]>
Date:   Fri Oct 13 03:38:02 2023 +0800

    fix i420 buffer rendering

commit caf1e4e
Author: Hiroshi Horie <[email protected]>
Date:   Tue Oct 3 11:19:15 2023 +0900

    log fileID instead of file

commit 697e432
Author: Hiroshi Horie <[email protected]>
Date:   Sun Sep 24 18:37:16 2023 +0900

    Make `customConfigureAudioSessionFunc` thread safe (livekit#253)

    * public states

    * impl

    * ref

    * doc

commit 1cd132c
Author: Hiroshi Horie <[email protected]>
Date:   Fri Sep 22 05:14:40 2023 +0900

    expose webrtc queue
  • Loading branch information
ronnyf committed Jan 22, 2024
1 parent 539bccf commit 5b3f171
Show file tree
Hide file tree
Showing 172 changed files with 4,248 additions and 4,833 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.7 # Xcode 14
2 changes: 2 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--exclude Sources/LiveKit/Protos
--header "/*\n * Copyright {year} LiveKit\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ proto: protoc protoc-swift
${PROTO_SOURCE}/livekit_models.proto \
${PROTO_SOURCE}/livekit_rtc.proto

protoc --swift_opt=Visibility=Public --swift_out=Sources/LiveKit/protos -I=. livekit_ipc.proto

docs: swift-docs
swift doc generate Sources/LiveKit \
--module-name "LiveKit Swift Client SDK" \
Expand Down
16 changes: 3 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.22.1")),
.package(url: "https://github.com/google/promises.git", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.25.2")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.5.3")),
.package(url: "https://github.com/apple/swift-async-algorithms.git", .upToNextMajor(from: "0.1.0")),
.package(url: "[email protected]:eBayMobile/webrtc-ios-xcframework.git", branch: "alternative"),
Expand All @@ -41,26 +40,17 @@ let package = Package(
.target(name: "CHeaders"),
.product(name: "WebRTC", package: "webrtc-ios-xcframework"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
.product(name: "Promises", package: "Promises"),
.product(name: "FBLPromises", package: "Promises"),
.product(name: "Logging", package: "swift-log"),
],
path: "Sources",
sources: [
"LiveKit",
]
path: "Sources"
),
.testTarget(
name: "LiveKitTests",
dependencies: ["LiveKit"]
),
.systemLibrary(name: "FakePromises", path: "Sources/FakePromises"),
.systemLibrary(name: "FakeFBLPromises", path: "Sources/FakeFBLPromises"),
.target(
name: "LiveKitCore",
dependencies: [
.target(name: "FakePromises"),
.target(name: "FakeFBLPromises"),
.product(name: "WebRTC", package: "webrtc-ios-xcframework"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
Expand Down Expand Up @@ -94,6 +84,7 @@ let package = Package(
"Shared/ConnectivityListener-Core.swift",
"Shared/DimensionsProvider.swift",
"Shared/Engine-Core.swift",
"Shared/LiveKitCompatibility.swift",
"Shared/Extensions/Engine+WebRTC.swift",
"Shared/Extensions/Primitives.swift",
"Shared/Extensions/RTCConfiguration.swift",
Expand All @@ -114,7 +105,6 @@ let package = Package(
"Shared/Types/ConnectOptions.swift",
"Shared/Types/ConnectionState.swift",
"Shared/Types/Dimensions.swift",
"Shared/Types/DisconnectReason.swift",
"Shared/Types/Errors.swift",
"Shared/Types/IceCandidate.swift",
"Shared/Types/Other.swift",
Expand Down
180 changes: 85 additions & 95 deletions Sources/LiveKit/Broadcast/BroadcastScreenCapturer.swift
Original file line number Diff line number Diff line change
@@ -1,119 +1,109 @@
//
// BroadcastScreenCapturer.m
// RCTWebRTC
//
// Created by Alex-Dan Bumbu on 06/01/2021.
//

import Foundation
import WebRTC
import Promises

#if canImport(UIKit)
import UIKit
#endif
/*
* Copyright 2024 LiveKit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#if os(iOS)

class BroadcastScreenCapturer: BufferCapturer {
static let kRTCScreensharingSocketFD = "rtc_SSFD"
static let kAppGroupIdentifierKey = "RTCAppGroupIdentifier"
static let kRTCScreenSharingExtension = "RTCScreenSharingExtension"
import Foundation

var frameReader: SocketConnectionFrameReader?
#if canImport(UIKit)
import UIKit
#endif

override func startCapture() -> Promise<Bool> {
@_implementationOnly import WebRTC

super.startCapture().then(on: queue) {didStart -> Promise<Bool> in
class BroadcastScreenCapturer: BufferCapturer {
static let kRTCScreensharingSocketFD = "rtc_SSFD"
static let kAppGroupIdentifierKey = "RTCAppGroupIdentifier"
static let kRTCScreenSharingExtension = "RTCScreenSharingExtension"

guard didStart, self.frameReader == nil else {
// already started
return Promise(false)
}
var frameReader: SocketConnectionFrameReader?

guard let identifier = self.lookUpAppGroupIdentifier(),
let filePath = self.filePathForIdentifier(identifier)
else {
return Promise { false }
}
override func startCapture() async throws -> Bool {
let didStart = try await super.startCapture()

return Promise { fufill, _ in
let bounds = UIScreen.main.bounds
let width = bounds.size.width
let height = bounds.size.height
let screenDimension = Dimensions(width: Int32(width), height: Int32(height))

// pre fill dimensions, so that we don't have to wait for the broadcast to start to get actual dimensions.
// should be able to safely predict using actual screen dimensions.
let targetDimensions = screenDimension
.aspectFit(size: self.options.dimensions.max)
.toEncodeSafeDimensions()

defer { self.dimensions = targetDimensions }
let frameReader = SocketConnectionFrameReader()
guard let socketConnection = BroadcastServerSocketConnection(filePath: filePath, streamDelegate: frameReader)
else {
fufill(false)
return
}
frameReader.didCapture = { pixelBuffer, rotation in
self.capture(pixelBuffer, rotation: rotation)

}
frameReader.startCapture(with: socketConnection)
self.frameReader = frameReader
fufill(true)
}
}
}
guard didStart else { return false }

override func stopCapture() -> Promise<Bool> {
guard let identifier = lookUpAppGroupIdentifier(),
let filePath = filePathForIdentifier(identifier) else { return false }

super.stopCapture().then(on: queue) { didStop -> Promise<Bool> in
let bounds = await UIScreen.main.bounds
let width = bounds.size.width
let height = bounds.size.height
let screenDimension = Dimensions(width: Int32(width), height: Int32(height))

guard didStop, self.frameReader != nil else {
// already stopped
return Promise(false)
}
// pre fill dimensions, so that we don't have to wait for the broadcast to start to get actual dimensions.
// should be able to safely predict using actual screen dimensions.
let targetDimensions = screenDimension
.aspectFit(size: options.dimensions.max)
.toEncodeSafeDimensions()

return Promise { fulfill, _ in
self.frameReader?.stopCapture()
self.frameReader = nil
fulfill(true)
defer { self.dimensions = targetDimensions }
let frameReader = SocketConnectionFrameReader()
guard let socketConnection = BroadcastServerSocketConnection(filePath: filePath, streamDelegate: frameReader)
else { return false }
frameReader.didCapture = { pixelBuffer, rotation in
self.capture(pixelBuffer, rotation: rotation.toLKType())
}
frameReader.startCapture(with: socketConnection)
self.frameReader = frameReader

return true
}
}

private func lookUpAppGroupIdentifier() -> String? {
return Bundle.main.infoDictionary?[BroadcastScreenCapturer.kAppGroupIdentifierKey] as? String
}
override func stopCapture() async throws -> Bool {
let didStop = try await super.stopCapture()

// Already stopped
guard didStop else { return false }

frameReader?.stopCapture()
frameReader = nil
return true
}

private func filePathForIdentifier(_ identifier: String) -> String? {
guard let sharedContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: identifier)
else {
return nil
private func lookUpAppGroupIdentifier() -> String? {
Bundle.main.infoDictionary?[BroadcastScreenCapturer.kAppGroupIdentifierKey] as? String
}

let filePath = sharedContainer.appendingPathComponent(BroadcastScreenCapturer.kRTCScreensharingSocketFD).path
return filePath
private func filePathForIdentifier(_ identifier: String) -> String? {
guard let sharedContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: identifier)
else { return nil }

let filePath = sharedContainer.appendingPathComponent(BroadcastScreenCapturer.kRTCScreensharingSocketFD).path
return filePath
}
}

}

extension LocalVideoTrack {
/// Creates a track that captures screen capture from a broadcast upload extension
public static func createBroadcastScreenCapturerTrack(name: String = Track.screenShareVideoName,
source: VideoTrack.Source = .screenShareVideo,
options: ScreenShareCaptureOptions = ScreenShareCaptureOptions()) -> LocalVideoTrack {
let videoSource = Engine.createVideoSource(forScreenShare: true)
let capturer = BroadcastScreenCapturer(delegate: videoSource, options: BufferCaptureOptions(from: options))
return LocalVideoTrack(
name: name,
source: source,
capturer: capturer,
videoSource: videoSource
)
public extension LocalVideoTrack {
/// Creates a track that captures screen capture from a broadcast upload extension
static func createBroadcastScreenCapturerTrack(name: String = Track.screenShareVideoName,
source: VideoTrack.Source = .screenShareVideo,
options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
reportStatistics: Bool = false) -> LocalVideoTrack
{
let videoSource = Engine.createVideoSource(forScreenShare: true)
let capturer = BroadcastScreenCapturer(delegate: videoSource, options: BufferCaptureOptions(from: options))
return LocalVideoTrack(
name: name,
source: source,
capturer: capturer,
videoSource: videoSource,
reportStatistics: reportStatistics
)
}
}
}

#endif
30 changes: 19 additions & 11 deletions Sources/LiveKit/Broadcast/BroadcastServerSocketConnection.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
//
// SocketConnection.swift
// Broadcast Extension
//
// Created by Alex-Dan Bumbu on 22/03/2021.
// Copyright © 2021 Atlassian Inc. All rights reserved.
//
/*
* Copyright 2024 LiveKit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import Foundation
import Darwin
import Foundation

#if canImport(CHeaders)
import CHeaders
import CHeaders
#endif

class BroadcastServerSocketConnection: NSObject {
Expand Down Expand Up @@ -152,7 +160,7 @@ class BroadcastServerSocketConnection: NSObject {
CFStreamCreatePairWithSocket(kCFAllocatorDefault, clientSocket, &readStream, &writeStream)

inputStream = readStream?.takeRetainedValue()
inputStream?.delegate = self.streamDelegate
inputStream?.delegate = streamDelegate
inputStream?.setProperty(kCFBooleanTrue, forKey: Stream.PropertyKey(kCFStreamPropertyShouldCloseNativeSocket as String))

outputStream = writeStream?.takeRetainedValue()
Expand All @@ -174,7 +182,7 @@ class BroadcastServerSocketConnection: NSObject {

repeat {
isRunning = self?.shouldKeepRunning ?? false && RunLoop.current.run(mode: .default, before: .distantFuture)
} while (isRunning)
} while isRunning

logger.log(level: .debug, "streams stopped")
}
Expand Down
Loading

0 comments on commit 5b3f171

Please sign in to comment.