Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:shiguredo/sora-ios-sdk into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Jul 20, 2024
2 parents 5cc44b6 + 37b64ba commit 3fa5206
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
- CocoaPods 1.8 からソースリポジトリのデフォルトが `https://cdn.cocoapods.org/` になった
- https://blog.cocoapods.org/CocoaPods-1.8.0-beta/
- @zztkm
- [UPDATE] `SignalingOffer``simulcast` を追加する
- @zztkm
- [FIX] SignalingConnect の `metadata`, `signaling_notify_metadata` が nil の場合に {} として送信されてしまう問題を修正する
- @zztkm
- [FIX] `WrapperVideoEncoderFactory.shared.simulcastEnabled` の値を type: offer の際に設定される simulcast の値で上書きする
- 認証ウェブフック成功時に払い出された type: offer の `simulcast` の値が反映されない不具合への対応
- @zztkm

## 2024.2.0

Expand Down
5 changes: 5 additions & 0 deletions Sora/PeerChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,11 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate {
signalingOfferMessageDataChannels = dataChannels
}

// offer.simulcast が設定されている場合、WrapperVideoEncoderFactory.shared.simulcastEnabled を上書きする
if let simulcast = offer.simulcast {
WrapperVideoEncoderFactory.shared.simulcastEnabled = simulcast
}

createAndSendAnswer(offer: offer)
case let .update(update):
if configuration.isMultistream {
Expand Down
23 changes: 19 additions & 4 deletions Sora/Signaling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ public struct SignalingOffer {

/// mid
public let mid: [String: String]?

/// サイマルキャスト有効 / 無効フラグ
public let simulcast: Bool?
}

/**
Expand Down Expand Up @@ -807,10 +810,20 @@ extension SignalingConnect: Codable {
try container.encodeIfPresent(clientId, forKey: .client_id)
try container.encodeIfPresent(bundleId, forKey: .bundle_id)
try container.encodeIfPresent(sdp, forKey: .sdp)
let metadataEnc = container.superEncoder(forKey: .metadata)
try metadata?.encode(to: metadataEnc)
let notifyEnc = container.superEncoder(forKey: .signaling_notify_metadata)
try notifyMetadata?.encode(to: notifyEnc)

// try metadata?.encode(to: metadataEnc) で metadata が nil の時はエンコードが実行されないように実装しても、
// container.superEncoder(forKey: .metadata) の呼び出し時点で子要素の準備までしてしまっているので
// metadata が nil の場合でも、`"metadata": {}` になってしまう。
// これを回避するために metadata が nil でない場合のみ、container.superEncoder(forKey: .metadata) を呼び出して
// encode(to:) を実行するような実装にしている。
if let metadata {
let metadataEnc = container.superEncoder(forKey: .metadata)
try metadata.encode(to: metadataEnc)
}
if let notifyMetadata {
let notifyEnc = container.superEncoder(forKey: .signaling_notify_metadata)
try notifyMetadata.encode(to: notifyEnc)
}
try container.encodeIfPresent(multistreamEnabled,
forKey: .multistream)
try container.encodeIfPresent(soraClient, forKey: .sora_client)
Expand Down Expand Up @@ -948,6 +961,7 @@ extension SignalingOffer: Codable {
case config
case encodings
case mid
case simulcast
}

public init(from decoder: Decoder) throws {
Expand All @@ -963,6 +977,7 @@ extension SignalingOffer: Codable {
try container.decodeIfPresent([Encoding].self,
forKey: .encodings)
mid = try container.decodeIfPresent([String: String].self, forKey: .mid)
simulcast = try container.decodeIfPresent(Bool.self, forKey: .simulcast)
}

public func encode(to encoder: Encoder) throws {
Expand Down

0 comments on commit 3fa5206

Please sign in to comment.