m122 merge fixes

This commit is contained in:
Jim Gustafson 2024-02-14 11:00:24 -08:00
parent c37ca3fc86
commit 5b1a8a189a
7 changed files with 33 additions and 32 deletions

View file

@ -104,7 +104,6 @@ void PacketBuffer::Flush() {
<< ", num_gaps_below_40ms=" << num_gaps_below_40ms
<< ", num_gaps_above_90ms=" << num_gaps_above_90ms
<< ", num_no_packet_info=" << num_no_packet_info;
}
buffer_.clear();
stats_->FlushedPacketBuffer();
@ -129,9 +128,12 @@ int PacketBuffer::InsertPacket(Packet&& packet) {
if (buffer_.size() >= max_number_of_packets_) {
// Buffer is full.
// RingRTC change to log more information around audio jitter buffer flushes
size_t buffer_size_before_flush = buffer_.size();
Flush();
return_val = kFlushed;
RTC_LOG(LS_WARNING) << "Packet buffer flushed.";
RTC_LOG(LS_WARNING) << "Packet buffer flushed"
<< ", packets discarded=" << buffer_size_before_flush;
}
// Get an iterator pointing to the place in the buffer where the new packet

View file

@ -332,7 +332,8 @@ class TurnPort;
// Performs the allocation of ports, in a sequenced (timed) manner, for a given
// network and IP address.
// This class is thread-compatible.
class AllocationSequence {
// RingRTC change to support ICE forking
class AllocationSequence : public sigslot::has_slots<> {
public:
enum State {
kInit, // Initial state.

View file

@ -248,7 +248,7 @@ PeerConnectionFactory::CreatePeerConnectionOrError(
// RingRTC change to control whether PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS
// is enabled.
uint32_t port_allocator_flags = configuration.port_allocator_config.flags;
if (trials->IsEnabled("RingRTC-AnyAddressPortsKillSwitch")) {
if (env.field_trials().IsEnabled("RingRTC-AnyAddressPortsKillSwitch")) {
port_allocator_flags &= ~cricket::PORTALLOCATOR_ENABLE_ANY_ADDRESS_PORTS;
}
dependencies.allocator->set_flags(

View file

@ -9,6 +9,7 @@
#include "p2p/client/basic_port_allocator.h"
#include "rffi/api/network.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/network/received_packet.h"
namespace webrtc {
@ -67,8 +68,10 @@ class InjectableUdpSocket : public rtc::AsyncPacketSocket {
RTC_LOG(LS_VERBOSE) << "InjectableUdpSocket::ReceiveFrom()"
<< " from " << remote_address.ToString()
<< " to " << local_address_.ToString();
auto now = rtc::TimeMicros();
SignalReadPacket(this, reinterpret_cast<const char*>(data), data_size, remote_address, now);
NotifyPacketReceived(rtc::ReceivedPacket::CreateFromLegacy(reinterpret_cast<const char*>(data),
data_size,
rtc::TimeMicros(),
remote_address));
}
// As rtc::AsyncPacketSocket
@ -191,10 +194,10 @@ class InjectableNetworkImpl : public InjectableNetwork, public rtc::NetworkManag
[this, source, dest, data{std::vector<uint8_t>(data, data+size)}, size] {
auto local_address = IpPortToRtcSocketAddress(dest);
auto remote_address = IpPortToRtcSocketAddress(source);
RTC_LOG(LS_VERBOSE) << "InjectableNetworkImpl::ReceiveUdp()"
<< " from " << remote_address.ToString()
<< " to " << local_address.ToString()
<< " size: " << size;
RTC_LOG(LS_VERBOSE) << "InjectableNetworkImpl::ReceiveUdp()"
<< " from " << remote_address.ToString()
<< " to " << local_address.ToString()
<< " size: " << size;
auto udp_socket = udp_socket_by_local_address_.find(local_address);
if (udp_socket == udp_socket_by_local_address_.end()) {
RTC_LOG(LS_WARNING) << "Received packet for unknown local address.";
@ -380,6 +383,3 @@ RUSTEXPORT void Rust_InjectableNetwork_ReceiveUdp(
} // namespace rffi
} // namespace webrtc

View file

@ -4,7 +4,7 @@
*/
#include "api/create_peerconnection_factory.h"
#include "api/call/call_factory_interface.h"
#include "api/enable_media.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
@ -16,7 +16,6 @@
#include "api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h"
#include "api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter.h"
#include "media/engine/simulcast_encoder_adapter.h"
#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_mixer/audio_mixer_impl.h"
#include "modules/audio_device/dummy/file_audio_device_factory.h"
#include "modules/audio_processing/include/audio_processing.h"
@ -118,10 +117,7 @@ class PeerConnectionFactoryWithOwnedThreads
dependencies.worker_thread = worker_thread.get();
dependencies.signaling_thread = signaling_thread.get();
dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
dependencies.call_factory = CreateCallFactory();
dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>(dependencies.task_queue_factory.get());
cricket::MediaEngineDependencies media_dependencies;
media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>();
#if defined(WEBRTC_WIN)
std::unique_ptr<ScopedCOMInitializer> com_initializer;
@ -149,9 +145,10 @@ class PeerConnectionFactoryWithOwnedThreads
AudioDeviceModule::kPlatformDefaultAudio, dependencies.task_queue_factory.get());
}
});
media_dependencies.adm = adm;
media_dependencies.audio_encoder_factory = CreateBuiltinAudioEncoderFactory();
media_dependencies.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
dependencies.adm = adm;
dependencies.audio_encoder_factory = CreateBuiltinAudioEncoderFactory();
dependencies.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
AudioProcessing::Config config;
config.high_pass_filter.enabled = audio_config.high_pass_filter_enabled;
@ -159,17 +156,18 @@ class PeerConnectionFactoryWithOwnedThreads
config.noise_suppression.enabled = audio_config.ns_enabled;
config.gain_controller1.enabled = audio_config.agc_enabled;
media_dependencies.audio_processing = AudioProcessingBuilder()
dependencies.audio_processing = AudioProcessingBuilder()
.SetConfig(config)
.Create();
dependencies.audio_mixer = AudioMixerImpl::Create();
media_dependencies.audio_mixer = AudioMixerImpl::Create();
media_dependencies.video_encoder_factory =
dependencies.video_encoder_factory =
std::make_unique<RingRTCVideoEncoderFactory>();
media_dependencies.video_decoder_factory =
dependencies.video_decoder_factory =
std::make_unique<VideoDecoderFactoryTemplate<
LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter>>();
dependencies.media_engine = cricket::CreateMediaEngine(std::move(media_dependencies));
EnableMedia(dependencies);
auto factory = CreateModularPeerConnectionFactory(std::move(dependencies));
return rtc::make_ref_counted<PeerConnectionFactoryWithOwnedThreads>(

View file

@ -42,7 +42,7 @@ void StatsObserverRffi::OnStatsDelivered(const rtc::scoped_refptr<const RTCStats
audio_sender.packets_sent = stat->packets_sent.ValueOrDefault(0);
audio_sender.bytes_sent = stat->bytes_sent.ValueOrDefault(0);
if (stat->remote_id.is_defined()) {
if (stat->remote_id.has_value()) {
auto remote_stat = report->GetAs<RTCRemoteInboundRtpStreamStats>(*stat->remote_id);
if (remote_stat) {
audio_sender.remote_packets_lost = remote_stat->packets_lost.ValueOrDefault(0);
@ -51,7 +51,7 @@ void StatsObserverRffi::OnStatsDelivered(const rtc::scoped_refptr<const RTCStats
}
}
if (stat->media_source_id.is_defined()) {
if (stat->media_source_id.has_value()) {
auto audio_source_stat = report->GetAs<RTCAudioSourceStats>(*stat->media_source_id);
if (audio_source_stat) {
audio_sender.total_audio_energy = audio_source_stat->total_audio_energy.ValueOrDefault(0.0);
@ -75,7 +75,7 @@ void StatsObserverRffi::OnStatsDelivered(const rtc::scoped_refptr<const RTCStats
video_sender.total_packet_send_delay = stat->total_packet_send_delay.ValueOrDefault(0.0);
video_sender.nack_count = stat->nack_count.ValueOrDefault(0);
video_sender.pli_count = stat->pli_count.ValueOrDefault(0);
if (stat->quality_limitation_reason.is_defined()) {
if (stat->quality_limitation_reason.has_value()) {
// "none" = 0 (the default)
if (*stat->quality_limitation_reason == "cpu") {
video_sender.quality_limitation_reason = 1;
@ -87,7 +87,7 @@ void StatsObserverRffi::OnStatsDelivered(const rtc::scoped_refptr<const RTCStats
}
video_sender.quality_limitation_resolution_changes = stat->quality_limitation_resolution_changes.ValueOrDefault(0);
if (stat->remote_id.is_defined()) {
if (stat->remote_id.has_value()) {
auto remote_stat = report->GetAs<RTCRemoteInboundRtpStreamStats>(*stat->remote_id);
if (remote_stat) {
video_sender.remote_packets_lost = remote_stat->packets_lost.ValueOrDefault(0);

View file

@ -905,7 +905,7 @@ int VideoReceiveStream2::DecodeAndMaybeDispatchEncodedFrame(
if (decode_result < WEBRTC_VIDEO_CODEC_OK) {
// Asynchronous decoders may delay error reporting, potentially resulting in
// error reports reflecting issues that occurred several frames back.
RTC_LOG(LS_WARNING)
RTC_LOG(LS_INFO)
<< "Failed to decode frame. Return code: " << decode_result
<< ", SSRC: " << remote_ssrc()
<< ", frame RTP timestamp: " << frame_ptr->RtpTimestamp()