Skip to content

Commit

Permalink
Merge branch 'release/2020.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Jun 1, 2020
2 parents 8d869c5 + b323873 commit 95fbbbc
Show file tree
Hide file tree
Showing 16 changed files with 194 additions and 115 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ on:
push:
paths-ignore:
- 'doc/**'
- 'README.md'
schedule:
- cron: "0 0 * * *"
- '**/*.md'

jobs:
build-windows:
Expand Down
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@

## develop

## 2020.3

- [UPDATE] Boost のバージョンを 1.73.0 に上げる
- @voluntas
- [UPDATE] WebRTC のバージョンを M83 (4103@{#12}) に上げる
- @melpon
- [CHANGE] Sora.Role.Upstream, Sora.Role.Downstream を削除
- @melpon
- [FIX] 接続確立中に Sora.Dispose するとエラーになることがあったのを修正
- @melpon
- [FIX] 接続が確立する前に ping を受け取ると通信が切断されてしまっていたのを修正
- @melpon
- [FIX] Windows 版の H.264 デコードでリサイズが発生した際にエラーになるのを修正
- @melpon

## 2020.2

- [UPDATE] WebRTC のバージョンを M81 (4044@{#12}) に上げる
Expand Down
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ Sora Unity SDK ではソフトウェアでの H.264 エンコード/デコード

そのため Windows では NVIDIA VIDEO CODEC SDK 、macOS では VideoToolbox を利用し、H.264 のエンコード/デコードを実現しています。

**NVIDIA VIDEO CODEC SDK を利用した H.264 はデコードは現時点では非対応です**

詳細は H.264 を [USE_H264.md](doc/USE_H264.md) をお読みください

## 対応機能
Expand Down Expand Up @@ -84,6 +82,7 @@ Sora Unity SDK ではソフトウェアでの H.264 エンコード/デコード
- NVIDIA VIDEO CODEC SDK
- Windows 版
- H.264 のハードウェアエンコードへの対応
- H.264 のハードウェアデコードへの対応

## 非対応

Expand All @@ -104,33 +103,15 @@ Sora Unity SDK ではソフトウェアでの H.264 エンコード/デコード
- Windows 10 1809 x86_64 以降
- macOS 10.15 x86_64 以降

## ライセンス

Apache License 2.0

```
Copyright 2019-2020, Wandbox LLC (Original Author)
Copyright 2019-2020, Shiguredo Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

## 有償での優先実装

- Windows 版 NVIDIA VIDEO CODEC SDK による H.264 エンコーダ対応
- [スロースネットワークス株式会社](http://www.sloth-networks.co.jp)
- WebRTC's Statistics 対応
- 企業名非公開
- Windows 版 NVIDIA VIDEO CODEC SDK による H.264 デコーダ対応
- [スロースネットワークス株式会社](http://www.sloth-networks.co.jp)

## 有償での優先実装が可能な機能一覧

Expand Down Expand Up @@ -170,3 +151,24 @@ iOS 10.0 以上への対応
### Android 対応

Android 5.0 以上への対応

## ライセンス

Apache License 2.0

```
Copyright 2019-2020, Wandbox LLC (Original Author)
Copyright 2019-2020, Shiguredo Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
6 changes: 1 addition & 5 deletions Sora/Sora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ public class Sora : IDisposable
{
public enum Role
{
Upstream,
Downstream,
Sendonly,
Recvonly,
Sendrecv,
Expand All @@ -29,7 +27,7 @@ public class Config
public string SignalingUrl = "";
public string ChannelId = "";
public string Metadata = "";
public Role Role = Sora.Role.Upstream;
public Role Role = Sora.Role.Sendonly;
public bool Multistream = false;
public CapturerType CapturerType = Sora.CapturerType.DeviceCamera;
public UnityEngine.Camera UnityCamera = null;
Expand Down Expand Up @@ -104,8 +102,6 @@ public bool Connect(Config config)
}

var role =
config.Role == Role.Upstream ? "upstream" :
config.Role == Role.Downstream ? "downstream" :
config.Role == Role.Sendonly ? "sendonly" :
config.Role == Role.Recvonly ? "recvonly" : "sendrecv";
return sora_connect(
Expand Down
6 changes: 3 additions & 3 deletions VERSIONS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SORA_UNITY_SDK_VERSION=2020.2
BOOST_VERSION=1.72.0
SORA_UNITY_SDK_VERSION=2020.3
BOOST_VERSION=1.73.0
JSON_VERSION=3.6.1
WEBRTC_BUILD_VERSION=81.4044.13.2
WEBRTC_BUILD_VERSION=83.4103.12.2
CUDA_VERSION=10.2
4 changes: 4 additions & 0 deletions doc/QA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 質問と答え
### 解像度を変更したい
- 解像度を変更したい場合はこちらの[SET_VIDEO_SIZE.md](https://github.com/shiguredo/sora-unity-sdk/blob/develop/doc/SET_VIDEO_SIZE.md)をお読みください

51 changes: 51 additions & 0 deletions doc/SET_VIDEO_SIZE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## 解像度の変更方法
### 概要
解像度の変更には「送信する映像のサイズ」、「受信するテクスチャのサイズ」、「Unityの表示上のサイズ」の3つを変える必要があります。
ここでの変更方法は[sora-unity-sdk-samples](https://github.com/shiguredo/sora-unity-sdk-samples)を参考例として記載しています。

### 変更対象
- SoraSample.cs
- RawImage(pub/sub/multi_pubシーンのみ)

### 変更方法
#### 送信する映像のサイズの変更
---------------------------------------
##### SoraSample.cs
`VideoWidth``VideoHeight`パラメータを追加してください。
[![Image from Gyazo](https://i.gyazo.com/36bad2d5d625a7e63107a9a2a5db7984.png)](https://gyazo.com/36bad2d5d625a7e63107a9a2a5db7984)

#### 受信するテクスチャのサイズの変更
---------------------------------------
##### SoraSample.cs
テクスチャを生成するパラメータを変更してください。
参考:[UnityDocument:Texture2D.Texture2D](https://docs.unity3d.com/jp/460/ScriptReference/Texture2D-ctor.html)

- pub/subの場合
[![Image from Gyazo](https://i.gyazo.com/47ae4e50834e793a7d5e84d0a68788a2.png)](https://gyazo.com/47ae4e50834e793a7d5e84d0a68788a2)
- multi_pub_sub/multi_subの場合
[![Image from Gyazo](https://i.gyazo.com/50d3e2699d008e59d2649733aae6b7ea.png)](https://gyazo.com/50d3e2699d008e59d2649733aae6b7ea)

#### Unityの表示上のサイズの変更
##### RawImage(pub/sub/multi_pubシーンのみ)
---------------------------------------
HierarchyからRawImageを選択し、Inspectorから`Width``Height`の値を変更してください。
`Width``Height`を変更すると設定した値によっては「開始」と「終了」ボタンが隠れてしまうため、
Hierarchyから「ButtonStart」と「ButtonEnd」を選択して少し上に動かしてください。

[![Image from Gyazo](https://i.gyazo.com/9ba94ab0b13edc2d4d4bf0d529e3ed14.png)](https://gyazo.com/9ba94ab0b13edc2d4d4bf0d529e3ed14)

参考:`Width``Height`を変更するとGameビューでは以下のように変化します。
[![Image from Gyazo](https://i.gyazo.com/791329a7ea7d5524cb781027ef918446.png)](https://gyazo.com/791329a7ea7d5524cb781027ef918446)

###### multi_pubsubシーンを変更したい場合
multi_pubsubシーンは動的に必要なイメージ数が変わるため、あらかじめ設定するRawImageはありません。
その場合はHierarchyのCanvas/BaseTrackの変更とCanvas/Scroll Viewのサイズ変更をしてください。
[![Image from Gyazo](https://i.gyazo.com/e025bc6392b4424e1b25d0b6f95b2589.png)](https://gyazo.com/e025bc6392b4424e1b25d0b6f95b2589)

#### 変更結果
- Unityでの表示
[![Image from Gyazo](https://i.gyazo.com/1b5cbd74888c36e3923ec99910db5955.png)](https://gyazo.com/1b5cbd74888c36e3923ec99910db5955)

- Unityから送信した映像の表示
設定した1280x720になっています。
[![Image from Gyazo](https://i.gyazo.com/3e7b05d4a2467dcd211b95660a764910.png)](https://gyazo.com/3e7b05d4a2467dcd211b95660a764910)
2 changes: 0 additions & 2 deletions doc/USE_H264.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Sora Unity SDK では、ソフトウェアでの H.264 エンコード/デコー
ただし、ハードウェアで H.264 エンコーダ/デコーダが使える場合は、それを積極的に利用します。

- Windows 版では [NVIDIA VIDEO CODEC SDK](https://developer.nvidia.com/nvidia-video-codec-sdk) がインストールされていれば、これを利用します。
- もしこれが利用可能な場合 **H.264 エンコードのみ可能** です。H.264 のデコードはできません。
- つまりシングルストリームの場合は `Sora.Role.Upstream` または `Sora.Role.Sendonly` のみ、マルチストリームの場合は `Sora.Role.Sendonly` でしか動作しません。
- macOS 版では [VideoToolbox](https://developer.apple.com/documentation/videotoolbox) を利用します。
- VideoToolbox によって H.264 エンコード/デコードが可能です。

Expand Down
14 changes: 12 additions & 2 deletions src/hwenc_nvcodec/nvcodec_video_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ NvCodecVideoDecoder::~NvCodecVideoDecoder() {
Release();
}

void NvCodecVideoDecoder::Log(NvCodecVideoDecoderCuda::LogType type, const std::string& log) {
if (type == NvCodecVideoDecoderCuda::LogType::LOG_INFO) {
RTC_LOG(LS_INFO) << log;
} else if (type == NvCodecVideoDecoderCuda::LogType::LOG_WARNING) {
RTC_LOG(LS_WARNING) << log;
} else {
RTC_LOG(LS_ERROR) << log;
}
}

bool NvCodecVideoDecoder::IsSupported(cudaVideoCodec codec_id) {
auto decoder = NvCodecVideoDecoderCuda::Create(codec_id);
auto decoder = NvCodecVideoDecoderCuda::Create(codec_id, &NvCodecVideoDecoder::Log);
return decoder != nullptr;
}

Expand Down Expand Up @@ -101,7 +111,7 @@ const char* NvCodecVideoDecoder::ImplementationName() const {
}

int32_t NvCodecVideoDecoder::InitNvCodec() {
decoder_ = NvCodecVideoDecoderCuda::Create(codec_id_);
decoder_ = NvCodecVideoDecoderCuda::Create(codec_id_, &NvCodecVideoDecoder::Log);
output_info_ = false;
return WEBRTC_VIDEO_CODEC_OK;
}
Expand Down
2 changes: 2 additions & 0 deletions src/hwenc_nvcodec/nvcodec_video_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class NvCodecVideoDecoder : public webrtc::VideoDecoder {
const char* ImplementationName() const override;

private:
static void NvCodecVideoDecoder::Log(NvCodecVideoDecoderCuda::LogType type, const std::string& log);

int32_t InitNvCodec();
void ReleaseNvCodec();

Expand Down
Loading

0 comments on commit 95fbbbc

Please sign in to comment.