shiguredo / sora-ios-sdk

WebRTC SFU Sora iOS SDK
https://sora-ios-sdk.shiguredo.jp/
Apache License 2.0
42 stars 8 forks source link

`MediaChannel` の接続数プロパティに値が設定されない不具合を修正する #174

Closed miosakuma closed 1 year ago

miosakuma commented 1 year ago

MediaChannelconnectionCount, publisherCount, subscriberCount に値が設定されない不具合を修正しました。

Sora の notify で廃止になっていた channel_upstream_connections, channel_downstream_connections の値を参照していたので、現在の Sora の仕様に合わせて channel_sendrecv_connections, channel_sendonly_connections, channel_recvonly_connections, channel_connections を利用しています。

sora-ios-sdk-quickstart の ViewController.swift に以下の修正を入れることで確認ができます。 Sora からシグナリングメッセージを受信するたびにログが出力されます。 connection.created が来るまでは接続数が通知されないため nil が設定されます。

@@ -95,6 +96,9 @@ class ViewController: UIViewController {
             }
             strongSelf.updateUI(false)
         }
+        config.mediaChannelHandlers.onReceiveSignaling = { _ in
+            NSLog("mediaChannel count pub/sub/total Count:\(String(describing: self.mediaChannel?.publisherCount)):\(String(describing: self.mediaChannel?.subscriberCount)):\(String(describing: self.mediaChannel?.connectionCount))")
+        }

         // 接続します。
         // connect() の戻り値 ConnectionTask を使うと