Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix type offer message #529

Merged
merged 8 commits into from
Jul 9, 2024
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

## develop

- [FIX] `"type": "offer"` の `simulcast` の値が反映されていない問題を修正する
- @voluntas
- [FIX] `"type": "offer"` の `bundle_id` と `spotlight` を保持するように修正する
- @voluntas

## 2024.1.1

**2024-06-17**
Expand Down
36 changes: 31 additions & 5 deletions packages/sdk/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export default class ConnectionBase {
* ロール(sendonly | sendrecv | recvonly)
*/
role: string
/**
* サイマルキャスト
*/
simulcast: boolean
/**
* スポットライト
*/
spotlight: boolean
/**
* チャネルID
*/
Expand All @@ -87,6 +95,10 @@ export default class ConnectionBase {
* デバッグフラグ
*/
debug: boolean
/**
* バンドルID
*/
bundleId: string | null
/**
* クライアントID
*/
Expand Down Expand Up @@ -229,9 +241,12 @@ export default class ConnectionBase {
}
this.constraints = null
this.debug = debug
this.simulcast = false
this.spotlight = false
this.sessionId = null
this.clientId = null
this.bundleId = null
this.connectionId = null
this.sessionId = null
this.remoteConnectionIds = []
this.stream = null
this.ws = null
Expand Down Expand Up @@ -723,9 +738,14 @@ export default class ConnectionBase {
* 接続状態の初期化をするメソッド
*/
private initializeConnection(): void {
this.simulcast = false
this.spotlight = false

this.sessionId = null
this.clientId = null
this.bundleId = null
this.connectionId = null
this.sessionId = null

this.remoteConnectionIds = []
this.stream = null
this.ws = null
Expand Down Expand Up @@ -1391,7 +1411,7 @@ export default class ConnectionBase {
}
}
// simulcast の場合
if (this.options.simulcast && (this.role === 'sendrecv' || this.role === 'sendonly')) {
if (this.simulcast && (this.role === 'sendrecv' || this.role === 'sendonly')) {
const transceiver = this.pc.getTransceivers().find((t) => {
if (t.mid === null) {
return
Expand Down Expand Up @@ -1878,11 +1898,17 @@ export default class ConnectionBase {
* @param message - type offer メッセージ
*/
private signalingOnMessageTypeOffer(message: SignalingOfferMessage): void {
this.clientId = message.client_id
this.connectionId = message.connection_id
this.simulcast = message.simulcast
this.spotlight = message.spotlight

// 互換性を考慮してオプションとする
if (message.session_id !== undefined) {
tnamao marked this conversation as resolved.
Show resolved Hide resolved
this.sessionId = message.session_id
}
this.clientId = message.client_id
this.bundleId = message.bundle_id
this.connectionId = message.connection_id

if (message.metadata !== undefined) {
this.authMetadata = message.metadata
}
Expand Down
13 changes: 11 additions & 2 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,19 @@ export type SignalingOfferMessageDataChannel = {
export type SignalingOfferMessage = {
type: 'offer'
sdp: string

multistream: boolean
simulcast: boolean
simulcast_multicodec: boolean
spotlight: boolean

channel_id: string
// 互換性を考慮してオプションとする
session_id?: string
client_id: string
bundle_id: string
connection_id: string
session_id?: string
bundle_id?: string
voluntas marked this conversation as resolved.
Show resolved Hide resolved

metadata?: JSONType
config?: RTCConfiguration
encodings?: RTCRtpEncodingParameters[]
Expand Down