From 983c669a10c2fee30790953cbfd80bfbece2c0fe Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Wed, 2 Jul 2025 15:47:37 +0200 Subject: [PATCH 01/15] refactor: WebRTC m138 (7204) ready --- webrtc-jni/pom.xml | 2 +- webrtc-jni/src/main/cpp/CMakeLists.txt | 3 ++ .../src/main/cpp/include/WebRTCContext.h | 3 ++ .../src/main/cpp/include/api/AudioOptions.h | 2 +- .../cpp/include/api/PeerConnectionObserver.h | 10 +++---- .../main/cpp/include/api/RTCIceCandidate.h | 4 +-- .../include/api/RTCStatsCollectorCallback.h | 2 +- .../src/main/cpp/include/api/RTCStatsReport.h | 2 +- .../src/main/cpp/include/api/VideoFrame.h | 2 +- .../src/main/cpp/include/api/VideoTrackSink.h | 2 +- .../src/main/cpp/include/api/WebRTCUtils.h | 2 +- .../cpp/include/media/video/VideoCapture.h | 6 ++-- .../main/cpp/include/media/video/VideoSink.h | 2 +- .../media/video/VideoTrackDesktopSource.h | 6 ++-- .../media/video/VideoTrackDeviceSource.h | 14 ++++----- .../video/desktop/DesktopCaptureCallback.h | 2 +- webrtc-jni/src/main/cpp/include/rtc/LogSink.h | 4 +-- .../main/cpp/include/rtc/RTCCertificatePEM.h | 4 +-- .../main/cpp/src/JNI_AudioDeviceModule.cpp | 14 +++------ .../src/main/cpp/src/JNI_AudioProcessing.cpp | 6 ++-- .../src/main/cpp/src/JNI_AudioResampler.cpp | 4 +-- webrtc-jni/src/main/cpp/src/JNI_Logging.cpp | 16 +++++----- .../src/main/cpp/src/JNI_MediaStream.cpp | 8 ++--- .../src/main/cpp/src/JNI_NativeI420Buffer.cpp | 2 +- .../cpp/src/JNI_PeerConnectionFactory.cpp | 28 ++++++++--------- .../src/main/cpp/src/JNI_RTCDataChannel.cpp | 4 +-- .../src/main/cpp/src/JNI_RTCDtlsTransport.cpp | 4 +-- .../main/cpp/src/JNI_RTCPeerConnection.cpp | 30 +++++++++---------- .../src/main/cpp/src/JNI_RTCRtpReceiver.cpp | 2 +- .../src/main/cpp/src/JNI_RTCRtpSender.cpp | 2 +- .../main/cpp/src/JNI_RTCRtpTransceiver.cpp | 4 +-- .../main/cpp/src/JNI_VideoDesktopSource.cpp | 2 +- .../main/cpp/src/JNI_VideoDeviceSource.cpp | 2 +- .../src/main/cpp/src/JNI_VideoTrack.cpp | 4 +-- webrtc-jni/src/main/cpp/src/WebRTCContext.cpp | 10 ++++--- .../src/main/cpp/src/api/AudioOptions.cpp | 4 +-- .../cpp/src/api/PeerConnectionObserver.cpp | 10 +++---- .../src/main/cpp/src/api/RTCConfiguration.cpp | 2 +- .../src/main/cpp/src/api/RTCIceCandidate.cpp | 4 +-- .../cpp/src/api/RTCRtpCodecCapability.cpp | 2 +- .../cpp/src/api/RTCRtpCodecParameters.cpp | 2 +- webrtc-jni/src/main/cpp/src/api/RTCStats.cpp | 6 ++-- .../cpp/src/api/RTCStatsCollectorCallback.cpp | 2 +- .../src/main/cpp/src/api/RTCStatsReport.cpp | 2 +- .../src/main/cpp/src/api/VideoFrame.cpp | 4 +-- .../src/main/cpp/src/api/VideoTrackSink.cpp | 8 ++--- .../windows/WindowsAudioDeviceManager.cpp | 13 ++++---- .../main/cpp/src/media/video/VideoCapture.cpp | 2 +- .../media/video/VideoTrackDesktopSource.cpp | 10 +++---- .../media/video/VideoTrackDeviceSource.cpp | 10 +++---- .../video/desktop/DesktopCaptureCallback.cpp | 4 +-- webrtc-jni/src/main/cpp/src/rtc/LogSink.cpp | 2 +- .../main/cpp/src/rtc/RTCCertificatePEM.cpp | 6 ++-- 53 files changed, 154 insertions(+), 153 deletions(-) diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index dfc5ad4f..70dcd044 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -12,7 +12,7 @@ pom - branch-heads/6998 + branch-heads/7204 ${user.home}/webrtc ${user.home}/webrtc/build Release diff --git a/webrtc-jni/src/main/cpp/CMakeLists.txt b/webrtc-jni/src/main/cpp/CMakeLists.txt index 2b2e439d..b3c7db1e 100644 --- a/webrtc-jni/src/main/cpp/CMakeLists.txt +++ b/webrtc-jni/src/main/cpp/CMakeLists.txt @@ -60,6 +60,9 @@ list(APPEND SOURCES add_library(${PROJECT_NAME} SHARED ${SOURCES}) +# Introduced since WebRTC branch 7204 and Clang 20. +target_compile_options(${PROJECT_NAME} PRIVATE -Wno-nullability-completeness) + target_include_directories(${PROJECT_NAME} PRIVATE include diff --git a/webrtc-jni/src/main/cpp/include/WebRTCContext.h b/webrtc-jni/src/main/cpp/include/WebRTCContext.h index 2763c71c..9b7d4050 100644 --- a/webrtc-jni/src/main/cpp/include/WebRTCContext.h +++ b/webrtc-jni/src/main/cpp/include/WebRTCContext.h @@ -18,6 +18,7 @@ #define JNI_WEBRTC_CONTEXT_H_ #include "JavaContext.h" +#include "api/environment/environment.h" #include "media/audio/AudioDeviceManager.h" #include "media/video/VideoDeviceManager.h" #include "media/video/desktop/PowerManagement.h" @@ -42,6 +43,8 @@ namespace jni avdev::VideoDeviceManager * getVideoDeviceManager(); avdev::PowerManagement * getPowerManagement(); + const webrtc::Environment webrtcEnv; + private: void initializeAudioManager(); void initializeVideoManager(); diff --git a/webrtc-jni/src/main/cpp/include/api/AudioOptions.h b/webrtc-jni/src/main/cpp/include/api/AudioOptions.h index 0da64591..1c5e6453 100644 --- a/webrtc-jni/src/main/cpp/include/api/AudioOptions.h +++ b/webrtc-jni/src/main/cpp/include/api/AudioOptions.h @@ -42,7 +42,7 @@ namespace jni jfieldID residualEchoDetector; }; - cricket::AudioOptions toNative(JNIEnv * env, const JavaRef & javaType); + webrtc::AudioOptions toNative(JNIEnv * env, const JavaRef & javaType); } } diff --git a/webrtc-jni/src/main/cpp/include/api/PeerConnectionObserver.h b/webrtc-jni/src/main/cpp/include/api/PeerConnectionObserver.h index 35bd3c3f..55b5ef96 100644 --- a/webrtc-jni/src/main/cpp/include/api/PeerConnectionObserver.h +++ b/webrtc-jni/src/main/cpp/include/api/PeerConnectionObserver.h @@ -36,16 +36,16 @@ namespace jni // PeerConnectionObserver implementation. void OnConnectionChange(webrtc::PeerConnectionInterface::PeerConnectionState state) override; void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState state) override; - void OnTrack(rtc::scoped_refptr transceiver) override; - void OnAddTrack(rtc::scoped_refptr receiver, const std::vector> & streams) override; - void OnRemoveTrack(rtc::scoped_refptr receiver) override; - void OnDataChannel(rtc::scoped_refptr channel) override; + void OnTrack(webrtc::scoped_refptr transceiver) override; + void OnAddTrack(webrtc::scoped_refptr receiver, const std::vector> & streams) override; + void OnRemoveTrack(webrtc::scoped_refptr receiver) override; + void OnDataChannel(webrtc::scoped_refptr channel) override; void OnRenegotiationNeeded() override; void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState state) override; void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState state) override; void OnIceCandidate(const webrtc::IceCandidateInterface * candidate) override; void OnIceCandidateError(const std::string & address, int port, const std::string & url, int error_code, const std::string & error_text) override; - void OnIceCandidatesRemoved(const std::vector & candidates) override; + void OnIceCandidatesRemoved(const std::vector & candidates) override; void OnIceConnectionReceivingChange(bool receiving) override; private: diff --git a/webrtc-jni/src/main/cpp/include/api/RTCIceCandidate.h b/webrtc-jni/src/main/cpp/include/api/RTCIceCandidate.h index 0cbd6075..0e16861c 100644 --- a/webrtc-jni/src/main/cpp/include/api/RTCIceCandidate.h +++ b/webrtc-jni/src/main/cpp/include/api/RTCIceCandidate.h @@ -43,9 +43,9 @@ namespace jni }; JavaLocalRef toJava(JNIEnv * env, const webrtc::IceCandidateInterface * candidate); - JavaLocalRef toJavaCricket(JNIEnv * env, const cricket::Candidate & candidate); + JavaLocalRef toJavaCricket(JNIEnv * env, const webrtc::Candidate & candidate); std::unique_ptr toNative(JNIEnv * env, const JavaRef & javaType); - cricket::Candidate toNativeCricket(JNIEnv * env, const JavaRef & javaType); + webrtc::Candidate toNativeCricket(JNIEnv * env, const JavaRef & javaType); }; } diff --git a/webrtc-jni/src/main/cpp/include/api/RTCStatsCollectorCallback.h b/webrtc-jni/src/main/cpp/include/api/RTCStatsCollectorCallback.h index 4e5d9163..9145c9fa 100644 --- a/webrtc-jni/src/main/cpp/include/api/RTCStatsCollectorCallback.h +++ b/webrtc-jni/src/main/cpp/include/api/RTCStatsCollectorCallback.h @@ -33,7 +33,7 @@ namespace jni RTCStatsCollectorCallback(JNIEnv * env, const JavaGlobalRef & callback); ~RTCStatsCollectorCallback() = default; - void OnStatsDelivered(const rtc::scoped_refptr & report) override; + void OnStatsDelivered(const webrtc::scoped_refptr & report) override; private: class JavaRTCStatsCollectorCallbackClass : public JavaClass diff --git a/webrtc-jni/src/main/cpp/include/api/RTCStatsReport.h b/webrtc-jni/src/main/cpp/include/api/RTCStatsReport.h index 000cc9cd..436053e5 100644 --- a/webrtc-jni/src/main/cpp/include/api/RTCStatsReport.h +++ b/webrtc-jni/src/main/cpp/include/api/RTCStatsReport.h @@ -37,7 +37,7 @@ namespace jni jmethodID ctor; }; - JavaLocalRef toJava(JNIEnv * env, const rtc::scoped_refptr & report); + JavaLocalRef toJava(JNIEnv * env, const webrtc::scoped_refptr & report); } } diff --git a/webrtc-jni/src/main/cpp/include/api/VideoFrame.h b/webrtc-jni/src/main/cpp/include/api/VideoFrame.h index e819e1c1..6be8e884 100644 --- a/webrtc-jni/src/main/cpp/include/api/VideoFrame.h +++ b/webrtc-jni/src/main/cpp/include/api/VideoFrame.h @@ -34,7 +34,7 @@ namespace jni namespace I420Buffer { - JavaLocalRef toJava(JNIEnv * env, const rtc::scoped_refptr & buffer); + JavaLocalRef toJava(JNIEnv * env, const webrtc::scoped_refptr & buffer); } class JavaVideoFrameClass : public JavaClass diff --git a/webrtc-jni/src/main/cpp/include/api/VideoTrackSink.h b/webrtc-jni/src/main/cpp/include/api/VideoTrackSink.h index 9d23ab2f..a224d21b 100644 --- a/webrtc-jni/src/main/cpp/include/api/VideoTrackSink.h +++ b/webrtc-jni/src/main/cpp/include/api/VideoTrackSink.h @@ -28,7 +28,7 @@ namespace jni { - class VideoTrackSink : public rtc::VideoSinkInterface + class VideoTrackSink : public webrtc::VideoSinkInterface { public: VideoTrackSink(JNIEnv * env, const JavaGlobalRef & sink); diff --git a/webrtc-jni/src/main/cpp/include/api/WebRTCUtils.h b/webrtc-jni/src/main/cpp/include/api/WebRTCUtils.h index f50e37d2..87f0f931 100644 --- a/webrtc-jni/src/main/cpp/include/api/WebRTCUtils.h +++ b/webrtc-jni/src/main/cpp/include/api/WebRTCUtils.h @@ -28,7 +28,7 @@ namespace jni { template - JavaLocalRef createObjectArray(JNIEnv * env, const std::vector> & vector) + JavaLocalRef createObjectArray(JNIEnv * env, const std::vector> & vector) { jsize vectorSize = static_cast(vector.size()); diff --git a/webrtc-jni/src/main/cpp/include/media/video/VideoCapture.h b/webrtc-jni/src/main/cpp/include/media/video/VideoCapture.h index fe4217a9..8ce70117 100644 --- a/webrtc-jni/src/main/cpp/include/media/video/VideoCapture.h +++ b/webrtc-jni/src/main/cpp/include/media/video/VideoCapture.h @@ -35,7 +35,7 @@ namespace jni void setDevice(const avdev::DevicePtr & device); void setVideoCaptureCapability(const webrtc::VideoCaptureCapability & capability); - void setVideoSink(std::unique_ptr> sink); + void setVideoSink(std::unique_ptr> sink); void start(); void stop(); void destroy(); @@ -43,9 +43,9 @@ namespace jni private: avdev::DevicePtr device; webrtc::VideoCaptureCapability capability; - std::unique_ptr> sink; + std::unique_ptr> sink; - rtc::scoped_refptr captureModule; + webrtc::scoped_refptr captureModule; }; } diff --git a/webrtc-jni/src/main/cpp/include/media/video/VideoSink.h b/webrtc-jni/src/main/cpp/include/media/video/VideoSink.h index 1ad460f4..b5251684 100644 --- a/webrtc-jni/src/main/cpp/include/media/video/VideoSink.h +++ b/webrtc-jni/src/main/cpp/include/media/video/VideoSink.h @@ -22,7 +22,7 @@ namespace jni { - class VideoSink : public rtc::VideoSinkInterface + class VideoSink : public webrtc::VideoSinkInterface { public: virtual ~VideoSink() {}; diff --git a/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDesktopSource.h b/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDesktopSource.h index 84fe7950..b1d9b1f0 100644 --- a/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDesktopSource.h +++ b/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDesktopSource.h @@ -24,7 +24,7 @@ namespace jni { - class VideoTrackDesktopSource : public rtc::AdaptedVideoTrackSource, public webrtc::DesktopCapturer::Callback + class VideoTrackDesktopSource : public webrtc::AdaptedVideoTrackSource, public webrtc::DesktopCapturer::Callback { public: VideoTrackDesktopSource(); @@ -66,9 +66,9 @@ namespace jni std::unique_ptr lastFrame; - std::unique_ptr captureThread; + std::unique_ptr captureThread; - rtc::scoped_refptr buffer; + webrtc::scoped_refptr buffer; }; } diff --git a/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDeviceSource.h b/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDeviceSource.h index a6500438..223c1bbe 100644 --- a/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDeviceSource.h +++ b/webrtc-jni/src/main/cpp/include/media/video/VideoTrackDeviceSource.h @@ -30,7 +30,7 @@ namespace jni { - class VideoTrackDeviceSource : public webrtc::VideoTrackSource, public rtc::VideoSinkInterface + class VideoTrackDeviceSource : public webrtc::VideoTrackSource, public webrtc::VideoSinkInterface { public: VideoTrackDeviceSource(); @@ -43,11 +43,11 @@ namespace jni void stop(); // VideoSourceInterface implementation. - void AddOrUpdateSink(rtc::VideoSinkInterface * sink, const rtc::VideoSinkWants & wants) override; - void RemoveSink(rtc::VideoSinkInterface * sink) override; + void AddOrUpdateSink(webrtc::VideoSinkInterface * sink, const webrtc::VideoSinkWants & wants) override; + void RemoveSink(webrtc::VideoSinkInterface * sink) override; // VideoTrackSource implementation. - rtc::VideoSourceInterface * source() override; + webrtc::VideoSourceInterface * source() override; // VideoSinkInterface implementation. void OnFrame(const webrtc::VideoFrame & frame) override; @@ -61,9 +61,9 @@ namespace jni avdev::VideoDevicePtr device; webrtc::VideoCaptureCapability capability; - rtc::scoped_refptr captureModule; - rtc::VideoBroadcaster broadcaster; - cricket::VideoAdapter videoAdapter; + webrtc::scoped_refptr captureModule; + webrtc::VideoBroadcaster broadcaster; + webrtc::VideoAdapter videoAdapter; }; } diff --git a/webrtc-jni/src/main/cpp/include/media/video/desktop/DesktopCaptureCallback.h b/webrtc-jni/src/main/cpp/include/media/video/desktop/DesktopCaptureCallback.h index b6863349..e8171140 100644 --- a/webrtc-jni/src/main/cpp/include/media/video/desktop/DesktopCaptureCallback.h +++ b/webrtc-jni/src/main/cpp/include/media/video/desktop/DesktopCaptureCallback.h @@ -52,7 +52,7 @@ namespace jni const std::shared_ptr javaClass; const std::shared_ptr javaFrameClass; - rtc::scoped_refptr i420Buffer; + webrtc::scoped_refptr i420Buffer; }; } diff --git a/webrtc-jni/src/main/cpp/include/rtc/LogSink.h b/webrtc-jni/src/main/cpp/include/rtc/LogSink.h index e37bc0f8..c05ae032 100644 --- a/webrtc-jni/src/main/cpp/include/rtc/LogSink.h +++ b/webrtc-jni/src/main/cpp/include/rtc/LogSink.h @@ -27,7 +27,7 @@ namespace jni { - class LogSink : public rtc::LogSink + class LogSink : public webrtc::LogSink { public: explicit LogSink(JNIEnv * env, const JavaGlobalRef & javaSink); @@ -35,7 +35,7 @@ namespace jni // LogSink implementation. void OnLogMessage(const std::string & message) override; - void OnLogMessage(const std::string & message, rtc::LoggingSeverity severity) override; + void OnLogMessage(const std::string & message, webrtc::LoggingSeverity severity) override; private: class JavaLogSinkClass : public JavaClass diff --git a/webrtc-jni/src/main/cpp/include/rtc/RTCCertificatePEM.h b/webrtc-jni/src/main/cpp/include/rtc/RTCCertificatePEM.h index 48420ef5..deb18325 100644 --- a/webrtc-jni/src/main/cpp/include/rtc/RTCCertificatePEM.h +++ b/webrtc-jni/src/main/cpp/include/rtc/RTCCertificatePEM.h @@ -40,8 +40,8 @@ namespace jni jfieldID certificate; }; - JavaLocalRef toJava(JNIEnv * env, const rtc::RTCCertificatePEM & certificate); - rtc::RTCCertificatePEM toNative(JNIEnv * env, const JavaRef & certificate); + JavaLocalRef toJava(JNIEnv * env, const webrtc::RTCCertificatePEM & certificate); + webrtc::RTCCertificatePEM toNative(JNIEnv * env, const JavaRef & certificate); } } diff --git a/webrtc-jni/src/main/cpp/src/JNI_AudioDeviceModule.cpp b/webrtc-jni/src/main/cpp/src/JNI_AudioDeviceModule.cpp index a9a425f5..11e48233 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_AudioDeviceModule.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_AudioDeviceModule.cpp @@ -23,12 +23,13 @@ #include "JavaRef.h" #include "JavaString.h" #include "JavaUtils.h" +#include "WebRTCContext.h" +#include "api/audio/create_audio_device_module.h" #include "media/audio/AudioDevice.h" #include "media/audio/AudioTransportSink.h" #include "media/audio/AudioTransportSource.h" #include "api/scoped_refptr.h" -#include "api/task_queue/default_task_queue_factory.h" #include "modules/audio_device/include/audio_device.h" #include "rtc_base/logging.h" @@ -472,17 +473,10 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_disp JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioDeviceModule_initialize (JNIEnv * env, jobject caller, jobject jAudioLayer) { - std::unique_ptr taskQueueFactory = webrtc::CreateDefaultTaskQueueFactory(); - - if (!taskQueueFactory) { - env->Throw(jni::JavaError(env, "Create TaskQueueFactory failed")); - return; - } - + jni::WebRTCContext * context = static_cast(javaContext); auto audioLayer = jni::JavaEnums::toNative(env, jAudioLayer); - rtc::scoped_refptr audioModule = webrtc::AudioDeviceModule::Create( - audioLayer, taskQueueFactory.release()); + webrtc::scoped_refptr audioModule = webrtc::CreateAudioDeviceModule(context->webrtcEnv, audioLayer); if (!audioModule) { env->Throw(jni::JavaError(env, "Create AudioDeviceModule failed")); diff --git a/webrtc-jni/src/main/cpp/src/JNI_AudioProcessing.cpp b/webrtc-jni/src/main/cpp/src/JNI_AudioProcessing.cpp index da7feecd..eb341b3e 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_AudioProcessing.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_AudioProcessing.cpp @@ -23,6 +23,7 @@ #include "JavaRef.h" #include "JavaString.h" #include "JavaUtils.h" +#include "WebRTCContext.h" #include "media/audio/AudioProcessing.h" #include "media/audio/AudioProcessingConfig.h" @@ -30,7 +31,6 @@ #include "api/audio/audio_frame.h" #include "api/audio/audio_processing.h" #include "api/audio/builtin_audio_processing_builder.h" -#include "api/environment/environment_factory.h" #include "api/scoped_refptr.h" #include "modules/audio_processing/include/audio_processing.h" #include "rtc_base/logging.h" @@ -198,7 +198,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioProcessing_dispos JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_audio_AudioProcessing_initialize (JNIEnv * env, jobject caller) { - rtc::scoped_refptr apm = webrtc::BuiltinAudioProcessingBuilder().Build(webrtc::CreateEnvironment()); + jni::WebRTCContext * context = static_cast(javaContext); + + webrtc::scoped_refptr apm = webrtc::BuiltinAudioProcessingBuilder().Build(context->webrtcEnv); if (!apm) { env->Throw(jni::JavaError(env, "Create AudioProcessing failed")); diff --git a/webrtc-jni/src/main/cpp/src/JNI_AudioResampler.cpp b/webrtc-jni/src/main/cpp/src/JNI_AudioResampler.cpp index e8de6f3e..d85e8c0f 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_AudioResampler.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_AudioResampler.cpp @@ -66,7 +66,7 @@ JNIEXPORT jint JNICALL Java_dev_onvoid_webrtc_media_audio_AudioResampler_resampl webrtc::InterleavedView src(src16Ptr, srcSamplesPerChannel, channels); webrtc::InterleavedView dst(dst16Ptr, dstSamplesPerChannel, channels); - size_t result = resampler->Resample(src, dst); + resampler->Resample(src, dst); if (isDstCopy == JNI_TRUE) { jsize dstLength = env->GetArrayLength(samplesOut); @@ -77,5 +77,5 @@ JNIEXPORT jint JNICALL Java_dev_onvoid_webrtc_media_audio_AudioResampler_resampl env->ReleaseByteArrayElements(samplesIn, srcPtr, JNI_ABORT); env->ReleaseByteArrayElements(samplesOut, dstPtr, JNI_ABORT); - return static_cast(result); + return static_cast(dstSamplesPerChannel); } diff --git a/webrtc-jni/src/main/cpp/src/JNI_Logging.cpp b/webrtc-jni/src/main/cpp/src/JNI_Logging.cpp index 8c731e9b..6e680aa0 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_Logging.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_Logging.cpp @@ -29,9 +29,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_addLogSink (JNIEnv * env, jclass caller, jobject jseverity, jobject jsink) { try { - auto severity = jni::JavaEnums::toNative(env, jseverity); + auto severity = jni::JavaEnums::toNative(env, jseverity); - rtc::LogMessage::AddLogToStream(new jni::LogSink(env, jni::JavaGlobalRef(env, jsink)), severity); + webrtc::LogMessage::AddLogToStream(new jni::LogSink(env, jni::JavaGlobalRef(env, jsink)), severity); } catch (...) { ThrowCxxJavaException(env); @@ -43,7 +43,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_log { std::string message = jni::JavaString::toNative(env, jni::JavaLocalRef(env, jmessage)); - auto severity = jni::JavaEnums::toNative(env, jseverity); + auto severity = jni::JavaEnums::toNative(env, jseverity); RTC_LOG_V(severity) << message; } @@ -51,21 +51,21 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_log JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logToDebug (JNIEnv * env, jclass caller, jobject jseverity) { - int rtcSeverity = jni::JavaEnums::toNative(env, jseverity); + int rtcSeverity = jni::JavaEnums::toNative(env, jseverity); - if (rtcSeverity >= rtc::LS_VERBOSE && rtcSeverity <= rtc::LS_NONE) { - rtc::LogMessage::LogToDebug(static_cast(rtcSeverity)); + if (rtcSeverity >= webrtc::LS_VERBOSE && rtcSeverity <= webrtc::LS_NONE) { + webrtc::LogMessage::LogToDebug(static_cast(rtcSeverity)); } } JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logThreads (JNIEnv * env, jclass caller, jboolean enable) { - rtc::LogMessage::LogThreads(static_cast(enable)); + webrtc::LogMessage::LogThreads(static_cast(enable)); } JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_logging_Logging_logTimestamps (JNIEnv * env, jclass caller, jboolean enable) { - rtc::LogMessage::LogTimestamps(static_cast(enable)); + webrtc::LogMessage::LogTimestamps(static_cast(enable)); } \ No newline at end of file diff --git a/webrtc-jni/src/main/cpp/src/JNI_MediaStream.cpp b/webrtc-jni/src/main/cpp/src/JNI_MediaStream.cpp index efd192f9..52068451 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_MediaStream.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_MediaStream.cpp @@ -79,10 +79,10 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_MediaStream_addTrack CHECK_HANDLE(track); if (webrtc::AudioTrackInterface * t = dynamic_cast(track)) { - stream->AddTrack(rtc::scoped_refptr(t)); + stream->AddTrack(webrtc::scoped_refptr(t)); } else if (webrtc::VideoTrackInterface * t = dynamic_cast(track)) { - stream->AddTrack(rtc::scoped_refptr(t)); + stream->AddTrack(webrtc::scoped_refptr(t)); } } @@ -96,10 +96,10 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_MediaStream_removeTrack CHECK_HANDLE(track); if (webrtc::AudioTrackInterface * t = dynamic_cast(track)) { - stream->RemoveTrack(rtc::scoped_refptr(t)); + stream->RemoveTrack(webrtc::scoped_refptr(t)); } else if (webrtc::VideoTrackInterface * t = dynamic_cast(track)) { - stream->RemoveTrack(rtc::scoped_refptr(t)); + stream->RemoveTrack(webrtc::scoped_refptr(t)); } } diff --git a/webrtc-jni/src/main/cpp/src/JNI_NativeI420Buffer.cpp b/webrtc-jni/src/main/cpp/src/JNI_NativeI420Buffer.cpp index 56224afd..6addbe2c 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_NativeI420Buffer.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_NativeI420Buffer.cpp @@ -24,7 +24,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_media_video_NativeI420Buffer_allocate (JNIEnv * env, jclass caller, jint width, jint height) { - rtc::scoped_refptr i420Buffer = webrtc::I420Buffer::Create(width, height); + webrtc::scoped_refptr i420Buffer = webrtc::I420Buffer::Create(width, height); jni::JavaLocalRef jBuffer = jni::I420Buffer::toJava(env, i420Buffer); diff --git a/webrtc-jni/src/main/cpp/src/JNI_PeerConnectionFactory.cpp b/webrtc-jni/src/main/cpp/src/JNI_PeerConnectionFactory.cpp index 382b91a5..f1e2155e 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_PeerConnectionFactory.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_PeerConnectionFactory.cpp @@ -57,9 +57,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_initialize : nullptr; try { - auto networkThread = rtc::Thread::CreateWithSocketServer(); - auto signalingThread = rtc::Thread::Create(); - auto workerThread = rtc::Thread::Create(); + auto networkThread = webrtc::Thread::CreateWithSocketServer(); + auto signalingThread = webrtc::Thread::Create(); + auto workerThread = webrtc::Thread::Create(); if (!networkThread->Start()) { throw jni::Exception("Start network thread failed"); @@ -74,8 +74,8 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_initialize webrtc::AudioProcessing * processing = (audioProcessing != nullptr) ? GetHandle(env, audioProcessing) : nullptr; - rtc::scoped_refptr apm(processing); - rtc::scoped_refptr adm(audioDevModule); + webrtc::scoped_refptr apm(processing); + webrtc::scoped_refptr adm(audioDevModule); auto factory = webrtc::CreatePeerConnectionFactory( networkThread.get(), @@ -118,9 +118,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_dispose webrtc::PeerConnectionFactoryInterface * factory = GetHandle(env, caller); CHECK_HANDLE(factory); - rtc::Thread * networkThread = GetHandle(env, caller, "networkThreadHandle"); - rtc::Thread * signalingThread = GetHandle(env, caller, "signalingThreadHandle"); - rtc::Thread * workerThread = GetHandle(env, caller, "workerThreadHandle"); + webrtc::Thread * networkThread = GetHandle(env, caller, "networkThreadHandle"); + webrtc::Thread * signalingThread = GetHandle(env, caller, "signalingThreadHandle"); + webrtc::Thread * workerThread = GetHandle(env, caller, "workerThreadHandle"); webrtc::RefCountReleaseStatus status = factory->Release(); @@ -164,7 +164,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_createAud auto audioOptions = jni::AudioOptions::toNative(env, jni::JavaLocalRef(env, jAudioOptions)); - rtc::scoped_refptr audioSource = factory->CreateAudioSource(audioOptions); + webrtc::scoped_refptr audioSource = factory->CreateAudioSource(audioOptions); if (audioSource == nullptr) { env->Throw(jni::JavaError(env, "Create audio-track source failed")); @@ -194,7 +194,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_createAud std::string label = jni::JavaString::toNative(env, jni::JavaLocalRef(env, jlabel)); - rtc::scoped_refptr audioTrack = factory->CreateAudioTrack(label, source); + webrtc::scoped_refptr audioTrack = factory->CreateAudioTrack(label, source); return jni::JavaFactories::create(env, audioTrack.release()).release(); } @@ -219,8 +219,8 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_createVid std::string label = jni::JavaString::toNative(env, jni::JavaLocalRef(env, jlabel)); - rtc::scoped_refptr videoTrack = factory->CreateVideoTrack( - rtc::scoped_refptr(source), label); + webrtc::scoped_refptr videoTrack = factory->CreateVideoTrack( + webrtc::scoped_refptr(source), label); return jni::JavaFactories::create(env, videoTrack.release()).release(); } @@ -272,7 +272,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_getRtpRec webrtc::PeerConnectionFactoryInterface * factory = GetHandle(env, caller); CHECK_HANDLEV(factory, nullptr); - auto type = jni::JavaEnums::toNative(env, mediaType); + auto type = jni::JavaEnums::toNative(env, mediaType); auto capabilities = factory->GetRtpReceiverCapabilities(type); return jni::RTCRtpCapabilities::toJava(env, capabilities).release(); @@ -284,7 +284,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_PeerConnectionFactory_getRtpSen webrtc::PeerConnectionFactoryInterface * factory = GetHandle(env, caller); CHECK_HANDLEV(factory, nullptr); - auto type = jni::JavaEnums::toNative(env, mediaType); + auto type = jni::JavaEnums::toNative(env, mediaType); auto capabilities = factory->GetRtpSenderCapabilities(type); return jni::RTCRtpCapabilities::toJava(env, capabilities).release(); diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCDataChannel.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCDataChannel.cpp index a08cfe79..2bcc8b0c 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCDataChannel.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCDataChannel.cpp @@ -171,7 +171,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCDataChannel_sendDirectBuffer if (address != NULL) { jlong bufferLength = env->GetDirectBufferCapacity(jBuffer); - rtc::CopyOnWriteBuffer data(address, static_cast(bufferLength)); + webrtc::CopyOnWriteBuffer data(address, static_cast(bufferLength)); channel->Send(webrtc::DataBuffer(data, static_cast(isBinary))); } @@ -189,7 +189,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCDataChannel_sendByteArrayBuffer int8_t * arrayPtr = env->GetByteArrayElements(jBufferArray, nullptr); size_t arrayLength = env->GetArrayLength(jBufferArray); - rtc::CopyOnWriteBuffer data(arrayPtr, arrayLength); + webrtc::CopyOnWriteBuffer data(arrayPtr, arrayLength); env->ReleaseByteArrayElements(jBufferArray, arrayPtr, JNI_ABORT); diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCDtlsTransport.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCDtlsTransport.cpp index 3a3ff681..04454fb2 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCDtlsTransport.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCDtlsTransport.cpp @@ -61,8 +61,8 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCDtlsTransport_getRemoteCerti jni::JavaArrayList certificates(env, count); for (size_t i = 0; i < count; i++) { - const rtc::SSLCertificate & certificate = certChain->Get(i); - const rtc::RTCCertificatePEM pem("", certificate.ToPEMString()); + const webrtc::SSLCertificate & certificate = certChain->Get(i); + const webrtc::RTCCertificatePEM pem("", certificate.ToPEMString()); certificates.add(jni::RTCCertificatePEM::toJava(env, pem)); } diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCPeerConnection.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCPeerConnection.cpp index 2244c28c..c93a80aa 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCPeerConnection.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCPeerConnection.cpp @@ -119,7 +119,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_addTrack std::vector streamIDs = jni::JavaList::toStringVector(env, jni::JavaLocalRef(env, jStreamIds)); - auto result = pc->AddTrack(rtc::scoped_refptr(track), streamIDs); + auto result = pc->AddTrack(webrtc::scoped_refptr(track), streamIDs); if (result.ok()) { auto sender = result.MoveValue(); @@ -146,7 +146,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_removeTrack webrtc::RtpSenderInterface * sender = GetHandle(env, jSender); CHECK_HANDLE(sender); - auto result = pc->RemoveTrackOrError(rtc::scoped_refptr(sender)); + auto result = pc->RemoveTrackOrError(webrtc::scoped_refptr(sender)); if (!result.ok()) { env->Throw(jni::JavaRuntimeException(env, "Remove track (RTCRtpSender) failed: %s %s", @@ -168,15 +168,15 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_addTransceive webrtc::MediaStreamTrackInterface * track = GetHandle(env, jTrack); CHECK_HANDLEV(track, nullptr); - webrtc::RTCErrorOr> result; + webrtc::RTCErrorOr> result; if (jTransceiverInit != nullptr) { auto init = jni::RTCRtpTransceiverInit::toNative(env, jni::JavaLocalRef(env, jTransceiverInit)); - result = pc->AddTransceiver(rtc::scoped_refptr(track), init); + result = pc->AddTransceiver(webrtc::scoped_refptr(track), init); } else { - result = pc->AddTransceiver(rtc::scoped_refptr(track)); + result = pc->AddTransceiver(webrtc::scoped_refptr(track)); } if (result.ok()) { @@ -245,7 +245,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_createOffer try { auto options = jni::RTCOfferOptions::toNative(env, jni::JavaLocalRef(env, jOptions)); - auto observer = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jObserver)); + auto observer = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jObserver)); pc->CreateOffer(observer, options); } @@ -271,7 +271,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_createAnswer try { auto options = jni::RTCAnswerOptions::toNative(env, jni::JavaLocalRef(env, jOptions)); - auto observer = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jObserver)); + auto observer = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jObserver)); pc->CreateAnswer(observer, options); } @@ -375,7 +375,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_setLocalDescript try { auto desc = jni::RTCSessionDescription::toNative(env, jni::JavaLocalRef(env, jSessionDesc)); - auto observer = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jobserver)); + auto observer = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jobserver)); pc->SetLocalDescription(observer, desc.release()); } @@ -401,7 +401,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_setRemoteDescrip try { auto desc = jni::RTCSessionDescription::toNative(env, jni::JavaLocalRef(env, jSessionDesc)); - auto observer = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jobserver)); + auto observer = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jobserver)); pc->SetRemoteDescription(observer, desc.release()); } @@ -442,7 +442,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_removeIceCandida CHECK_HANDLE(pc); try { - auto candidates = jni::JavaArray::toNativeVector(env, + auto candidates = jni::JavaArray::toNativeVector(env, jni::static_java_ref_cast(env, jni::JavaLocalRef(env, jCandidates)), &jni::RTCIceCandidate::toNativeCricket); @@ -531,7 +531,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_getStats__Ldev_o return; } - auto callback = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); + auto callback = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); pc->GetStats(callback); } @@ -554,9 +554,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_getStats__Ldev_o webrtc::RtpReceiverInterface * receiver = GetHandle(env, jreceiver); CHECK_HANDLE(receiver); - auto callback = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); + auto callback = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); - pc->GetStats(rtc::scoped_refptr(receiver), rtc::scoped_refptr(callback)); + pc->GetStats(webrtc::scoped_refptr(receiver), webrtc::scoped_refptr(callback)); } JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_getStats__Ldev_onvoid_webrtc_RTCRtpSender_2Ldev_onvoid_webrtc_RTCStatsCollectorCallback_2 @@ -577,9 +577,9 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_getStats__Ldev_o webrtc::RtpSenderInterface * sender = GetHandle(env, jsender); CHECK_HANDLE(sender); - auto callback = new rtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); + auto callback = new webrtc::RefCountedObject(env, jni::JavaGlobalRef(env, jcallback)); - pc->GetStats(rtc::scoped_refptr(sender), rtc::scoped_refptr(callback)); + pc->GetStats(webrtc::scoped_refptr(sender), webrtc::scoped_refptr(callback)); } JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_RTCPeerConnection_restartIce diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpReceiver.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpReceiver.cpp index 9d1cc826..7e74734d 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpReceiver.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpReceiver.cpp @@ -32,7 +32,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCRtpReceiver_getTrack webrtc::RtpReceiverInterface * receiver = GetHandle(env, caller); CHECK_HANDLEV(receiver, nullptr); - rtc::scoped_refptr track = receiver->track(); + webrtc::scoped_refptr track = receiver->track(); if (webrtc::AudioTrackInterface * t = dynamic_cast(track.get())) { return jni::JavaFactories::create(env, t).release(); diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpSender.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpSender.cpp index e0b50ba5..e63b577e 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpSender.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpSender.cpp @@ -31,7 +31,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCRtpSender_getTrack webrtc::RtpSenderInterface * sender = GetHandle(env, caller); CHECK_HANDLEV(sender, nullptr); - rtc::scoped_refptr track = sender->track(); + webrtc::scoped_refptr track = sender->track(); if (webrtc::AudioTrackInterface * t = dynamic_cast(track.get())) { return jni::JavaFactories::create(env, t).release(); diff --git a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpTransceiver.cpp b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpTransceiver.cpp index a2fd9564..d752bb6e 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_RTCRtpTransceiver.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_RTCRtpTransceiver.cpp @@ -43,7 +43,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCRtpTransceiver_getSender webrtc::RtpTransceiverInterface * transceiver = GetHandle(env, caller); CHECK_HANDLEV(transceiver, nullptr); - rtc::scoped_refptr sender = transceiver->sender(); + webrtc::scoped_refptr sender = transceiver->sender(); return jni::JavaFactories::create(env, sender.get()).release(); } @@ -54,7 +54,7 @@ JNIEXPORT jobject JNICALL Java_dev_onvoid_webrtc_RTCRtpTransceiver_getReceiver webrtc::RtpTransceiverInterface * transceiver = GetHandle(env, caller); CHECK_HANDLEV(transceiver, nullptr); - rtc::scoped_refptr receiver = transceiver->receiver(); + webrtc::scoped_refptr receiver = transceiver->receiver(); return jni::JavaFactories::create(env, receiver.get()).release(); } diff --git a/webrtc-jni/src/main/cpp/src/JNI_VideoDesktopSource.cpp b/webrtc-jni/src/main/cpp/src/JNI_VideoDesktopSource.cpp index 3d15ee36..2dfb04d4 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_VideoDesktopSource.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_VideoDesktopSource.cpp @@ -108,7 +108,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_video_VideoDesktopSource_dis JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_video_VideoDesktopSource_initialize (JNIEnv * env, jobject caller) { - rtc::scoped_refptr videoSource = webrtc::make_ref_counted(); + webrtc::scoped_refptr videoSource = webrtc::make_ref_counted(); SetHandle(env, caller, videoSource.release()); } \ No newline at end of file diff --git a/webrtc-jni/src/main/cpp/src/JNI_VideoDeviceSource.cpp b/webrtc-jni/src/main/cpp/src/JNI_VideoDeviceSource.cpp index d64bc900..c4832e89 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_VideoDeviceSource.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_VideoDeviceSource.cpp @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_video_VideoDeviceSource_disp JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_video_VideoDeviceSource_initialize (JNIEnv * env, jobject caller) { - rtc::scoped_refptr videoSource = webrtc::make_ref_counted(); + webrtc::scoped_refptr videoSource = webrtc::make_ref_counted(); SetHandle(env, caller, videoSource.release()); } \ No newline at end of file diff --git a/webrtc-jni/src/main/cpp/src/JNI_VideoTrack.cpp b/webrtc-jni/src/main/cpp/src/JNI_VideoTrack.cpp index 94b17436..95bc599f 100644 --- a/webrtc-jni/src/main/cpp/src/JNI_VideoTrack.cpp +++ b/webrtc-jni/src/main/cpp/src/JNI_VideoTrack.cpp @@ -34,7 +34,7 @@ JNIEXPORT jlong JNICALL Java_dev_onvoid_webrtc_media_video_VideoTrack_addSinkInt auto sink = new jni::VideoTrackSink(env, jni::JavaGlobalRef(env, jsink)); - track->AddOrUpdateSink(sink, rtc::VideoSinkWants()); + track->AddOrUpdateSink(sink, webrtc::VideoSinkWants()); return reinterpret_cast(sink); } @@ -45,7 +45,7 @@ JNIEXPORT void JNICALL Java_dev_onvoid_webrtc_media_video_VideoTrack_removeSinkI webrtc::VideoTrackInterface * track = GetHandle(env, caller); CHECK_HANDLE(track); - auto sink = reinterpret_cast *>(sinkHandle); + auto sink = reinterpret_cast *>(sinkHandle); if (sink != nullptr) { track->RemoveSink(sink); diff --git a/webrtc-jni/src/main/cpp/src/WebRTCContext.cpp b/webrtc-jni/src/main/cpp/src/WebRTCContext.cpp index bd80f0f7..8c2769e0 100644 --- a/webrtc-jni/src/main/cpp/src/WebRTCContext.cpp +++ b/webrtc-jni/src/main/cpp/src/WebRTCContext.cpp @@ -25,6 +25,7 @@ #include "JavaUtils.h" #include "JNI_WebRTC.h" +#include "api/environment/environment_factory.h" #include "api/peer_connection_interface.h" #include "modules/desktop_capture/desktop_capturer.h" #include "rtc_base/ssl_adapter.h" @@ -52,6 +53,7 @@ namespace jni { WebRTCContext::WebRTCContext(JavaVM * vm) : JavaContext(vm), + webrtcEnv(webrtc::CreateEnvironment()), audioDevManager(nullptr), videoDevManager(nullptr), powerManagement(nullptr) @@ -60,12 +62,12 @@ namespace jni void WebRTCContext::initialize(JNIEnv * env) { - if (!rtc::InitializeSSL()) { + if (!webrtc::InitializeSSL()) { throw Exception("Initialize SSL failed"); } - JavaEnums::add(env, PKG_LOG"Logging$Severity"); - JavaEnums::add(env, PKG_MEDIA"MediaType"); + JavaEnums::add(env, PKG_LOG"Logging$Severity"); + JavaEnums::add(env, PKG_MEDIA"MediaType"); JavaEnums::add(env, PKG"RTCDataChannelState"); JavaEnums::add(env, PKG_DESKTOP"DesktopCapturer$Result"); JavaEnums::add(env, PKG"RTCDtlsTransportState"); @@ -118,7 +120,7 @@ namespace jni void WebRTCContext::destroy(JNIEnv * env) { - if (!rtc::CleanupSSL()) { + if (!webrtc::CleanupSSL()) { env->Throw(jni::JavaError(env, "Cleanup SSL failed")); } diff --git a/webrtc-jni/src/main/cpp/src/api/AudioOptions.cpp b/webrtc-jni/src/main/cpp/src/api/AudioOptions.cpp index 4b9f69b6..64884dea 100644 --- a/webrtc-jni/src/main/cpp/src/api/AudioOptions.cpp +++ b/webrtc-jni/src/main/cpp/src/api/AudioOptions.cpp @@ -24,13 +24,13 @@ namespace jni { namespace AudioOptions { - cricket::AudioOptions toNative(JNIEnv * env, const JavaRef& javaType) + webrtc::AudioOptions toNative(JNIEnv * env, const JavaRef& javaType) { const auto javaClass = JavaClasses::get(env); JavaObject obj(env, javaType); - auto options = cricket::AudioOptions(); + auto options = webrtc::AudioOptions(); options.echo_cancellation = obj.getBoolean(javaClass->echoCancellation); options.auto_gain_control = obj.getBoolean(javaClass->autoGainControl); options.noise_suppression = obj.getBoolean(javaClass->noiseSuppression); diff --git a/webrtc-jni/src/main/cpp/src/api/PeerConnectionObserver.cpp b/webrtc-jni/src/main/cpp/src/api/PeerConnectionObserver.cpp index da9e37a1..576aa0e4 100644 --- a/webrtc-jni/src/main/cpp/src/api/PeerConnectionObserver.cpp +++ b/webrtc-jni/src/main/cpp/src/api/PeerConnectionObserver.cpp @@ -57,7 +57,7 @@ namespace jni ExceptionCheck(env); } - void PeerConnectionObserver::OnTrack(rtc::scoped_refptr transceiver) + void PeerConnectionObserver::OnTrack(webrtc::scoped_refptr transceiver) { JNIEnv * env = AttachCurrentThread(); @@ -68,7 +68,7 @@ namespace jni ExceptionCheck(env); } - void PeerConnectionObserver::OnAddTrack(rtc::scoped_refptr receiver, const std::vector> & streams) + void PeerConnectionObserver::OnAddTrack(webrtc::scoped_refptr receiver, const std::vector> & streams) { JNIEnv * env = AttachCurrentThread(); @@ -88,7 +88,7 @@ namespace jni ExceptionCheck(env); } - void PeerConnectionObserver::OnRemoveTrack(rtc::scoped_refptr receiver) + void PeerConnectionObserver::OnRemoveTrack(webrtc::scoped_refptr receiver) { JNIEnv * env = AttachCurrentThread(); @@ -99,7 +99,7 @@ namespace jni ExceptionCheck(env); } - void PeerConnectionObserver::OnDataChannel(rtc::scoped_refptr channel) + void PeerConnectionObserver::OnDataChannel(webrtc::scoped_refptr channel) { JNIEnv * env = AttachCurrentThread(); @@ -163,7 +163,7 @@ namespace jni ExceptionCheck(env); } - void PeerConnectionObserver::OnIceCandidatesRemoved(const std::vector & candidates) + void PeerConnectionObserver::OnIceCandidatesRemoved(const std::vector & candidates) { JNIEnv * env = AttachCurrentThread(); diff --git a/webrtc-jni/src/main/cpp/src/api/RTCConfiguration.cpp b/webrtc-jni/src/main/cpp/src/api/RTCConfiguration.cpp index 33b1c72c..dd12644a 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCConfiguration.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCConfiguration.cpp @@ -80,7 +80,7 @@ namespace jni configuration.rtcp_mux_policy = JavaEnums::toNative(env, mp); for (auto & item : JavaIterable(env, cr)) { - auto certificate = rtc::RTCCertificate::FromPEM(jni::RTCCertificatePEM::toNative(env, item)); + auto certificate = webrtc::RTCCertificate::FromPEM(jni::RTCCertificatePEM::toNative(env, item)); RTC_CHECK(certificate != nullptr) << "Supplied certificate is malformed"; diff --git a/webrtc-jni/src/main/cpp/src/api/RTCIceCandidate.cpp b/webrtc-jni/src/main/cpp/src/api/RTCIceCandidate.cpp index 2a154281..50468035 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCIceCandidate.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCIceCandidate.cpp @@ -44,7 +44,7 @@ namespace jni return JavaLocalRef(env, jCandidate); } - JavaLocalRef toJavaCricket(JNIEnv * env, const cricket::Candidate & candidate) + JavaLocalRef toJavaCricket(JNIEnv * env, const webrtc::Candidate & candidate) { const auto javaClass = JavaClasses::get(env); @@ -84,7 +84,7 @@ namespace jni return std::unique_ptr(candidate); } - cricket::Candidate toNativeCricket(JNIEnv * env, const JavaRef & javaType) + webrtc::Candidate toNativeCricket(JNIEnv * env, const JavaRef & javaType) { return toNative(env, javaType)->candidate(); } diff --git a/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecCapability.cpp b/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecCapability.cpp index 5e05603b..1d05c4a1 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecCapability.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecCapability.cpp @@ -62,7 +62,7 @@ namespace jni webrtc::RtpCodecCapability codecCapability; - codecCapability.kind = JavaEnums::toNative(env, obj.getObject(javaClass->mediaType)); + codecCapability.kind = JavaEnums::toNative(env, obj.getObject(javaClass->mediaType)); codecCapability.name = JavaString::toNative(env, obj.getString(javaClass->name)); codecCapability.clock_rate = obj.getInt(javaClass->clockRate); codecCapability.num_channels = obj.getInt(javaClass->channels); diff --git a/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecParameters.cpp b/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecParameters.cpp index 8259004d..c635fc8a 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecParameters.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCRtpCodecParameters.cpp @@ -67,7 +67,7 @@ namespace jni webrtc::RtpCodecParameters params; params.payload_type = obj.getInt(javaClass->payloadType); - params.kind = JavaEnums::toNative(env, obj.getObject(javaClass->mediaType)); + params.kind = JavaEnums::toNative(env, obj.getObject(javaClass->mediaType)); params.name = JavaString::toNative(env, obj.getString(javaClass->codecName)); for (const auto & entry : JavaHashMap(env, obj.getObject(javaClass->parameters))) { diff --git a/webrtc-jni/src/main/cpp/src/api/RTCStats.cpp b/webrtc-jni/src/main/cpp/src/api/RTCStats.cpp index 8146f3c7..0ee6f494 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCStats.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCStats.cpp @@ -122,7 +122,7 @@ namespace jni return Long::create(env, attribute.get()); } else if (attribute.holds_alternative()) { - return JavaBigInteger::toJava(env, rtc::ToString(attribute.get())); + return JavaBigInteger::toJava(env, std::to_string(attribute.get())); } else if (attribute.holds_alternative()) { return Double::create(env, attribute.get()); @@ -148,7 +148,7 @@ namespace jni std::vector r; std::transform(v.begin(), v.end(), std::back_inserter(r), - [](uint64_t n) { return rtc::ToString(n); }); + [](uint64_t n) { return std::to_string(n); }); return jni::static_java_ref_cast(env, JavaBigInteger::createArray(env, r)); } @@ -165,7 +165,7 @@ namespace jni for (const auto & item : map) { memberMap.put(jni::static_java_ref_cast(env, JavaString::toJava(env, item.first)), - JavaBigInteger::toJava(env, rtc::ToString(item.second))); + JavaBigInteger::toJava(env, std::to_string(item.second))); } return jni::static_java_ref_cast(env, memberMap); diff --git a/webrtc-jni/src/main/cpp/src/api/RTCStatsCollectorCallback.cpp b/webrtc-jni/src/main/cpp/src/api/RTCStatsCollectorCallback.cpp index bdb69c80..c6e152b2 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCStatsCollectorCallback.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCStatsCollectorCallback.cpp @@ -27,7 +27,7 @@ namespace jni { } - void RTCStatsCollectorCallback::OnStatsDelivered(const rtc::scoped_refptr & report) + void RTCStatsCollectorCallback::OnStatsDelivered(const webrtc::scoped_refptr & report) { JNIEnv * env = AttachCurrentThread(); diff --git a/webrtc-jni/src/main/cpp/src/api/RTCStatsReport.cpp b/webrtc-jni/src/main/cpp/src/api/RTCStatsReport.cpp index 4025051c..6c7f9f20 100644 --- a/webrtc-jni/src/main/cpp/src/api/RTCStatsReport.cpp +++ b/webrtc-jni/src/main/cpp/src/api/RTCStatsReport.cpp @@ -25,7 +25,7 @@ namespace jni { namespace RTCStatsReport { - JavaLocalRef toJava(JNIEnv * env, const rtc::scoped_refptr & report) + JavaLocalRef toJava(JNIEnv * env, const webrtc::scoped_refptr & report) { const auto javaClass = JavaClasses::get(env); diff --git a/webrtc-jni/src/main/cpp/src/api/VideoFrame.cpp b/webrtc-jni/src/main/cpp/src/api/VideoFrame.cpp index cd826102..fce04433 100644 --- a/webrtc-jni/src/main/cpp/src/api/VideoFrame.cpp +++ b/webrtc-jni/src/main/cpp/src/api/VideoFrame.cpp @@ -36,7 +36,7 @@ namespace jni return webrtc::VideoFrame::Builder() //.set_video_frame_buffer(buffer) //.set_timestamp_rtp(timestamp_rtp) - .set_timestamp_ms(timestamp_ns / rtc::kNumNanosecsPerMillisec) + .set_timestamp_ms(timestamp_ns / webrtc::kNumNanosecsPerMillisec) .set_rotation(static_cast(rotation)) .build(); } @@ -44,7 +44,7 @@ namespace jni namespace I420Buffer { - JavaLocalRef toJava(JNIEnv * env, const rtc::scoped_refptr & buffer) + JavaLocalRef toJava(JNIEnv * env, const webrtc::scoped_refptr & buffer) { const auto javaClass = JavaClasses::get(env); diff --git a/webrtc-jni/src/main/cpp/src/api/VideoTrackSink.cpp b/webrtc-jni/src/main/cpp/src/api/VideoTrackSink.cpp index 32db9145..187217d5 100644 --- a/webrtc-jni/src/main/cpp/src/api/VideoTrackSink.cpp +++ b/webrtc-jni/src/main/cpp/src/api/VideoTrackSink.cpp @@ -35,14 +35,14 @@ namespace jni { JNIEnv * env = AttachCurrentThread(); - rtc::scoped_refptr buffer = frame.video_frame_buffer(); - rtc::scoped_refptr i420Buffer = buffer->ToI420(); + webrtc::scoped_refptr buffer = frame.video_frame_buffer(); + webrtc::scoped_refptr i420Buffer = buffer->ToI420(); if (i420Buffer == nullptr) { return; } - rtc::scoped_refptr i420BufferCopy = webrtc::I420Buffer::Copy(*i420Buffer); + webrtc::scoped_refptr i420BufferCopy = webrtc::I420Buffer::Copy(*i420Buffer); i420BufferCopy->AddRef(); // if (frame.rotation() != webrtc::kVideoRotation_0) { @@ -50,7 +50,7 @@ namespace jni // } jint rotation = static_cast(frame.rotation()); - jlong timestamp = frame.timestamp_us() * rtc::kNumNanosecsPerMicrosec; + jlong timestamp = frame.timestamp_us() * webrtc::kNumNanosecsPerMicrosec; JavaLocalRef jBuffer = I420Buffer::toJava(env, i420BufferCopy); jobject jFrame = env->NewObject(javaFrameClass->cls, javaFrameClass->ctor, jBuffer.get(), rotation, timestamp); diff --git a/webrtc-jni/src/main/cpp/src/media/audio/windows/WindowsAudioDeviceManager.cpp b/webrtc-jni/src/main/cpp/src/media/audio/windows/WindowsAudioDeviceManager.cpp index 8e85fd6d..c648d6f4 100644 --- a/webrtc-jni/src/main/cpp/src/media/audio/windows/WindowsAudioDeviceManager.cpp +++ b/webrtc-jni/src/main/cpp/src/media/audio/windows/WindowsAudioDeviceManager.cpp @@ -18,11 +18,12 @@ #include "media/audio/windows/WindowsAudioDeviceManager.h" #include "platform/windows/MFInitializer.h" #include "platform/windows/WinUtils.h" +#include "WebRTCContext.h" #include "Functiondiscoverykeys_devpkey.h" +#include "api/audio/create_audio_device_module.h" #include "api/scoped_refptr.h" -#include "api/task_queue/default_task_queue_factory.h" #include "modules/audio_device/include/audio_device.h" #include "rtc_base/logging.h" @@ -76,14 +77,10 @@ namespace jni void WindowsAudioDeviceManager::enumerateDevices(EDataFlow dataFlow) { - std::unique_ptr taskQueueFactory = webrtc::CreateDefaultTaskQueueFactory(); + jni::WebRTCContext * context = static_cast(javaContext); - if (!taskQueueFactory) { - throw jni::Exception("Create TaskQueueFactory failed"); - } - - rtc::scoped_refptr audioModule = webrtc::AudioDeviceModule::Create( - webrtc::AudioDeviceModule::kPlatformDefaultAudio, taskQueueFactory.get()); + webrtc::scoped_refptr audioModule = webrtc::CreateAudioDeviceModule( + context->webrtcEnv, webrtc::AudioDeviceModule::kPlatformDefaultAudio); if (!audioModule) { throw jni::Exception("Create AudioDeviceModule failed"); diff --git a/webrtc-jni/src/main/cpp/src/media/video/VideoCapture.cpp b/webrtc-jni/src/main/cpp/src/media/video/VideoCapture.cpp index 58e7b25f..817fbec4 100644 --- a/webrtc-jni/src/main/cpp/src/media/video/VideoCapture.cpp +++ b/webrtc-jni/src/main/cpp/src/media/video/VideoCapture.cpp @@ -45,7 +45,7 @@ namespace jni this->capability = capability; } - void VideoCapture::setVideoSink(std::unique_ptr> sink) + void VideoCapture::setVideoSink(std::unique_ptr> sink) { this->sink = std::move(sink); } diff --git a/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cpp b/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cpp index ea2f6102..1a2b4f2c 100644 --- a/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cpp +++ b/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDesktopSource.cpp @@ -24,7 +24,7 @@ #include "modules/video_capture/video_capture_factory.h" #include "third_party/libyuv/include/libyuv/video_common.h" #include "rtc_base/logging.h" -#include "system_wrappers/include/sleep.h" +#include "rtc_base/thread.h" #include "modules/desktop_capture/desktop_capturer.h" #include "modules/desktop_capture/desktop_and_cursor_composer.h" @@ -73,7 +73,7 @@ namespace jni { isCapturing = true; - captureThread = rtc::Thread::Create(); + captureThread = webrtc::Thread::Create(); captureThread->Start(); captureThread->PostTask([&] { capture(); }); } @@ -144,7 +144,7 @@ namespace jni void VideoTrackDesktopSource::process(std::unique_ptr& frame) { - int64_t time = rtc::TimeMicros(); + int64_t time = webrtc::TimeMicros(); int width = frame->size().width(); int height = frame->size().height(); @@ -212,7 +212,7 @@ namespace jni if (adapted_width != width || adapted_height != height) { // Video adapter has requested a down-scale. Allocate a new buffer and return scaled version. - rtc::scoped_refptr scaled_buffer = webrtc::I420Buffer::Create(adapted_width, adapted_height); + webrtc::scoped_refptr scaled_buffer = webrtc::I420Buffer::Create(adapted_width, adapted_height); scaled_buffer->ScaleFrom(*buffer); @@ -274,7 +274,7 @@ namespace jni while (isCapturing) { capturer->CaptureFrame(); - webrtc::SleepMs(msPerFrame); + webrtc::Thread::SleepMs(msPerFrame); } } } \ No newline at end of file diff --git a/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDeviceSource.cpp b/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDeviceSource.cpp index 310caab5..7c86ecb2 100644 --- a/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDeviceSource.cpp +++ b/webrtc-jni/src/main/cpp/src/media/video/VideoTrackDeviceSource.cpp @@ -152,14 +152,14 @@ namespace jni captureModule = nullptr; } - void VideoTrackDeviceSource::AddOrUpdateSink(rtc::VideoSinkInterface * sink, const rtc::VideoSinkWants & wants) + void VideoTrackDeviceSource::AddOrUpdateSink(webrtc::VideoSinkInterface * sink, const webrtc::VideoSinkWants & wants) { broadcaster.AddOrUpdateSink(sink, wants); updateVideoAdapter(); } - void VideoTrackDeviceSource::RemoveSink(rtc::VideoSinkInterface * sink) + void VideoTrackDeviceSource::RemoveSink(webrtc::VideoSinkInterface * sink) { broadcaster.RemoveSink(sink); @@ -177,7 +177,7 @@ namespace jni void VideoTrackDeviceSource::updateVideoAdapter() { - rtc::VideoSinkWants wants = broadcaster.wants(); + webrtc::VideoSinkWants wants = broadcaster.wants(); videoAdapter.OnOutputFormatRequest(std::make_pair(capability.width, capability.height), wants.max_pixel_count, wants.max_framerate_fps); } @@ -197,7 +197,7 @@ namespace jni if (outHeight != frame.height() || outWidth != frame.width()) { // Video adapter has requested a down-scale. Allocate a new buffer and return scaled version. - rtc::scoped_refptr scaled_buffer = webrtc::I420Buffer::Create(outWidth, outHeight); + webrtc::scoped_refptr scaled_buffer = webrtc::I420Buffer::Create(outWidth, outHeight); scaled_buffer->ScaleFrom(*frame.video_frame_buffer()->ToI420()); @@ -214,7 +214,7 @@ namespace jni } } - rtc::VideoSourceInterface * VideoTrackDeviceSource::source() + webrtc::VideoSourceInterface * VideoTrackDeviceSource::source() { return this; } diff --git a/webrtc-jni/src/main/cpp/src/media/video/desktop/DesktopCaptureCallback.cpp b/webrtc-jni/src/main/cpp/src/media/video/desktop/DesktopCaptureCallback.cpp index aca320ff..46b8d6d2 100644 --- a/webrtc-jni/src/main/cpp/src/media/video/desktop/DesktopCaptureCallback.cpp +++ b/webrtc-jni/src/main/cpp/src/media/video/desktop/DesktopCaptureCallback.cpp @@ -93,9 +93,9 @@ namespace jni } jint rotation = static_cast(webrtc::kVideoRotation_0); - jlong timestamp = rtc::TimeMicros() * rtc::kNumNanosecsPerMicrosec; + jlong timestamp = webrtc::TimeMicros() * webrtc::kNumNanosecsPerMicrosec; - rtc::scoped_refptr i420BufferCopy = webrtc::I420Buffer::Copy(*i420Buffer); + webrtc::scoped_refptr i420BufferCopy = webrtc::I420Buffer::Copy(*i420Buffer); i420BufferCopy->AddRef(); JavaLocalRef jBuffer = I420Buffer::toJava(env, i420BufferCopy); diff --git a/webrtc-jni/src/main/cpp/src/rtc/LogSink.cpp b/webrtc-jni/src/main/cpp/src/rtc/LogSink.cpp index 3f2ab759..f5b8ce35 100644 --- a/webrtc-jni/src/main/cpp/src/rtc/LogSink.cpp +++ b/webrtc-jni/src/main/cpp/src/rtc/LogSink.cpp @@ -31,7 +31,7 @@ namespace jni { } - void LogSink::OnLogMessage(const std::string & message, rtc::LoggingSeverity severity) + void LogSink::OnLogMessage(const std::string & message, webrtc::LoggingSeverity severity) { JNIEnv * env = AttachCurrentThread(); diff --git a/webrtc-jni/src/main/cpp/src/rtc/RTCCertificatePEM.cpp b/webrtc-jni/src/main/cpp/src/rtc/RTCCertificatePEM.cpp index ac52679a..fe5f1148 100644 --- a/webrtc-jni/src/main/cpp/src/rtc/RTCCertificatePEM.cpp +++ b/webrtc-jni/src/main/cpp/src/rtc/RTCCertificatePEM.cpp @@ -27,7 +27,7 @@ namespace jni { namespace RTCCertificatePEM { - JavaLocalRef toJava(JNIEnv * env, const rtc::RTCCertificatePEM & certificate) + JavaLocalRef toJava(JNIEnv * env, const webrtc::RTCCertificatePEM & certificate) { const auto javaClass = JavaClasses::get(env); @@ -40,13 +40,13 @@ namespace jni return JavaLocalRef(env, obj); } - rtc::RTCCertificatePEM toNative(JNIEnv * env, const JavaRef & certificate) + webrtc::RTCCertificatePEM toNative(JNIEnv * env, const JavaRef & certificate) { const auto javaClass = JavaClasses::get(env); JavaObject obj(env, certificate); - return rtc::RTCCertificatePEM( + return webrtc::RTCCertificatePEM( JavaString::toNative(env, obj.getString(javaClass->privateKey)), JavaString::toNative(env, obj.getString(javaClass->certificate)) ); From dcfa1f46e33f7584b107d41c049b08f24f509b62 Mon Sep 17 00:00:00 2001 From: devopvoid <58339654+devopvoid@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:26:10 +0000 Subject: [PATCH 02/15] Prepare release v0.11.0 --- pom.xml | 4 +- webrtc-jni/pom.xml | 394 ++++++++++++++++++++++----------------------- webrtc/pom.xml | 2 +- 3 files changed, 200 insertions(+), 200 deletions(-) diff --git a/pom.xml b/pom.xml index 1a70d805..b04d0e4f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0-SNAPSHOT + 0.11.0 pom webrtc-java-parent @@ -40,7 +40,7 @@ scm:git:git://github.com/devopvoid/webrtc-java.git scm:git:ssh://git@github.com/devopvoid/webrtc-java.git https://github.com/devopvoid/webrtc-java/tree/master - HEAD + v0.11.0 diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 70dcd044..3e2b4868 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -1,197 +1,197 @@ - - - 4.0.0 - - - dev.onvoid.webrtc - webrtc-java-parent - 0.11.0-SNAPSHOT - - - webrtc-java-jni - pom - - - branch-heads/7204 - ${user.home}/webrtc - ${user.home}/webrtc/build - Release - - - - - - webrtc-java-${project.version} - - - - org.apache.maven.plugins - maven-jar-plugin - - - prepare-package - - jar - - - ${platform.classifier} - ${project.build.directory}/lib - - false - - ${platform.module} - - - - - - - - org.apache.maven.plugins - maven-install-plugin - - true - - - - install-classifier - package - - install-file - - - ${project.build.directory}/webrtc-java-${project.version}-${platform.classifier}.jar - ${platform.classifier} - ${project.groupId} - webrtc-java - ${project.version} - jar - false - - - - - - com.googlecode.cmake-maven-project - cmake-maven-plugin - 3.22.1-b1 - - - cmake-generate - generate-resources - - generate - - - src/main/cpp - ${project.build.directory}/${platform.classifier} - - - - - - - - - - - - - - cmake-compile - generate-resources - - compile - - - ${cmake.config} - install - ${project.build.directory}/${platform.classifier} - - - - - - - - - - windows-x86_64 - - - windows - amd64 - - - - -Ax64 - ${cmake.build.type} - - - - windows-clang - - - windows - amd64 - - - - -T ClangCL - toolchain/x86_64-windows-clang.cmake - - - - linux-x86_64 - - - linux - amd64 - - - - toolchain/x86_64-linux-clang.cmake - - - - linux-aarch32 - - - linux - aarch32 - - - - toolchain/aarch32-linux-clang.cmake - - - - linux-aarch64 - - - linux - aarch64 - - - - toolchain/aarch64-linux-clang.cmake - - - - + + + 4.0.0 + + + dev.onvoid.webrtc + webrtc-java-parent + 0.11.0 + + + webrtc-java-jni + pom + + + branch-heads/7204 + ${user.home}/webrtc + ${user.home}/webrtc/build + Release + + + + + + webrtc-java-${project.version} + + + + org.apache.maven.plugins + maven-jar-plugin + + + prepare-package + + jar + + + ${platform.classifier} + ${project.build.directory}/lib + + false + + ${platform.module} + + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + install-classifier + package + + install-file + + + ${project.build.directory}/webrtc-java-${project.version}-${platform.classifier}.jar + ${platform.classifier} + ${project.groupId} + webrtc-java + ${project.version} + jar + false + + + + + + com.googlecode.cmake-maven-project + cmake-maven-plugin + 3.22.1-b1 + + + cmake-generate + generate-resources + + generate + + + src/main/cpp + ${project.build.directory}/${platform.classifier} + + + + + + + + + + + + + + cmake-compile + generate-resources + + compile + + + ${cmake.config} + install + ${project.build.directory}/${platform.classifier} + + + + + + + + + + windows-x86_64 + + + windows + amd64 + + + + -Ax64 + ${cmake.build.type} + + + + windows-clang + + + windows + amd64 + + + + -T ClangCL + toolchain/x86_64-windows-clang.cmake + + + + linux-x86_64 + + + linux + amd64 + + + + toolchain/x86_64-linux-clang.cmake + + + + linux-aarch32 + + + linux + aarch32 + + + + toolchain/aarch32-linux-clang.cmake + + + + linux-aarch64 + + + linux + aarch64 + + + + toolchain/aarch64-linux-clang.cmake + + + + diff --git a/webrtc/pom.xml b/webrtc/pom.xml index baa6420e..74df44d3 100644 --- a/webrtc/pom.xml +++ b/webrtc/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0-SNAPSHOT + 0.11.0 webrtc-java From 15d08e930e7b5d1dc1bc0749d640140f092e691d Mon Sep 17 00:00:00 2001 From: devopvoid <58339654+devopvoid@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:26:10 +0000 Subject: [PATCH 03/15] Prepare for next development iteration --- pom.xml | 4 ++-- webrtc-jni/pom.xml | 2 +- webrtc/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b04d0e4f..2a90f813 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0 + 0.11.1-SNAPSHOT pom webrtc-java-parent @@ -40,7 +40,7 @@ scm:git:git://github.com/devopvoid/webrtc-java.git scm:git:ssh://git@github.com/devopvoid/webrtc-java.git https://github.com/devopvoid/webrtc-java/tree/master - v0.11.0 + HEAD diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 3e2b4868..932d1a2f 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0 + 0.11.1-SNAPSHOT webrtc-java-jni diff --git a/webrtc/pom.xml b/webrtc/pom.xml index 74df44d3..e884454d 100644 --- a/webrtc/pom.xml +++ b/webrtc/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0 + 0.11.1-SNAPSHOT webrtc-java From 6d17664b5424821550b98adad1e049f4c3ec600b Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Sun, 6 Jul 2025 12:25:20 +0200 Subject: [PATCH 04/15] Revert "Prepare for next development iteration" This reverts commit 15d08e930e7b5d1dc1bc0749d640140f092e691d. --- pom.xml | 4 ++-- webrtc-jni/pom.xml | 2 +- webrtc/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 2a90f813..b04d0e4f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.1-SNAPSHOT + 0.11.0 pom webrtc-java-parent @@ -40,7 +40,7 @@ scm:git:git://github.com/devopvoid/webrtc-java.git scm:git:ssh://git@github.com/devopvoid/webrtc-java.git https://github.com/devopvoid/webrtc-java/tree/master - HEAD + v0.11.0 diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 932d1a2f..3e2b4868 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.1-SNAPSHOT + 0.11.0 webrtc-java-jni diff --git a/webrtc/pom.xml b/webrtc/pom.xml index e884454d..74df44d3 100644 --- a/webrtc/pom.xml +++ b/webrtc/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.1-SNAPSHOT + 0.11.0 webrtc-java From 80b6bf550a4f3a0c669f2c3406e43971c0e68834 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Sun, 6 Jul 2025 12:25:28 +0200 Subject: [PATCH 05/15] Revert "Prepare release v0.11.0" This reverts commit dcfa1f46e33f7584b107d41c049b08f24f509b62. --- pom.xml | 4 +- webrtc-jni/pom.xml | 394 ++++++++++++++++++++++----------------------- webrtc/pom.xml | 2 +- 3 files changed, 200 insertions(+), 200 deletions(-) diff --git a/pom.xml b/pom.xml index b04d0e4f..1a70d805 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0 + 0.11.0-SNAPSHOT pom webrtc-java-parent @@ -40,7 +40,7 @@ scm:git:git://github.com/devopvoid/webrtc-java.git scm:git:ssh://git@github.com/devopvoid/webrtc-java.git https://github.com/devopvoid/webrtc-java/tree/master - v0.11.0 + HEAD diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 3e2b4868..70dcd044 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -1,197 +1,197 @@ - - - 4.0.0 - - - dev.onvoid.webrtc - webrtc-java-parent - 0.11.0 - - - webrtc-java-jni - pom - - - branch-heads/7204 - ${user.home}/webrtc - ${user.home}/webrtc/build - Release - - - - - - webrtc-java-${project.version} - - - - org.apache.maven.plugins - maven-jar-plugin - - - prepare-package - - jar - - - ${platform.classifier} - ${project.build.directory}/lib - - false - - ${platform.module} - - - - - - - - org.apache.maven.plugins - maven-install-plugin - - true - - - - install-classifier - package - - install-file - - - ${project.build.directory}/webrtc-java-${project.version}-${platform.classifier}.jar - ${platform.classifier} - ${project.groupId} - webrtc-java - ${project.version} - jar - false - - - - - - com.googlecode.cmake-maven-project - cmake-maven-plugin - 3.22.1-b1 - - - cmake-generate - generate-resources - - generate - - - src/main/cpp - ${project.build.directory}/${platform.classifier} - - - - - - - - - - - - - - cmake-compile - generate-resources - - compile - - - ${cmake.config} - install - ${project.build.directory}/${platform.classifier} - - - - - - - - - - windows-x86_64 - - - windows - amd64 - - - - -Ax64 - ${cmake.build.type} - - - - windows-clang - - - windows - amd64 - - - - -T ClangCL - toolchain/x86_64-windows-clang.cmake - - - - linux-x86_64 - - - linux - amd64 - - - - toolchain/x86_64-linux-clang.cmake - - - - linux-aarch32 - - - linux - aarch32 - - - - toolchain/aarch32-linux-clang.cmake - - - - linux-aarch64 - - - linux - aarch64 - - - - toolchain/aarch64-linux-clang.cmake - - - - + + + 4.0.0 + + + dev.onvoid.webrtc + webrtc-java-parent + 0.11.0-SNAPSHOT + + + webrtc-java-jni + pom + + + branch-heads/7204 + ${user.home}/webrtc + ${user.home}/webrtc/build + Release + + + + + + webrtc-java-${project.version} + + + + org.apache.maven.plugins + maven-jar-plugin + + + prepare-package + + jar + + + ${platform.classifier} + ${project.build.directory}/lib + + false + + ${platform.module} + + + + + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + install-classifier + package + + install-file + + + ${project.build.directory}/webrtc-java-${project.version}-${platform.classifier}.jar + ${platform.classifier} + ${project.groupId} + webrtc-java + ${project.version} + jar + false + + + + + + com.googlecode.cmake-maven-project + cmake-maven-plugin + 3.22.1-b1 + + + cmake-generate + generate-resources + + generate + + + src/main/cpp + ${project.build.directory}/${platform.classifier} + + + + + + + + + + + + + + cmake-compile + generate-resources + + compile + + + ${cmake.config} + install + ${project.build.directory}/${platform.classifier} + + + + + + + + + + windows-x86_64 + + + windows + amd64 + + + + -Ax64 + ${cmake.build.type} + + + + windows-clang + + + windows + amd64 + + + + -T ClangCL + toolchain/x86_64-windows-clang.cmake + + + + linux-x86_64 + + + linux + amd64 + + + + toolchain/x86_64-linux-clang.cmake + + + + linux-aarch32 + + + linux + aarch32 + + + + toolchain/aarch32-linux-clang.cmake + + + + linux-aarch64 + + + linux + aarch64 + + + + toolchain/aarch64-linux-clang.cmake + + + + diff --git a/webrtc/pom.xml b/webrtc/pom.xml index 74df44d3..baa6420e 100644 --- a/webrtc/pom.xml +++ b/webrtc/pom.xml @@ -5,7 +5,7 @@ dev.onvoid.webrtc webrtc-java-parent - 0.11.0 + 0.11.0-SNAPSHOT webrtc-java From 97702dff39deeee9abae8a3c3448e593c1d5b50c Mon Sep 17 00:00:00 2001 From: Alex Andres <58339654+devopvoid@users.noreply.github.com> Date: Mon, 7 Jul 2025 08:34:11 +0200 Subject: [PATCH 06/15] Update pom.xml --- webrtc-jni/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 3e2bbc3f..8e42262a 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -12,7 +12,7 @@ pom - branch-heads/6998 + branch-heads/7204 ${user.home}/webrtc ${user.home}/webrtc/build Release @@ -196,4 +196,4 @@ - \ No newline at end of file + From ac3bf198da01155fb4cb3794e41eab8836a0d130 Mon Sep 17 00:00:00 2001 From: Alex Andres <58339654+devopvoid@users.noreply.github.com> Date: Mon, 7 Jul 2025 08:43:54 +0000 Subject: [PATCH 07/15] test mac --- .github/actions/prepare-macos/action.yml | 2 +- .github/workflows/build.yml | 60 +----------------------- 2 files changed, 3 insertions(+), 59 deletions(-) diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index d4f66dca..084114fb 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -14,5 +14,5 @@ runs: shell: bash - name: Select Xcode version - run: sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer + run: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index defa4a36..e6fac0bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,67 +16,11 @@ on: workflow_dispatch: env: - WEBRTC_CACHE_BRANCH: 6998 + WEBRTC_CACHE_BRANCH: 7204 WEBRTC_CHECKOUT_FOLDER: webrtc WEBRTC_INSTALL_FOLDER: webrtc/build jobs: - build-windows: - strategy: - fail-fast: false - matrix: - platform: - - name: windows_x86_64 - runs-on: windows-2022 - java: [17] - runs-on: ${{ matrix.platform.runs-on }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - id: prepare - name: Prepare build - uses: ./.github/actions/prepare-windows - - - id: maven-build - name: Maven build - uses: ./.github/actions/build - with: - java-version: ${{ matrix.java }} - platform-name: ${{ matrix.platform.name }} - maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_TOKEN }} - - build-linux: - strategy: - fail-fast: false - matrix: - platform: - - name: linux_arm - runs-on: ubuntu-22.04 - - name: linux_arm64 - runs-on: ubuntu-22.04 - - name: linux_x86-64 - runs-on: ubuntu-22.04 - java: [17] - runs-on: ${{ matrix.platform.runs-on }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - id: prepare - name: Prepare build - uses: ./.github/actions/prepare-linux - - - id: maven-build - name: Maven build - uses: ./.github/actions/build - with: - java-version: ${{ matrix.java }} - platform-name: ${{ matrix.platform.name }} - maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_TOKEN }} - build-macos: strategy: fail-fast: false @@ -85,7 +29,7 @@ jobs: - name: macos_x86-64 runs-on: macos-13 - name: macos_arm64 - runs-on: macos-14 + runs-on: macos-15 java: [17] runs-on: ${{ matrix.platform.runs-on }} steps: From b9d2bad9e8dac8b7f74baa5605a64434a7f827a9 Mon Sep 17 00:00:00 2001 From: Alex Andres <58339654+devopvoid@users.noreply.github.com> Date: Mon, 7 Jul 2025 08:45:46 +0000 Subject: [PATCH 08/15] build: remove Xcode version selection step from macOS preparation --- .github/actions/prepare-macos/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index 084114fb..6742bdf6 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -13,6 +13,3 @@ runs: brew install python-setuptools shell: bash - - name: Select Xcode version - run: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer - shell: bash From 108c3273ab31451f4b0c35179cd94af8e7d6bef0 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Mon, 7 Jul 2025 15:56:23 +0200 Subject: [PATCH 09/15] Revert "build: remove Xcode version selection step from macOS preparation" This reverts commit b9d2bad9e8dac8b7f74baa5605a64434a7f827a9. --- .github/actions/prepare-macos/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index 6742bdf6..084114fb 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -13,3 +13,6 @@ runs: brew install python-setuptools shell: bash + - name: Select Xcode version + run: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer + shell: bash From 6c3f1b354deeb01491c86f11e7ad28c166a17851 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Mon, 7 Jul 2025 15:56:32 +0200 Subject: [PATCH 10/15] Revert "test mac" This reverts commit ac3bf198da01155fb4cb3794e41eab8836a0d130. --- .github/actions/prepare-macos/action.yml | 2 +- .github/workflows/build.yml | 60 +++++++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index 084114fb..d4f66dca 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -14,5 +14,5 @@ runs: shell: bash - name: Select Xcode version - run: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer + run: sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6fac0bf..defa4a36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,67 @@ on: workflow_dispatch: env: - WEBRTC_CACHE_BRANCH: 7204 + WEBRTC_CACHE_BRANCH: 6998 WEBRTC_CHECKOUT_FOLDER: webrtc WEBRTC_INSTALL_FOLDER: webrtc/build jobs: + build-windows: + strategy: + fail-fast: false + matrix: + platform: + - name: windows_x86_64 + runs-on: windows-2022 + java: [17] + runs-on: ${{ matrix.platform.runs-on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - id: prepare + name: Prepare build + uses: ./.github/actions/prepare-windows + + - id: maven-build + name: Maven build + uses: ./.github/actions/build + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + + build-linux: + strategy: + fail-fast: false + matrix: + platform: + - name: linux_arm + runs-on: ubuntu-22.04 + - name: linux_arm64 + runs-on: ubuntu-22.04 + - name: linux_x86-64 + runs-on: ubuntu-22.04 + java: [17] + runs-on: ${{ matrix.platform.runs-on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - id: prepare + name: Prepare build + uses: ./.github/actions/prepare-linux + + - id: maven-build + name: Maven build + uses: ./.github/actions/build + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} + build-macos: strategy: fail-fast: false @@ -29,7 +85,7 @@ jobs: - name: macos_x86-64 runs-on: macos-13 - name: macos_arm64 - runs-on: macos-15 + runs-on: macos-14 java: [17] runs-on: ${{ matrix.platform.runs-on }} steps: From 43a18fbdedfbbd25ca53ad7ca7aa5ae2e4296f36 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Mon, 7 Jul 2025 19:39:29 +0200 Subject: [PATCH 11/15] build: update macOS build configurations --- .github/actions/build/action.yml | 6 +++++- .github/actions/prepare-macos/action.yml | 4 +--- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- pom.xml | 4 ++-- webrtc-jni/pom.xml | 18 ++++++++++++++++++ .../cpp/dependencies/webrtc/CMakeLists.txt | 4 +++- .../cpp/toolchain/aarch64-macos-clang.cmake | 7 +++++++ .../cpp/toolchain/x86_64-macos-cross.cmake | 17 +++++++++++++++++ 9 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 webrtc-jni/src/main/cpp/toolchain/aarch64-macos-clang.cmake create mode 100644 webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 79572d64..bbd369e5 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -52,13 +52,15 @@ runs: mvn package -DskipTests -Plinux-aarch32 elif [ "${{ inputs.platform-name }}" == "linux_arm64" ]; then mvn package -DskipTests -Plinux-aarch64 + elif [ "${{ inputs.platform-name }}" == "macos_x86-64" ]; then + mvn package -DskipTests -Pmacos-cross-x86_64 else mvn package -DskipTests fi shell: bash - name: Test - if: ${{ inputs.platform-name != 'linux_arm' && inputs.platform-name != 'linux_arm64' }} + if: ${{ inputs.platform-name != 'linux_arm' && inputs.platform-name != 'linux_arm64' && inputs.platform-name != 'macos_x86-64' }} run: mvn -B jar:jar surefire:test shell: bash @@ -71,6 +73,8 @@ runs: mvn deploy -DskipTests -Plinux-aarch32 elif [ "${{ inputs.platform-name }}" == "linux_arm64" ]; then mvn deploy -DskipTests -Plinux-aarch64 + elif [ "${{ inputs.platform-name }}" == "macos_x86-64" ]; then + mvn deploy -DskipTests -Pmacos-cross-x86_64 else mvn deploy -DskipTests fi diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index d4f66dca..f7537130 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -7,12 +7,10 @@ runs: steps: - name: Install required packages run: | - # Required for macos-13 - pip install setuptools # Required for macos-14 brew install python-setuptools shell: bash - name: Select Xcode version - run: sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer + run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index defa4a36..61cafe6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ on: workflow_dispatch: env: - WEBRTC_CACHE_BRANCH: 6998 + WEBRTC_CACHE_BRANCH: 7204 WEBRTC_CHECKOUT_FOLDER: webrtc WEBRTC_INSTALL_FOLDER: webrtc/build @@ -83,7 +83,7 @@ jobs: matrix: platform: - name: macos_x86-64 - runs-on: macos-13 + runs-on: macos-14 - name: macos_arm64 runs-on: macos-14 java: [17] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbae6c77..e0f38b0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: default: "X.Y.Z-SNAPSHOT" env: - WEBRTC_CACHE_BRANCH: 6998 + WEBRTC_CACHE_BRANCH: 7204 WEBRTC_CHECKOUT_FOLDER: webrtc WEBRTC_INSTALL_FOLDER: webrtc/build @@ -153,7 +153,7 @@ jobs: matrix: platform: - name: macos_x86-64 - runs-on: macos-13 + runs-on: macos-14 - name: macos_arm64 runs-on: macos-14 java: [17] diff --git a/pom.xml b/pom.xml index bbd07f95..ddddecc3 100644 --- a/pom.xml +++ b/pom.xml @@ -319,7 +319,7 @@ - mac-x86_64 + macos-x86_64 mac @@ -332,7 +332,7 @@ - mac-aarch64 + macos-aarch64 mac diff --git a/webrtc-jni/pom.xml b/webrtc-jni/pom.xml index 8e42262a..148da89f 100644 --- a/webrtc-jni/pom.xml +++ b/webrtc-jni/pom.xml @@ -195,5 +195,23 @@ toolchain/aarch64-linux-clang.cmake + + macos-aarch64 + + + mac + aarch64 + + + + toolchain/aarch64-macos-clang.cmake + + + + macos-cross-x86_64 + + toolchain/x86_64-macos-cross.cmake + + diff --git a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt index bd97147f..0fd669c9 100644 --- a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt +++ b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt @@ -261,7 +261,9 @@ use_rtti=true \ rtc_use_h264=true \ symbol_level=0") -if(LINUX) +if(APPLE) + set(COMPILE_ARGS "${COMPILE_ARGS} mac_deployment_target=\"${CMAKE_OSX_DEPLOYMENT_TARGET}\"") +elseif(LINUX) if(${TARGET_CPU} STREQUAL "arm") set(COMPILE_ARGS "${COMPILE_ARGS} custom_toolchain=\"//build/toolchain/linux:clang_arm\"") elseif(${TARGET_CPU} STREQUAL "arm64") diff --git a/webrtc-jni/src/main/cpp/toolchain/aarch64-macos-clang.cmake b/webrtc-jni/src/main/cpp/toolchain/aarch64-macos-clang.cmake new file mode 100644 index 00000000..0c811c72 --- /dev/null +++ b/webrtc-jni/src/main/cpp/toolchain/aarch64-macos-clang.cmake @@ -0,0 +1,7 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_PROCESSOR arm64) + +set(CMAKE_OSX_ARCHITECTURES arm64) +set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") + +set(TARGET_CPU "arm64") \ No newline at end of file diff --git a/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake new file mode 100644 index 00000000..4ad4fbbf --- /dev/null +++ b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake @@ -0,0 +1,17 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(CMAKE_OSX_ARCHITECTURES x86_64) +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15") + +set(CMAKE_C_FLAGS_INIT "-arch x86_64") +set(CMAKE_CXX_FLAGS_INIT "-arch x86_64") + +set(CMAKE_EXE_LINKER_FLAGS_INIT "-arch x86_64") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-arch x86_64") + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +set(TARGET_CPU "x64") \ No newline at end of file From 2ac7ce6846fa5c0873ab8e5d87390a59a3854a83 Mon Sep 17 00:00:00 2001 From: Alex Andres <58339654+devopvoid@users.noreply.github.com> Date: Mon, 7 Jul 2025 23:18:24 +0200 Subject: [PATCH 12/15] x86_64-macos-cross.cmake updated --- webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake index 4ad4fbbf..353fac55 100644 --- a/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake +++ b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake @@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_NAME Darwin) set(CMAKE_SYSTEM_PROCESSOR x86_64) set(CMAKE_OSX_ARCHITECTURES x86_64) -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15") +set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") set(CMAKE_C_FLAGS_INIT "-arch x86_64") set(CMAKE_CXX_FLAGS_INIT "-arch x86_64") From a6170084aa06c5ef4c2634c292e9dc88c29c69ee Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Tue, 8 Jul 2025 11:33:08 +0200 Subject: [PATCH 13/15] build: update macOS deployment target to 13.0 --- webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt | 2 ++ webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt index 0fd669c9..7183bff7 100644 --- a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt +++ b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt @@ -271,6 +271,8 @@ elseif(LINUX) endif() endif() +message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}") + execute_command( COMMAND gn gen ${WEBRTC_BUILD} --args=${COMPILE_ARGS} WORKING_DIRECTORY "${WEBRTC_SRC}" diff --git a/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake index 353fac55..b09750f5 100644 --- a/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake +++ b/webrtc-jni/src/main/cpp/toolchain/x86_64-macos-cross.cmake @@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_NAME Darwin) set(CMAKE_SYSTEM_PROCESSOR x86_64) set(CMAKE_OSX_ARCHITECTURES x86_64) -set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") +set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "Minimum OS X deployment version") set(CMAKE_C_FLAGS_INIT "-arch x86_64") set(CMAKE_CXX_FLAGS_INIT "-arch x86_64") From 2e341a0532ffb4101cbdaf641a658feca40e4b94 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Tue, 8 Jul 2025 12:39:44 +0200 Subject: [PATCH 14/15] build: update Maven build actions for macOS platforms --- .github/actions/build-macos-x86_64/action.yml | 63 +++++++++++++++++++ .github/actions/build/action.yml | 6 +- .github/actions/prepare-macos/action.yml | 2 +- .github/workflows/build.yml | 13 +++- .github/workflows/release.yml | 3 - .../cpp/dependencies/webrtc/CMakeLists.txt | 2 - 6 files changed, 77 insertions(+), 12 deletions(-) create mode 100644 .github/actions/build-macos-x86_64/action.yml diff --git a/.github/actions/build-macos-x86_64/action.yml b/.github/actions/build-macos-x86_64/action.yml new file mode 100644 index 00000000..fabcbb68 --- /dev/null +++ b/.github/actions/build-macos-x86_64/action.yml @@ -0,0 +1,63 @@ +name: 'Maven Build' + +description: 'Build the platform dependent Java library' + +inputs: + java-version: + description: 'The Java build version.' + required: true + default: '17' + + platform-name: + description: 'The target platform.' + required: true + + maven-username: + description: 'The Maven username.' + required: true + + maven-password: + description: 'The Maven password.' + required: true + +runs: + using: "composite" + steps: + - name: Set up WebRTC cache + uses: actions/cache@v4 + with: + path: ~/${{ env.WEBRTC_INSTALL_FOLDER }} + key: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ inputs.platform-name }}-${{ hashFiles('webrtc-jni/pom.xml') }} + restore-keys: webrtc-${{ env.WEBRTC_CACHE_BRANCH }}-${{ inputs.platform-name }}- + + - name: Set up Maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: maven-${{ inputs.platform-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: maven-${{ inputs.platform-name }}- + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + architecture: 'x64' + java-version: ${{ inputs.java-version }} + distribution: 'temurin' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + + - name: Build + run: arch -x86_64 mvn package -DskipTests -Pmacos-cross-x86_64 + shell: bash + + - name: Test + run: arch -x86_64 mvn -B jar:jar surefire:test -Pmacos-cross-x86_64 + shell: bash + + - name: Deploy + env: + MAVEN_USERNAME: ${{ inputs.maven-username }} + MAVEN_TOKEN: ${{ inputs.maven-password }} + run: arch -x86_64 mvn deploy -DskipTests -Pmacos-cross-x86_64 + shell: bash diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index bbd369e5..79572d64 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -52,15 +52,13 @@ runs: mvn package -DskipTests -Plinux-aarch32 elif [ "${{ inputs.platform-name }}" == "linux_arm64" ]; then mvn package -DskipTests -Plinux-aarch64 - elif [ "${{ inputs.platform-name }}" == "macos_x86-64" ]; then - mvn package -DskipTests -Pmacos-cross-x86_64 else mvn package -DskipTests fi shell: bash - name: Test - if: ${{ inputs.platform-name != 'linux_arm' && inputs.platform-name != 'linux_arm64' && inputs.platform-name != 'macos_x86-64' }} + if: ${{ inputs.platform-name != 'linux_arm' && inputs.platform-name != 'linux_arm64' }} run: mvn -B jar:jar surefire:test shell: bash @@ -73,8 +71,6 @@ runs: mvn deploy -DskipTests -Plinux-aarch32 elif [ "${{ inputs.platform-name }}" == "linux_arm64" ]; then mvn deploy -DskipTests -Plinux-aarch64 - elif [ "${{ inputs.platform-name }}" == "macos_x86-64" ]; then - mvn deploy -DskipTests -Pmacos-cross-x86_64 else mvn deploy -DskipTests fi diff --git a/.github/actions/prepare-macos/action.yml b/.github/actions/prepare-macos/action.yml index f7537130..818e04ea 100644 --- a/.github/actions/prepare-macos/action.yml +++ b/.github/actions/prepare-macos/action.yml @@ -7,7 +7,7 @@ runs: steps: - name: Install required packages run: | - # Required for macos-14 + # Required on macos-14 brew install python-setuptools shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61cafe6a..18b65cbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,10 +97,21 @@ jobs: uses: ./.github/actions/prepare-macos - id: maven-build - name: Maven build + name: Maven build - Apple Silicon + if: matrix.platform.name == 'macos_arm64' uses: ./.github/actions/build with: java-version: ${{ matrix.java }} platform-name: ${{ matrix.platform.name }} maven-username: ${{ secrets.MAVEN_USERNAME }} maven-password: ${{ secrets.MAVEN_TOKEN }} + + - id: maven-build + name: Maven build - Intel + if: matrix.platform.name == 'macos_x86-64' + uses: ./.github/actions/build-macos-x86_64 + with: + java-version: ${{ matrix.java }} + platform-name: ${{ matrix.platform.name }} + maven-username: ${{ secrets.MAVEN_USERNAME }} + maven-password: ${{ secrets.MAVEN_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0f38b0e..1e8656ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,6 @@ name: Release on: - create: - tags: - - 'v*' workflow_dispatch: inputs: developmentVersion: diff --git a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt index 7183bff7..0fd669c9 100644 --- a/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt +++ b/webrtc-jni/src/main/cpp/dependencies/webrtc/CMakeLists.txt @@ -271,8 +271,6 @@ elseif(LINUX) endif() endif() -message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}") - execute_command( COMMAND gn gen ${WEBRTC_BUILD} --args=${COMPILE_ARGS} WORKING_DIRECTORY "${WEBRTC_SRC}" From 89a1f52077473b8092cf61c561e93b0da3d32beb Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Tue, 8 Jul 2025 12:40:52 +0200 Subject: [PATCH 15/15] build: differentiate Maven build actions for Apple Silicon and Intel --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18b65cbc..7cd35679 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -96,7 +96,7 @@ jobs: name: Prepare build uses: ./.github/actions/prepare-macos - - id: maven-build + - id: maven-build-arm64 name: Maven build - Apple Silicon if: matrix.platform.name == 'macos_arm64' uses: ./.github/actions/build @@ -106,7 +106,7 @@ jobs: maven-username: ${{ secrets.MAVEN_USERNAME }} maven-password: ${{ secrets.MAVEN_TOKEN }} - - id: maven-build + - id: maven-build-x86_64 name: Maven build - Intel if: matrix.platform.name == 'macos_x86-64' uses: ./.github/actions/build-macos-x86_64