Skip to content

Commit

Permalink
Merge tag 'm132.6834.5.8' into feature/m132.6834
Browse files Browse the repository at this point in the history
  • Loading branch information
Laky-64 committed Feb 17, 2025
2 parents 7097cfc + c4ce1a0 commit fad3687
Show file tree
Hide file tree
Showing 12 changed files with 738 additions and 87 deletions.
43 changes: 43 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,49 @@ VERSION ファイルを上げただけの場合は変更履歴記録は不要。
- @melpon

## タイムライン

- 2025-02-07 [RELEASE] m132.6834.5.8
- @melpon
- 2025-02-07 [CHANGE] RTCDefaultVideoEncoderFactory が返すフォーマットの一覧を scalability_mode に対応する
- @melpon
- 2025-02-03 [RELEASE] m132.6834.5.7
- @zztkm
- 2025-02-03 [RELEASE] m132.6834.5.6
- @zztkm
- 2025-01-31 [UPDATE] iOS の scaleResolutionDownTo のプロパティの setter を assign から copy に変更する
- @zztkm
- 2025-01-30 [RELEASE] m132.6834.5.5
- @melpon
- 2025-01-30 [FIX] Windows のビルド依存に api:enable_media_with_defaults を追加し忘れていた
- @melpon
- 2025-01-30 [RELEASE] m132.6834.5.4
- @melpon
- 2025-01-30 [ADD] ビルド依存に api:enable_media_with_defaults を追加
- @melpon
- 2025-01-27 [RELEASE] m132.6834.5.3
- @torikizi
- 2025-01-25 [ADD] Android と iOS の RtpEncodingParameters に scaleResolutionDownTo を定義する
- @melpon
- 2025-01-23 [RELEASE] m132.6834.5.2
- @miosakuma
- 2025-01-23 [FIX] apt_install_x86_64.sh の `apt-get update` のコメントアウトを解除
- apt-get install で vim のパッケージが 404 エラーになったため
- @miosakuma
- 2025-01-22 [FIX] kVTVideoEncoderSpecification_RequiredLowLatency を h265_ios.patch から削除する
- libwebrtc を組み込んだ iOS アプリを App Store Connect にアップロードが失敗する問題への対処
- 非公開シンボルである kVTVideoEncoderSpecification_RequiredLowLatency を参照しているとのエラーメッセージであったため、参照している箇所を削除した
- @miosakuma
- 2025-01-14 [RELEASE] m132.6834.5.1
- @miosakuma
- 2024-12-20 [RELEASE] m132.6834.5.0
- @melpon @torikizi
- 2024-12-20 [RELEASE] m132.6834.4.0
- ios_proxy.patch を libwebrtc 側の処理変更に追従して修正する
- @melpon
- 2025-01-10 [RELEASE] m130.6723.2.1
- @miosakuma
- 2025-01-10 [CHANGE] libwebrtc の iOS Simulcast 対応が不十分だったので、`ios_simulcast.patch` パッチを復活させた。 scalabilityMode の型が変更になっている。詳細は[こちら](patches/README.md#ios_simulcastpatch)
- @tnoho
- 2024-12-14 [RELEASE] m131.6778.4.0
- apt_install_arm.sh の `apt update` のコメントアウトを解除
- @torikizi
Expand Down
8 changes: 4 additions & 4 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WEBRTC_BUILD_VERSION=131.6778.4.0
WEBRTC_VERSION=131.6778.4
WEBRTC_READABLE_VERSION=M131.6778@{#4}
WEBRTC_COMMIT=79aff54b0fa9238ce3518dd9eaf9610cd6f22e82
WEBRTC_BUILD_VERSION=132.6834.5.8
WEBRTC_VERSION=132.6834.5
WEBRTC_READABLE_VERSION=M132.6834@{#5}
WEBRTC_COMMIT=afaf497805cbb502da89991c2dcd783201efdd08
14 changes: 14 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,17 @@ https://github.com/shiguredo/sora-cpp-sdk/blob/e1257a3e358e62512c0c77db5ba82f90e
# windows_add_optional.patch
Windows で std::optional が参照エラーになるのを改善するパッチ。
## ios_simulcast.patch
iOS でのサイマルキャストのサポートを追加するパッチ。この実装は C++ の `SimulcastEncoderAdapter` の簡単なラッパーであり、既存の仕様に破壊的変更も行わない。
以下の API を追加する。
- `RTCVideoEncoderFactorySimulcast`
- `RTCVideoEncoderSimulcast`
同等の機能が本家に実装されたら削除する。
[libwebrtcの変更](https://webrtc-review.googlesource.com/c/src/+/358866)を取り込んだため、従来の ios_simulcast.patch とは異なる。
特に scalabilityMode は libwebrtc 側で NSString 記述となったため RTCScalabilityMode ENUM を削除した。変数名は同じだが NSNumber から NSString に型が変更になっているので注意すること。
3 changes: 2 additions & 1 deletion patches/add_deps.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ diff --git a/BUILD.gn b/BUILD.gn
index 533262e03b..9978e67db1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -501,6 +501,10 @@ if (!build_with_chromium) {
@@ -501,6 +501,11 @@ if (!build_with_chromium) {
"pc:rtc_pc",
"sdk",
"video",
+ "//third_party/zlib",
+ "rtc_base:log_sinks",
+ "rtc_base:socket_adapters",
+ "media:rtc_simulcast_encoder_adapter",
+ "api:enable_media_with_defaults",
]

if (rtc_include_builtin_audio_codecs) {
119 changes: 119 additions & 0 deletions patches/android_add_scale_resolution_down_to.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
diff --git a/sdk/android/api/org/webrtc/RtpParameters.java b/sdk/android/api/org/webrtc/RtpParameters.java
index d6a22662bb..a0bfdc65a5 100644
--- a/sdk/android/api/org/webrtc/RtpParameters.java
+++ b/sdk/android/api/org/webrtc/RtpParameters.java
@@ -43,6 +43,27 @@ public class RtpParameters {
}
}

+ public static class ResolutionRestriction {
+ public int maxWidth;
+ public int maxHeight;
+
+ @CalledByNative("ResolutionRestriction")
+ ResolutionRestriction(int maxWidth, int maxHeight) {
+ this.maxWidth = maxWidth;
+ this.maxHeight = maxHeight;
+ }
+
+ @CalledByNative("ResolutionRestriction")
+ int getMaxWidth() {
+ return maxWidth;
+ }
+
+ @CalledByNative("ResolutionRestriction")
+ int getMaxHeight() {
+ return maxHeight;
+ }
+ }
+
public static class Encoding {
// If non-null, this represents the RID that identifies this encoding layer.
// RIDs are used to identify layers in simulcast.
@@ -76,6 +97,7 @@ public class RtpParameters {
// If non-null, scale the width and height down by this factor for video. If null,
// implementation default scaling factor will be used.
@Nullable public Double scaleResolutionDownBy;
+ @Nullable public ResolutionRestriction scaleResolutionDownTo;
@Nullable public String scalabilityMode;
// SSRC to be used by this encoding.
// Can't be changed between getParameters/setParameters.
@@ -94,7 +116,7 @@ public class RtpParameters {
@CalledByNative("Encoding")
Encoding(String rid, boolean active, double bitratePriority, @Priority int networkPriority,
Integer maxBitrateBps, Integer minBitrateBps, Integer maxFramerate,
- Integer numTemporalLayers, Double scaleResolutionDownBy, String scalabilityMode, Long ssrc,
+ Integer numTemporalLayers, Double scaleResolutionDownBy, ResolutionRestriction scaleResolutionDownTo, String scalabilityMode, Long ssrc,
boolean adaptiveAudioPacketTime) {
this.rid = rid;
this.active = active;
@@ -105,6 +127,7 @@ public class RtpParameters {
this.maxFramerate = maxFramerate;
this.numTemporalLayers = numTemporalLayers;
this.scaleResolutionDownBy = scaleResolutionDownBy;
+ this.scaleResolutionDownTo = scaleResolutionDownTo;
this.scalabilityMode = scalabilityMode;
this.ssrc = ssrc;
this.adaptiveAudioPacketTime = adaptiveAudioPacketTime;
@@ -168,6 +191,12 @@ public class RtpParameters {
return scaleResolutionDownBy;
}

+ @Nullable
+ @CalledByNative("Encoding")
+ ResolutionRestriction getScaleResolutionDownTo() {
+ return scaleResolutionDownTo;
+ }
+
@CalledByNative("Encoding")
Long getSsrc() {
return ssrc;
diff --git a/sdk/android/src/jni/pc/rtp_parameters.cc b/sdk/android/src/jni/pc/rtp_parameters.cc
index dfc7f17f6d..a7858b0dcf 100644
--- a/sdk/android/src/jni/pc/rtp_parameters.cc
+++ b/sdk/android/src/jni/pc/rtp_parameters.cc
@@ -42,6 +42,24 @@ webrtc::DegradationPreference JavaToNativeDegradationPreference(
return webrtc::DegradationPreference::DISABLED;
}

+ScopedJavaLocalRef<jobject> NativeToJavaResolutionRestriction(
+ JNIEnv* env,
+ const webrtc::Resolution& resolution) {
+ return Java_ResolutionRestriction_Constructor(
+ env, resolution.width, resolution.height);
+}
+
+webrtc::Resolution JavaToNativeResolutionRestriction(
+ JNIEnv* jni,
+ const JavaRef<jobject>& j_resolution) {
+ jint width = Java_ResolutionRestriction_getMaxWidth(jni, j_resolution);
+ jint height = Java_ResolutionRestriction_getMaxHeight(jni, j_resolution);
+ webrtc::Resolution resolution;
+ resolution.width = width;
+ resolution.height = height;
+ return resolution;
+}
+
ScopedJavaLocalRef<jobject> NativeToJavaRtpEncodingParameter(
JNIEnv* env,
const RtpEncodingParameters& encoding) {
@@ -53,6 +71,7 @@ ScopedJavaLocalRef<jobject> NativeToJavaRtpEncodingParameter(
NativeToJavaInteger(env, encoding.max_framerate),
NativeToJavaInteger(env, encoding.num_temporal_layers),
NativeToJavaDouble(env, encoding.scale_resolution_down_by),
+ encoding.scale_resolution_down_to ? NativeToJavaResolutionRestriction(env, *encoding.scale_resolution_down_to) : nullptr,
NativeToJavaString(env, encoding.scalability_mode),
encoding.ssrc ? NativeToJavaLong(env, *encoding.ssrc) : nullptr,
encoding.adaptive_ptime);
@@ -117,6 +136,11 @@ RtpEncodingParameters JavaToNativeRtpEncodingParameters(
Java_Encoding_getScaleResolutionDownBy(jni, j_encoding_parameters);
encoding.scale_resolution_down_by =
JavaToNativeOptionalDouble(jni, j_scale_resolution_down_by);
+ ScopedJavaLocalRef<jobject> j_scale_resolution_down_to =
+ Java_Encoding_getScaleResolutionDownTo(jni, j_encoding_parameters);
+ if (!IsNull(jni, j_scale_resolution_down_to)) {
+ encoding.scale_resolution_down_to = JavaToNativeResolutionRestriction(jni, j_scale_resolution_down_to);
+ }
ScopedJavaLocalRef<jstring> j_scalability_mode =
Java_Encoding_getScalabilityMode(jni, j_encoding_parameters);
if (!IsNull(jni, j_scalability_mode)) {
75 changes: 37 additions & 38 deletions patches/h265_ios.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index da967d555e..9d9efc723f 100644
index 1df3a48fd6..d0e39c5e0e 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -689,6 +689,16 @@ if (is_ios || is_mac) {
@@ -688,6 +688,16 @@ if (is_ios || is_mac) {
]
}

Expand All @@ -19,7 +19,7 @@ index da967d555e..9d9efc723f 100644
public_configs = [ ":common_config_objc" ]
deps = [
":base_objc",
@@ -1360,6 +1370,15 @@ if (is_ios || is_mac) {
@@ -1375,6 +1385,15 @@ if (is_ios || is_mac) {
"objc/api/video_frame_buffer/RTCNativeMutableI420Buffer.h",
]

Expand All @@ -35,7 +35,7 @@ index da967d555e..9d9efc723f 100644
if (!build_with_chromium) {
common_objc_headers += [
"objc/api/logging/RTCCallbackLogger.h",
@@ -1729,6 +1748,17 @@ if (is_ios || is_mac) {
@@ -1745,6 +1764,17 @@ if (is_ios || is_mac) {
"objc/components/video_codec/RTCVideoEncoderH264.mm",
]

Expand Down Expand Up @@ -196,10 +196,10 @@ index 6e3baa8750..838647fa25 100644
[RTC_OBJC_TYPE(RTCVideoDecoderVP9) isSupported]) {
return [RTC_OBJC_TYPE(RTCVideoDecoderVP9) vp9Decoder];
diff --git a/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
index 8de55bde4a..3c4a8aa2d7 100644
index b6ce925633..81c953baed 100644
--- a/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
+++ b/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m
@@ -15,6 +15,8 @@
@@ -16,6 +16,8 @@
#import "api/video_codec/RTCVideoCodecConstants.h"
#import "api/video_codec/RTCVideoEncoderVP8.h"
#import "api/video_codec/RTCVideoEncoderVP9.h"
Expand All @@ -208,25 +208,7 @@ index 8de55bde4a..3c4a8aa2d7 100644
#import "base/RTCVideoCodecInfo.h"

#if defined(RTC_USE_LIBAOM_AV1_ENCODER)
@@ -44,6 +46,9 @@ @implementation RTC_OBJC_TYPE (RTCDefaultVideoEncoderFactory)
[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH264Name
parameters:constrainedBaselineParams];

+ RTC_OBJC_TYPE(RTCVideoCodecInfo) *h265Info =
+ [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH265Name];
+
RTC_OBJC_TYPE(RTCVideoCodecInfo) *vp8Info =
[[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecVp8Name];

@@ -51,6 +56,7 @@ @implementation RTC_OBJC_TYPE (RTCDefaultVideoEncoderFactory)
constrainedHighInfo,
constrainedBaselineInfo,
vp8Info,
+ h265Info,
] mutableCopy];

if ([RTC_OBJC_TYPE(RTCVideoEncoderVP9) isSupported]) {
@@ -73,6 +79,10 @@ @implementation RTC_OBJC_TYPE (RTCDefaultVideoEncoderFactory)
@@ -38,6 +40,10 @@ @implementation RTC_OBJC_TYPE (RTCDefaultVideoEncoderFactory)
} else if ([info.name isEqualToString:kRTCVideoCodecVp9Name] &&
[RTC_OBJC_TYPE(RTCVideoEncoderVP9) isSupported]) {
return [RTC_OBJC_TYPE(RTCVideoEncoderVP9) vp9Encoder];
Expand Down Expand Up @@ -832,6 +814,31 @@ index 0000000000..5d70a453cf
+
+@end
\ No newline at end of file
diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderFactorySimulcast.mm b/sdk/objc/components/video_codec/RTCVideoEncoderFactorySimulcast.mm
index 15a6249c11..486980dc36 100644
--- a/sdk/objc/components/video_codec/RTCVideoEncoderFactorySimulcast.mm
+++ b/sdk/objc/components/video_codec/RTCVideoEncoderFactorySimulcast.mm
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>

#import "RTCH264ProfileLevelId.h"
+#import "RTCH265ProfileLevelId.h"
#import "RTCMacros.h"
#import "RTCVideoCodecInfo.h"
#import "RTCVideoEncoderFactorySimulcast.h"
@@ -109,6 +110,12 @@ - (instancetype)initWithPrimary:(id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)prima
RTCVideoCodecInfo *codec = [[RTCVideoCodecInfo alloc] initWithNativeSdpVideoFormat: format];
[codecs addObject: codec];
}
+ // H265
+ {
+ RTC_OBJC_TYPE(RTCVideoCodecInfo) *codec =
+ [[RTC_OBJC_TYPE(RTCVideoCodecInfo) alloc] initWithName:kRTCVideoCodecH265Name];
+ [codecs addObject: codec];
+ }

return [codecs copy];
}
diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderH265.h b/sdk/objc/components/video_codec/RTCVideoEncoderH265.h
new file mode 100644
index 0000000000..54d86807ec
Expand Down Expand Up @@ -865,10 +872,10 @@ index 0000000000..54d86807ec
\ No newline at end of file
diff --git a/sdk/objc/components/video_codec/RTCVideoEncoderH265.mm b/sdk/objc/components/video_codec/RTCVideoEncoderH265.mm
new file mode 100644
index 0000000000..b9ba2c139e
index 0000000000..42284c1ab3
--- /dev/null
+++ b/sdk/objc/components/video_codec/RTCVideoEncoderH265.mm
@@ -0,0 +1,614 @@
@@ -0,0 +1,606 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
Expand Down Expand Up @@ -908,8 +915,6 @@ index 0000000000..b9ba2c139e
+#include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h"
+#include "system_wrappers/include/clock.h"
+
+VT_EXPORT const CFStringRef kVTVideoEncoderSpecification_RequiredLowLatency;
+
+static constexpr int ErrorCallbackDefaultValue = -1;
+
+@interface RTC_OBJC_TYPE (RTCVideoEncoderH265) ()
Expand Down Expand Up @@ -1293,10 +1298,6 @@ index 0000000000..b9ba2c139e
+#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
+ CFDictionarySetValue(encoder_specs, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue);
+#endif
+#if HAVE_VTB_REQUIREDLOWLATENCY
+ if (_isLowLatencyEnabled)
+ CFDictionarySetValue(encoder_specs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
+#endif
+ OSStatus status = VTCompressionSessionCreate(
+ nullptr, // use default allocator
+ _width, _height, kCMVideoCodecType_HEVC,
Expand All @@ -1305,8 +1306,6 @@ index 0000000000..b9ba2c139e
+ nullptr, // use default compressed data allocator
+ compressionOutputCallback, nullptr, &_compressionSession);
+ if (status != noErr) {
+ if (encoder_specs)
+ CFDictionaryRemoveValue(encoder_specs, kVTVideoEncoderSpecification_RequiredLowLatency);
+ status = VTCompressionSessionCreate(
+ nullptr, // use default allocator
+ _width, _height, kCMVideoCodecType_HEVC,
Expand Down Expand Up @@ -1638,7 +1637,7 @@ index 0000000000..fcaccb8bbc
+}
\ No newline at end of file
diff --git a/sdk/objc/components/video_codec/nalu_rewriter.cc b/sdk/objc/components/video_codec/nalu_rewriter.cc
index 73c0ed0abd..4a160565e1 100644
index 054d6f9284..301dd7f8c9 100644
--- a/sdk/objc/components/video_codec/nalu_rewriter.cc
+++ b/sdk/objc/components/video_codec/nalu_rewriter.cc
@@ -18,6 +18,7 @@
Expand Down Expand Up @@ -2321,7 +2320,7 @@ index c2b9e4875e..a88e4d5c26 100644
private:
// Returns the the next offset that contains NALU data.
diff --git a/sdk/objc/native/src/objc_video_encoder_factory.mm b/sdk/objc/native/src/objc_video_encoder_factory.mm
index 1085cb8cb4..359ca67a4b 100644
index 919848a161..40050361fe 100644
--- a/sdk/objc/native/src/objc_video_encoder_factory.mm
+++ b/sdk/objc/native/src/objc_video_encoder_factory.mm
@@ -16,6 +16,7 @@
Expand All @@ -2332,7 +2331,7 @@ index 1085cb8cb4..359ca67a4b 100644
#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h"
#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
#import "sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h"
@@ -59,6 +60,9 @@ int32_t RegisterEncodeCompleteCallback(EncodedImageCallback *callback) override
@@ -60,6 +61,9 @@ int32_t RegisterEncodeCompleteCallback(EncodedImageCallback *callback) override
if ([info isKindOfClass:[RTC_OBJC_TYPE(RTCCodecSpecificInfoH264) class]]) {
codecSpecificInfo =
[(RTC_OBJC_TYPE(RTCCodecSpecificInfoH264) *)info nativeCodecSpecificInfo];
Expand Down
Loading

0 comments on commit fad3687

Please sign in to comment.