diff --git a/api/candidate.h b/api/candidate.h index 0aa75aa192..715761a142 100644 --- a/api/candidate.h +++ b/api/candidate.h @@ -105,7 +105,7 @@ class RTC_EXPORT Candidate { // cricket::LOCAL_PORT_TYPE). The type should really be an enum rather than a // string, but until we make that change the lifetime attribute helps us lock // things down. See also the `Port` class. - void set_type(absl::string_view type ABSL_ATTRIBUTE_LIFETIME_BOUND) { + void set_type(absl::string_view type) { Assign(type_, type); } diff --git a/common_video/h265/h265_pps_parser.h b/common_video/h265/h265_pps_parser.h index 28c95ea9bc..f377508b15 100644 --- a/common_video/h265/h265_pps_parser.h +++ b/common_video/h265/h265_pps_parser.h @@ -11,6 +11,9 @@ #ifndef COMMON_VIDEO_H265_PPS_PARSER_H_ #define COMMON_VIDEO_H265_PPS_PARSER_H_ +#include +#include + #include "absl/types/optional.h" namespace rtc { diff --git a/modules/audio_device/audio_device_generic.cc b/modules/audio_device/audio_device_generic.cc index 7b8cfd1734..f6f079d074 100644 --- a/modules/audio_device/audio_device_generic.cc +++ b/modules/audio_device/audio_device_generic.cc @@ -63,4 +63,15 @@ int AudioDeviceGeneric::GetRecordAudioParameters( } #endif // WEBRTC_IOS +// MARK: Nicegram NCG-5828 call recording + +void AudioDeviceGeneric::StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback) { + RTC_LOG_F(LS_ERROR) << "Not supported on this platform"; +} + +void AudioDeviceGeneric::StopNicegramRecording(bool synchronous) { + RTC_LOG_F(LS_ERROR) << "Not supported on this platform"; +} +// + } // namespace webrtc diff --git a/modules/audio_device/audio_device_generic.h b/modules/audio_device/audio_device_generic.h index 41e24eb3b0..5fee887d18 100644 --- a/modules/audio_device/audio_device_generic.h +++ b/modules/audio_device/audio_device_generic.h @@ -21,6 +21,13 @@ namespace webrtc { class AudioDeviceGeneric { public: + // MARK: Nicegram NCG-5828 call recording + using CompletionRecorderCallback = std::function; + + using RecorderErrorCallback = std::function; + // // For use with UMA logging. Must be kept in sync with histograms.xml in // Chrome, located at // https://cs.chromium.org/chromium/src/tools/metrics/histograms/histograms.xml @@ -135,6 +142,11 @@ class AudioDeviceGeneric { virtual int GetRecordAudioParameters(AudioParameters* params) const; #endif // WEBRTC_IOS + // MARK: Nicegram NCG-5828 call recording + virtual void StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback); + virtual void StopNicegramRecording(bool synchronous = false); + // + virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0; virtual ~AudioDeviceGeneric() {} diff --git a/modules/audio_device/include/audio_device.h b/modules/audio_device/include/audio_device.h index 47d2aecfa7..2874ff996b 100644 --- a/modules/audio_device/include/audio_device.h +++ b/modules/audio_device/include/audio_device.h @@ -23,6 +23,13 @@ class AudioDeviceModuleForTest; class AudioDeviceModule : public webrtc::RefCountInterface { public: + // MARK: Nicegram NCG-5828 call recording + using CompletionRecorderCallback = std::function; + + using RecorderErrorCallback = std::function; + // enum AudioLayer { kPlatformDefaultAudio = 0, kWindowsCoreAudio, @@ -171,6 +178,11 @@ class AudioDeviceModule : public webrtc::RefCountInterface { virtual int GetRecordAudioParameters(AudioParameters* params) const = 0; #endif // WEBRTC_IOS + // MARK: Nicegram NCG-5828 call recording + virtual void StartNicegramRecording(const CompletionRecorderCallback& callback, const RecorderErrorCallback &errorCallback) {} + virtual void StopNicegramRecording(bool synchronous = false) {} + // + protected: ~AudioDeviceModule() override {} }; diff --git a/modules/video_coding/codecs/h264/h264.cc b/modules/video_coding/codecs/h264/h264.cc index 5b9f0338a9..c1e63ec785 100644 --- a/modules/video_coding/codecs/h264/h264.cc +++ b/modules/video_coding/codecs/h264/h264.cc @@ -153,7 +153,7 @@ bool H264Encoder::SupportsScalabilityMode(ScalabilityMode scalability_mode) { std::unique_ptr H264Decoder::Create() { RTC_DCHECK(H264Decoder::IsSupported()); -#if defined(WEBRTC_USE_H264) +#if defined(WEBRTC_USE_H264) && defined(WEBRTC_USE_H264_DECODER) RTC_CHECK(g_rtc_use_h264); RTC_LOG(LS_INFO) << "Creating H264DecoderImpl."; return std::make_unique(); diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/modules/video_coding/codecs/h264/h264_decoder_impl.cc index c6446c25ce..b90a592327 100644 --- a/modules/video_coding/codecs/h264/h264_decoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_decoder_impl.cc @@ -13,6 +13,7 @@ // build with H264 support, please do not move anything out of the // #ifdef unless needed and tested. #ifdef WEBRTC_USE_H264 +#ifdef WEBRTC_USE_H264_DECODER #include "modules/video_coding/codecs/h264/h264_decoder_impl.h" @@ -658,4 +659,5 @@ void H264DecoderImpl::ReportError() { } // namespace webrtc +#endif // WEBRTC_USE_H264_DECODER #endif // WEBRTC_USE_H264 diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.h b/modules/video_coding/codecs/h264/h264_decoder_impl.h index 97d091cf4b..7c1f1aac9b 100644 --- a/modules/video_coding/codecs/h264/h264_decoder_impl.h +++ b/modules/video_coding/codecs/h264/h264_decoder_impl.h @@ -16,6 +16,7 @@ // build with H264 support, please do not move anything out of the // #ifdef unless needed and tested. #ifdef WEBRTC_USE_H264 +#ifdef WEBRTC_USE_H264_DECODER #if defined(WEBRTC_WIN) && !defined(__clang__) #error "See: bugs.webrtc.org/9213#c13." @@ -104,6 +105,7 @@ class H264DecoderImpl : public H264Decoder { } // namespace webrtc +#endif // WEBRTC_USE_H264_DECODER #endif // WEBRTC_USE_H264 #endif // MODULES_VIDEO_CODING_CODECS_H264_H264_DECODER_IMPL_H_ diff --git a/p2p/base/ice_transport_internal.cc b/p2p/base/ice_transport_internal.cc index 0dc7e50af2..4619ef5898 100644 --- a/p2p/base/ice_transport_internal.cc +++ b/p2p/base/ice_transport_internal.cc @@ -35,9 +35,12 @@ RTCError VerifyCandidate(const Candidate& cand) { return RTCError::OK(); } if (port < 1024) { - if ((port != 80) && (port != 443)) { - return RTCError(RTCErrorType::INVALID_PARAMETER, - "candidate has port below 1024, but not 80 or 443"); + if (absl::EndsWith(cand.address().hostname(), ".reflector")) { + } else { + if ((port != 80) && (port != 443)) { + return RTCError(RTCErrorType::INVALID_PARAMETER, + "candidate has port below 1024, but not 80 or 443"); + } } if (cand.address().IsPrivateIP()) { diff --git a/sdk/objc/components/network/RTCNetworkMonitor.mm b/sdk/objc/components/network/RTCNetworkMonitor.mm index 7e75b2b4c0..d76ffcc890 100644 --- a/sdk/objc/components/network/RTCNetworkMonitor.mm +++ b/sdk/objc/components/network/RTCNetworkMonitor.mm @@ -7,19 +7,14 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ - #import "RTCNetworkMonitor+Private.h" - #import - #import "base/RTCLogging.h" #import "helpers/RTCDispatcher+Private.h" - #include "rtc_base/string_utils.h" - namespace { - -rtc::AdapterType AdapterTypeFromInterfaceType(nw_interface_type_t interfaceType) { +rtc::AdapterType AdapterTypeFromInterfaceType( + nw_interface_type_t interfaceType) { rtc::AdapterType adapterType = rtc::ADAPTER_TYPE_UNKNOWN; switch (interfaceType) { case nw_interface_type_other: @@ -43,18 +38,16 @@ } return adapterType; } - } // namespace - @implementation RTCNetworkMonitor { webrtc::NetworkMonitorObserver *_observer; nw_path_monitor_t _pathMonitor; dispatch_queue_t _monitorQueue; } - - (instancetype)initWithObserver:(webrtc::NetworkMonitorObserver *)observer { RTC_DCHECK(observer); - if (self = [super init]) { + self = [super init]; + if (self) { _observer = observer; if (@available(iOS 12, *)) { _pathMonitor = nw_path_monitor_create(); @@ -65,10 +58,10 @@ - (instancetype)initWithObserver:(webrtc::NetworkMonitorObserver *)observer { RTCLog(@"NW path monitor created."); __weak RTCNetworkMonitor *weakSelf = self; nw_path_monitor_set_update_handler(_pathMonitor, ^(nw_path_t path) { - if (weakSelf == nil) { + RTCNetworkMonitor *strongSelf = weakSelf; + if (strongSelf == nil) { return; } - RTCNetworkMonitor *strongSelf = weakSelf; RTCLog(@"NW path monitor: updated."); nw_path_status_t status = nw_path_get_status(path); if (status == nw_path_status_invalid) { @@ -80,33 +73,34 @@ - (instancetype)initWithObserver:(webrtc::NetworkMonitorObserver *)observer { } else if (status == nw_path_status_satisfiable) { RTCLog(@"NW path monitor status: satisfiable."); } - std::map *map = - new std::map(); - nw_path_enumerate_interfaces( - path, (nw_path_enumerate_interfaces_block_t) ^ (nw_interface_t interface) { - const char *name = nw_interface_get_name(interface); - nw_interface_type_t interfaceType = nw_interface_get_type(interface); - RTCLog(@"NW path monitor available interface: %s", name); - rtc::AdapterType adapterType = AdapterTypeFromInterfaceType(interfaceType); - map->insert(std::pair(name, adapterType)); - }); + std::map + owned_map; + auto map = &owned_map; // Capture raw pointer for Objective-C block + nw_path_enumerate_interfaces(path, ^(nw_interface_t interface) { + const char *name = nw_interface_get_name(interface); + nw_interface_type_t interfaceType = nw_interface_get_type(interface); + RTCLog(@"NW path monitor available interface: %s", name); + rtc::AdapterType adapterType = + AdapterTypeFromInterfaceType(interfaceType); + map->emplace(name, adapterType); + return true; + }); @synchronized(strongSelf) { webrtc::NetworkMonitorObserver *observer = strongSelf->_observer; if (observer) { - observer->OnPathUpdate(std::move(*map)); + observer->OnPathUpdate(std::move(owned_map)); } } - delete map; }); nw_path_monitor_set_queue( _pathMonitor, - [RTC_OBJC_TYPE(RTCDispatcher) dispatchQueueForType:RTCDispatcherTypeNetworkMonitor]); + [RTC_OBJC_TYPE(RTCDispatcher) + dispatchQueueForType:RTCDispatcherTypeNetworkMonitor]); nw_path_monitor_start(_pathMonitor); } } return self; } - - (void)cancel { if (@available(iOS 12, *)) { nw_path_monitor_cancel(_pathMonitor); @@ -118,9 +112,7 @@ - (void)stop { _observer = nil; } } - - (void)dealloc { [self cancel]; } - @end diff --git a/video/rtp_video_stream_receiver2.cc b/video/rtp_video_stream_receiver2.cc index f66a2feace..43ca8a9298 100644 --- a/video/rtp_video_stream_receiver2.cc +++ b/video/rtp_video_stream_receiver2.cc @@ -328,7 +328,7 @@ RtpVideoStreamReceiver2::RtpVideoStreamReceiver2( } // Only construct the encrypted receiver if frame encryption is enabled. - if (config_.crypto_options.sframe.require_frame_encryption) { + if (config_.crypto_options.sframe.require_frame_encryption || frame_decryptor) { buffered_frame_decryptor_ = std::make_unique(this, this, field_trials_); if (frame_decryptor != nullptr) { diff --git a/video/rtp_video_stream_receiver2.h b/video/rtp_video_stream_receiver2.h index a1e26f93e9..a64f0cf565 100644 --- a/video/rtp_video_stream_receiver2.h +++ b/video/rtp_video_stream_receiver2.h @@ -389,7 +389,7 @@ class RtpVideoStreamReceiver2 : public LossNotificationSender, RTC_GUARDED_BY(packet_sequence_checker_); video_coding::H264SpsPpsTracker tracker_ RTC_GUARDED_BY(packet_sequence_checker_); - video_coding::H265VpsSpsPpsTracker h265_tracker_; + video_coding::H265VpsSpsPpsTracker h265_tracker_ RTC_GUARDED_BY(packet_sequence_checker_); // Maps payload id to the depacketizer.