Skip to content

Commit 65666ea

Browse files
authored
feat: Upgrade libwebrtc M116 (#973)
* libwebrtc M116 * fix * fix for m116 * fix stats
1 parent d050e78 commit 65666ea

24 files changed

+42
-50
lines changed

.yamato/package.metafile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ upm:
22
registry_url: https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
33
package_version: stable
44
webrtc_version:
5-
name: M115
5+
name: M116
66

77
editors:
88
- version: 2020.3

BuildScripts~/build_libwebrtc_android.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=5790
10+
export WEBRTC_VERSION=5845
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
1313
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"

BuildScripts~/build_libwebrtc_ios.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=5790
10+
export WEBRTC_VERSION=5845
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
1313
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"

BuildScripts~/build_libwebrtc_linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=5790
10+
export WEBRTC_VERSION=5845
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
1313
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"

BuildScripts~/build_libwebrtc_macos.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fi
77

88
export COMMAND_DIR=$(cd $(dirname $0); pwd)
99
export PATH="$(pwd)/depot_tools:$PATH"
10-
export WEBRTC_VERSION=5790
10+
export WEBRTC_VERSION=5845
1111
export OUTPUT_DIR="$(pwd)/out"
1212
export ARTIFACTS_DIR="$(pwd)/artifacts"
1313
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"

BuildScripts~/build_libwebrtc_win.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if not exist depot_tools (
66

77
set COMMAND_DIR=%~dp0
88
set PATH=%cd%\depot_tools;%PATH%
9-
set WEBRTC_VERSION=5790
9+
set WEBRTC_VERSION=5845
1010
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
1111
set GYP_GENERATORS=ninja,msvs-ninja
1212
set GYP_MSVS_VERSION=2022

BuildScripts~/build_plugin_android.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-android.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-android.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export PLUGIN_DIR=$(pwd)/Runtime/Plugins/Android
66

BuildScripts~/build_plugin_ios.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-ios.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-ios.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export WEBRTC_FRAMEWORK_DIR=$(pwd)/Runtime/Plugins/iOS
66
export WEBRTC_ARCHIVE_DIR=build/webrtc.xcarchive

BuildScripts~/build_plugin_linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-linux.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-linux.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export OUTPUT_FILEPATH=$(pwd)/Runtime/Plugins/x86_64/libwebrtc.so
66
export LIBCXX_BUILD_DIR=$(pwd)/llvm-project/build

BuildScripts~/build_plugin_mac.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-mac.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-mac.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export DYLIB_FILE=$(pwd)/Runtime/Plugins/macOS/libwebrtc.dylib
66

BuildScripts~/build_plugin_win.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@echo off
22

3-
set LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-win.zip
3+
set LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-win.zip
44
set SOLUTION_DIR=%cd%\Plugin~
55

66
echo Download LibWebRTC

BuildScripts~/build_testrunner_android.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-android.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-android.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export ARCH_ABI=arm64-v8a
66

BuildScripts~/build_testrunner_linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-linux.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-linux.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55

66
source ~/.profile

BuildScripts~/build_testrunner_mac.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-mac.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-mac.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55

66
# Install cmake

BuildScripts~/build_testrunner_win.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@echo off
22

3-
set LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-win.zip
3+
set LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-win.zip
44
set SOLUTION_DIR=%cd%\Plugin~
55

66
echo -------------------
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
--- depot_tools/fetch_configs/webrtc.py 2023-03-22 06:38:50.000000000 +0900
2-
+++ depot_tools/fetch_configs/webrtc.py.patch 2023-03-27 09:33:06.000000000 +0900
3-
@@ -22,7 +22,9 @@ class WebRTC(config_util.Config):
4-
'url': url,
5-
'deps_file': 'DEPS',
6-
'managed': False,
7-
- 'custom_deps': {},
8-
+ 'custom_deps': {
9-
+ "src/examples/androidtests/third_party/gradle": None
10-
+ },
11-
},
12-
],
13-
'with_branch_heads': True,
1+
--- fetch_configs/webrtc.py 2023-09-07 18:44:46.485574800 +0900
2+
+++ fetch_configs/webrtc.py.patch 2023-09-07 18:46:11.601268700 +0900
3+
@@ -21,7 +21,9 @@
4+
'url': url,
5+
'deps_file': 'DEPS',
6+
'managed': False,
7+
- 'custom_deps': {},
8+
+ 'custom_deps': {
9+
+ "src/examples/androidtests/third_party/gradle": None
10+
+ },
11+
},
12+
],
13+
'with_branch_heads':

BuildScripts~/test_plugin_android.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-android.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-android.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55
export ARCH_ABI=arm64-v8a
66

BuildScripts~/test_plugin_ios.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -eu
22

3-
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M115/webrtc-ios.zip
3+
export LIBWEBRTC_DOWNLOAD_URL=https://github.com/Unity-Technologies/com.unity.webrtc/releases/download/M116/webrtc-ios.zip
44
export SOLUTION_DIR=$(pwd)/Plugin~
55

66
# Install cmake

Plugin~/WebRTCPlugin/Codec/NvCodec/NvCodec.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ namespace webrtc
194194
std::unique_ptr<VideoEncoder> NvEncoderFactory::CreateVideoEncoder(const SdpVideoFormat& format)
195195
{
196196
// todo(kazuki):: add CUmemorytype::CU_MEMORYTYPE_DEVICE option
197-
return NvEncoder::Create(cricket::VideoCodec(format), context_, CU_MEMORYTYPE_ARRAY, format_, profiler_);
197+
return NvEncoder::Create(cricket::CreateVideoCodec(format), context_, CU_MEMORYTYPE_ARRAY, format_, profiler_);
198198
}
199199

200200
NvDecoderFactory::NvDecoderFactory(CUcontext context, ProfilerMarkerFactory* profiler)
@@ -211,7 +211,7 @@ namespace webrtc
211211

212212
std::unique_ptr<VideoDecoder> NvDecoderFactory::CreateVideoDecoder(const SdpVideoFormat& format)
213213
{
214-
return NvDecoder::Create(cricket::VideoCodec(format), context_, profiler_);
214+
return NvDecoder::Create(cricket::CreateVideoCodec(format), context_, profiler_);
215215
}
216216
}
217217
}

Plugin~/WebRTCPluginTest/NvCodec/NvCodecTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ namespace webrtc
4747
protected:
4848
std::unique_ptr<VideoEncoder> CreateEncoder() override
4949
{
50-
cricket::VideoCodec codec = cricket::VideoCodec(cricket::kH264CodecName);
50+
cricket::VideoCodec codec = cricket::CreateVideoCodec(cricket::kH264CodecName);
5151
codec.SetParam(cricket::kH264FmtpProfileLevelId, kProfileLevelIdString());
5252
return NvEncoder::Create(codec, context_, CU_MEMORYTYPE_ARRAY, NV_ENC_BUFFER_FORMAT_ARGB, nullptr);
5353
}
5454

5555
std::unique_ptr<VideoDecoder> CreateDecoder() override
5656
{
57-
cricket::VideoCodec codec = cricket::VideoCodec(cricket::kH264CodecName);
57+
cricket::VideoCodec codec = cricket::CreateVideoCodec(cricket::kH264CodecName);
5858
codec.SetParam(cricket::kH264FmtpProfileLevelId, kProfileLevelIdString());
5959
return NvDecoder::Create(codec, context_, nullptr);
6060
}

Plugin~/WebRTCPluginTest/NvCodec/NvEncoderImplTest.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace webrtc
4040

4141
TEST_P(NvEncoderImplTest, CanInitializeWithDefaultParameters)
4242
{
43-
cricket::VideoCodec codec = cricket::VideoCodec(cricket::kH264CodecName);
43+
cricket::VideoCodec codec = cricket::CreateVideoCodec(cricket::kH264CodecName);
4444
codec.SetParam(cricket::kH264FmtpProfileLevelId, kProfileLevelIdString());
4545
NvEncoderImpl encoder(codec, context_, CU_MEMORYTYPE_ARRAY, NV_ENC_BUFFER_FORMAT_ARGB, nullptr);
4646

@@ -53,7 +53,7 @@ namespace webrtc
5353
{
5454
H264ProfileLevelId profileLevelId(H264Profile::kProfileBaseline, H264Level::kLevel5_1);
5555

56-
cricket::VideoCodec codec = cricket::VideoCodec(cricket::kH264CodecName);
56+
cricket::VideoCodec codec = cricket::CreateVideoCodec(cricket::kH264CodecName);
5757
codec.SetParam(cricket::kH264FmtpProfileLevelId, *H264ProfileLevelIdToString(profileLevelId));
5858
NvEncoderImpl encoder(codec, context_, CU_MEMORYTYPE_ARRAY, NV_ENC_BUFFER_FORMAT_ARGB, nullptr);
5959

@@ -69,7 +69,7 @@ namespace webrtc
6969
{
7070
H264ProfileLevelId profileLevelId(H264Profile::kProfileBaseline, H264Level::kLevel5_1);
7171

72-
cricket::VideoCodec codec = cricket::VideoCodec(cricket::kH264CodecName);
72+
cricket::VideoCodec codec = cricket::CreateVideoCodec(cricket::kH264CodecName);
7373
codec.SetParam(cricket::kH264FmtpProfileLevelId, *H264ProfileLevelIdToString(profileLevelId));
7474
NvEncoderImpl encoder(codec, context_, CU_MEMORYTYPE_ARRAY, NV_ENC_BUFFER_FORMAT_ARGB, nullptr);
7575

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Please read this if you have an interest to customize native code in this projec
5656
| `3.0.0-pre.4` | [M107](https://groups.google.com/g/discuss-webrtc/c/StVFkKuSRc8) | - Fix bugs | Jan 2023 |
5757
| `3.0.0-pre.5` | [M107](https://groups.google.com/g/discuss-webrtc/c/StVFkKuSRc8) | - Encoded Transform API | Apr 2023 |
5858
| `3.0.0-pre.6` | [M112](https://groups.google.com/g/discuss-webrtc/c/V-XFau9W9gY) | - Fix bugs | Jul 2023 |
59-
| `3.0.0-pre.7` | [M115](https://groups.google.com/g/discuss-webrtc/c/1CTKFxJsrmQ) | - Fix bugs | Sep 2023 |
59+
| `3.0.0-pre.7` | [M116](https://groups.google.com/g/discuss-webrtc/c/bEsO8Lz7psE) | - Fix bugs | Sep 2023 |
6060

6161
## Licenses
6262

Runtime/Scripts/RTCStats.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,6 @@ public class RTCRTPStreamStats : RTCStats
837837
/// </summary>
838838
public string kind { get { return GetString("kind"); } }
839839

840-
/// <summary>
841-
///
842-
/// </summary>
843-
[Obsolete]
844-
public string trackId { get { return GetString("trackId"); } }
845-
846840
/// <summary>
847841
///
848842
/// </summary>
@@ -886,7 +880,7 @@ public class RTCSentRtpStreamStats : RTCRTPStreamStats
886880
/// <summary>
887881
///
888882
/// </summary>
889-
public uint packetsSent { get { return GetUnsignedInt("packetsSent"); } }
883+
public ulong packetsSent { get { return GetUnsignedLong("packetsSent"); } }
890884

891885
/// <summary>
892886
///
@@ -1036,7 +1030,7 @@ public class RTCInboundRTPStreamStats : RTCReceivedRtpStreamStats
10361030
/// <summary>
10371031
///
10381032
/// </summary>
1039-
public int framesReceived { get { return GetInt("framesReceived"); } }
1033+
public uint framesReceived { get { return GetUnsignedInt("framesReceived"); } }
10401034

10411035
/// <summary>
10421036
///

Tests/Runtime/StatsReportTest.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ public static void Test(RTCStats stats)
117117
case RTCStatsType.InboundRtp:
118118
var inboundRtpStreamStats = stats as RTCInboundRTPStreamStats;
119119
Assert.NotNull(inboundRtpStreamStats);
120-
Assert.AreEqual(65, inboundRtpStreamStats.Dict.Count);
120+
Assert.AreEqual(64, inboundRtpStreamStats.Dict.Count);
121121
Ignore.Pass(inboundRtpStreamStats.ssrc);
122122
Assert.IsNotEmpty(inboundRtpStreamStats.kind);
123-
// Obsolete: Ignore.Pass(inboundRtpStreamStats.trackId);
124123
Assert.IsNotEmpty(inboundRtpStreamStats.transportId);
125124
Ignore.Pass(inboundRtpStreamStats.codecId);
126125
Ignore.Pass(inboundRtpStreamStats.jitter);
@@ -244,10 +243,9 @@ public static void Test(RTCStats stats)
244243
case RTCStatsType.OutboundRtp:
245244
var outboundRtpStreamStats = stats as RTCOutboundRTPStreamStats;
246245
Assert.NotNull(outboundRtpStreamStats);
247-
Assert.AreEqual(37, outboundRtpStreamStats.Dict.Count);
246+
Assert.AreEqual(36, outboundRtpStreamStats.Dict.Count);
248247
Ignore.Pass(outboundRtpStreamStats.ssrc);
249248
Assert.IsNotEmpty(outboundRtpStreamStats.kind);
250-
// Obsolete: Ignore.Pass(outboundRtpStreamStats.trackId);
251249
Assert.IsNotEmpty(outboundRtpStreamStats.transportId);
252250
Ignore.Pass(outboundRtpStreamStats.codecId);
253251
Ignore.Pass(outboundRtpStreamStats.mediaSourceId);

0 commit comments

Comments
 (0)