Skip to content

Commit

Permalink
Merge branch 'hotfix/2.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
SUZUKI Tetsuya committed Jun 11, 2019
2 parents d0667b4 + 72eda74 commit 756d4bf
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ theme: apple
min_acl: public
sdk: iphoneos
module: Sora
module_version: 2.2.1
swift_version: 5.0
module_version: 2.3.2
swift_version: 5.0.1
xcodebuild_arguments:
- -parallelizeTargets
- -scheme
Expand Down
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
- FIX
- バグ修正

## 2.3.2

### CHANGE

- SDP セマンティクスのデフォルトを Unified Plan に変更した

- API: シグナリング "notify" の "connection_id" プロパティに対応した

- API: ``SDPSemantics``: ``case default`` を削除した

- API: ``SignalingNotifyMessage``: ``connectionId`` プロパティを追加した

### FIX

- 接続状態によってシグナリング "notify" が無視される現象を修正する

## 2.3.1

### FIX
Expand Down
2 changes: 1 addition & 1 deletion Sora.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sora"
s.version = "2.3.1"
s.version = "2.3.2"
s.summary = "Sora iOS SDK"
s.description = <<-DESC
A library to develop Sora client applications.
Expand Down
2 changes: 1 addition & 1 deletion Sora/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>2.3.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
46 changes: 29 additions & 17 deletions Sora/PeerChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -592,52 +592,64 @@ class BasicPeerChannelContext: NSObject, RTCPeerConnectionDelegate {
}

func handleMessage(_ message: SignalingMessage?, _ text: String) {
Logger.debug(type: .mediaStream, message: "handle message")
guard let message = message else {
Logger.debug(type: .peerChannel, message: "receive invalid signaling")
return
}

Logger.debug(type: .peerChannel, message: "receive signaling '\(message.shortDescription)'")

switch message {
case .notify(message: let message):
Logger.debug(type: .peerChannel, message: "call onNotifyHandler")
channel.internalHandlers.onNotifyHandler?(message)
channel.handlers.onNotifyHandler?(message)
default:
break
}

switch state {
case .waitingOffer:
switch message {
case .offer(let offer):
Logger.debug(type: .peerChannel, message: "receive offer")
clientId = offer.clientId
createAndSendAnswerMessage(offer: offer)

default:
// discard
case .notify(message: _):
break

default:
Logger.debug(type: .peerChannel, message: "discard invalid signaling")
}

case .connected:
switch message {
case .update(sdp: let sdp):
guard configuration.role == .group ||
configuration.role == .groupSub else { return }
Logger.debug(type: .peerChannel, message: "receive update")
createAndSendUpdateAnswerMessage(forOffer: sdp)

case .notify(message: let message):
Logger.debug(type: .peerChannel, message: "receive notify")
Logger.debug(type: .peerChannel, message: "call onNotifyHandler")
channel.internalHandlers.onNotifyHandler?(message)
channel.handlers.onNotifyHandler?(message)


case .ping:
Logger.debug(type: .peerChannel, message: "receive ping")
signalingChannel.send(message: .pong)
Logger.debug(type: .peerChannel, message: "call onPingHandler")
channel.internalHandlers.onPingHandler?()
channel.handlers.onPingHandler?()

default:
// discard
case .notify(message: _):
break

default:
Logger.debug(type: .peerChannel, message: "discard invalid signaling")
}

default:
// discard
break
switch message {
case .notify(message: _):
break

default:
Logger.debug(type: .peerChannel, message: "discard invalid signaling")
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions Sora/SignalingMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ public struct SignalingNotifyMessage {
/// クライアント ID
public let clientId: String?

/// 接続 ID
public let connectionId: String?

/// 音声の可否
public let audioEnabled: Bool?

Expand Down Expand Up @@ -248,6 +251,37 @@ public enum SignalingMessage {
return msg
}

var shortDescription: String {
get {
switch self {
case .connect(message: let message):
return "connect(\(message.channelId), \(message.role))"
case .offer(message: let message):
return "offer(\(message.clientId))"
case .answer(sdp: _):
return "answer"
case .candidate(let candidate):
if let url = candidate.url {
return "candidate(\(url))"
} else {
return "candidate"
}
case .update(sdp: _):
return "update"
case .notify(message: let message):
return "notify(\(message.eventType))"
case .ping:
return "ping"
case .pong:
return "pong"
case .disconnect:
return "disconnect"
case .push(message: _):
return "push"
}
}
}

}

// MARK: -
Expand Down Expand Up @@ -439,6 +473,7 @@ extension SignalingNotifyMessage: Codable {
case subscriberCount = "channel_downstream_connections"
case channelId = "channel_id"
case clientId = "client_id"
case connectionId = "connection_id"
case spotlightId = "spotlight_id"
case audio = "audio"
case video = "video"
Expand All @@ -465,6 +500,7 @@ extension SignalingNotifyMessage: Codable {
subscriberCount = try container.decodeIfPresent(Int.self, forKey: .subscriberCount)
channelId = try container.decodeIfPresent(String.self, forKey: .channelId)
clientId = try container.decodeIfPresent(String.self, forKey: .clientId)
connectionId = try container.decodeIfPresent(String.self, forKey: .connectionId)
audioEnabled = try container.decodeIfPresent(Bool.self, forKey: .audio)
videoEnabled = try container.decodeIfPresent(Bool.self, forKey: .video)
spotlightId = try container.decodeIfPresent(String.self, forKey: .spotlightId)
Expand Down
9 changes: 2 additions & 7 deletions Sora/WebRTCConfigration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public struct MediaConstraints {
SDP でのマルチストリームの記述方式です。
*/
public enum SDPSemantics {

/// デフォルト
case `default`


/// Plan B
case planB

Expand All @@ -42,8 +39,6 @@ public enum SDPSemantics {
var nativeValue: RTCSdpSemantics {
get {
switch self {
case .default:
return RTCSdpSemantics.default
case .planB:
return RTCSdpSemantics.planB
case .unifiedPlan:
Expand Down Expand Up @@ -75,7 +70,7 @@ public struct WebRTCConfiguration {
// MARK: SDP に関する設定

/// SDP でのマルチストリームの記述方式
public var sdpSemantics: SDPSemantics = .default
public var sdpSemantics: SDPSemantics = .unifiedPlan

// MARK: - インスタンスの生成

Expand Down

0 comments on commit 756d4bf

Please sign in to comment.