Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@
- [ADD] シグナリング connect 時にリスト形式の転送フィルターを設定するための項目を追加する
- `Configuration`, `SignalingConnect` に forwardingFilters を追加する
- @zztkm
- [ADD] SignalingOffer に項目を追加する
- 追加する項目
- `version`
- `simulcastMulticodec`
- `spotlight`
- `channelId`
- `sessionId`
- `audio`
- `audioCodecType`
- `audioBitRate`
- `video`
- `videoCodecType`
- `videoBitRate`

### misc

Expand Down
64 changes: 60 additions & 4 deletions Sora/Signaling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ private func serializeData(_ data: Any?) -> [SignalingNotifyMetadata]? {

let result = array.map { (dict: [String: Any]) -> SignalingNotifyMetadata in
var signalingNotifyMetadata = SignalingNotifyMetadata()
if let clinetId = dict["client_id"] as? String {
signalingNotifyMetadata.clientId = clinetId
if let clientId = dict["client_id"] as? String {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 修正

signalingNotifyMetadata.clientId = clientId
}
if let bundleId = dict["bundle_id"] as? String {
signalingNotifyMetadata.bundleId = bundleId
Expand All @@ -25,8 +25,8 @@ private func serializeData(_ data: Any?) -> [SignalingNotifyMetadata]? {
signalingNotifyMetadata.authnMetadata = authnMetadata
}

if let authzMetada = dict["authz_metadata"] {
signalingNotifyMetadata.authzMetadata = authzMetada
if let authzMetadata = dict["authz_metadata"] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 修正

signalingNotifyMetadata.authzMetadata = authzMetadata
}

if let metadata = dict["metadata"] {
Expand Down Expand Up @@ -406,6 +406,9 @@ public struct SignalingOffer {
}
}

/// チャネルID
public let channelId: String?

/// クライアント ID
public let clientId: String

Expand All @@ -415,9 +418,15 @@ public struct SignalingOffer {
/// 接続 ID
public let connectionId: String

/// セッションID
public let sessionId: String?

/// SDP メッセージ
public let sdp: String

/// version
public let version: String?

/// クライアントが更新すべき設定
public let configuration: Configuration?

Expand All @@ -435,6 +444,30 @@ public struct SignalingOffer {

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

/// サイマルキャストマルチコーデック
public let simulcastMulticodec: Bool?

/// スポットライト
public let spotlight: Bool?

/// audio
public let audio: Bool?

/// audio codec type
public let audioCodecType: String?

/// audio bit rate
public let audioBitRate: Int?

/// video
public let video: Bool?

/// video codec type
public let videoCodecType: String?

/// video bit rate
public let videoBitRate: Int?
}

/**
Expand Down Expand Up @@ -969,14 +1002,29 @@ extension SignalingOffer: Codable {
case encodings
case mid
case simulcast
case version
case simulcast_multicodec
case spotlight
case channel_id
case session_id
case audio
case audio_codec_type
case audio_bit_rate
case video
case video_codec_type
case video_bit_rate
}

public init(from decoder: Decoder) throws {
// metadata, dataChannels は updateMetadata() で処理されるので、ここでは処理しない
let container = try decoder.container(keyedBy: CodingKeys.self)
channelId = try container.decodeIfPresent(String.self, forKey: .channel_id)
clientId = try container.decode(String.self, forKey: .client_id)
bundleId = try container.decodeIfPresent(String.self, forKey: .bundle_id)
connectionId = try container.decode(String.self, forKey: .connection_id)
sessionId = try container.decodeIfPresent(String.self, forKey: .session_id)
sdp = try container.decode(String.self, forKey: .sdp)
version = try container.decodeIfPresent(String.self, forKey: .version)
configuration =
try container.decodeIfPresent(Configuration.self,
forKey: .config)
Expand All @@ -985,6 +1033,14 @@ extension SignalingOffer: Codable {
forKey: .encodings)
mid = try container.decodeIfPresent([String: String].self, forKey: .mid)
simulcast = try container.decodeIfPresent(Bool.self, forKey: .simulcast)
simulcastMulticodec = try container.decodeIfPresent(Bool.self, forKey: .simulcast_multicodec)
spotlight = try container.decodeIfPresent(Bool.self, forKey: .spotlight)
audio = try container.decodeIfPresent(Bool.self, forKey: .audio)
audioCodecType = try container.decodeIfPresent(String.self, forKey: .audio_codec_type)
audioBitRate = try container.decodeIfPresent(Int.self, forKey: .audio_bit_rate)
video = try container.decodeIfPresent(Bool.self, forKey: .video)
videoCodecType = try container.decodeIfPresent(String.self, forKey: .video_codec_type)
videoBitRate = try container.decodeIfPresent(Int.self, forKey: .video_bit_rate)
}

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