Skip to content

Commit

Permalink
Merge branch 'develop' into feature/simulcast-encodings-scale-resolut…
Browse files Browse the repository at this point in the history
…ion-down-to
  • Loading branch information
zztkm committed Jan 29, 2025
2 parents ff3d192 + aeca8f1 commit 2b017de
Show file tree
Hide file tree
Showing 9 changed files with 218 additions and 45 deletions.
58 changes: 41 additions & 17 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,51 @@

## develop

- [UPDATE] libwebrtc を 131.6778.4.0 に上げる
- [CHANGE] connect メッセージの `multistream` を true 固定で送信する処理を削除する破壊的変更
- `SoraMediaOption.enableSpotlight` を実行したときに multistream を true にする処理を削除
- `ConnectMessage` 初期化時に渡す multistream の値を `SoraMediaOption.multistreamEnabled` に変更
- `SoraMediaOption.multistreamIsRequired` 利用しなくなったので削除
- @zztkm
- [UPDATE] `SoraMediaOption.enableMultistream` を非推奨にする
- @zztkm
- [UPDATE] `SoraMediaOption``enableLegacyStream` を追加する
- レガシーストリームのための関数だが、レガシーストリームは廃止予定なので最初から非推奨にしている
- @zztkm

## 2025.1.0

**リリース日**: 2025-01-27

- [UPDATE] libwebrtc を 132.6834.5.0 に上げる
- @miosakuma @zztkm
- [UPDATE] SoraForwardingFilterOption 型の引数を Sora での 2025 年 12 月の廃止に向けて非推奨にする
- 今後はリスト形式の転送フィルター設定を利用してもらう
- 非推奨になるクラス
- SoraMediaChannel
- SignalingChannelImpl
- ConnectMessage (Any で定義されているが、実態は SoraForwardingFilterOption を Map に変換したもの)
- @zztkm
- [UPDATE] OfferMessage に項目を追加する
- 追加した項目
- `version`
- `multistream`
- `simulcast_multicodec`
- `simulcastMulticodec`
- `spotlight`
- `channel_id`
- `session_id`
- `channelId`
- `sessionId`
- `audio`
- `audio_codec_type`
- `audio_bit_rate`
- `audioCodecType`
- `audioBitRate`
- `video`
- `video_codec_type`
- `video_bit_rate`
- `videoCodecType`
- `videoBitRate`
- @zztkm
- [UPDATE] SoraForwardingFilterOption 型の引数を Sora での 2025 年 12 月の廃止に向けて非推奨にする
- 今後はリスト形式の転送フィルター設定を利用してもらう
- 非推奨になるクラス
- SoraMediaChannel
- SignalingChannelImpl
- ConnectMessage (Any で定義されているが、実態は SoraForwardingFilterOption を Map に変換したもの)
- [UPDATE] NotificationMessage に項目を追加する
- 追加した項目
- `timestamp`
- `spotlightNumber`
- `failedConnectionId`
- `currentState`
- `previousState`
- @zztkm
- [ADD] 転送フィルター機能の設定を表すクラス `SoraForwardingFilterOption``name``priority` を追加する
- @zztkm
Expand Down Expand Up @@ -63,8 +85,10 @@
- [CHANGE] GitHub Actions の ubuntu-latest を ubuntu-24.04 に変更する
- @voluntas
- [UPDATE] システム条件を更新する
- Android Studio 2024.1.2 以降
- @miosakuma
- Android Studio 2024.2.2 以降
- @miosakuma @zztkm
- [ADD] Canary Release 用スクリプトの canary.py を追加する
- @zztkm

## 2024.3.1

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Sora Android SDK

[![Release](https://jitpack.io/v/shiguredo/sora-android-sdk.svg)](https://jitpack.io/#shiguredo/sora-android-sdk)
[![libwebrtc](https://img.shields.io/badge/libwebrtc-131.6778-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/6778)
[![libwebrtc](https://img.shields.io/badge/libwebrtc-132.6834-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/6834)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/shiguredo/sora-android-sdk.svg)](https://github.com/shiguredo/sora-android-sdk.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Expand All @@ -21,8 +21,8 @@ Please read https://github.com/shiguredo/oss before use.
## システム条件

- Android 5 以降 (エミュレーターでの動作は保証しません)
- Android Studio 2024.1.2 以降
- WebRTC SFU Sora 2024.1.0 以降
- Android Studio 2024.2.2 以降
- WebRTC SFU Sora 2024.2.0 以降

## サンプル

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'org.jetbrains.dokka'

buildscript {
ext.kotlin_version = '1.9.25'
ext.libwebrtc_version = '131.6778.4.0'
ext.libwebrtc_version = '132.6834.5.0'

ext.dokka_version = '1.8.10'

Expand Down
146 changes: 146 additions & 0 deletions canary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import argparse
import re
import subprocess


SDKINFO_FILE = "sora-android-sdk/src/main/kotlin/jp/shiguredo/sora/sdk/util/SDKInfo.kt"


def update_sdkinfo_version(packageinfo_content):
"""
SDKInfo.ktファイルの内容からバージョンを更新する
Args:
packageinfo_content (list): SDKInfo.ktファイルの各行を要素とするリスト
Returns:
tuple: (更新後のファイル内容のリスト, 新しいバージョン文字列)
Raises:
ValueError: バージョン指定が見つからない場合
"""
updated_content = []
sdk_version_updated = False
new_version = None

for line in packageinfo_content:
line = line.rstrip() # 末尾の改行のみを削除
if "const val version" in line:
# バージョン行のパターンマッチング
version_match = re.match(
r'\s*const\s+val\s+version\s*=\s*[\'"](\d+\.\d+\.\d+)(-canary\.(\d+))?[\'"]',
line,
)
if version_match:
major_minor_patch = version_match.group(1) # 基本バージョン (例: 1.0.0)
canary_suffix = version_match.group(2) # canaryサフィックス部分

# canaryサフィックスが無い場合は.0から開始、ある場合は番号をインクリメント
if canary_suffix is None:
new_version = f"{major_minor_patch}-canary.0"
else:
canary_number = int(version_match.group(3))
new_version = f"{major_minor_patch}-canary.{canary_number + 1}"

# SDKInfoのバージョン行を更新
updated_content.append(f' const val version = "{new_version}"')
sdk_version_updated = True
else:
updated_content.append(line)
else:
updated_content.append(line)

if not sdk_version_updated:
raise ValueError("Version specification not found in SDKInfo.kt file.")

return updated_content, new_version


def write_file(filename, updated_content, dry_run):
"""
更新後の内容をファイルに書き込む
Args:
filename (str): 書き込み対象のファイル名
updated_content (list): 更新後のファイル内容
dry_run (bool): True の場合は実際の書き込みを行わない
"""
if dry_run:
print(f"Dry run: The following changes would be written to {filename}:")
print("\n".join(updated_content))
else:
with open(filename, "w") as file:
file.write("\n".join(updated_content) + "\n")
print(f"{filename} updated.")


def git_operations(new_version, dry_run):
"""
Git操作(コミット、タグ付け、プッシュ)を実行
Args:
new_version (str): 新しいバージョン文字列(タグとして使用)
dry_run (bool): True の場合は実際のGit操作を行わない
"""
commit_message = f"[canary] Update SDKInfo.kt version to {new_version}"

if dry_run:
# dry-run時は実行されるコマンドを表示のみ
print(f"Dry run: Would execute git add {SDKINFO_FILE}")
print(f"Dry run: Would execute git commit -m '{commit_message}'")
print(f"Dry run: Would execute git tag {new_version}")
print(f"Dry run: Would execute git push origin develop")
print(f"Dry run: Would execute git push origin {new_version}")
else:
# ファイルをステージング
print(f"Executing: git add {SDKINFO_FILE}")
subprocess.run(["git", "add", SDKINFO_FILE], check=True)

# 変更をコミット
print(f"Executing: git commit -m '{commit_message}'")
subprocess.run(["git", "commit", "-m", commit_message], check=True)

# バージョンタグを作成
print(f"Executing: git tag {new_version}")
subprocess.run(["git", "tag", new_version], check=True)

# developブランチをプッシュ
print("Executing: git push origin develop")
subprocess.run(["git", "push", "origin", "develop"], check=True)

# タグをプッシュ
print(f"Executing: git push origin {new_version}")
subprocess.run(["git", "push", "origin", new_version], check=True)


def main():
"""
メイン処理:
1. コマンドライン引数の解析
2. SDKInfo.kt ファイルの読み込みと更新
3. Git操作の実行
"""
parser = argparse.ArgumentParser(
description="Update SDKInfo.kt version and push changes with git."
)
parser.add_argument(
"--dry-run",
action="store_true",
help="Perform a dry run without making any changes.",
)
args = parser.parse_args()

# SDKInfo.kt を読み込んでバージョンを更新
with open(SDKINFO_FILE, "r") as file:
packageinfo_content = file.readlines()
updated_packageinfo_content, new_version = update_sdkinfo_version(
packageinfo_content
)
write_file(SDKINFO_FILE, updated_packageinfo_content, args.dry_run)

# Git操作の実行
git_operations(new_version, args.dry_run)


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class SoraMediaChannel @JvmOverloads constructor(

override fun onAddRemoteStream(ms: MediaStream) {
SoraLogger.d(TAG, "[channel:$role] @peer:onAddRemoteStream msid=:${ms.id}, connectionId=$connectionId")
if (mediaOption.multistreamEnabled && connectionId != null && ms.id == connectionId) {
if (mediaOption.multistreamEnabled != false && connectionId != null && ms.id == connectionId) {
SoraLogger.d(TAG, "[channel:$role] this stream is mine, ignore: ${ms.id}")
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SoraMediaOption {
internal var audioUpstreamEnabled = false
internal var videoDownstreamEnabled = false
internal var videoUpstreamEnabled = false
internal var multistreamEnabled = false
internal var multistreamEnabled: Boolean? = null
internal var spotlightOption: SoraSpotlightOption? = null
internal var simulcastEnabled = false
internal var simulcastRid: SoraVideoOption.SimulcastRid? = null
Expand Down Expand Up @@ -128,8 +128,6 @@ class SoraMediaOption {
@JvmOverloads
fun enableSpotlight(option: SoraSpotlightOption, enableSimulcast: Boolean = true) {
spotlightOption = option
multistreamEnabled = true

if (enableSimulcast) {
enableSimulcast()
}
Expand Down Expand Up @@ -172,10 +170,23 @@ class SoraMediaOption {
* - Sora ドキュメントのマルチストリーム
* [](https://sora.shiguredo.jp/doc/MULTISTREAM.html)
*/
@Deprecated(
message = "レガシーストリーム機能は 2025 年 6 月リリースの Sora にて廃止します。",
)
fun enableMultistream() {
multistreamEnabled = true
}

/**
* レガシーストリームを有効にします.
*/
@Deprecated(
message = "レガシーストリーム機能は 2025 年 6 月リリースの Sora にて廃止します。",
)
fun enableLegacyStream() {
multistreamEnabled = false
}

/**
* ロール.
*
Expand All @@ -199,24 +210,12 @@ class SoraMediaOption {
internal val upstreamIsRequired: Boolean
get() = audioUpstreamEnabled || videoUpstreamEnabled

internal var _multistreamIsRequired: Boolean? = null

internal var multistreamIsRequired: Boolean
get() = when {
_multistreamIsRequired != null ->
_multistreamIsRequired!!
downstreamIsRequired && upstreamIsRequired ->
// 双方向通信の場合は multistream フラグを立てる
true
else ->
multistreamEnabled
}
set(value) {
_multistreamIsRequired = value
}

// TODO(zztkm): internal かつ 未使用なので削除して良い
internal var _requiredRole: SoraChannelRole? = null

/**
* Upstream と Downstream の設定から、必要なロールを決定します.
*/
internal val requiredRole: SoraChannelRole
get() = if (upstreamIsRequired && downstreamIsRequired)
SoraChannelRole.SENDRECV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data class ConnectMessage(
@SerializedName("metadata") val metadata: Any? = null,
@SerializedName("signaling_notify_metadata")
val signalingNotifyMetadata: Any? = null,
@SerializedName("multistream") val multistream: Boolean = false,
@SerializedName("multistream") val multistream: Boolean? = null,
@SerializedName("spotlight") var spotlight: Any? = null,
@SerializedName("spotlight_number")
var spotlightNumber: Int? = null,
Expand Down Expand Up @@ -121,7 +121,6 @@ data class OfferMessage(
@SerializedName("sdp") val sdp: String,
@SerializedName("version") val version: String? = null,

@SerializedName("multistream") val multistream: Boolean? = null,
@SerializedName("simulcast") val simulcast: Boolean = false,
@SerializedName("simulcast_multicodec") val simulcastMulticodec: Boolean? = null,
@SerializedName("spotlight") val spotlight: Boolean? = null,
Expand Down Expand Up @@ -193,11 +192,13 @@ data class StatsMessage(
data class NotificationMessage(
@SerializedName("type") val type: String = "notify",
@SerializedName("event_type") val eventType: String,
@SerializedName("timestamp") val timestamp: String,
@SerializedName("role") val role: String?,
@SerializedName("session_id") val sessionId: String?,
@SerializedName("client_id") val clientId: String?,
@SerializedName("bundle_id") val bundleId: String?,
@SerializedName("connection_id") val connectionId: String?,
@SerializedName("spotlight_number") val spotlightNumber: Int?,
@SerializedName("audio") val audio: Boolean?,
@SerializedName("video") val video: Boolean?,
@SerializedName("metadata") val metadata: Any?,
Expand All @@ -219,6 +220,9 @@ data class NotificationMessage(
@SerializedName("recv_connection_id") val recvConnectionId: String?,
@SerializedName("send_connection_id") val sendConnectionId: String?,
@SerializedName("stream_id") val streamId: String?,
@SerializedName("failed_connection_id") val failedConnectionId: String?,
@SerializedName("current_state") val currentState: String?,
@SerializedName("previous_state") val previousState: String?,
)

data class DisconnectMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MessageConverter {
ignoreDisconnectWebsocket = ignoreDisconnectWebSocket,
dataChannels = dataChannels,
metadata = metadata,
multistream = mediaOption.multistreamIsRequired,
multistream = mediaOption.multistreamEnabled,
sdp = sdp,
clientId = clientId,
bundleId = bundleId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.webrtc.WebrtcBuildVersion

class SDKInfo {
companion object {
const val version = "2024.3.1"
const val version = "2025.2.0-canary.1"

fun sdkInfo(): String {
return "Sora Android SDK $version (${BuildConfig.REVISION})"
Expand Down

0 comments on commit 2b017de

Please sign in to comment.