Skip to content

Commit ffd5ba9

Browse files
committed
fix compile issue for linux.
1 parent 8fbd62f commit ffd5ba9

10 files changed

Lines changed: 30 additions & 45 deletions

webrtc-sys/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ fn main() {
186186
_ => {}
187187
}
188188

189-
builder.flag("-std=c++2a");
189+
builder
190+
.flag("-Wno-changes-meaning")
191+
.flag("-std=c++20");
190192
}
191193
"macos" => {
192194
println!("cargo:rustc-link-lib=framework=Foundation");

webrtc-sys/libwebrtc/build_android.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v
7272
git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7373
git apply "$COMMAND_DIR/patches/android_use_libunwind.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7474

75-
cd third_party
76-
git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
77-
cd ..
78-
7975
cd ..
8076

8177
mkdir -p "$ARTIFACTS_DIR/lib"

webrtc-sys/libwebrtc/build_linux.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --i
7171
git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7272
git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
7373

74-
cd third_party
75-
git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn
76-
cd ..
77-
7874
cd ..
7975

8076
mkdir -p "$ARTIFACTS_DIR/lib"
@@ -99,9 +95,9 @@ args="is_debug=$debug \
9995
enable_libaom=true \
10096
is_component_build=false \
10197
enable_stripping=true \
102-
use_goma=false \
10398
ffmpeg_branding=\"Chrome\" \
10499
rtc_use_h264=true \
100+
rtc_use_h265=true \
105101
rtc_use_pipewire=false \
106102
symbol_level=0 \
107103
enable_iterator_debugging=false \
@@ -117,7 +113,7 @@ ninja -C "$OUTPUT_DIR" :default
117113
# make libwebrtc.a
118114
# don't include nasm
119115
ar -rc "$ARTIFACTS_DIR/lib/libwebrtc.a" `find "$OUTPUT_DIR/obj" -name '*.o' -not -path "*/third_party/nasm/*"`
120-
objcopy --redefine-syms="$COMMAND_DIR/boringssl_prefix_symbols.txt" "$ARTIFACTS_DIR/lib/libwebrtc.a"
116+
objcopy --target=elf64-x86-64 --redefine-syms="$COMMAND_DIR/boringssl_prefix_symbols.txt" "$ARTIFACTS_DIR/lib/libwebrtc.a"
121117

122118
python3 "./src/tools_webrtc/libs/generate_licenses.py" \
123119
--target :default "$OUTPUT_DIR" "$OUTPUT_DIR"

webrtc-sys/libwebrtc/patches/abseil_use_optional.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

webrtc-sys/libwebrtc/patches/add_deps.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/BUILD.gn b/BUILD.gn
2-
index d5289b85d7..76823f6cff 100644
2+
index ca8d8faa61..13e07a2f28 100644
33
--- a/BUILD.gn
44
+++ b/BUILD.gn
55
@@ -24,6 +24,9 @@
@@ -12,7 +12,7 @@ index d5289b85d7..76823f6cff 100644
1212
if (rtc_enable_protobuf) {
1313
import("//third_party/protobuf/proto_library.gni")
1414
}
15-
@@ -292,6 +295,10 @@ config("common_config") {
15+
@@ -331,6 +334,10 @@ config("common_config") {
1616
defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
1717
}
1818

@@ -23,7 +23,7 @@ index d5289b85d7..76823f6cff 100644
2323
if (rtc_libvpx_build_vp9) {
2424
defines += [ "RTC_ENABLE_VP9" ]
2525
}
26-
@@ -517,6 +524,10 @@ if (!build_with_chromium) {
26+
@@ -565,6 +572,10 @@ if (!build_with_chromium) {
2727
"pc:rtc_pc",
2828
"sdk",
2929
"video",

webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/rtc_base/boringssl_certificate.cc b/rtc_base/boringssl_certificate.cc
2-
index 99b2ab3e24..c37d6d963f 100644
2+
index 016b4dabba..1a0c1b8d42 100644
33
--- a/rtc_base/boringssl_certificate.cc
44
+++ b/rtc_base/boringssl_certificate.cc
5-
@@ -253,6 +253,12 @@ BoringSSLCertificate::BoringSSLCertificate(
5+
@@ -259,6 +259,12 @@ BoringSSLCertificate::BoringSSLCertificate(
66
RTC_DCHECK(cert_buffer_ != nullptr);
77
}
88

@@ -16,18 +16,18 @@ index 99b2ab3e24..c37d6d963f 100644
1616
OpenSSLKeyPair* key_pair,
1717
const SSLIdentityParams& params) {
1818
diff --git a/rtc_base/boringssl_certificate.h b/rtc_base/boringssl_certificate.h
19-
index 8b4577a17c..e1fe26cba5 100644
19+
index 926dd332ec..5c62c63390 100644
2020
--- a/rtc_base/boringssl_certificate.h
2121
+++ b/rtc_base/boringssl_certificate.h
22-
@@ -33,6 +33,7 @@ class OpenSSLKeyPair;
22+
@@ -34,6 +34,7 @@ namespace webrtc {
2323
class BoringSSLCertificate final : public SSLCertificate {
2424
public:
2525
explicit BoringSSLCertificate(bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer);
2626
+ BoringSSLCertificate(bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer, SSL* ssl);
2727

2828
static std::unique_ptr<BoringSSLCertificate> Generate(
2929
OpenSSLKeyPair* key_pair,
30-
@@ -74,6 +75,11 @@ class BoringSSLCertificate final : public SSLCertificate {
30+
@@ -66,6 +67,11 @@ class BoringSSLCertificate final : public SSLCertificate {
3131
private:
3232
// A handle to the DER encoded certificate data.
3333
bssl::UniquePtr<CRYPTO_BUFFER> cert_buffer_;
@@ -38,12 +38,12 @@ index 8b4577a17c..e1fe26cba5 100644
3838
+ SSL* ssl() const { return ssl_; }
3939
};
4040

41-
} // namespace rtc
41+
} // namespace webrtc
4242
diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc
43-
index bc10e619eb..836ef9ea18 100644
43+
index cb5dfc6a85..a2de51ee74 100644
4444
--- a/rtc_base/openssl_adapter.cc
4545
+++ b/rtc_base/openssl_adapter.cc
46-
@@ -822,7 +822,7 @@ enum ssl_verify_result_t OpenSSLAdapter::SSLVerifyInternal(SSL* ssl,
46+
@@ -840,7 +840,7 @@ enum ssl_verify_result_t OpenSSLAdapter::SSLVerifyInternal(SSL* ssl,
4747
return ssl_verify_invalid;
4848
}
4949

@@ -52,20 +52,20 @@ index bc10e619eb..836ef9ea18 100644
5252
if (!ssl_cert_verifier_->Verify(cert)) {
5353
RTC_LOG(LS_WARNING) << "Failed to verify certificate using custom callback";
5454
return ssl_verify_invalid;
55-
@@ -894,7 +894,7 @@ int OpenSSLAdapter::SSLVerifyInternal(int previous_status,
55+
@@ -912,7 +912,7 @@ int OpenSSLAdapter::SSLVerifyInternal(int previous_status,
5656
RTC_LOG(LS_ERROR) << "Failed to allocate CRYPTO_BUFFER.";
5757
return previous_status;
5858
}
5959
- const BoringSSLCertificate cert(std::move(crypto_buffer));
6060
+ const BoringSSLCertificate cert(std::move(crypto_buffer), ssl);
6161
#else
62-
const OpenSSLCertificate cert(X509_STORE_CTX_get_current_cert(store));
62+
const webrtc::OpenSSLCertificate cert(X509_STORE_CTX_get_current_cert(store));
6363
#endif
6464
diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc
65-
index dd82e4f061..6d7e39c534 100644
65+
index b46faff911..537171b1f3 100644
6666
--- a/rtc_base/openssl_stream_adapter.cc
6767
+++ b/rtc_base/openssl_stream_adapter.cc
68-
@@ -1154,7 +1154,7 @@ enum ssl_verify_result_t OpenSSLStreamAdapter::SSLVerifyCallback(
68+
@@ -1181,7 +1181,7 @@ enum ssl_verify_result_t OpenSSLStreamAdapter::SSLVerifyCallback(
6969
// Creates certificate chain.
7070
std::vector<std::unique_ptr<SSLCertificate>> cert_chain;
7171
for (CRYPTO_BUFFER* cert : chain) {

webrtc-sys/src/nvidia/h264_encoder_impl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ NvidiaH264EncoderImpl::NvidiaH264EncoderImpl(
8080
CUmemorytype memory_type,
8181
NV_ENC_BUFFER_FORMAT nv_format,
8282
const SdpVideoFormat& format)
83-
: encoder_(nullptr),
83+
: env_(env),
84+
encoder_(nullptr),
8485
cu_context_(context),
8586
cu_memory_type_(memory_type),
8687
cu_scaled_array_(nullptr),
@@ -237,7 +238,7 @@ int32_t NvidiaH264EncoderImpl::InitEncode(
237238
return WEBRTC_VIDEO_CODEC_ERROR;
238239
}
239240

240-
SimulcastRateAllocator init_allocator(codec_);
241+
SimulcastRateAllocator init_allocator(env_, codec_);
241242
VideoBitrateAllocation allocation =
242243
init_allocator.Allocate(VideoBitrateAllocationParameters(
243244
DataRate::KilobitsPerSec(codec_.startBitrate), codec_.maxFramerate));
@@ -361,7 +362,7 @@ int32_t NvidiaH264EncoderImpl::ProcessEncodedFrame(
361362
const ::webrtc::VideoFrame& inputFrame) {
362363
encoded_image_._encodedWidth = encoder_->GetEncodeWidth();
363364
encoded_image_._encodedHeight = encoder_->GetEncodeHeight();
364-
encoded_image_.SetRtpTimestamp(inputFrame.timestamp());
365+
encoded_image_.SetRtpTimestamp(inputFrame.rtp_timestamp());
365366
encoded_image_.SetSimulcastIndex(0);
366367
encoded_image_.ntp_time_ms_ = inputFrame.ntp_time_ms();
367368
encoded_image_.capture_time_ms_ = inputFrame.render_time_ms();
@@ -371,7 +372,7 @@ int32_t NvidiaH264EncoderImpl::ProcessEncodedFrame(
371372
encoded_image_._frameType = VideoFrameType::kVideoFrameDelta;
372373
encoded_image_.SetColorSpace(inputFrame.color_space());
373374
std::vector<H264::NaluIndex> naluIndices =
374-
H264::FindNaluIndices(packet.data(), packet.size());
375+
H264::FindNaluIndices(MakeArrayView(packet.data(), packet.size()));
375376
for (uint32_t i = 0; i < naluIndices.size(); i++) {
376377
const H264::NaluType naluType =
377378
H264::ParseNaluType(packet[naluIndices[i].payload_start_offset]);

webrtc-sys/src/nvidia/h264_encoder_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class NvidiaH264EncoderImpl : public VideoEncoder {
6767
int32_t ProcessEncodedFrame(std::vector<uint8_t>& packet,
6868
const ::webrtc::VideoFrame& inputFrame);
6969
private:
70+
const webrtc::Environment& env_;
7071
EncodedImageCallback* encoded_image_callback_ = nullptr;
7172

7273
std::unique_ptr<NvEncoder> encoder_;

webrtc-sys/src/vaapi/h264_encoder_impl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ enum H264EncoderImplEvent {
3434

3535
VAAPIH264EncoderWrapper::VAAPIH264EncoderWrapper(const webrtc::Environment& env,
3636
const SdpVideoFormat& format)
37-
: encoder_(new livekit::VaapiH264EncoderWrapper()),
37+
: env_(env),
38+
encoder_(new livekit::VaapiH264EncoderWrapper()),
3839
packetization_mode_(
3940
H264EncoderSettings::Parse(format).packetization_mode),
4041
format_(format) {
@@ -152,7 +153,7 @@ int32_t VAAPIH264EncoderWrapper::InitEncode(
152153
va_profile, VA_RC_CBR);
153154
}
154155

155-
SimulcastRateAllocator init_allocator(codec_);
156+
SimulcastRateAllocator init_allocator(env_, codec_);
156157
VideoBitrateAllocation allocation =
157158
init_allocator.Allocate(VideoBitrateAllocationParameters(
158159
DataRate::KilobitsPerSec(codec_.startBitrate), codec_.maxFramerate));

webrtc-sys/src/vaapi/h264_encoder_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class VAAPIH264EncoderWrapper : public VideoEncoder {
6161
VAProfile GetVAProfile() const;
6262

6363
private:
64+
const webrtc::Environment& env_;
6465
EncodedImageCallback* encoded_image_callback_ = nullptr;
6566
std::unique_ptr<livekit::VaapiH264EncoderWrapper> encoder_;
6667
LayerConfig configuration_;

0 commit comments

Comments
 (0)