aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Jansen <jansene@google.com>2023-12-15 11:49:13 -0800
committerErwin Jansen <jansene@google.com>2023-12-15 11:49:13 -0800
commit3828327c300510e0d542f0e7c9a46e75363c7a96 (patch)
tree3cecdfdd9c8114b079c2875e5c0737adb22ef0e7
parent6b2545f8bc9c20c375497afad71e11d271ebf705 (diff)
parent7e6315a61994be57daaf5fc491564cd543072be4 (diff)
downloadwebrtc-3828327c300510e0d542f0e7c9a46e75363c7a96.tar.gz
Partial merge of WebRTC
This is a partial merge. This is needed since we do not accept changes to OWNER files from the chrome domain, so those cannot come in a single merge. Change-Id: I37473f53ec79e422e8b77761a5859ebcd73f2e3e
-rw-r--r--BUILD.gn5
-rw-r--r--DEPS188
-rwxr-xr-xPRESUBMIT.py2208
-rw-r--r--api/BUILD.gn143
-rw-r--r--api/DEPS80
-rw-r--r--api/async_resolver_factory.h5
-rw-r--r--api/audio/BUILD.gn18
-rw-r--r--api/audio/test/BUILD.gn3
-rw-r--r--api/audio/test/echo_canceller3_config_unittest.cc2
-rw-r--r--api/audio_codecs/BUILD.gn1
-rw-r--r--api/audio_codecs/audio_decoder_factory.h4
-rw-r--r--api/call/call_factory_interface.h11
-rw-r--r--api/create_peerconnection_factory.cc77
-rw-r--r--api/create_peerconnection_factory.h19
-rw-r--r--api/data_channel_interface.h4
-rw-r--r--api/dtls_transport_interface.h4
-rw-r--r--api/dtmf_sender_interface.h4
-rw-r--r--api/enable_media.cc79
-rw-r--r--api/enable_media.h27
-rw-r--r--api/enable_media_with_defaults.cc46
-rw-r--r--api/enable_media_with_defaults.h28
-rw-r--r--api/environment/BUILD.gn20
-rw-r--r--api/environment/environment.h141
-rw-r--r--api/frame_transformer_interface.h11
-rw-r--r--api/ice_transport_interface.h7
-rw-r--r--api/jsep.h7
-rw-r--r--api/legacy_stats_types.h4
-rw-r--r--api/media_stream_interface.h10
-rw-r--r--api/packet_socket_factory.h5
-rw-r--r--api/peer_connection_interface.cc7
-rw-r--r--api/peer_connection_interface.h49
-rw-r--r--api/ref_count.h67
-rw-r--r--api/rtp_receiver_interface.h4
-rw-r--r--api/rtp_sender_interface.h4
-rw-r--r--api/rtp_transceiver_interface.h4
-rw-r--r--api/scoped_refptr.h33
-rw-r--r--api/sctp_transport_interface.h4
-rw-r--r--api/sequence_checker.h14
-rw-r--r--api/sequence_checker_unittest.cc7
-rw-r--r--api/set_local_description_observer_interface.h4
-rw-r--r--api/set_remote_description_observer_interface.h4
-rw-r--r--api/stats/rtc_stats_report.h2
-rw-r--r--api/stats/rtcstats_objects.h11
-rw-r--r--api/task_queue/BUILD.gn5
-rw-r--r--api/task_queue/pending_task_safety_flag.cc11
-rw-r--r--api/task_queue/pending_task_safety_flag.h10
-rw-r--r--api/task_queue/pending_task_safety_flag_unittest.cc11
-rw-r--r--api/task_queue/task_queue_base.h9
-rw-r--r--api/task_queue/task_queue_test.cc2
-rw-r--r--api/test/compile_all_headers.cc1
-rw-r--r--api/test/create_time_controller.cc41
-rw-r--r--api/test/create_time_controller.h12
-rw-r--r--api/test/create_video_codec_tester.cc27
-rw-r--r--api/test/create_video_codec_tester.h26
-rw-r--r--api/test/mock_transformable_audio_frame.h3
-rw-r--r--api/test/mock_transformable_frame.h45
-rw-r--r--api/test/mock_transformable_video_frame.h2
-rw-r--r--api/test/pclf/BUILD.gn4
-rw-r--r--api/test/pclf/media_quality_test_params.h6
-rw-r--r--api/test/pclf/peer_configurer.cc13
-rw-r--r--api/test/pclf/peer_configurer.h8
-rw-r--r--api/test/video_codec_stats.cc97
-rw-r--r--api/test/video_codec_stats.h120
-rw-r--r--api/test/video_codec_tester.h148
-rw-r--r--api/transport/BUILD.gn1
-rw-r--r--api/transport/field_trial_based_config.h3
-rw-r--r--api/video/BUILD.gn1
-rw-r--r--api/video/color_space.cc76
-rw-r--r--api/video/color_space.h3
-rw-r--r--api/video/encoded_image.h14
-rw-r--r--api/video/test/color_space_unittest.cc9
-rw-r--r--api/video/video_frame.cc14
-rw-r--r--api/video/video_frame.h16
-rw-r--r--api/video/video_frame_buffer.h4
-rw-r--r--api/wrapping_async_dns_resolver.h8
-rw-r--r--audio/audio_send_stream.cc4
-rw-r--r--audio/audio_send_stream_unittest.cc11
-rw-r--r--audio/channel_receive.cc13
-rw-r--r--audio/channel_receive_frame_transformer_delegate.cc29
-rw-r--r--audio/channel_receive_frame_transformer_delegate.h7
-rw-r--r--audio/channel_receive_frame_transformer_delegate_unittest.cc28
-rw-r--r--audio/channel_send.cc21
-rw-r--r--audio/channel_send.h1
-rw-r--r--audio/channel_send_frame_transformer_delegate.cc31
-rw-r--r--audio/channel_send_frame_transformer_delegate.h7
-rw-r--r--audio/channel_send_frame_transformer_delegate_unittest.cc24
-rw-r--r--audio/channel_send_unittest.cc7
-rw-r--r--audio/mock_voe_channel_proxy.h4
-rw-r--r--call/BUILD.gn3
-rw-r--r--call/call.cc75
-rw-r--r--call/call.h13
-rw-r--r--call/call_factory.cc11
-rw-r--r--call/call_factory.h7
-rw-r--r--call/call_perf_tests.cc15
-rw-r--r--call/call_unittest.cc41
-rw-r--r--call/rampup_tests.cc2
-rw-r--r--call/rtp_demuxer.cc13
-rw-r--r--call/rtp_demuxer.h3
-rw-r--r--call/rtp_transport_controller_send.cc5
-rw-r--r--call/rtp_video_sender.cc4
-rw-r--r--call/version.cc2
-rw-r--r--call/video_receive_stream.cc2
-rw-r--r--common_audio/signal_processing/cross_correlation_neon.c4
-rw-r--r--common_audio/signal_processing/downsample_fast_neon.c33
-rw-r--r--common_video/h265/h265_bitstream_parser.cc4
-rw-r--r--common_video/h265/h265_common.h4
-rw-r--r--docs/native-code/rtp-hdrext/video-layers-allocation00/README.md12
-rw-r--r--examples/BUILD.gn4
-rw-r--r--examples/androidnativeapi/BUILD.gn2
-rw-r--r--examples/androidnativeapi/jni/android_call_client.cc13
-rw-r--r--examples/objcnativeapi/objc/objc_call_client.mm18
-rw-r--r--examples/peerconnection/client/peer_connection_client.cc34
-rw-r--r--examples/peerconnection/client/peer_connection_client.h5
-rwxr-xr-xexperiments/field_trials.py12
-rw-r--r--g3doc/abseil-in-webrtc.md1
-rw-r--r--g3doc/style-guide.md14
-rw-r--r--infra/config/commit-queue.cfg2
-rwxr-xr-xinfra/config/config.star8
-rw-r--r--infra/config/cr-buildbucket.cfg50
-rw-r--r--infra/config/luci-analysis.cfg129
-rw-r--r--infra/config/luci-logdog.cfg2
-rw-r--r--infra/config/luci-milo.cfg2
-rw-r--r--infra/config/luci-notify.cfg2
-rw-r--r--infra/config/luci-scheduler.cfg2
-rw-r--r--infra/config/project.cfg4
-rw-r--r--infra/config/realms.cfg2
-rw-r--r--infra/specs/client.webrtc.json1104
-rw-r--r--infra/specs/client.webrtc.perf.json24
-rw-r--r--infra/specs/internal.client.webrtc.json181
-rw-r--r--infra/specs/mixins.pyl27
-rw-r--r--infra/specs/mixins_webrtc.pyl21
-rw-r--r--infra/specs/test_suites.pyl2
-rw-r--r--infra/specs/tryserver.webrtc.json1306
-rw-r--r--infra/specs/variants.pyl15
-rw-r--r--logging/BUILD.gn8
-rw-r--r--logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc3
-rw-r--r--logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc3
-rw-r--r--logging/rtc_event_log/rtc_event_log2_proto_include.h4
-rw-r--r--logging/rtc_event_log/rtc_event_log_parser.h3
-rw-r--r--media/BUILD.gn7
-rw-r--r--media/base/codec.cc118
-rw-r--r--media/base/codec.h22
-rw-r--r--media/base/codec_unittest.cc15
-rw-r--r--media/base/fake_media_engine.h1
-rw-r--r--media/base/media_channel.h2
-rw-r--r--media/base/media_constants.cc5
-rw-r--r--media/base/media_constants.h2
-rw-r--r--media/base/test_utils.h14
-rw-r--r--media/engine/null_webrtc_video_engine_unittest.cc2
-rw-r--r--media/engine/simulcast_encoder_adapter.cc34
-rw-r--r--media/engine/simulcast_encoder_adapter.h4
-rw-r--r--media/engine/simulcast_encoder_adapter_unittest.cc31
-rw-r--r--media/engine/webrtc_media_engine.cc1
-rw-r--r--media/engine/webrtc_media_engine.h8
-rw-r--r--media/engine/webrtc_media_engine_defaults.cc2
-rw-r--r--media/engine/webrtc_media_engine_defaults.h8
-rw-r--r--media/engine/webrtc_media_engine_unittest.cc6
-rw-r--r--media/engine/webrtc_video_engine.cc63
-rw-r--r--media/engine/webrtc_video_engine.h11
-rw-r--r--media/engine/webrtc_video_engine_unittest.cc93
-rw-r--r--media/engine/webrtc_voice_engine.cc44
-rw-r--r--media/engine/webrtc_voice_engine.h8
-rw-r--r--media/engine/webrtc_voice_engine_unittest.cc55
-rw-r--r--modules/audio_coding/BUILD.gn7
-rw-r--r--modules/audio_coding/acm2/audio_coding_module_unittest.cc26
-rw-r--r--modules/audio_coding/audio_network_adaptor/controller_manager.cc4
-rw-r--r--modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc3
-rw-r--r--modules/audio_coding/audio_network_adaptor/debug_dump_writer.cc3
-rw-r--r--modules/audio_coding/audio_network_adaptor/debug_dump_writer.h4
-rw-r--r--modules/audio_coding/neteq/decision_logic.cc30
-rw-r--r--modules/audio_coding/neteq/decision_logic.h16
-rw-r--r--modules/audio_coding/neteq/decision_logic_unittest.cc62
-rw-r--r--modules/audio_coding/neteq/mock/mock_packet_arrival_history.h32
-rw-r--r--modules/audio_coding/neteq/mock/mock_packet_buffer.h42
-rw-r--r--modules/audio_coding/neteq/neteq_impl.cc35
-rw-r--r--modules/audio_coding/neteq/neteq_impl_unittest.cc24
-rw-r--r--modules/audio_coding/neteq/neteq_network_stats_unittest.cc7
-rw-r--r--modules/audio_coding/neteq/neteq_unittest.cc20
-rw-r--r--modules/audio_coding/neteq/packet_arrival_history.h5
-rw-r--r--modules/audio_coding/neteq/packet_buffer.cc154
-rw-r--r--modules/audio_coding/neteq/packet_buffer.h49
-rw-r--r--modules/audio_coding/neteq/packet_buffer_unittest.cc337
-rw-r--r--modules/audio_coding/neteq/test/neteq_decoding_test.cc4
-rw-r--r--modules/audio_coding/neteq/test/neteq_performance_unittest.cc11
-rw-r--r--modules/audio_coding/neteq/test/result_sink.cc5
-rw-r--r--modules/audio_device/BUILD.gn2
-rw-r--r--modules/audio_device/include/audio_device.h4
-rw-r--r--modules/audio_device/include/fake_audio_device.h4
-rw-r--r--modules/audio_mixer/audio_mixer_impl_unittest.cc1
-rw-r--r--modules/audio_processing/BUILD.gn27
-rw-r--r--modules/audio_processing/aec_dump/BUILD.gn1
-rw-r--r--modules/audio_processing/aec_dump/aec_dump_impl.h3
-rw-r--r--modules/audio_processing/aec_dump/capture_stream_info.h3
-rw-r--r--modules/audio_processing/audio_processing_impl.h1
-rw-r--r--modules/audio_processing/audio_processing_impl_unittest.cc2
-rw-r--r--modules/audio_processing/audio_processing_unittest.cc6
-rw-r--r--modules/audio_processing/include/audio_processing.h6
-rw-r--r--modules/audio_processing/test/aec_dump_based_simulator.h3
-rw-r--r--modules/audio_processing/test/audio_processing_simulator.cc2
-rw-r--r--modules/audio_processing/test/debug_dump_replayer.h4
-rw-r--r--modules/audio_processing/test/echo_canceller3_config_json.cc (renamed from api/audio/echo_canceller3_config_json.cc)9
-rw-r--r--modules/audio_processing/test/echo_canceller3_config_json.h (renamed from api/audio/echo_canceller3_config_json.h)19
-rw-r--r--modules/audio_processing/test/echo_canceller3_config_json_unittest.cc (renamed from api/audio/test/echo_canceller3_config_json_unittest.cc)8
-rw-r--r--modules/audio_processing/test/protobuf_utils.h4
-rw-r--r--modules/congestion_controller/goog_cc/BUILD.gn1
-rw-r--r--modules/congestion_controller/goog_cc/goog_cc_network_control.cc50
-rw-r--r--modules/congestion_controller/goog_cc/goog_cc_network_control.h1
-rw-r--r--modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc30
-rw-r--r--modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc499
-rw-r--r--modules/congestion_controller/goog_cc/loss_based_bwe_v2.h78
-rw-r--r--modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc1347
-rw-r--r--modules/congestion_controller/goog_cc/probe_controller.cc80
-rw-r--r--modules/congestion_controller/goog_cc/probe_controller.h11
-rw-r--r--modules/congestion_controller/goog_cc/probe_controller_unittest.cc184
-rw-r--r--modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc33
-rw-r--r--modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h4
-rw-r--r--modules/congestion_controller/rtp/control_handler.cc4
-rw-r--r--modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc6
-rw-r--r--modules/desktop_capture/linux/wayland/restore_token_manager.cc6
-rw-r--r--modules/desktop_capture/linux/wayland/restore_token_manager.h2
-rw-r--r--modules/desktop_capture/win/dxgi_duplicator_controller.h2
-rw-r--r--modules/desktop_capture/win/wgc_capture_session.cc28
-rw-r--r--modules/desktop_capture/win/wgc_capture_session.h11
-rw-r--r--modules/desktop_capture/win/wgc_capture_source.cc11
-rw-r--r--modules/desktop_capture/win/wgc_capture_source.h5
-rw-r--r--modules/desktop_capture/win/wgc_capturer_win.cc3
-rw-r--r--modules/pacing/pacing_controller.cc14
-rw-r--r--modules/pacing/pacing_controller.h8
-rw-r--r--modules/pacing/pacing_controller_unittest.cc36
-rw-r--r--modules/rtp_rtcp/BUILD.gn11
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_interpolator.cc65
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_interpolator.h23
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc290
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_sender.cc67
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_sender.h57
-rw-r--r--modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc333
-rw-r--r--modules/rtp_rtcp/source/flexfec_header_reader_writer.cc18
-rw-r--r--modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc121
-rw-r--r--modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc4
-rw-r--r--modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc12
-rw-r--r--modules/rtp_rtcp/source/rtp_format.cc9
-rw-r--r--modules/rtp_rtcp/source/rtp_packetizer_h265.cc350
-rw-r--r--modules/rtp_rtcp/source/rtp_packetizer_h265.h66
-rw-r--r--modules/rtp_rtcp/source/rtp_packetizer_h265_unittest.cc525
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_audio.cc41
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_audio.h5
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_video.cc12
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_video.h3
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc25
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h3
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc35
-rw-r--r--modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc31
-rw-r--r--modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h5
-rw-r--r--modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc24
-rw-r--r--modules/video_capture/linux/camera_portal.cc16
-rw-r--r--modules/video_capture/linux/device_info_pipewire.cc8
-rw-r--r--modules/video_capture/linux/device_info_pipewire.h2
-rw-r--r--modules/video_capture/video_capture.h2
-rw-r--r--modules/video_coding/BUILD.gn74
-rw-r--r--modules/video_coding/codecs/av1/av1_svc_config.cc4
-rw-r--r--modules/video_coding/codecs/av1/libaom_av1_encoder.cc8
-rw-r--r--modules/video_coding/codecs/h264/h264_encoder_impl.cc14
-rw-r--r--modules/video_coding/codecs/test/video_codec_analyzer.cc193
-rw-r--r--modules/video_coding/codecs/test/video_codec_analyzer.h75
-rw-r--r--modules/video_coding/codecs/test/video_codec_analyzer_unittest.cc127
-rw-r--r--modules/video_coding/codecs/test/video_codec_stats_impl.cc278
-rw-r--r--modules/video_coding/codecs/test/video_codec_stats_impl.h62
-rw-r--r--modules/video_coding/codecs/test/video_codec_stats_impl_unittest.cc148
-rw-r--r--modules/video_coding/codecs/test/video_codec_test.cc722
-rw-r--r--modules/video_coding/codecs/test/video_codec_tester_impl.cc437
-rw-r--r--modules/video_coding/codecs/test/video_codec_tester_impl.h45
-rw-r--r--modules/video_coding/codecs/test/video_codec_tester_impl_unittest.cc205
-rw-r--r--modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc14
-rw-r--r--modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc4
-rw-r--r--modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc23
-rw-r--r--modules/video_coding/codecs/vp9/svc_config.cc11
-rw-r--r--modules/video_coding/codecs/vp9/svc_config_unittest.cc15
-rw-r--r--modules/video_coding/include/video_codec_interface.h16
-rw-r--r--modules/video_coding/utility/quality_scaler.cc26
-rw-r--r--modules/video_coding/utility/quality_scaler.h5
-rw-r--r--modules/video_coding/utility/quality_scaler_unittest.cc13
-rw-r--r--modules/video_coding/video_codec_initializer.cc11
-rw-r--r--net/dcsctp/common/BUILD.gn8
-rw-r--r--net/dcsctp/common/internal_types.h5
-rw-r--r--net/dcsctp/fuzzers/dcsctp_fuzzers.h2
-rw-r--r--net/dcsctp/packet/BUILD.gn3
-rw-r--r--net/dcsctp/packet/chunk/data_common.h6
-rw-r--r--net/dcsctp/packet/chunk/forward_tsn_common.h13
-rw-r--r--net/dcsctp/packet/chunk/idata_chunk.cc8
-rw-r--r--net/dcsctp/packet/chunk/idata_chunk.h4
-rw-r--r--net/dcsctp/packet/chunk/idata_chunk_test.cc12
-rw-r--r--net/dcsctp/packet/chunk/iforward_tsn_chunk.cc6
-rw-r--r--net/dcsctp/packet/chunk/sack_chunk.cc2
-rw-r--r--net/dcsctp/packet/data.h10
-rw-r--r--net/dcsctp/packet/error_cause/missing_mandatory_parameter_cause.cc4
-rw-r--r--net/dcsctp/packet/parameter/supported_extensions_parameter.cc4
-rw-r--r--net/dcsctp/public/BUILD.gn2
-rw-r--r--net/dcsctp/public/dcsctp_socket.h15
-rw-r--r--net/dcsctp/public/types.h10
-rw-r--r--net/dcsctp/rx/BUILD.gn4
-rw-r--r--net/dcsctp/rx/data_tracker.h4
-rw-r--r--net/dcsctp/rx/data_tracker_test.cc8
-rw-r--r--net/dcsctp/rx/interleaved_reassembly_streams.cc8
-rw-r--r--net/dcsctp/rx/interleaved_reassembly_streams.h2
-rw-r--r--net/dcsctp/rx/reassembly_queue.cc158
-rw-r--r--net/dcsctp/rx/reassembly_queue.h40
-rw-r--r--net/dcsctp/rx/reassembly_queue_test.cc50
-rw-r--r--net/dcsctp/socket/BUILD.gn6
-rw-r--r--net/dcsctp/socket/callback_deferrer.cc4
-rw-r--r--net/dcsctp/socket/callback_deferrer.h1
-rw-r--r--net/dcsctp/socket/context.h7
-rw-r--r--net/dcsctp/socket/dcsctp_socket.cc61
-rw-r--r--net/dcsctp/socket/dcsctp_socket.h11
-rw-r--r--net/dcsctp/socket/dcsctp_socket_network_test.cc16
-rw-r--r--net/dcsctp/socket/dcsctp_socket_test.cc121
-rw-r--r--net/dcsctp/socket/heartbeat_handler.cc43
-rw-r--r--net/dcsctp/socket/heartbeat_handler.h6
-rw-r--r--net/dcsctp/socket/heartbeat_handler_test.cc19
-rw-r--r--net/dcsctp/socket/mock_context.h7
-rw-r--r--net/dcsctp/socket/mock_dcsctp_socket_callbacks.h12
-rw-r--r--net/dcsctp/socket/stream_reset_handler.cc73
-rw-r--r--net/dcsctp/socket/stream_reset_handler.h19
-rw-r--r--net/dcsctp/socket/stream_reset_handler_test.cc244
-rw-r--r--net/dcsctp/socket/transmission_control_block.cc46
-rw-r--r--net/dcsctp/socket/transmission_control_block.h18
-rw-r--r--net/dcsctp/testing/data_generator.cc18
-rw-r--r--net/dcsctp/testing/data_generator.h9
-rw-r--r--net/dcsctp/timer/BUILD.gn4
-rw-r--r--net/dcsctp/timer/fake_timeout.h37
-rw-r--r--net/dcsctp/timer/task_queue_timeout.cc24
-rw-r--r--net/dcsctp/timer/task_queue_timeout.h8
-rw-r--r--net/dcsctp/timer/timer.cc42
-rw-r--r--net/dcsctp/timer/timer.h44
-rw-r--r--net/dcsctp/timer/timer_test.cc203
-rw-r--r--net/dcsctp/tx/BUILD.gn15
-rw-r--r--net/dcsctp/tx/mock_send_queue.h12
-rw-r--r--net/dcsctp/tx/outstanding_data.cc61
-rw-r--r--net/dcsctp/tx/outstanding_data.h39
-rw-r--r--net/dcsctp/tx/outstanding_data_test.cc210
-rw-r--r--net/dcsctp/tx/retransmission_queue.cc30
-rw-r--r--net/dcsctp/tx/retransmission_queue.h12
-rw-r--r--net/dcsctp/tx/retransmission_queue_test.cc545
-rw-r--r--net/dcsctp/tx/retransmission_timeout.cc19
-rw-r--r--net/dcsctp/tx/retransmission_timeout.h22
-rw-r--r--net/dcsctp/tx/retransmission_timeout_test.cc153
-rw-r--r--net/dcsctp/tx/rr_send_queue.cc50
-rw-r--r--net/dcsctp/tx/rr_send_queue.h29
-rw-r--r--net/dcsctp/tx/rr_send_queue_test.cc57
-rw-r--r--net/dcsctp/tx/send_queue.h18
-rw-r--r--net/dcsctp/tx/stream_scheduler.cc6
-rw-r--r--net/dcsctp/tx/stream_scheduler.h8
-rw-r--r--net/dcsctp/tx/stream_scheduler_test.cc294
-rw-r--r--p2p/BUILD.gn4
-rw-r--r--p2p/base/basic_async_resolver_factory.cc3
-rw-r--r--p2p/base/basic_async_resolver_factory.h12
-rw-r--r--p2p/base/basic_async_resolver_factory_unittest.cc5
-rw-r--r--p2p/base/basic_packet_socket_factory.cc4
-rw-r--r--p2p/base/connection.cc52
-rw-r--r--p2p/base/connection.h14
-rw-r--r--p2p/base/dtls_transport.cc7
-rw-r--r--p2p/base/dtls_transport.h6
-rw-r--r--p2p/base/dtls_transport_internal.h6
-rw-r--r--p2p/base/fake_dtls_transport.h1
-rw-r--r--p2p/base/ice_transport_internal.h6
-rw-r--r--p2p/base/mock_async_resolver.h11
-rw-r--r--p2p/base/p2p_transport_channel.cc42
-rw-r--r--p2p/base/p2p_transport_channel.h5
-rw-r--r--p2p/base/p2p_transport_channel_unittest.cc39
-rw-r--r--p2p/base/port.cc2
-rw-r--r--p2p/base/port_allocator.cc21
-rw-r--r--p2p/base/port_allocator.h10
-rw-r--r--p2p/base/port_allocator_unittest.cc32
-rw-r--r--p2p/base/port_unittest.cc170
-rw-r--r--p2p/base/stun_port.cc7
-rw-r--r--p2p/base/stun_request.cc46
-rw-r--r--p2p/base/stun_request.h7
-rw-r--r--p2p/base/stun_request_unittest.cc48
-rw-r--r--p2p/base/stun_server_unittest.cc9
-rw-r--r--p2p/base/tcp_port.cc3
-rw-r--r--p2p/base/turn_port.cc5
-rw-r--r--p2p/base/turn_port.h2
-rw-r--r--p2p/base/turn_port_unittest.cc62
-rw-r--r--p2p/stunprober/stun_prober.cc26
-rw-r--r--p2p/stunprober/stun_prober.h5
-rw-r--r--p2p/stunprober/stun_prober_unittest.cc62
-rw-r--r--pc/BUILD.gn37
-rw-r--r--pc/audio_rtp_receiver.cc2
-rw-r--r--pc/audio_rtp_receiver.h3
-rw-r--r--pc/audio_rtp_receiver_unittest.cc2
-rw-r--r--pc/audio_track.h2
-rw-r--r--pc/channel.cc43
-rw-r--r--pc/channel.h21
-rw-r--r--pc/channel_unittest.cc80
-rw-r--r--pc/connection_context.cc28
-rw-r--r--pc/connection_context.h2
-rw-r--r--pc/data_channel_controller_unittest.cc2
-rw-r--r--pc/data_channel_integrationtest.cc10
-rw-r--r--pc/data_channel_unittest.cc17
-rw-r--r--pc/dtls_srtp_transport.h9
-rw-r--r--pc/ice_server_parsing_unittest.cc7
-rw-r--r--pc/ice_transport_unittest.cc2
-rw-r--r--pc/jsep_transport.cc2
-rw-r--r--pc/jsep_transport_controller.cc39
-rw-r--r--pc/jsep_transport_controller.h18
-rw-r--r--pc/jsep_transport_controller_unittest.cc10
-rw-r--r--pc/legacy_stats_collector.cc12
-rw-r--r--pc/legacy_stats_collector.h6
-rw-r--r--pc/media_factory.h46
-rw-r--r--pc/media_session.cc960
-rw-r--r--pc/media_session.h43
-rw-r--r--pc/media_session_unittest.cc820
-rw-r--r--pc/media_stream_unittest.cc10
-rw-r--r--pc/peer_connection.cc418
-rw-r--r--pc/peer_connection.h25
-rw-r--r--pc/peer_connection_bundle_unittest.cc45
-rw-r--r--pc/peer_connection_crypto_unittest.cc2
-rw-r--r--pc/peer_connection_data_channel_unittest.cc7
-rw-r--r--pc/peer_connection_encodings_integrationtest.cc410
-rw-r--r--pc/peer_connection_factory.cc5
-rw-r--r--pc/peer_connection_factory_proxy.h4
-rw-r--r--pc/peer_connection_factory_unittest.cc216
-rw-r--r--pc/peer_connection_field_trial_tests.cc23
-rw-r--r--pc/peer_connection_header_extension_unittest.cc17
-rw-r--r--pc/peer_connection_histogram_unittest.cc127
-rw-r--r--pc/peer_connection_ice_unittest.cc6
-rw-r--r--pc/peer_connection_integrationtest.cc274
-rw-r--r--pc/peer_connection_interface_unittest.cc261
-rw-r--r--pc/peer_connection_internal.h20
-rw-r--r--pc/peer_connection_jsep_unittest.cc12
-rw-r--r--pc/peer_connection_media_unittest.cc61
-rw-r--r--pc/peer_connection_rampup_tests.cc2
-rw-r--r--pc/peer_connection_rtp_unittest.cc20
-rw-r--r--pc/peer_connection_signaling_unittest.cc20
-rw-r--r--pc/peer_connection_simulcast_unittest.cc2
-rw-r--r--pc/peer_connection_svc_integrationtest.cc77
-rw-r--r--pc/peer_connection_wrapper.cc3
-rw-r--r--pc/rtc_stats_collector.cc7
-rw-r--r--pc/rtc_stats_collector.h2
-rw-r--r--pc/rtc_stats_collector_unittest.cc25
-rw-r--r--pc/rtc_stats_traversal_unittest.cc2
-rw-r--r--pc/rtp_sender.cc16
-rw-r--r--pc/rtp_sender.h4
-rw-r--r--pc/rtp_sender_receiver_unittest.cc80
-rw-r--r--pc/rtp_transceiver.cc6
-rw-r--r--pc/rtp_transceiver.h10
-rw-r--r--pc/rtp_transceiver_unittest.cc15
-rw-r--r--pc/rtp_transport.cc19
-rw-r--r--pc/rtp_transport.h2
-rw-r--r--pc/rtp_transport_internal.h4
-rw-r--r--pc/rtp_transport_unittest.cc24
-rw-r--r--pc/sctp_transport.h2
-rw-r--r--pc/sdp_offer_answer.cc71
-rw-r--r--pc/sdp_offer_answer.h20
-rw-r--r--pc/sdp_offer_answer_unittest.cc62
-rw-r--r--pc/session_description.h44
-rw-r--r--pc/slow_peer_connection_integration_test.cc12
-rw-r--r--pc/srtp_session.cc6
-rw-r--r--pc/srtp_session.h8
-rw-r--r--pc/srtp_session_unittest.cc32
-rw-r--r--pc/srtp_transport.cc95
-rw-r--r--pc/srtp_transport.h7
-rw-r--r--pc/srtp_transport_unittest.cc64
-rw-r--r--pc/test/android_test_initializer.cc2
-rw-r--r--pc/test/enable_fake_media.cc61
-rw-r--r--pc/test/enable_fake_media.h38
-rw-r--r--pc/test/fake_peer_connection_base.h15
-rw-r--r--pc/test/fake_peer_connection_for_stats.h12
-rw-r--r--pc/test/fake_periodic_video_source.h4
-rw-r--r--pc/test/integration_test_helpers.cc9
-rw-r--r--pc/test/integration_test_helpers.h293
-rw-r--r--pc/test/mock_peer_connection_internal.h14
-rw-r--r--pc/test/mock_peer_connection_observers.h19
-rw-r--r--pc/test/rtp_transport_test_util.h17
-rw-r--r--pc/test/svc_e2e_tests.cc9
-rw-r--r--pc/transport_stats.h1
-rw-r--r--pc/video_rtp_receiver_unittest.cc2
-rw-r--r--pc/video_rtp_track_source_unittest.cc4
-rw-r--r--pc/video_track.h2
-rw-r--r--pc/video_track_source_proxy.h2
-rw-r--r--pc/webrtc_sdp.cc79
-rw-r--r--pc/webrtc_sdp_unittest.cc50
-rw-r--r--pylintrc_old_style216
-rw-r--r--resources/.gitignore1
-rw-r--r--resources/rtc_event_log/rtc_event_log_500kbps.binarypb.sha11
-rw-r--r--rtc_base/BUILD.gn38
-rw-r--r--rtc_base/async_dns_resolver.h3
-rw-r--r--rtc_base/async_packet_socket.cc37
-rw-r--r--rtc_base/async_packet_socket.h22
-rw-r--r--rtc_base/async_packet_socket_unittest.cc110
-rw-r--r--rtc_base/async_resolver.h7
-rw-r--r--rtc_base/async_resolver_interface.h2
-rw-r--r--rtc_base/async_tcp_socket.cc4
-rw-r--r--rtc_base/async_tcp_socket.h1
-rw-r--r--rtc_base/async_udp_socket.cc4
-rw-r--r--rtc_base/byte_buffer.cc18
-rw-r--r--rtc_base/byte_buffer.h20
-rw-r--r--rtc_base/byte_buffer_unittest.cc17
-rw-r--r--rtc_base/experiments/BUILD.gn10
-rw-r--r--rtc_base/experiments/quality_scaler_settings.cc18
-rw-r--r--rtc_base/experiments/quality_scaler_settings.h4
-rw-r--r--rtc_base/experiments/quality_scaler_settings_unittest.cc43
-rw-r--r--rtc_base/experiments/quality_scaling_experiment.cc24
-rw-r--r--rtc_base/experiments/quality_scaling_experiment.h11
-rw-r--r--rtc_base/experiments/quality_scaling_experiment_unittest.cc78
-rw-r--r--rtc_base/ip_address_unittest.cc4
-rw-r--r--rtc_base/nat_unittest.cc72
-rw-r--r--rtc_base/network/BUILD.gn16
-rw-r--r--rtc_base/network/received_packet.cc42
-rw-r--r--rtc_base/network/received_packet.h58
-rw-r--r--rtc_base/numerics/sample_counter.cc9
-rw-r--r--rtc_base/numerics/sample_counter.h2
-rw-r--r--rtc_base/numerics/sample_counter_unittest.cc4
-rw-r--r--rtc_base/openssl_adapter.cc20
-rw-r--r--rtc_base/openssl_adapter.h8
-rw-r--r--rtc_base/openssl_adapter_unittest.cc15
-rw-r--r--rtc_base/openssl_stream_adapter.cc62
-rw-r--r--rtc_base/openssl_stream_adapter.h11
-rw-r--r--rtc_base/physical_socket_server.cc38
-rw-r--r--rtc_base/physical_socket_server.h12
-rw-r--r--rtc_base/rate_limiter.cc4
-rw-r--r--rtc_base/rate_limiter_unittest.cc14
-rw-r--r--rtc_base/ref_count.h55
-rw-r--r--rtc_base/socket_unittest.cc6
-rw-r--r--rtc_base/ssl_stream_adapter.h7
-rw-r--r--rtc_base/ssl_stream_adapter_unittest.cc188
-rw-r--r--rtc_base/strings/str_join.h (renamed from net/dcsctp/common/str_join.h)10
-rw-r--r--rtc_base/strings/str_join_unittest.cc (renamed from net/dcsctp/common/str_join_test.cc)8
-rw-r--r--rtc_base/synchronization/sequence_checker_internal.cc5
-rw-r--r--rtc_base/synchronization/sequence_checker_internal.h2
-rw-r--r--rtc_base/system/file_wrapper.cc6
-rw-r--r--rtc_base/system/file_wrapper.h1
-rw-r--r--rtc_base/test_client.cc55
-rw-r--r--rtc_base/test_client.h25
-rw-r--r--rtc_tools/BUILD.gn74
-rw-r--r--rtc_tools/network_tester/BUILD.gn2
-rw-r--r--rtc_tools/network_tester/config_reader.h3
-rw-r--r--rtc_tools/network_tester/network_tester_unittest.cc12
-rw-r--r--rtc_tools/network_tester/packet_logger.h4
-rw-r--r--rtc_tools/network_tester/packet_sender.h3
-rw-r--r--rtc_tools/network_tester/test_controller.cc1
-rw-r--r--rtc_tools/network_tester/test_controller.h3
-rw-r--r--rtc_tools/rtc_event_log_visualizer/alerts.cc13
-rw-r--r--rtc_tools/rtc_event_log_visualizer/alerts.h1
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyze_audio.cc21
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyze_audio.h1
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer.cc144
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer.h10
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc140
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h24
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc74
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer_common.cc6
-rw-r--r--rtc_tools/rtc_event_log_visualizer/analyzer_common.h3
-rw-r--r--rtc_tools/rtc_event_log_visualizer/log_simulation.cc14
-rw-r--r--rtc_tools/rtc_event_log_visualizer/log_simulation.h10
-rw-r--r--rtc_tools/rtc_event_log_visualizer/main.cc8
-rw-r--r--rtc_tools/rtc_event_log_visualizer/plot_base.cc16
-rw-r--r--rtc_tools/rtc_event_log_visualizer/plot_base.h8
-rw-r--r--rtc_tools/rtc_event_log_visualizer/plot_protobuf.h7
-rw-r--r--rtc_tools/rtc_event_log_visualizer/proto/chart_enums.proto1
-rw-r--r--rtc_tools/unpack_aecdump/unpack.cc4
-rw-r--r--rtc_tools/video_encoder/video_encoder.cc11
-rw-r--r--rtc_tools/video_file_reader.h4
-rw-r--r--rtc_tools/video_replay.cc4
-rw-r--r--sdk/BUILD.gn2
-rw-r--r--sdk/android/BUILD.gn7
-rw-r--r--sdk/android/api/org/webrtc/EglRenderer.java44
-rw-r--r--sdk/android/api/org/webrtc/EglThread.java81
-rw-r--r--sdk/android/api/org/webrtc/RenderSynchronizer.java116
-rw-r--r--sdk/android/api/org/webrtc/audio/AudioDeviceModule.java10
-rw-r--r--sdk/android/api/org/webrtc/audio/LegacyAudioDeviceModule.java46
-rw-r--r--sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java21
-rw-r--r--sdk/android/native_unittests/audio_device/audio_device_unittest.cc3
-rw-r--r--sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc18
-rw-r--r--sdk/android/src/java/org/webrtc/EglBase10Impl.java45
-rw-r--r--sdk/android/src/java/org/webrtc/EglBase14Impl.java43
-rw-r--r--sdk/android/src/java/org/webrtc/HardwareVideoEncoder.java2
-rw-r--r--sdk/android/src/jni/audio_device/audio_device_module.cc6
-rw-r--r--sdk/android/src/jni/audio_device/audio_device_module.h3
-rw-r--r--sdk/android/src/jni/pc/peer_connection_factory.cc29
-rw-r--r--sdk/android/src/jni/video_decoder_wrapper.cc5
-rw-r--r--sdk/android/tests/src/org/webrtc/RenderSynchronizerTest.java123
-rw-r--r--sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm22
-rw-r--r--test/BUILD.gn78
-rw-r--r--test/call_test.cc22
-rw-r--r--test/call_test.h8
-rw-r--r--test/fuzzers/BUILD.gn2
-rw-r--r--test/fuzzers/aec3_config_json_fuzzer.cc2
-rw-r--r--test/fuzzers/rtp_frame_reference_finder_fuzzer.cc2
-rw-r--r--test/fuzzers/utils/rtp_replayer.cc2
-rw-r--r--test/mock_transformable_frame.h1
-rw-r--r--test/network/BUILD.gn2
-rw-r--r--test/network/network_emulation_pc_unittest.cc14
-rw-r--r--test/pc/e2e/BUILD.gn9
-rw-r--r--test/pc/e2e/peer_connection_quality_test.cc4
-rw-r--r--test/pc/e2e/test_peer_factory.cc67
-rw-r--r--test/peer_scenario/peer_scenario_client.cc24
-rw-r--r--test/rtp_rtcp_observer.h10
-rw-r--r--test/scenario/audio_stream.cc2
-rw-r--r--test/scenario/call_client.cc17
-rw-r--r--test/scenario/video_stream.cc5
-rw-r--r--test/test_flags.cc5
-rw-r--r--test/test_flags.h1
-rw-r--r--test/testsupport/yuv_frame_reader.cc2
-rw-r--r--test/testsupport/yuv_frame_reader_unittest.cc83
-rw-r--r--test/video_codec_tester.cc1260
-rw-r--r--test/video_codec_tester.h221
-rw-r--r--test/video_codec_tester_unittest.cc513
-rwxr-xr-xtools_webrtc/autoroller/roll_deps.py1013
-rw-r--r--tools_webrtc/mb/mb_config.pyl76
-rwxr-xr-xtools_webrtc/remove_extra_namespace.py93
-rw-r--r--video/BUILD.gn5
-rw-r--r--video/adaptation/overuse_frame_detector.cc15
-rw-r--r--video/adaptation/quality_scaler_resource.cc8
-rw-r--r--video/adaptation/quality_scaler_resource.h4
-rw-r--r--video/adaptation/video_stream_encoder_resource_manager.cc17
-rw-r--r--video/encoder_bitrate_adjuster.cc10
-rw-r--r--video/encoder_bitrate_adjuster.h4
-rw-r--r--video/encoder_bitrate_adjuster_unittest.cc13
-rw-r--r--video/end_to_end_tests/multi_stream_tester.cc7
-rw-r--r--video/end_to_end_tests/network_state_tests.cc2
-rw-r--r--video/end_to_end_tests/stats_tests.cc4
-rw-r--r--video/frame_cadence_adapter.cc40
-rw-r--r--video/frame_cadence_adapter_unittest.cc23
-rw-r--r--video/pc_full_stack_tests.cc4
-rw-r--r--video/screenshare_loopback.cc10
-rw-r--r--video/sv_loopback.cc10
-rw-r--r--video/video_loopback.cc10
-rw-r--r--video/video_quality_test.cc25
-rw-r--r--video/video_quality_test.h4
-rw-r--r--video/video_send_stream_impl.cc13
-rw-r--r--video/video_stream_encoder.cc6
-rw-r--r--webrtc.gni3
-rw-r--r--webrtc_lib_link_test.cc21
633 files changed, 18136 insertions, 13991 deletions
diff --git a/BUILD.gn b/BUILD.gn
index cc86183c17..baf8b0951d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -500,6 +500,7 @@ if (!build_with_chromium) {
deps = [
"api:create_peerconnection_factory",
+ "api:enable_media",
"api:libjingle_peerconnection_api",
"api:rtc_error",
"api:transport_api",
@@ -607,6 +608,7 @@ if (rtc_include_tests && !build_with_chromium) {
"p2p:libstunprober_unittests",
"p2p:rtc_p2p_unittests",
"rtc_base:async_dns_resolver_unittests",
+ "rtc_base:async_packet_socket_unittest",
"rtc_base:callback_list_unittests",
"rtc_base:rtc_base_approved_unittests",
"rtc_base:rtc_base_unittests",
@@ -806,8 +808,5 @@ group("poison_default_task_queue") {
group("poison_default_echo_detector") {
}
-group("poison_rtc_json") {
-}
-
group("poison_software_video_codecs") {
}
diff --git a/DEPS b/DEPS
index 2a0e22c2df..2c4bcb4b05 100644
--- a/DEPS
+++ b/DEPS
@@ -10,7 +10,7 @@ vars = {
# chromium waterfalls. More info at: crbug.com/570091.
'checkout_configuration': 'default',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration == "default"',
- 'chromium_revision': '1a86984556b017ee9ae81ea711f28e4422b8bb82',
+ 'chromium_revision': '5d3daefdba4edcf95180ce9b6512b635cd1049bd',
# Fetch the prebuilt binaries for llvm-cov and llvm-profdata. Needed to
# process the raw profiles produced by instrumented targets (built with
@@ -25,14 +25,14 @@ vars = {
# By default, download the fuchsia sdk from the public sdk directory.
'fuchsia_sdk_cipd_prefix': 'fuchsia/sdk/core/',
- 'fuchsia_version': 'version:15.20230930.1.1',
+ 'fuchsia_version': 'version:16.20231117.2.1',
# By default, download the fuchsia images from the fuchsia GCS bucket.
'fuchsia_images_bucket': 'fuchsia',
'checkout_fuchsia': False,
# Since the images are hundreds of MB, default to only downloading the image
# most commonly useful for developers. Bots and developers that need to use
# other images can override this with additional images.
- 'checkout_fuchsia_boot_images': "terminal.qemu-x64,terminal.x64",
+ 'checkout_fuchsia_boot_images': "terminal.x64",
'checkout_fuchsia_product_bundles': '"{checkout_fuchsia_boot_images}" != ""',
# Fetch configuration files required for the 'use_remoteexec' gn arg
@@ -40,7 +40,7 @@ vars = {
# RBE instance to use for running remote builds
'rbe_instance': 'projects/rbe-webrtc-developer/instances/default_instance',
# reclient CIPD package version
- 'reclient_version': 're_client_version:0.113.0.8b45b89-gomaip',
+ 'reclient_version': 're_client_version:0.120.1.f75cfb7-gomaip',
# ninja CIPD package version
# https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/ninja
@@ -50,30 +50,30 @@ vars = {
deps = {
# TODO(kjellander): Move this to be Android-only.
'src/base':
- 'https://chromium.googlesource.com/chromium/src/base@19c600fca5dbeb7916a5420936133c4fba422e64',
+ 'https://chromium.googlesource.com/chromium/src/base@379c0c20fcb6780902dcde44a5cca7453a58c9d1',
'src/build':
- 'https://chromium.googlesource.com/chromium/src/build@8a44cdc629be0b9c91e5a7c9222ad8b100f6f8ad',
+ 'https://chromium.googlesource.com/chromium/src/build@cd2687c456137bfc010e8bb096713fddf080f73e',
'src/buildtools':
- 'https://chromium.googlesource.com/chromium/src/buildtools@c8bee3e69d439a3fb2a444da9dda1492d0807084',
+ 'https://chromium.googlesource.com/chromium/src/buildtools@2895795509ad9d48b962cc9f3c69ef5d831f58e3',
# Gradle 6.6.1. Used for testing Android Studio project generation for WebRTC.
'src/examples/androidtests/third_party/gradle': {
'url': 'https://chromium.googlesource.com/external/github.com/gradle/gradle.git@f2d1fb54a951d8b11d25748e4711bec8d128d7e3',
'condition': 'checkout_android',
},
'src/ios': {
- 'url': 'https://chromium.googlesource.com/chromium/src/ios@533f961c059d81c45019a70f1f63df5b6b2b0c94',
+ 'url': 'https://chromium.googlesource.com/chromium/src/ios@cf99685f483d04540b75d5f95439d63f2ab56725',
'condition': 'checkout_ios',
},
'src/testing':
- 'https://chromium.googlesource.com/chromium/src/testing@86a23709934e70d353a8885c32f6aa474bef5692',
+ 'https://chromium.googlesource.com/chromium/src/testing@cfc92f7188ca3eca5c8735d7d3653f0d0519bc69',
'src/third_party':
- 'https://chromium.googlesource.com/chromium/src/third_party@55c4796b773ead35513e8f1a5ba83a89635c72f7',
+ 'https://chromium.googlesource.com/chromium/src/third_party@f1298d29b7779248ebf8db921533bba2d958a294',
'src/buildtools/linux64': {
'packages': [
{
'package': 'gn/gn/linux-${{arch}}',
- 'version': 'git_revision:991530ce394efb58fcd848195469022fa17ae126',
+ 'version': 'git_revision:c7b223bfb225ce87a72a244d016ffdfcf227fa5e',
}
],
'dep_type': 'cipd',
@@ -83,7 +83,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/mac-${{arch}}',
- 'version': 'git_revision:991530ce394efb58fcd848195469022fa17ae126',
+ 'version': 'git_revision:c7b223bfb225ce87a72a244d016ffdfcf227fa5e',
}
],
'dep_type': 'cipd',
@@ -93,7 +93,7 @@ deps = {
'packages': [
{
'package': 'gn/gn/windows-amd64',
- 'version': 'git_revision:991530ce394efb58fcd848195469022fa17ae126',
+ 'version': 'git_revision:c7b223bfb225ce87a72a244d016ffdfcf227fa5e',
}
],
'dep_type': 'cipd',
@@ -115,11 +115,11 @@ deps = {
'src/third_party/clang-format/script':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@e5337933f2951cacd3aeacd238ce4578163ca0b9',
'src/third_party/libc++/src':
- 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@a094e2535c54dd295d22c56bd088691459708b46',
+ 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git@a96e76348a51cb38e2120a7333c49884e5737768',
'src/third_party/libc++abi/src':
- 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@e8e4eb8f1c413ea4365256b2b83a6093c95d2d86',
+ 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git@371593893aeee51ecfb785093115fd846c3b73ca',
'src/third_party/libunwind/src':
- 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@7608093d21b209a23ccac7c0d5af5cc47e148887',
+ 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libunwind.git@85df028e4c5e8a3eaa38fe75e0d78157bee2d668',
'src/third_party/ninja': {
'packages': [
@@ -155,7 +155,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/aapt2',
- 'version': 'STY0BXlZxsEhudnlXQFed-B5UpwehcoM0sYqor6qRqsC',
+ 'version': 'y1G4s2RWI63L9ZLgzS3RzFdWdeblpCmYyAUzMphcQawC',
},
],
'condition': 'checkout_android',
@@ -166,7 +166,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/bundletool',
- 'version': '2RPwohwtc6on0_96oFxokeEvnC1LbLrGuyCAw00k62AC',
+ 'version': 'XoK0RwIzanpFScg7dU_8th5zMvLgKvk7c_PmhZ5LSEQC',
},
],
'condition': 'checkout_android',
@@ -174,11 +174,11 @@ deps = {
},
'src/third_party/boringssl/src':
- 'https://boringssl.googlesource.com/boringssl.git@d24a38200fef19150eef00cad35b138936c08767',
+ 'https://boringssl.googlesource.com/boringssl.git@1b7fdbd9101dedc3e0aa3fcf4ff74eacddb34ecc',
'src/third_party/breakpad/breakpad':
- 'https://chromium.googlesource.com/breakpad/breakpad.git@8988364bcddd9b194b0bf931c10bc125987330ed',
+ 'https://chromium.googlesource.com/breakpad/breakpad.git@f49c2f1a2023da0cb055874fba050563dfea57db',
'src/third_party/catapult':
- 'https://chromium.googlesource.com/catapult.git@b018f901e807db6fcb44dfc45deb658b9810aa46',
+ 'https://chromium.googlesource.com/catapult.git@bd17576ac2d58104cb43d375ff282fde394ecb44',
'src/third_party/ced/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git@ba412eaaacd3186085babcd901679a48863c7dd5',
},
@@ -191,11 +191,11 @@ deps = {
'src/third_party/crc32c/src':
'https://chromium.googlesource.com/external/github.com/google/crc32c.git@fa5ade41ee480003d9c5af6f43567ba22e4e17e6',
'src/third_party/depot_tools':
- 'https://chromium.googlesource.com/chromium/tools/depot_tools.git@f90b3b035c31a13a08922ff0270dfc55fe5a176c',
+ 'https://chromium.googlesource.com/chromium/tools/depot_tools.git@eb48a6ac0fa5835353ddd137ac35f44eee011716',
'src/third_party/ffmpeg':
- 'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@0ba37733400593b162e5ae9ff26b384cff49c250',
+ 'https://chromium.googlesource.com/chromium/third_party/ffmpeg.git@c1d0dc4135ecb8a75a044019fce960ab5120c65c',
'src/third_party/flatbuffers/src':
- 'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@0343396e49d1c0bf4ca1058130efd9585ecb3c8f',
+ 'https://chromium.googlesource.com/external/github.com/google/flatbuffers.git@bcb9ef187628fe07514e57756d05e6a6296f7dc5',
'src/third_party/grpc/src': {
'url': 'https://chromium.googlesource.com/external/github.com/grpc/grpc.git@822dab21d9995c5cf942476b35ca12a1aa9d2737',
},
@@ -205,35 +205,29 @@ deps = {
'condition': 'checkout_linux',
},
'src/third_party/freetype/src':
- 'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@7b308a29dd105074eea9c8d5953a182d325f74f1',
+ 'https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@e969289f88a586c40678133abcf999362aefe565',
'src/third_party/harfbuzz-ng/src':
- 'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@db700b5670d9475cc8ed4880cc9447b232c5e432',
+ 'https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@920c40cd43dd7b10b7ecba3d82a46f5fea88536f',
'src/third_party/google_benchmark/src': {
'url': 'https://chromium.googlesource.com/external/github.com/google/benchmark.git@b177433f3ee2513b1075140c723d73ab8901790f',
},
# WebRTC-only dependency (not present in Chromium).
'src/third_party/gtest-parallel':
'https://chromium.googlesource.com/external/github.com/google/gtest-parallel@f4d65b555894b301699c7c3c52906f72ea052e83',
- 'src/third_party/google-truth': {
- 'packages': [
- {
- 'package': 'chromium/third_party/google-truth',
- 'version': 'u8oovXxp24lStqX4d54htRovta-75Sy2w7ijg1TL07gC',
- },
- ],
+ 'src/third_party/google-truth/src': {
+ 'url': 'https://chromium.googlesource.com/external/github.com/google/truth.git@33387149b465f82712a817e6744847fe136949b3',
'condition': 'checkout_android',
- 'dep_type': 'cipd',
},
'src/third_party/googletest/src':
'https://chromium.googlesource.com/external/github.com/google/googletest.git@af29db7ec28d6df1c7f0f745186884091e602e07',
'src/third_party/icu': {
- 'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@985b9a6f70e13f3db741fed121e4dcc3046ad494',
+ 'url': 'https://chromium.googlesource.com/chromium/deps/icu.git@a622de35ac311c5ad390a7af80724634e5dc61ed',
},
'src/third_party/jdk': {
'packages': [
{
'package': 'chromium/third_party/jdk',
- 'version': '0yjD6s5XYtcGAQoObIys7xs2ThkudwxJwS-2ZNP0SFEC',
+ 'version': 'tUJrCBvDNDE9jFvgkuOwX8tU6oCWT8CtI2_JxpGlTJIC',
},
],
'condition': 'host_os == "linux" and checkout_android',
@@ -255,14 +249,14 @@ deps = {
'src/third_party/jsoncpp/source':
'https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git@42e892d96e47b1f6e29844cc705e148ec4856448', # from svn 248
'src/third_party/junit/src': {
- 'url': 'https://chromium.googlesource.com/external/junit.git@05fe2a64f59127c02135be22f416e91260d6ede6',
+ 'url': 'https://chromium.googlesource.com/external/junit.git@0eb5ce72848d730da5bd6d42902fdd6a8a42055d',
'condition': 'checkout_android',
},
'src/third_party/kotlin_stdlib': {
'packages': [
{
'package': 'chromium/third_party/kotlin_stdlib',
- 'version': 'as5vlzFVMpLTCQXVJqs-kifMAEQmjK_fImDy09zQB8AC',
+ 'version': 'QEHg036Jc2HWG4-ao7usl1QUexRidGFFSgqqWUpmK-YC',
},
],
'condition': 'checkout_android',
@@ -273,7 +267,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/kotlinc',
- 'version': '6Hdj5fkzcomS1cNTWnXoeTZj0wvCG4zdyLtZ23eK-U4C',
+ 'version': 'y9zd2-JF5FESwNZEVJnnejmk6J97g7fjlmwxNaMuJAoC',
},
],
'condition': 'checkout_android',
@@ -282,22 +276,24 @@ deps = {
# Used for building libFuzzers (only supports Linux).
'src/third_party/libFuzzer/src':
'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt/lib/fuzzer.git@758bd21f103a501b362b1ca46fa8fcb692eaa303',
+ 'src/third_party/fuzztest/src':
+ 'https://chromium.googlesource.com/external/github.com/google/fuzztest.git@9e3dbc646516772c70f7a100be53967323d310cb',
'src/third_party/libjpeg_turbo':
- 'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@30bdb85e302ecfc52593636b2f44af438e05e784',
+ 'https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@9b894306ec3b28cea46e84c32b56773a98c483da',
'src/third_party/libsrtp':
'https://chromium.googlesource.com/chromium/deps/libsrtp.git@5b7c744eb8310250ccc534f3f86a2015b3887a0a',
'src/third_party/dav1d/libdav1d':
- 'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@f8ae94eca0f53502a2cddd29a263c1edea4822a0',
+ 'https://chromium.googlesource.com/external/github.com/videolan/dav1d.git@47107e384bd1dc25674acf04d000a8cdc6195234',
'src/third_party/libaom/source/libaom':
- 'https://aomedia.googlesource.com/aom.git@0d59418942412c4176805198f2ab7ff446637c3b',
+ 'https://aomedia.googlesource.com/aom.git@af3d2a707b5a89d5ffc77260698230505d9bcd35',
'src/third_party/libunwindstack': {
'url': 'https://chromium.googlesource.com/chromium/src/third_party/libunwindstack.git@4dbfa0e8c844c8e243b297bc185e54a99ff94f9e',
'condition': 'checkout_android',
},
'src/third_party/perfetto':
- 'https://android.googlesource.com/platform/external/perfetto.git@d44dbe4ad2af5f2148e8a879bca8aa6dd6b10dfa',
+ 'https://android.googlesource.com/platform/external/perfetto.git@0447454ec8cefdbaa41ec2c67ca7013a83188ac0',
'src/third_party/libvpx/source/libvpx':
- 'https://chromium.googlesource.com/webm/libvpx.git@38a707faef72eeff89d669c553e7bfe9e08dba8f',
+ 'https://chromium.googlesource.com/webm/libvpx.git@9142314c2cec2be364e6844d1630a056e7b0a3c8',
'src/third_party/libyuv':
'https://chromium.googlesource.com/libyuv/libyuv.git@04821d1e7d60845525e8db55c7bcd41ef5be9406',
'src/third_party/lss': {
@@ -316,11 +312,15 @@ deps = {
'src/third_party/openh264/src':
'https://chromium.googlesource.com/external/github.com/cisco/openh264@09a4f3ec842a8932341b195c5b01e141c8a16eb7',
+
+ 'src/third_party/re2/src':
+ 'https://chromium.googlesource.com/external/github.com/google/re2.git@7e0c1a9e2417e70e5f0efc323267ac71d1fa0685',
+
'src/third_party/r8': {
'packages': [
{
'package': 'chromium/third_party/r8',
- 'version': 'ZQH8yoO1Ol5rCFRL2hzp4_mcdq23Fk19Z_gVHn5pzk8C',
+ 'version': 'mIydEkNvLtzm1YbYV6Vch1Oj7Hwzdgw-XVLHEKLmjq4C',
},
],
'condition': 'checkout_android',
@@ -344,7 +344,7 @@ deps = {
'condition': 'checkout_android',
},
'src/tools':
- 'https://chromium.googlesource.com/chromium/src/tools@8a2e7818c8fe35da8be21da1670f88fc33c1632c',
+ 'https://chromium.googlesource.com/chromium/src/tools@b763962670a4d9f8ba10d365237f2178a1bebd05',
'src/third_party/accessibility_test_framework': {
'packages': [
@@ -416,7 +416,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/androidx',
- 'version': 'tfNYaYQPGwu8upYGYo38upn04cSQFYR49Ai89gPC0PAC',
+ 'version': 'SVekkV-WsTydJ9quroV_dvN5Q7X7UZ_C4eJ8VstiLzoC',
},
],
'condition': 'checkout_android',
@@ -427,7 +427,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_build_tools/manifest_merger',
- 'version': '9gAaukznhLAAtANeZ_AT_9z8xXF5ZUzuc0h0TfMr7IIC',
+ 'version': 'SdNR04V227YL22FMmKoS4AdLYwv6MJe8HBAZKNhXoCsC',
},
],
'condition': 'checkout_android',
@@ -445,10 +445,6 @@ deps = {
'version': '9lGp8nTUCRRWGMnI_96HcKfzjnxEJKUcfvfwmA3wXNkC',
},
{
- 'package': 'chromium/third_party/android_sdk/public/patcher',
- 'version': 'I6FNMhrXlpB-E1lOhMlvld7xt9lBVNOO83KIluXDyA0C',
- },
- {
'package': 'chromium/third_party/android_sdk/public/platform-tools',
'version': 'HWVsGs2HCKgSVv41FsOcsfJbNcB0UFiNrF6Tc4yRArYC',
},
@@ -457,14 +453,6 @@ deps = {
'version': 'u-bhWbTME6u-DjypTgr3ZikCyeAeU6txkR9ET6Uudc8C',
},
{
- 'package': 'chromium/third_party/android_sdk/public/platforms/android-tiramisuprivacysandbox',
- 'version': 'YWMYkzyxGBgVsty0GhXL1oxbY0pGXQIgFc0Rh7ZMRPYC',
- },
- {
- 'package': 'chromium/third_party/android_sdk/public/sources/android-31',
- 'version': '_a_BcnANjPYw5mSKlNHa7GFY8yc1kdqj2rmQgac7yUcC',
- },
- {
'package': 'chromium/third_party/android_sdk/public/cmdline-tools',
'version': 'Sy00LuyBIUJdRGYKwg0zjWH8eAIUvgnnNiPkI8etaZYC',
},
@@ -499,7 +487,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/robolectric',
- 'version': 'hzetqh1qFI32FOgQroZvGcGdomrgVBJ6WKRnl1KFw6EC',
+ 'version': 'UmWqaevXYVw3D8VySDJcqj3aU9zMDFwt1RySUuU0vI8C',
},
],
'condition': 'checkout_android',
@@ -521,7 +509,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/turbine',
- 'version': 'hgwj3KajqJCdACBdNiRoYQZhZw2NhHu0-pwuAp3S-LcC',
+ 'version': 'rg7X3-H8Yd0enT9HWZY9KwEh1ciZBP0jkla5_rGW2pUC',
},
],
'condition': 'checkout_android',
@@ -532,11 +520,11 @@ deps = {
'packages': [
{
'package': 'infra/tools/luci/isolate/${{platform}}',
- 'version': 'git_revision:589d8654cfa7808816a6ecb4284ed2fd72c2f6d5',
+ 'version': 'git_revision:bd7ce256f73f85cb75c630b40afa382cdf7fcc51',
},
{
'package': 'infra/tools/luci/swarming/${{platform}}',
- 'version': 'git_revision:589d8654cfa7808816a6ecb4284ed2fd72c2f6d5',
+ 'version': 'git_revision:bd7ce256f73f85cb75c630b40afa382cdf7fcc51',
},
],
'dep_type': 'cipd',
@@ -1158,7 +1146,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_android_material_material',
- 'version': 'version:2@1.7.0-alpha02.cr1',
+ 'version': 'version:2@1.11.0-beta01.cr1',
},
],
'condition': 'checkout_android',
@@ -1224,7 +1212,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_auto_value_auto_value_annotations',
- 'version': 'version:2@1.10.1.cr1',
+ 'version': 'version:2@1.10.4.cr1',
},
],
'condition': 'checkout_android',
@@ -1301,7 +1289,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_errorprone_error_prone_annotation',
- 'version': 'version:2@2.11.0.cr1',
+ 'version': 'version:2@2.19.1.cr1',
},
],
'condition': 'checkout_android',
@@ -1312,7 +1300,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_errorprone_error_prone_annotations',
- 'version': 'version:2@2.18.0.cr1',
+ 'version': 'version:2@2.23.0.cr1',
},
],
'condition': 'checkout_android',
@@ -1521,7 +1509,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_guava_guava',
- 'version': 'version:2@31.1-jre.cr1',
+ 'version': 'version:2@32.1.3-jre.cr1',
},
],
'condition': 'checkout_android',
@@ -1532,18 +1520,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_guava_guava_android',
- 'version': 'version:2@31.1-android.cr1',
- },
- ],
- 'condition': 'checkout_android',
- 'dep_type': 'cipd',
- },
-
- 'src/third_party/android_deps/libs/com_google_guava_listenablefuture': {
- 'packages': [
- {
- 'package': 'chromium/third_party/android_deps/libs/com_google_guava_listenablefuture',
- 'version': 'version:2@1.0.cr1',
+ 'version': 'version:2@32.1.3-android.cr1',
},
],
'condition': 'checkout_android',
@@ -1554,7 +1531,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/com_google_j2objc_j2objc_annotations',
- 'version': 'version:2@1.3.cr1',
+ 'version': 'version:2@2.8.cr1',
},
],
'condition': 'checkout_android',
@@ -1796,7 +1773,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_bouncycastle_bcprov_jdk18on',
- 'version': 'version:2@1.72.cr1',
+ 'version': 'version:2@1.76.cr1',
},
],
'condition': 'checkout_android',
@@ -1829,7 +1806,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_checkerframework_checker_qual',
- 'version': 'version:2@3.25.0.cr1',
+ 'version': 'version:2@3.37.0.cr1',
},
],
'condition': 'checkout_android',
@@ -2027,7 +2004,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_ow2_asm_asm',
- 'version': 'version:2@9.5.cr1',
+ 'version': 'version:2@9.6.cr1',
},
],
'condition': 'checkout_android',
@@ -2038,7 +2015,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_ow2_asm_asm_analysis',
- 'version': 'version:2@9.5.cr1',
+ 'version': 'version:2@9.6.cr1',
},
],
'condition': 'checkout_android',
@@ -2049,7 +2026,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_ow2_asm_asm_commons',
- 'version': 'version:2@9.5.cr1',
+ 'version': 'version:2@9.6.cr1',
},
],
'condition': 'checkout_android',
@@ -2060,7 +2037,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_ow2_asm_asm_tree',
- 'version': 'version:2@9.5.cr1',
+ 'version': 'version:2@9.6.cr1',
},
],
'condition': 'checkout_android',
@@ -2071,7 +2048,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_ow2_asm_asm_util',
- 'version': 'version:2@9.5.cr1',
+ 'version': 'version:2@9.6.cr1',
},
],
'condition': 'checkout_android',
@@ -2093,7 +2070,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_annotations',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2104,7 +2081,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_junit',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2115,7 +2092,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_nativeruntime',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2126,7 +2103,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_nativeruntime_dist_compat',
- 'version': 'version:2@1.0.1.cr1',
+ 'version': 'version:2@1.0.2.cr1',
},
],
'condition': 'checkout_android',
@@ -2137,7 +2114,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_pluginapi',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2148,7 +2125,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_plugins_maven_dependency_resolver',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2159,7 +2136,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_resources',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2170,7 +2147,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_robolectric',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2181,7 +2158,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_sandbox',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2192,7 +2169,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_shadowapi',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2203,18 +2180,18 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_shadows_framework',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
'dep_type': 'cipd',
},
- 'src/third_party/android_deps/libs/org_robolectric_shadows_playservices': {
+ 'src/third_party/android_deps/libs/org_robolectric_shadows_versioning': {
'packages': [
{
- 'package': 'chromium/third_party/android_deps/libs/org_robolectric_shadows_playservices',
- 'version': 'version:2@4.10.3.cr1',
+ 'package': 'chromium/third_party/android_deps/libs/org_robolectric_shadows_versioning',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2225,7 +2202,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_utils',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2236,7 +2213,7 @@ deps = {
'packages': [
{
'package': 'chromium/third_party/android_deps/libs/org_robolectric_utils_reflector',
- 'version': 'version:2@4.10.3.cr1',
+ 'version': 'version:2@4.11.1.cr1',
},
],
'condition': 'checkout_android',
@@ -2608,6 +2585,7 @@ include_rules = [
"+absl/base/attributes.h",
"+absl/base/config.h",
"+absl/base/const_init.h",
+ "+absl/base/nullability.h",
"+absl/base/macros.h",
"+absl/cleanup/cleanup.h",
"+absl/container/inlined_vector.h",
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 4fbee0e32d..2d9768f86a 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -47,6 +47,11 @@ CPPLINT_EXCEPTIONS = [
'voice_engine',
]
+PYLINT_OLD_STYLE = [
+ "PRESUBMIT.py",
+ "tools_webrtc/autoroller/roll_deps.py",
+]
+
# These filters will always be removed, even if the caller specifies a filter
# set, as they are problematic or broken in some way.
#
@@ -122,42 +127,42 @@ FILE_PATH_RE = re.compile(r'"(?P<file_path>(\w|\/)+)(?P<extension>\.\w+)"')
def FindSrcDirPath(starting_dir):
- """Returns the abs path to the src/ dir of the project."""
- src_dir = starting_dir
- while os.path.basename(src_dir) != 'src':
- src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
- return src_dir
+ """Returns the abs path to the src/ dir of the project."""
+ src_dir = starting_dir
+ while os.path.basename(src_dir) != 'src':
+ src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
+ return src_dir
@contextmanager
def _AddToPath(*paths):
- original_sys_path = sys.path
- sys.path.extend(paths)
- try:
- yield
- finally:
- # Restore sys.path to what it was before.
- sys.path = original_sys_path
+ original_sys_path = sys.path
+ sys.path.extend(paths)
+ try:
+ yield
+ finally:
+ # Restore sys.path to what it was before.
+ sys.path = original_sys_path
def VerifyNativeApiHeadersListIsValid(input_api, output_api):
- """Ensures the list of native API header directories is up to date."""
- non_existing_paths = []
- native_api_full_paths = [
- input_api.os_path.join(input_api.PresubmitLocalPath(), *path.split('/'))
- for path in API_DIRS
- ]
- for path in native_api_full_paths:
- if not os.path.isdir(path):
- non_existing_paths.append(path)
- if non_existing_paths:
- return [
- output_api.PresubmitError(
- 'Directories to native API headers have changed which has made '
- 'the list in PRESUBMIT.py outdated.\nPlease update it to the '
- 'current location of our native APIs.', non_existing_paths)
+ """Ensures the list of native API header directories is up to date."""
+ non_existing_paths = []
+ native_api_full_paths = [
+ input_api.os_path.join(input_api.PresubmitLocalPath(),
+ *path.split('/')) for path in API_DIRS
]
- return []
+ for path in native_api_full_paths:
+ if not os.path.isdir(path):
+ non_existing_paths.append(path)
+ if non_existing_paths:
+ return [
+ output_api.PresubmitError(
+ 'Directories to native API headers have changed which has made '
+ 'the list in PRESUBMIT.py outdated.\nPlease update it to the '
+ 'current location of our native APIs.', non_existing_paths)
+ ]
+ return []
API_CHANGE_MSG = """
@@ -181,592 +186,613 @@ Related files:
def CheckNativeApiHeaderChanges(input_api, output_api):
- """Checks to remind proper changing of native APIs."""
- files = []
- source_file_filter = lambda x: input_api.FilterSourceFile(
- x, files_to_check=[r'.+\.(gn|gni|h)$'])
- for f in input_api.AffectedSourceFiles(source_file_filter):
- for path in API_DIRS:
- dn = os.path.dirname(f.LocalPath())
- if path == 'api':
- # Special case: Subdirectories included.
- if dn == 'api' or dn.startswith('api/'):
- files.append(f.LocalPath())
- else:
- # Normal case: Subdirectories not included.
- if dn == path:
- files.append(f.LocalPath())
-
- if files:
- return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, files)]
- return []
+ """Checks to remind proper changing of native APIs."""
+ files = []
+ source_file_filter = lambda x: input_api.FilterSourceFile(
+ x, files_to_check=[r'.+\.(gn|gni|h)$'])
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ for path in API_DIRS:
+ dn = os.path.dirname(f.LocalPath())
+ if path == 'api':
+ # Special case: Subdirectories included.
+ if dn == 'api' or dn.startswith('api/'):
+ files.append(f.LocalPath())
+ else:
+ # Normal case: Subdirectories not included.
+ if dn == path:
+ files.append(f.LocalPath())
+
+ if files:
+ return [output_api.PresubmitNotifyResult(API_CHANGE_MSG, files)]
+ return []
def CheckNoIOStreamInHeaders(input_api, output_api, source_file_filter):
- """Checks to make sure no .h files include <iostream>."""
- files = []
- pattern = input_api.re.compile(r'^#include\s*<iostream>',
- input_api.re.MULTILINE)
- file_filter = lambda x: (input_api.FilterSourceFile(x) and source_file_filter(
- x))
- for f in input_api.AffectedSourceFiles(file_filter):
- if not f.LocalPath().endswith('.h'):
- continue
- contents = input_api.ReadFile(f)
- if pattern.search(contents):
- files.append(f)
-
- if len(files) > 0:
- return [
- output_api.PresubmitError(
- 'Do not #include <iostream> in header files, since it inserts '
- 'static initialization into every file including the header. '
- 'Instead, #include <ostream>. See http://crbug.com/94794', files)
- ]
- return []
+ """Checks to make sure no .h files include <iostream>."""
+ files = []
+ pattern = input_api.re.compile(r'^#include\s*<iostream>',
+ input_api.re.MULTILINE)
+ file_filter = lambda x: (input_api.FilterSourceFile(x) and
+ source_file_filter(x))
+ for f in input_api.AffectedSourceFiles(file_filter):
+ if not f.LocalPath().endswith('.h'):
+ continue
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ files.append(f)
+
+ if len(files) > 0:
+ return [
+ output_api.PresubmitError(
+ 'Do not #include <iostream> in header files, since it inserts '
+ 'static initialization into every file including the header. '
+ 'Instead, #include <ostream>. See http://crbug.com/94794',
+ files)
+ ]
+ return []
def CheckNoPragmaOnce(input_api, output_api, source_file_filter):
- """Make sure that banned functions are not used."""
- files = []
- pattern = input_api.re.compile(r'^#pragma\s+once', input_api.re.MULTILINE)
- file_filter = lambda x: (input_api.FilterSourceFile(x) and source_file_filter(
- x))
- for f in input_api.AffectedSourceFiles(file_filter):
- if not f.LocalPath().endswith('.h'):
- continue
- contents = input_api.ReadFile(f)
- if pattern.search(contents):
- files.append(f)
-
- if files:
- return [
- output_api.PresubmitError(
- 'Do not use #pragma once in header files.\n'
- 'See http://www.chromium.org/developers/coding-style'
- '#TOC-File-headers', files)
- ]
- return []
+ """Make sure that banned functions are not used."""
+ files = []
+ pattern = input_api.re.compile(r'^#pragma\s+once', input_api.re.MULTILINE)
+ file_filter = lambda x: (input_api.FilterSourceFile(x) and
+ source_file_filter(x))
+ for f in input_api.AffectedSourceFiles(file_filter):
+ if not f.LocalPath().endswith('.h'):
+ continue
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ files.append(f)
+
+ if files:
+ return [
+ output_api.PresubmitError(
+ 'Do not use #pragma once in header files.\n'
+ 'See http://www.chromium.org/developers/coding-style'
+ '#TOC-File-headers', files)
+ ]
+ return []
def CheckNoFRIEND_TEST(# pylint: disable=invalid-name
input_api,
output_api,
source_file_filter):
- """Make sure that gtest's FRIEND_TEST() macro is not used, the
+ """Make sure that gtest's FRIEND_TEST() macro is not used, the
FRIEND_TEST_ALL_PREFIXES() macro from testsupport/gtest_prod_util.h should be
used instead since that allows for FLAKY_, FAILS_ and DISABLED_ prefixes."""
- problems = []
+ problems = []
- file_filter = lambda f: (f.LocalPath().endswith(('.cc', '.h')) and
- source_file_filter(f))
- for f in input_api.AffectedFiles(file_filter=file_filter):
- for line_num, line in f.ChangedContents():
- if 'FRIEND_TEST(' in line:
- problems.append(' %s:%d' % (f.LocalPath(), line_num))
+ file_filter = lambda f: (f.LocalPath().endswith(
+ ('.cc', '.h')) and source_file_filter(f))
+ for f in input_api.AffectedFiles(file_filter=file_filter):
+ for line_num, line in f.ChangedContents():
+ if 'FRIEND_TEST(' in line:
+ problems.append(' %s:%d' % (f.LocalPath(), line_num))
- if not problems:
- return []
- return [
- output_api.PresubmitPromptWarning(
- 'WebRTC\'s code should not use gtest\'s FRIEND_TEST() macro. '
- 'Include testsupport/gtest_prod_util.h and use '
- 'FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))
- ]
+ if not problems:
+ return []
+ return [
+ output_api.PresubmitPromptWarning(
+ 'WebRTC\'s code should not use gtest\'s FRIEND_TEST() macro. '
+ 'Include testsupport/gtest_prod_util.h and use '
+ 'FRIEND_TEST_ALL_PREFIXES() instead.\n' + '\n'.join(problems))
+ ]
def IsLintDisabled(disabled_paths, file_path):
- """ Checks if a file is disabled for lint check."""
- for path in disabled_paths:
- if file_path == path or os.path.dirname(file_path).startswith(path):
- return True
- return False
+ """ Checks if a file is disabled for lint check."""
+ for path in disabled_paths:
+ if file_path == path or os.path.dirname(file_path).startswith(path):
+ return True
+ return False
def CheckApprovedFilesLintClean(input_api, output_api,
source_file_filter=None):
- """Checks that all new or non-exempt .cc and .h files pass cpplint.py.
+ """Checks that all new or non-exempt .cc and .h files pass cpplint.py.
This check is based on CheckChangeLintsClean in
depot_tools/presubmit_canned_checks.py but has less filters and only checks
added files."""
- result = []
-
- # Initialize cpplint.
- import cpplint
- # Access to a protected member _XX of a client class
- # pylint: disable=W0212
- cpplint._cpplint_state.ResetErrorCounts()
-
- lint_filters = cpplint._Filters()
- lint_filters.extend(DISABLED_LINT_FILTERS)
- cpplint._SetFilters(','.join(lint_filters))
-
- # Create a platform independent exempt list for cpplint.
- disabled_paths = [
- input_api.os_path.join(*path.split('/')) for path in CPPLINT_EXCEPTIONS
- ]
-
- # Use the strictest verbosity level for cpplint.py (level 1) which is the
- # default when running cpplint.py from command line. To make it possible to
- # work with not-yet-converted code, we're only applying it to new (or
- # moved/renamed) files and files not listed in CPPLINT_EXCEPTIONS.
- verbosity_level = 1
- files = []
- for f in input_api.AffectedSourceFiles(source_file_filter):
- # Note that moved/renamed files also count as added.
- if f.Action() == 'A' or not IsLintDisabled(disabled_paths, f.LocalPath()):
- files.append(f.AbsoluteLocalPath())
-
- for file_name in files:
- cpplint.ProcessFile(file_name, verbosity_level)
-
- if cpplint._cpplint_state.error_count > 0:
- if input_api.is_committing:
- res_type = output_api.PresubmitError
- else:
- res_type = output_api.PresubmitPromptWarning
- result = [res_type('Changelist failed cpplint.py check.')]
+ result = []
- return result
+ # Initialize cpplint.
+ import cpplint
+ # Access to a protected member _XX of a client class
+ # pylint: disable=W0212
+ cpplint._cpplint_state.ResetErrorCounts()
+ lint_filters = cpplint._Filters()
+ lint_filters.extend(DISABLED_LINT_FILTERS)
+ cpplint._SetFilters(','.join(lint_filters))
-def CheckNoSourcesAbove(input_api, gn_files, output_api):
- # Disallow referencing source files with paths above the GN file location.
- source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]',
- re.MULTILINE | re.DOTALL)
- file_pattern = input_api.re.compile(r'"((\.\./.*?)|(//.*?))"')
- violating_gn_files = set()
- violating_source_entries = []
- for gn_file in gn_files:
- contents = input_api.ReadFile(gn_file)
- for source_block_match in source_pattern.finditer(contents):
- # Find all source list entries starting with ../ in the source block
- # (exclude overrides entries).
- for file_list_match in file_pattern.finditer(source_block_match.group(1)):
- source_file = file_list_match.group(1)
- if 'overrides/' not in source_file:
- violating_source_entries.append(source_file)
- violating_gn_files.add(gn_file)
- if violating_gn_files:
- return [
- output_api.PresubmitError(
- 'Referencing source files above the directory of the GN file '
- 'is not allowed. Please introduce new GN targets in the proper '
- 'location instead.\n'
- 'Invalid source entries:\n'
- '%s\n'
- 'Violating GN files:' % '\n'.join(violating_source_entries),
- items=violating_gn_files)
+ # Create a platform independent exempt list for cpplint.
+ disabled_paths = [
+ input_api.os_path.join(*path.split('/')) for path in CPPLINT_EXCEPTIONS
]
- return []
+
+ # Use the strictest verbosity level for cpplint.py (level 1) which is the
+ # default when running cpplint.py from command line. To make it possible to
+ # work with not-yet-converted code, we're only applying it to new (or
+ # moved/renamed) files and files not listed in CPPLINT_EXCEPTIONS.
+ verbosity_level = 1
+ files = []
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ # Note that moved/renamed files also count as added.
+ if f.Action() == 'A' or not IsLintDisabled(disabled_paths,
+ f.LocalPath()):
+ files.append(f.AbsoluteLocalPath())
+
+ for file_name in files:
+ cpplint.ProcessFile(file_name, verbosity_level)
+
+ if cpplint._cpplint_state.error_count > 0:
+ if input_api.is_committing:
+ res_type = output_api.PresubmitError
+ else:
+ res_type = output_api.PresubmitPromptWarning
+ result = [res_type('Changelist failed cpplint.py check.')]
+
+ return result
+
+
+def CheckNoSourcesAbove(input_api, gn_files, output_api):
+ # Disallow referencing source files with paths above the GN file location.
+ source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]',
+ re.MULTILINE | re.DOTALL)
+ file_pattern = input_api.re.compile(r'"((\.\./.*?)|(//.*?))"')
+ violating_gn_files = set()
+ violating_source_entries = []
+ for gn_file in gn_files:
+ contents = input_api.ReadFile(gn_file)
+ for source_block_match in source_pattern.finditer(contents):
+ # Find all source list entries starting with ../ in the source block
+ # (exclude overrides entries).
+ for file_list_match in file_pattern.finditer(
+ source_block_match.group(1)):
+ source_file = file_list_match.group(1)
+ if 'overrides/' not in source_file:
+ violating_source_entries.append(source_file)
+ violating_gn_files.add(gn_file)
+ if violating_gn_files:
+ return [
+ output_api.PresubmitError(
+ 'Referencing source files above the directory of the GN file '
+ 'is not allowed. Please introduce new GN targets in the proper '
+ 'location instead.\n'
+ 'Invalid source entries:\n'
+ '%s\n'
+ 'Violating GN files:' % '\n'.join(violating_source_entries),
+ items=violating_gn_files)
+ ]
+ return []
def CheckAbseilDependencies(input_api, gn_files, output_api):
- """Checks that Abseil dependencies are declared in `absl_deps`."""
- absl_re = re.compile(r'third_party/abseil-cpp', re.MULTILINE | re.DOTALL)
- target_types_to_check = [
- 'rtc_library',
- 'rtc_source_set',
- 'rtc_static_library',
- 'webrtc_fuzzer_test',
- ]
- error_msg = ('Abseil dependencies in target "%s" (file: %s) '
- 'should be moved to the "absl_deps" parameter.')
- errors = []
-
- # pylint: disable=too-many-nested-blocks
- for gn_file in gn_files:
- gn_file_content = input_api.ReadFile(gn_file)
- for target_match in TARGET_RE.finditer(gn_file_content):
- target_type = target_match.group('target_type')
- target_name = target_match.group('target_name')
- target_contents = target_match.group('target_contents')
- if target_type in target_types_to_check:
- for deps_match in DEPS_RE.finditer(target_contents):
- deps = deps_match.group('deps').splitlines()
- for dep in deps:
- if re.search(absl_re, dep):
- errors.append(
- output_api.PresubmitError(error_msg %
- (target_name, gn_file.LocalPath())))
- break # no need to warn more than once per target
- return errors
+ """Checks that Abseil dependencies are declared in `absl_deps`."""
+ absl_re = re.compile(r'third_party/abseil-cpp', re.MULTILINE | re.DOTALL)
+ target_types_to_check = [
+ 'rtc_library',
+ 'rtc_source_set',
+ 'rtc_static_library',
+ 'webrtc_fuzzer_test',
+ ]
+ error_msg = ('Abseil dependencies in target "%s" (file: %s) '
+ 'should be moved to the "absl_deps" parameter.')
+ errors = []
+
+ # pylint: disable=too-many-nested-blocks
+ for gn_file in gn_files:
+ gn_file_content = input_api.ReadFile(gn_file)
+ for target_match in TARGET_RE.finditer(gn_file_content):
+ target_type = target_match.group('target_type')
+ target_name = target_match.group('target_name')
+ target_contents = target_match.group('target_contents')
+ if target_type in target_types_to_check:
+ for deps_match in DEPS_RE.finditer(target_contents):
+ deps = deps_match.group('deps').splitlines()
+ for dep in deps:
+ if re.search(absl_re, dep):
+ errors.append(
+ output_api.PresubmitError(
+ error_msg %
+ (target_name, gn_file.LocalPath())))
+ break # no need to warn more than once per target
+ return errors
def CheckNoMixingSources(input_api, gn_files, output_api):
- """Disallow mixing C, C++ and Obj-C/Obj-C++ in the same target.
+ """Disallow mixing C, C++ and Obj-C/Obj-C++ in the same target.
See bugs.webrtc.org/7743 for more context.
"""
-
- def _MoreThanOneSourceUsed(*sources_lists):
- sources_used = 0
- for source_list in sources_lists:
- if len(source_list) > 0:
- sources_used += 1
- return sources_used > 1
-
- errors = defaultdict(lambda: [])
- for gn_file in gn_files:
- gn_file_content = input_api.ReadFile(gn_file)
- for target_match in TARGET_RE.finditer(gn_file_content):
- # list_of_sources is a list of tuples of the form
- # (c_files, cc_files, objc_files) that keeps track of all the
- # sources defined in a target. A GN target can have more that
- # on definition of sources (since it supports if/else statements).
- # E.g.:
- # rtc_static_library("foo") {
- # if (is_win) {
- # sources = [ "foo.cc" ]
- # } else {
- # sources = [ "foo.mm" ]
- # }
- # }
- # This is allowed and the presubmit check should support this case.
- list_of_sources = []
- c_files = []
- cc_files = []
- objc_files = []
- target_name = target_match.group('target_name')
- target_contents = target_match.group('target_contents')
- for sources_match in SOURCES_RE.finditer(target_contents):
- if '+=' not in sources_match.group(0):
- if c_files or cc_files or objc_files:
+ def _MoreThanOneSourceUsed(*sources_lists):
+ sources_used = 0
+ for source_list in sources_lists:
+ if len(source_list) > 0:
+ sources_used += 1
+ return sources_used > 1
+
+ errors = defaultdict(lambda: [])
+ for gn_file in gn_files:
+ gn_file_content = input_api.ReadFile(gn_file)
+ for target_match in TARGET_RE.finditer(gn_file_content):
+ # list_of_sources is a list of tuples of the form
+ # (c_files, cc_files, objc_files) that keeps track of all the
+ # sources defined in a target. A GN target can have more that
+ # on definition of sources (since it supports if/else statements).
+ # E.g.:
+ # rtc_static_library("foo") {
+ # if (is_win) {
+ # sources = [ "foo.cc" ]
+ # } else {
+ # sources = [ "foo.mm" ]
+ # }
+ # }
+ # This is allowed and the presubmit check should support this case.
+ list_of_sources = []
+ c_files = []
+ cc_files = []
+ objc_files = []
+ target_name = target_match.group('target_name')
+ target_contents = target_match.group('target_contents')
+ for sources_match in SOURCES_RE.finditer(target_contents):
+ if '+=' not in sources_match.group(0):
+ if c_files or cc_files or objc_files:
+ list_of_sources.append((c_files, cc_files, objc_files))
+ c_files = []
+ cc_files = []
+ objc_files = []
+ for file_match in FILE_PATH_RE.finditer(
+ sources_match.group(1)):
+ file_path = file_match.group('file_path')
+ extension = file_match.group('extension')
+ if extension == '.c':
+ c_files.append(file_path + extension)
+ if extension == '.cc':
+ cc_files.append(file_path + extension)
+ if extension in ['.m', '.mm']:
+ objc_files.append(file_path + extension)
list_of_sources.append((c_files, cc_files, objc_files))
- c_files = []
- cc_files = []
- objc_files = []
- for file_match in FILE_PATH_RE.finditer(sources_match.group(1)):
- file_path = file_match.group('file_path')
- extension = file_match.group('extension')
- if extension == '.c':
- c_files.append(file_path + extension)
- if extension == '.cc':
- cc_files.append(file_path + extension)
- if extension in ['.m', '.mm']:
- objc_files.append(file_path + extension)
- list_of_sources.append((c_files, cc_files, objc_files))
- for c_files_list, cc_files_list, objc_files_list in list_of_sources:
- if _MoreThanOneSourceUsed(c_files_list, cc_files_list, objc_files_list):
- all_sources = sorted(c_files_list + cc_files_list + objc_files_list)
- errors[gn_file.LocalPath()].append((target_name, all_sources))
- if errors:
- return [
- output_api.PresubmitError(
- 'GN targets cannot mix .c, .cc and .m (or .mm) source files.\n'
- 'Please create a separate target for each collection of '
- 'sources.\n'
- 'Mixed sources: \n'
- '%s\n'
- 'Violating GN files:\n%s\n' %
- (json.dumps(errors, indent=2), '\n'.join(list(errors.keys()))))
- ]
- return []
+ for c_files_list, cc_files_list, objc_files_list in list_of_sources:
+ if _MoreThanOneSourceUsed(c_files_list, cc_files_list,
+ objc_files_list):
+ all_sources = sorted(c_files_list + cc_files_list +
+ objc_files_list)
+ errors[gn_file.LocalPath()].append(
+ (target_name, all_sources))
+ if errors:
+ return [
+ output_api.PresubmitError(
+ 'GN targets cannot mix .c, .cc and .m (or .mm) source files.\n'
+ 'Please create a separate target for each collection of '
+ 'sources.\n'
+ 'Mixed sources: \n'
+ '%s\n'
+ 'Violating GN files:\n%s\n' %
+ (json.dumps(errors, indent=2), '\n'.join(list(errors.keys()))))
+ ]
+ return []
def CheckNoPackageBoundaryViolations(input_api, gn_files, output_api):
- cwd = input_api.PresubmitLocalPath()
- with _AddToPath(
- input_api.os_path.join(cwd, 'tools_webrtc', 'presubmit_checks_lib')):
- from check_package_boundaries import CheckPackageBoundaries
- build_files = [os.path.join(cwd, gn_file.LocalPath()) for gn_file in gn_files]
- errors = CheckPackageBoundaries(cwd, build_files)[:5]
- if errors:
- return [
- output_api.PresubmitError(
- 'There are package boundary violations in the following GN '
- 'files:',
- long_text='\n\n'.join(str(err) for err in errors))
+ cwd = input_api.PresubmitLocalPath()
+ with _AddToPath(
+ input_api.os_path.join(cwd, 'tools_webrtc',
+ 'presubmit_checks_lib')):
+ from check_package_boundaries import CheckPackageBoundaries
+ build_files = [
+ os.path.join(cwd, gn_file.LocalPath()) for gn_file in gn_files
]
- return []
+ errors = CheckPackageBoundaries(cwd, build_files)[:5]
+ if errors:
+ return [
+ output_api.PresubmitError(
+ 'There are package boundary violations in the following GN '
+ 'files:',
+ long_text='\n\n'.join(str(err) for err in errors))
+ ]
+ return []
def _ReportFileAndLine(filename, line_num):
- """Default error formatter for _FindNewViolationsOfRule."""
- return '%s (line %s)' % (filename, line_num)
+ """Default error formatter for _FindNewViolationsOfRule."""
+ return '%s (line %s)' % (filename, line_num)
def CheckNoWarningSuppressionFlagsAreAdded(gn_files,
input_api,
output_api,
error_formatter=_ReportFileAndLine):
- """Ensure warning suppression flags are not added without a reason."""
- msg = ('Usage of //build/config/clang:extra_warnings is discouraged '
- 'in WebRTC.\n'
- 'If you are not adding this code (e.g. you are just moving '
- 'existing code) or you want to add an exception,\n'
- 'you can add a comment on the line that causes the problem:\n\n'
- '"-Wno-odr" # no-presubmit-check TODO(bugs.webrtc.org/BUG_ID)\n'
- '\n'
- 'Affected files:\n')
- errors = [] # 2-element tuples with (file, line number)
- clang_warn_re = input_api.re.compile(r'//build/config/clang:extra_warnings')
- # pylint: disable-next=fixme
- no_presubmit_re = input_api.re.compile(
- r'# no-presubmit-check TODO\(bugs\.webrtc\.org/\d+\)')
- for f in gn_files:
- for line_num, line in f.ChangedContents():
- if clang_warn_re.search(line) and not no_presubmit_re.search(line):
- errors.append(error_formatter(f.LocalPath(), line_num))
- if errors:
- return [output_api.PresubmitError(msg, errors)]
- return []
+ """Ensure warning suppression flags are not added without a reason."""
+ msg = ('Usage of //build/config/clang:extra_warnings is discouraged '
+ 'in WebRTC.\n'
+ 'If you are not adding this code (e.g. you are just moving '
+ 'existing code) or you want to add an exception,\n'
+ 'you can add a comment on the line that causes the problem:\n\n'
+ '"-Wno-odr" # no-presubmit-check TODO(bugs.webrtc.org/BUG_ID)\n'
+ '\n'
+ 'Affected files:\n')
+ errors = [] # 2-element tuples with (file, line number)
+ clang_warn_re = input_api.re.compile(
+ r'//build/config/clang:extra_warnings')
+ # pylint: disable-next=fixme
+ no_presubmit_re = input_api.re.compile(
+ r'# no-presubmit-check TODO\(bugs\.webrtc\.org/\d+\)')
+ for f in gn_files:
+ for line_num, line in f.ChangedContents():
+ if clang_warn_re.search(line) and not no_presubmit_re.search(line):
+ errors.append(error_formatter(f.LocalPath(), line_num))
+ if errors:
+ return [output_api.PresubmitError(msg, errors)]
+ return []
def CheckNoTestCaseUsageIsAdded(input_api,
output_api,
source_file_filter,
error_formatter=_ReportFileAndLine):
- error_msg = ('Usage of legacy GoogleTest API detected!\nPlease use the '
- 'new API: https://github.com/google/googletest/blob/master/'
- 'googletest/docs/primer.md#beware-of-the-nomenclature.\n'
- 'Affected files:\n')
- errors = [] # 2-element tuples with (file, line number)
- test_case_re = input_api.re.compile(r'TEST_CASE')
- file_filter = lambda f: (source_file_filter(f) and f.LocalPath().endswith(
- '.cc'))
- for f in input_api.AffectedSourceFiles(file_filter):
- for line_num, line in f.ChangedContents():
- if test_case_re.search(line):
- errors.append(error_formatter(f.LocalPath(), line_num))
- if errors:
- return [output_api.PresubmitError(error_msg, errors)]
- return []
+ error_msg = ('Usage of legacy GoogleTest API detected!\nPlease use the '
+ 'new API: https://github.com/google/googletest/blob/master/'
+ 'googletest/docs/primer.md#beware-of-the-nomenclature.\n'
+ 'Affected files:\n')
+ errors = [] # 2-element tuples with (file, line number)
+ test_case_re = input_api.re.compile(r'TEST_CASE')
+ file_filter = lambda f: (source_file_filter(f) and f.LocalPath().endswith(
+ '.cc'))
+ for f in input_api.AffectedSourceFiles(file_filter):
+ for line_num, line in f.ChangedContents():
+ if test_case_re.search(line):
+ errors.append(error_formatter(f.LocalPath(), line_num))
+ if errors:
+ return [output_api.PresubmitError(error_msg, errors)]
+ return []
def CheckNoStreamUsageIsAdded(input_api,
output_api,
source_file_filter,
error_formatter=_ReportFileAndLine):
- """Make sure that no more dependencies on stringstream are added."""
- error_msg = ('Usage of <sstream>, <istream> and <ostream> in WebRTC is '
- 'deprecated.\n'
- 'This includes the following types:\n'
- 'std::istringstream, std::ostringstream, std::wistringstream, '
- 'std::wostringstream,\n'
- 'std::wstringstream, std::ostream, std::wostream, std::istream,'
- 'std::wistream,\n'
- 'std::iostream, std::wiostream.\n'
- 'If you are not adding this code (e.g. you are just moving '
- 'existing code),\n'
- 'you can add a comment on the line that causes the problem:\n\n'
- '#include <sstream> // no-presubmit-check TODO(webrtc:8982)\n'
- 'std::ostream& F() { // no-presubmit-check TODO(webrtc:8982)\n'
- '\n'
- 'If you are adding new code, consider using '
- 'rtc::SimpleStringBuilder\n'
- '(in rtc_base/strings/string_builder.h).\n'
- 'Affected files:\n')
- errors = [] # 2-element tuples with (file, line number)
- include_re = input_api.re.compile(r'#include <(i|o|s)stream>')
- usage_re = input_api.re.compile(r'std::(w|i|o|io|wi|wo|wio)(string)*stream')
- no_presubmit_re = input_api.re.compile(
- r'// no-presubmit-check TODO\(webrtc:8982\)')
- file_filter = lambda x: (input_api.FilterSourceFile(x) and source_file_filter(
- x))
-
- def _IsException(file_path):
- is_test = any(
- file_path.endswith(x)
- for x in ['_test.cc', '_tests.cc', '_unittest.cc', '_unittests.cc'])
- return (file_path.startswith('examples') or file_path.startswith('test')
- or is_test)
-
- for f in input_api.AffectedSourceFiles(file_filter):
- # Usage of stringstream is allowed under examples/ and in tests.
- if f.LocalPath() == 'PRESUBMIT.py' or _IsException(f.LocalPath()):
- continue
- for line_num, line in f.ChangedContents():
- if ((include_re.search(line) or usage_re.search(line))
- and not no_presubmit_re.search(line)):
- errors.append(error_formatter(f.LocalPath(), line_num))
- if errors:
- return [output_api.PresubmitError(error_msg, errors)]
- return []
+ """Make sure that no more dependencies on stringstream are added."""
+ error_msg = (
+ 'Usage of <sstream>, <istream> and <ostream> in WebRTC is '
+ 'deprecated.\n'
+ 'This includes the following types:\n'
+ 'std::istringstream, std::ostringstream, std::wistringstream, '
+ 'std::wostringstream,\n'
+ 'std::wstringstream, std::ostream, std::wostream, std::istream,'
+ 'std::wistream,\n'
+ 'std::iostream, std::wiostream.\n'
+ 'If you are not adding this code (e.g. you are just moving '
+ 'existing code),\n'
+ 'you can add a comment on the line that causes the problem:\n\n'
+ '#include <sstream> // no-presubmit-check TODO(webrtc:8982)\n'
+ 'std::ostream& F() { // no-presubmit-check TODO(webrtc:8982)\n'
+ '\n'
+ 'If you are adding new code, consider using '
+ 'rtc::SimpleStringBuilder\n'
+ '(in rtc_base/strings/string_builder.h).\n'
+ 'Affected files:\n')
+ errors = [] # 2-element tuples with (file, line number)
+ include_re = input_api.re.compile(r'#include <(i|o|s)stream>')
+ usage_re = input_api.re.compile(
+ r'std::(w|i|o|io|wi|wo|wio)(string)*stream')
+ no_presubmit_re = input_api.re.compile(
+ r'// no-presubmit-check TODO\(webrtc:8982\)')
+ file_filter = lambda x: (input_api.FilterSourceFile(x) and
+ source_file_filter(x))
+
+ def _IsException(file_path):
+ is_test = any(
+ file_path.endswith(x) for x in
+ ['_test.cc', '_tests.cc', '_unittest.cc', '_unittests.cc'])
+ return (file_path.startswith('examples')
+ or file_path.startswith('test') or is_test)
+
+ for f in input_api.AffectedSourceFiles(file_filter):
+ # Usage of stringstream is allowed under examples/ and in tests.
+ if f.LocalPath() == 'PRESUBMIT.py' or _IsException(f.LocalPath()):
+ continue
+ for line_num, line in f.ChangedContents():
+ if ((include_re.search(line) or usage_re.search(line))
+ and not no_presubmit_re.search(line)):
+ errors.append(error_formatter(f.LocalPath(), line_num))
+ if errors:
+ return [output_api.PresubmitError(error_msg, errors)]
+ return []
def CheckPublicDepsIsNotUsed(gn_files, input_api, output_api):
- """Checks that public_deps is not used without a good reason."""
- result = []
- no_presubmit_check_re = input_api.re.compile(
- r'# no-presubmit-check TODO\(webrtc:\d+\)')
- error_msg = ('public_deps is not recommended in WebRTC BUILD.gn files '
- 'because it doesn\'t map well to downstream build systems.\n'
- 'Used in: %s (line %d).\n'
- 'If you are not adding this code (e.g. you are just moving '
- 'existing code) or you have a good reason, you can add this '
- 'comment (verbatim) on the line that causes the problem:\n\n'
- 'public_deps = [ # no-presubmit-check TODO(webrtc:8603)\n')
- for affected_file in gn_files:
- for (line_number, affected_line) in affected_file.ChangedContents():
- if 'public_deps' in affected_line:
- surpressed = no_presubmit_check_re.search(affected_line)
- if not surpressed:
- result.append(
- output_api.PresubmitError(
- error_msg % (affected_file.LocalPath(), line_number)))
- return result
+ """Checks that public_deps is not used without a good reason."""
+ result = []
+ no_presubmit_check_re = input_api.re.compile(
+ r'# no-presubmit-check TODO\(webrtc:\d+\)')
+ error_msg = ('public_deps is not recommended in WebRTC BUILD.gn files '
+ 'because it doesn\'t map well to downstream build systems.\n'
+ 'Used in: %s (line %d).\n'
+ 'If you are not adding this code (e.g. you are just moving '
+ 'existing code) or you have a good reason, you can add this '
+ 'comment (verbatim) on the line that causes the problem:\n\n'
+ 'public_deps = [ # no-presubmit-check TODO(webrtc:8603)\n')
+ for affected_file in gn_files:
+ for (line_number, affected_line) in affected_file.ChangedContents():
+ if 'public_deps' in affected_line:
+ surpressed = no_presubmit_check_re.search(affected_line)
+ if not surpressed:
+ result.append(
+ output_api.PresubmitError(
+ error_msg %
+ (affected_file.LocalPath(), line_number)))
+ return result
def CheckCheckIncludesIsNotUsed(gn_files, input_api, output_api):
- result = []
- error_msg = ('check_includes overrides are not allowed since it can cause '
- 'incorrect dependencies to form. It effectively means that your '
- 'module can include any .h file without depending on its '
- 'corresponding target. There are some exceptional cases when '
- 'this is allowed: if so, get approval from a .gn owner in the '
- 'root OWNERS file.\n'
- 'Used in: %s (line %d).')
- # pylint: disable-next=fixme
- no_presubmit_re = input_api.re.compile(
- r'# no-presubmit-check TODO\(bugs\.webrtc\.org/\d+\)')
- for affected_file in gn_files:
- for (line_number, affected_line) in affected_file.ChangedContents():
- if ('check_includes' in affected_line
- and not no_presubmit_re.search(affected_line)):
- result.append(
- output_api.PresubmitError(error_msg %
- (affected_file.LocalPath(), line_number)))
- return result
+ result = []
+ error_msg = (
+ 'check_includes overrides are not allowed since it can cause '
+ 'incorrect dependencies to form. It effectively means that your '
+ 'module can include any .h file without depending on its '
+ 'corresponding target. There are some exceptional cases when '
+ 'this is allowed: if so, get approval from a .gn owner in the '
+ 'root OWNERS file.\n'
+ 'Used in: %s (line %d).')
+ # pylint: disable-next=fixme
+ no_presubmit_re = input_api.re.compile(
+ r'# no-presubmit-check TODO\(bugs\.webrtc\.org/\d+\)')
+ for affected_file in gn_files:
+ for (line_number, affected_line) in affected_file.ChangedContents():
+ if ('check_includes' in affected_line
+ and not no_presubmit_re.search(affected_line)):
+ result.append(
+ output_api.PresubmitError(
+ error_msg % (affected_file.LocalPath(), line_number)))
+ return result
def CheckGnChanges(input_api, output_api):
- file_filter = lambda x: (input_api.FilterSourceFile(
- x,
- files_to_check=(r'.+\.(gn|gni)$', ),
- files_to_skip=(r'.*/presubmit_checks_lib/testdata/.*', )))
-
- gn_files = []
- for f in input_api.AffectedSourceFiles(file_filter):
- gn_files.append(f)
-
- result = []
- if gn_files:
- result.extend(CheckNoSourcesAbove(input_api, gn_files, output_api))
- result.extend(CheckNoMixingSources(input_api, gn_files, output_api))
- result.extend(CheckAbseilDependencies(input_api, gn_files, output_api))
- result.extend(
- CheckNoPackageBoundaryViolations(input_api, gn_files, output_api))
- result.extend(CheckPublicDepsIsNotUsed(gn_files, input_api, output_api))
- result.extend(CheckCheckIncludesIsNotUsed(gn_files, input_api, output_api))
- result.extend(
- CheckNoWarningSuppressionFlagsAreAdded(gn_files, input_api, output_api))
- return result
+ file_filter = lambda x: (input_api.FilterSourceFile(
+ x,
+ files_to_check=(r'.+\.(gn|gni)$', ),
+ files_to_skip=(r'.*/presubmit_checks_lib/testdata/.*', )))
+
+ gn_files = []
+ for f in input_api.AffectedSourceFiles(file_filter):
+ gn_files.append(f)
+
+ result = []
+ if gn_files:
+ result.extend(CheckNoSourcesAbove(input_api, gn_files, output_api))
+ result.extend(CheckNoMixingSources(input_api, gn_files, output_api))
+ result.extend(CheckAbseilDependencies(input_api, gn_files, output_api))
+ result.extend(
+ CheckNoPackageBoundaryViolations(input_api, gn_files, output_api))
+ result.extend(CheckPublicDepsIsNotUsed(gn_files, input_api,
+ output_api))
+ result.extend(
+ CheckCheckIncludesIsNotUsed(gn_files, input_api, output_api))
+ result.extend(
+ CheckNoWarningSuppressionFlagsAreAdded(gn_files, input_api,
+ output_api))
+ return result
def CheckGnGen(input_api, output_api):
- """Runs `gn gen --check` with default args to detect mismatches between
+ """Runs `gn gen --check` with default args to detect mismatches between
#includes and dependencies in the BUILD.gn files, as well as general build
errors.
"""
- with _AddToPath(
- input_api.os_path.join(input_api.PresubmitLocalPath(), 'tools_webrtc',
- 'presubmit_checks_lib')):
- from build_helpers import RunGnCheck
- errors = RunGnCheck(FindSrcDirPath(input_api.PresubmitLocalPath()))[:5]
- if errors:
- return [
- output_api.PresubmitPromptWarning(
- 'Some #includes do not match the build dependency graph. '
- 'Please run:\n'
- ' gn gen --check <out_dir>',
- long_text='\n\n'.join(errors))
- ]
- return []
+ with _AddToPath(
+ input_api.os_path.join(input_api.PresubmitLocalPath(),
+ 'tools_webrtc', 'presubmit_checks_lib')):
+ from build_helpers import RunGnCheck
+ errors = RunGnCheck(FindSrcDirPath(input_api.PresubmitLocalPath()))[:5]
+ if errors:
+ return [
+ output_api.PresubmitPromptWarning(
+ 'Some #includes do not match the build dependency graph. '
+ 'Please run:\n'
+ ' gn gen --check <out_dir>',
+ long_text='\n\n'.join(errors))
+ ]
+ return []
def CheckUnwantedDependencies(input_api, output_api, source_file_filter):
- """Runs checkdeps on #include statements added in this
+ """Runs checkdeps on #include statements added in this
change. Breaking - rules is an error, breaking ! rules is a
warning.
"""
- # Copied from Chromium's src/PRESUBMIT.py.
-
- # We need to wait until we have an input_api object and use this
- # roundabout construct to import checkdeps because this file is
- # eval-ed and thus doesn't have __file__.
- src_path = FindSrcDirPath(input_api.PresubmitLocalPath())
- checkdeps_path = input_api.os_path.join(src_path, 'buildtools', 'checkdeps')
- if not os.path.exists(checkdeps_path):
- return [
- output_api.PresubmitError(
- 'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
- 'download all the DEPS entries?' % checkdeps_path)
- ]
- with _AddToPath(checkdeps_path):
- import checkdeps
- from cpp_checker import CppChecker
- from rules import Rule
-
- added_includes = []
- for f in input_api.AffectedFiles(file_filter=source_file_filter):
- if not CppChecker.IsCppFile(f.LocalPath()):
- continue
-
- changed_lines = [line for _, line in f.ChangedContents()]
- added_includes.append([f.LocalPath(), changed_lines])
-
- deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
-
- error_descriptions = []
- warning_descriptions = []
- for path, rule_type, rule_description in deps_checker.CheckAddedCppIncludes(
- added_includes):
- description_with_path = '%s\n %s' % (path, rule_description)
- if rule_type == Rule.DISALLOW:
- error_descriptions.append(description_with_path)
- else:
- warning_descriptions.append(description_with_path)
+ # Copied from Chromium's src/PRESUBMIT.py.
+
+ # We need to wait until we have an input_api object and use this
+ # roundabout construct to import checkdeps because this file is
+ # eval-ed and thus doesn't have __file__.
+ src_path = FindSrcDirPath(input_api.PresubmitLocalPath())
+ checkdeps_path = input_api.os_path.join(src_path, 'buildtools',
+ 'checkdeps')
+ if not os.path.exists(checkdeps_path):
+ return [
+ output_api.PresubmitError(
+ 'Cannot find checkdeps at %s\nHave you run "gclient sync" to '
+ 'download all the DEPS entries?' % checkdeps_path)
+ ]
+ with _AddToPath(checkdeps_path):
+ import checkdeps
+ from cpp_checker import CppChecker
+ from rules import Rule
+
+ added_includes = []
+ for f in input_api.AffectedFiles(file_filter=source_file_filter):
+ if not CppChecker.IsCppFile(f.LocalPath()):
+ continue
+
+ changed_lines = [line for _, line in f.ChangedContents()]
+ added_includes.append([f.LocalPath(), changed_lines])
+
+ deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
+
+ error_descriptions = []
+ warning_descriptions = []
+ for path, rule_type, rule_description in deps_checker.CheckAddedCppIncludes(
+ added_includes):
+ description_with_path = '%s\n %s' % (path, rule_description)
+ if rule_type == Rule.DISALLOW:
+ error_descriptions.append(description_with_path)
+ else:
+ warning_descriptions.append(description_with_path)
- results = []
- if error_descriptions:
- results.append(
- output_api.PresubmitError(
- 'You added one or more #includes that violate checkdeps rules.'
- '\nCheck that the DEPS files in these locations contain valid '
- 'rules.\nSee '
- 'https://cs.chromium.org/chromium/src/buildtools/checkdeps/ '
- 'for more details about checkdeps.', error_descriptions))
- if warning_descriptions:
- results.append(
- output_api.PresubmitPromptOrNotify(
- 'You added one or more #includes of files that are temporarily'
- '\nallowed but being removed. Can you avoid introducing the\n'
- '#include? See relevant DEPS file(s) for details and contacts.'
- '\nSee '
- 'https://cs.chromium.org/chromium/src/buildtools/checkdeps/ '
- 'for more details about checkdeps.', warning_descriptions))
- return results
+ results = []
+ if error_descriptions:
+ results.append(
+ output_api.PresubmitError(
+ 'You added one or more #includes that violate checkdeps rules.'
+ '\nCheck that the DEPS files in these locations contain valid '
+ 'rules.\nSee '
+ 'https://cs.chromium.org/chromium/src/buildtools/checkdeps/ '
+ 'for more details about checkdeps.', error_descriptions))
+ if warning_descriptions:
+ results.append(
+ output_api.PresubmitPromptOrNotify(
+ 'You added one or more #includes of files that are temporarily'
+ '\nallowed but being removed. Can you avoid introducing the\n'
+ '#include? See relevant DEPS file(s) for details and contacts.'
+ '\nSee '
+ 'https://cs.chromium.org/chromium/src/buildtools/checkdeps/ '
+ 'for more details about checkdeps.', warning_descriptions))
+ return results
def CheckCommitMessageBugEntry(input_api, output_api):
- """Check that bug entries are well-formed in commit message."""
- bogus_bug_msg = (
- 'Bogus Bug entry: %s. Please specify the issue tracker prefix and the '
- 'issue number, separated by a colon, e.g. webrtc:123 or chromium:12345.')
- results = []
- for bug in input_api.change.BugsFromDescription():
- bug = bug.strip()
- if bug.lower() == 'none':
- continue
- if 'b/' not in bug and ':' not in bug:
- try:
- if int(bug) > 100000:
- # Rough indicator for current chromium bugs.
- prefix_guess = 'chromium'
- else:
- prefix_guess = 'webrtc'
- results.append('Bug entry requires issue tracker prefix, e.g. %s:%s' %
- (prefix_guess, bug))
- except ValueError:
- results.append(bogus_bug_msg % bug)
- elif not (re.match(r'\w+:\d+', bug) or re.match(r'b/\d+', bug)):
- results.append(bogus_bug_msg % bug)
- return [output_api.PresubmitError(r) for r in results]
+ """Check that bug entries are well-formed in commit message."""
+ bogus_bug_msg = (
+ 'Bogus Bug entry: %s. Please specify the issue tracker prefix and the '
+ 'issue number, separated by a colon, e.g. webrtc:123 or chromium:12345.'
+ )
+ results = []
+ for bug in input_api.change.BugsFromDescription():
+ bug = bug.strip()
+ if bug.lower() == 'none':
+ continue
+ if 'b/' not in bug and ':' not in bug:
+ try:
+ if int(bug) > 100000:
+ # Rough indicator for current chromium bugs.
+ prefix_guess = 'chromium'
+ else:
+ prefix_guess = 'webrtc'
+ results.append(
+ 'Bug entry requires issue tracker prefix, e.g. %s:%s' %
+ (prefix_guess, bug))
+ except ValueError:
+ results.append(bogus_bug_msg % bug)
+ elif not (re.match(r'\w+:\d+', bug) or re.match(r'b/\d+', bug)):
+ results.append(bogus_bug_msg % bug)
+ return [output_api.PresubmitError(r) for r in results]
def CheckChangeHasBugField(input_api, output_api):
- """Requires that the changelist is associated with a bug.
+ """Requires that the changelist is associated with a bug.
This check is stricter than the one in depot_tools/presubmit_canned_checks.py
since it fails the presubmit if the bug field is missing or doesn't contain
@@ -775,277 +801,291 @@ def CheckChangeHasBugField(input_api, output_api):
This supports both 'BUG=' and 'Bug:' since we are in the process of migrating
to Gerrit and it encourages the usage of 'Bug:'.
"""
- if input_api.change.BugsFromDescription():
- return []
- return [
- output_api.PresubmitError(
- 'The "Bug: [bug number]" footer is mandatory. Please create a '
- 'bug and reference it using either of:\n'
- ' * https://bugs.webrtc.org - reference it using Bug: '
- 'webrtc:XXXX\n'
- ' * https://crbug.com - reference it using Bug: chromium:XXXXXX')
- ]
+ if input_api.change.BugsFromDescription():
+ return []
+ return [
+ output_api.PresubmitError(
+ 'The "Bug: [bug number]" footer is mandatory. Please create a '
+ 'bug and reference it using either of:\n'
+ ' * https://bugs.webrtc.org - reference it using Bug: '
+ 'webrtc:XXXX\n'
+ ' * https://crbug.com - reference it using Bug: chromium:XXXXXX')
+ ]
def CheckJSONParseErrors(input_api, output_api, source_file_filter):
- """Check that JSON files do not contain syntax errors."""
+ """Check that JSON files do not contain syntax errors."""
+ def FilterFile(affected_file):
+ return (input_api.os_path.splitext(affected_file.LocalPath())[1]
+ == '.json' and source_file_filter(affected_file))
+
+ def GetJSONParseError(input_api, filename):
+ try:
+ contents = input_api.ReadFile(filename)
+ input_api.json.loads(contents)
+ except ValueError as e:
+ return e
+ return None
+
+ results = []
+ for affected_file in input_api.AffectedFiles(file_filter=FilterFile,
+ include_deletes=False):
+ parse_error = GetJSONParseError(input_api,
+ affected_file.AbsoluteLocalPath())
+ if parse_error:
+ results.append(
+ output_api.PresubmitError(
+ '%s could not be parsed: %s' %
+ (affected_file.LocalPath(), parse_error)))
+ return results
- def FilterFile(affected_file):
- return (input_api.os_path.splitext(affected_file.LocalPath())[1] == '.json'
- and source_file_filter(affected_file))
- def GetJSONParseError(input_api, filename):
- try:
- contents = input_api.ReadFile(filename)
- input_api.json.loads(contents)
- except ValueError as e:
- return e
- return None
-
- results = []
- for affected_file in input_api.AffectedFiles(file_filter=FilterFile,
- include_deletes=False):
- parse_error = GetJSONParseError(input_api,
- affected_file.AbsoluteLocalPath())
- if parse_error:
- results.append(
- output_api.PresubmitError('%s could not be parsed: %s' %
- (affected_file.LocalPath(), parse_error)))
- return results
+def RunPythonTests(input_api, output_api):
+ def Join(*args):
+ return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)
+
+ excluded_files = [
+ # These tests should be run manually after webrtc_dashboard_upload
+ # target has been built.
+ 'catapult_uploader_test.py',
+ 'process_perf_results_test.py',
+ ]
+ test_directories = [
+ input_api.PresubmitLocalPath(),
+ Join('rtc_tools', 'py_event_log_analyzer'),
+ ] + [
+ root for root, _, files in os.walk(Join('tools_webrtc')) if any(
+ f.endswith('_test.py') and f not in excluded_files for f in files)
+ ]
-def RunPythonTests(input_api, output_api):
- def Join(*args):
- return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)
-
- excluded_files = [
- # These tests should be run manually after webrtc_dashboard_upload target
- # has been built.
- 'catapult_uploader_test.py',
- 'process_perf_results_test.py',
- ]
-
- test_directories = [
- input_api.PresubmitLocalPath(),
- Join('rtc_tools', 'py_event_log_analyzer'),
- ] + [
- root for root, _, files in os.walk(Join('tools_webrtc')) if any(
- f.endswith('_test.py') and f not in excluded_files for f in files)
- ]
-
- tests = []
-
- for directory in test_directories:
- tests.extend(
- input_api.canned_checks.GetUnitTestsInDirectory(
- input_api,
- output_api,
- directory,
- files_to_check=[r'.+_test\.py$'],
- run_on_python2=False))
- return input_api.RunTests(tests, parallel=True)
+ tests = []
+
+ for directory in test_directories:
+ tests.extend(
+ input_api.canned_checks.GetUnitTestsInDirectory(
+ input_api,
+ output_api,
+ directory,
+ files_to_check=[r'.+_test\.py$'],
+ run_on_python2=False))
+ return input_api.RunTests(tests, parallel=True)
def CheckUsageOfGoogleProtobufNamespace(input_api, output_api,
source_file_filter):
- """Checks that the namespace google::protobuf has not been used."""
- files = []
- pattern = input_api.re.compile(r'google::protobuf')
- proto_utils_path = os.path.join('rtc_base', 'protobuf_utils.h')
- file_filter = lambda x: (input_api.FilterSourceFile(x) and source_file_filter(
- x))
- for f in input_api.AffectedSourceFiles(file_filter):
- if f.LocalPath() in [proto_utils_path, 'PRESUBMIT.py']:
- continue
- contents = input_api.ReadFile(f)
- if pattern.search(contents):
- files.append(f)
-
- if files:
- return [
- output_api.PresubmitError(
- 'Please avoid to use namespace `google::protobuf` directly.\n'
- 'Add a using directive in `%s` and include that header instead.' %
- proto_utils_path, files)
- ]
- return []
+ """Checks that the namespace google::protobuf has not been used."""
+ files = []
+ pattern = input_api.re.compile(r'google::protobuf')
+ proto_utils_path = os.path.join('rtc_base', 'protobuf_utils.h')
+ file_filter = lambda x: (input_api.FilterSourceFile(x) and
+ source_file_filter(x))
+ for f in input_api.AffectedSourceFiles(file_filter):
+ if f.LocalPath() in [proto_utils_path, 'PRESUBMIT.py']:
+ continue
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ files.append(f)
+
+ if files:
+ return [
+ output_api.PresubmitError(
+ 'Please avoid to use namespace `google::protobuf` directly.\n'
+ 'Add a using directive in `%s` and include that header instead.'
+ % proto_utils_path, files)
+ ]
+ return []
def _LicenseHeader(input_api):
- """Returns the license header regexp."""
- # Accept any year number from 2003 to the current year
- current_year = int(input_api.time.strftime('%Y'))
- allowed_years = (str(s) for s in reversed(range(2003, current_year + 1)))
- years_re = '(' + '|'.join(allowed_years) + ')'
- license_header = (
- r'.*? Copyright( \(c\))? %(year)s The WebRTC [Pp]roject [Aa]uthors\. '
- r'All [Rr]ights [Rr]eserved\.\n'
- r'.*?\n'
- r'.*? Use of this source code is governed by a BSD-style license\n'
- r'.*? that can be found in the LICENSE file in the root of the source\n'
- r'.*? tree\. An additional intellectual property rights grant can be '
- r'found\n'
- r'.*? in the file PATENTS\. All contributing project authors may\n'
- r'.*? be found in the AUTHORS file in the root of the source tree\.\n'
- ) % {
- 'year': years_re,
- }
- return license_header
+ """Returns the license header regexp."""
+ # Accept any year number from 2003 to the current year
+ current_year = int(input_api.time.strftime('%Y'))
+ allowed_years = (str(s) for s in reversed(range(2003, current_year + 1)))
+ years_re = '(' + '|'.join(allowed_years) + ')'
+ license_header = (
+ r'.*? Copyright( \(c\))? %(year)s The WebRTC [Pp]roject [Aa]uthors\. '
+ r'All [Rr]ights [Rr]eserved\.\n'
+ r'.*?\n'
+ r'.*? Use of this source code is governed by a BSD-style license\n'
+ r'.*? that can be found in the LICENSE file in the root of the source\n'
+ r'.*? tree\. An additional intellectual property rights grant can be '
+ r'found\n'
+ r'.*? in the file PATENTS\. All contributing project authors may\n'
+ r'.*? be found in the AUTHORS file in the root of the source tree\.\n'
+ ) % {
+ 'year': years_re,
+ }
+ return license_header
def CommonChecks(input_api, output_api):
- """Checks common to both upload and commit."""
- results = []
- # Filter out files that are in objc or ios dirs from being cpplint-ed since
- # they do not follow C++ lint rules.
- exception_list = input_api.DEFAULT_FILES_TO_SKIP + (
- r".*\bobjc[\\\/].*",
- r".*objc\.[hcm]+$",
- )
- source_file_filter = lambda x: input_api.FilterSourceFile(
- x, None, exception_list)
- results.extend(
- CheckApprovedFilesLintClean(input_api, output_api, source_file_filter))
- results.extend(
- input_api.canned_checks.CheckLicense(input_api, output_api,
- _LicenseHeader(input_api)))
-
- # TODO(bugs.webrtc.org/12114): Delete this filter and run pylint on
- # all python files. This is a temporary solution.
- python_file_filter = lambda f: (f.LocalPath().endswith('.py') and
- source_file_filter(f))
- python_changed_files = [
- f.LocalPath()
- for f in input_api.AffectedFiles(include_deletes=False,
- file_filter=python_file_filter)
- ]
-
- results.extend(
- input_api.canned_checks.RunPylint(
- input_api,
- output_api,
- files_to_check=python_changed_files,
- files_to_skip=(
- r'^base[\\\/].*\.py$',
- r'^build[\\\/].*\.py$',
- r'^buildtools[\\\/].*\.py$',
- r'^infra[\\\/].*\.py$',
- r'^ios[\\\/].*\.py$',
- r'^out.*[\\\/].*\.py$',
- r'^testing[\\\/].*\.py$',
- r'^third_party[\\\/].*\.py$',
- r'^tools[\\\/].*\.py$',
- r'^xcodebuild.*[\\\/].*\.py$',
- ),
- pylintrc='pylintrc',
- version='2.7'))
-
- # TODO(bugs.webrtc.org/13606): talk/ is no more, so make below checks simpler?
- # WebRTC can't use the presubmit_canned_checks.PanProjectChecks function
- # since we need to have different license checks
- # in talk/ and webrtc/directories.
- # Instead, hand-picked checks are included below.
-
- # .m and .mm files are ObjC files. For simplicity we will consider
- # .h files in ObjC subdirectories ObjC headers.
- objc_filter_list = (r'.+\.m$', r'.+\.mm$', r'.+objc\/.+\.h$')
- # Skip long-lines check for DEPS and GN files.
- build_file_filter_list = (r'.+\.gn$', r'.+\.gni$', 'DEPS')
- # Also we will skip most checks for third_party directory.
- third_party_filter_list = (r'(^|.*[\\\/])third_party[\\\/].+', )
- eighty_char_sources = lambda x: input_api.FilterSourceFile(
- x,
- files_to_skip=build_file_filter_list + objc_filter_list +
- third_party_filter_list)
- hundred_char_sources = lambda x: input_api.FilterSourceFile(
- x, files_to_check=objc_filter_list)
- non_third_party_sources = lambda x: input_api.FilterSourceFile(
- x, files_to_skip=third_party_filter_list)
-
- results.extend(
- input_api.canned_checks.CheckLongLines(
- input_api,
- output_api,
- maxlen=80,
- source_file_filter=eighty_char_sources))
- results.extend(
- input_api.canned_checks.CheckLongLines(
- input_api,
- output_api,
- maxlen=100,
- source_file_filter=hundred_char_sources))
- results.extend(
- input_api.canned_checks.CheckChangeHasNoTabs(
- input_api, output_api, source_file_filter=non_third_party_sources))
- results.extend(
- input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
- input_api, output_api, source_file_filter=non_third_party_sources))
- results.extend(
- input_api.canned_checks.CheckAuthorizedAuthor(
- input_api,
- output_api,
- bot_allowlist=[
- 'chromium-webrtc-autoroll@webrtc-ci.iam.gserviceaccount.com',
- 'webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com',
- ]))
- results.extend(
- input_api.canned_checks.CheckChangeTodoHasOwner(
- input_api, output_api, source_file_filter=non_third_party_sources))
- results.extend(
- input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
- results.extend(CheckNativeApiHeaderChanges(input_api, output_api))
- results.extend(
- CheckNoIOStreamInHeaders(input_api,
- output_api,
- source_file_filter=non_third_party_sources))
- results.extend(
- CheckNoPragmaOnce(input_api,
- output_api,
- source_file_filter=non_third_party_sources))
- results.extend(
- CheckNoFRIEND_TEST(input_api,
- output_api,
- source_file_filter=non_third_party_sources))
- results.extend(CheckGnChanges(input_api, output_api))
- results.extend(
- CheckUnwantedDependencies(input_api,
- output_api,
- source_file_filter=non_third_party_sources))
- results.extend(
- CheckJSONParseErrors(input_api,
+ """Checks common to both upload and commit."""
+ results = []
+ # Filter out files that are in objc or ios dirs from being cpplint-ed since
+ # they do not follow C++ lint rules.
+ exception_list = input_api.DEFAULT_FILES_TO_SKIP + (
+ r".*\bobjc[\\\/].*",
+ r".*objc\.[hcm]+$",
+ )
+ source_file_filter = lambda x: input_api.FilterSourceFile(
+ x, None, exception_list)
+ results.extend(
+ CheckApprovedFilesLintClean(input_api, output_api, source_file_filter))
+ results.extend(
+ input_api.canned_checks.CheckLicense(input_api, output_api,
+ _LicenseHeader(input_api)))
+
+ # TODO(bugs.webrtc.org/12114): Delete this filter and run pylint on
+ # all python files. This is a temporary solution.
+ python_file_filter = lambda f: (f.LocalPath().endswith('.py') and
+ source_file_filter(f))
+ python_changed_files = [
+ f.LocalPath()
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=python_file_filter)
+ ]
+ pylint_new_style = [
+ f for f in python_changed_files if f not in PYLINT_OLD_STYLE
+ ]
+ pylint_old_style = [
+ f for f in python_changed_files if f in PYLINT_OLD_STYLE
+ ]
+ if pylint_new_style:
+ results.extend(
+ input_api.canned_checks.RunPylint(
+ input_api,
+ output_api,
+ files_to_check=pylint_new_style,
+ files_to_skip=(
+ r'^base[\\\/].*\.py$',
+ r'^build[\\\/].*\.py$',
+ r'^buildtools[\\\/].*\.py$',
+ r'^infra[\\\/].*\.py$',
+ r'^ios[\\\/].*\.py$',
+ r'^out.*[\\\/].*\.py$',
+ r'^testing[\\\/].*\.py$',
+ r'^third_party[\\\/].*\.py$',
+ r'^tools[\\\/].*\.py$',
+ r'^xcodebuild.*[\\\/].*\.py$',
+ ),
+ pylintrc='pylintrc',
+ version='2.7'))
+
+ if pylint_old_style:
+ results.extend(
+ input_api.canned_checks.RunPylint(input_api,
+ output_api,
+ files_to_check=pylint_old_style,
+ pylintrc='pylintrc_old_style',
+ version='2.7'))
+ # TODO(bugs.webrtc.org/13606): talk/ is no more, so make below checks
+ # simpler. WebRTC can't use the presubmit_canned_checks.PanProjectChecks
+ # function since we need to have different license checks in talk/ and
+ # webrtc/directories. Instead, hand-picked checks are included below.
+
+ # .m and .mm files are ObjC files. For simplicity we will consider
+ # .h files in ObjC subdirectories ObjC headers.
+ objc_filter_list = (r'.+\.m$', r'.+\.mm$', r'.+objc\/.+\.h$')
+ # Skip long-lines check for DEPS and GN files.
+ build_file_filter_list = (r'.+\.gn$', r'.+\.gni$', 'DEPS')
+ # Also we will skip most checks for third_party directory.
+ third_party_filter_list = (r'(^|.*[\\\/])third_party[\\\/].+', )
+ eighty_char_sources = lambda x: input_api.FilterSourceFile(
+ x,
+ files_to_skip=build_file_filter_list + objc_filter_list +
+ third_party_filter_list)
+ hundred_char_sources = lambda x: input_api.FilterSourceFile(
+ x, files_to_check=objc_filter_list)
+ non_third_party_sources = lambda x: input_api.FilterSourceFile(
+ x, files_to_skip=third_party_filter_list)
+
+ results.extend(
+ input_api.canned_checks.CheckLongLines(
+ input_api,
+ output_api,
+ maxlen=80,
+ source_file_filter=eighty_char_sources))
+ results.extend(
+ input_api.canned_checks.CheckLongLines(
+ input_api,
+ output_api,
+ maxlen=100,
+ source_file_filter=hundred_char_sources))
+ results.extend(
+ input_api.canned_checks.CheckChangeHasNoTabs(
+ input_api, output_api, source_file_filter=non_third_party_sources))
+ results.extend(
+ input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
+ input_api, output_api, source_file_filter=non_third_party_sources))
+ results.extend(
+ input_api.canned_checks.CheckAuthorizedAuthor(
+ input_api,
+ output_api,
+ bot_allowlist=[
+ 'chromium-webrtc-autoroll@webrtc-ci.iam.gserviceaccount.com',
+ 'webrtc-version-updater@webrtc-ci.iam.gserviceaccount.com',
+ ]))
+ results.extend(
+ input_api.canned_checks.CheckChangeTodoHasOwner(
+ input_api, output_api, source_file_filter=non_third_party_sources))
+ results.extend(
+ input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
+ results.extend(CheckNativeApiHeaderChanges(input_api, output_api))
+ results.extend(
+ CheckNoIOStreamInHeaders(input_api,
+ output_api,
+ source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckNoPragmaOnce(input_api,
+ output_api,
+ source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckNoFRIEND_TEST(input_api,
output_api,
source_file_filter=non_third_party_sources))
- results.extend(RunPythonTests(input_api, output_api))
- results.extend(
- CheckUsageOfGoogleProtobufNamespace(
- input_api, output_api, source_file_filter=non_third_party_sources))
- results.extend(
- CheckOrphanHeaders(input_api,
- output_api,
- source_file_filter=non_third_party_sources))
- results.extend(
- CheckNewlineAtTheEndOfProtoFiles(
- input_api, output_api, source_file_filter=non_third_party_sources))
- results.extend(
- CheckNoStreamUsageIsAdded(input_api, output_api, non_third_party_sources))
- results.extend(
- CheckNoTestCaseUsageIsAdded(input_api, output_api,
+ results.extend(CheckGnChanges(input_api, output_api))
+ results.extend(
+ CheckUnwantedDependencies(input_api,
+ output_api,
+ source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckJSONParseErrors(input_api,
+ output_api,
+ source_file_filter=non_third_party_sources))
+ results.extend(RunPythonTests(input_api, output_api))
+ results.extend(
+ CheckUsageOfGoogleProtobufNamespace(
+ input_api, output_api, source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckOrphanHeaders(input_api,
+ output_api,
+ source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckNewlineAtTheEndOfProtoFiles(
+ input_api, output_api, source_file_filter=non_third_party_sources))
+ results.extend(
+ CheckNoStreamUsageIsAdded(input_api, output_api,
non_third_party_sources))
- results.extend(CheckAddedDepsHaveTargetApprovals(input_api, output_api))
- results.extend(CheckApiDepsFileIsUpToDate(input_api, output_api))
- results.extend(
- CheckAbslMemoryInclude(input_api, output_api, non_third_party_sources))
- results.extend(
- CheckAssertUsage(input_api, output_api, non_third_party_sources))
- results.extend(
- CheckBannedAbslMakeUnique(input_api, output_api, non_third_party_sources))
- results.extend(
- CheckObjcApiSymbols(input_api, output_api, non_third_party_sources))
- return results
+ results.extend(
+ CheckNoTestCaseUsageIsAdded(input_api, output_api,
+ non_third_party_sources))
+ results.extend(CheckAddedDepsHaveTargetApprovals(input_api, output_api))
+ results.extend(CheckApiDepsFileIsUpToDate(input_api, output_api))
+ results.extend(
+ CheckAbslMemoryInclude(input_api, output_api, non_third_party_sources))
+ results.extend(
+ CheckAssertUsage(input_api, output_api, non_third_party_sources))
+ results.extend(
+ CheckBannedAbslMakeUnique(input_api, output_api,
+ non_third_party_sources))
+ results.extend(
+ CheckObjcApiSymbols(input_api, output_api, non_third_party_sources))
+ return results
def CheckApiDepsFileIsUpToDate(input_api, output_api):
- """Check that 'include_rules' in api/DEPS is up to date.
+ """Check that 'include_rules' in api/DEPS is up to date.
The file api/DEPS must be kept up to date in order to avoid to avoid to
include internal header from WebRTC's api/ headers.
@@ -1054,378 +1094,384 @@ def CheckApiDepsFileIsUpToDate(input_api, output_api):
rule for each root level directory. More focused allow rules can be
added to 'specific_include_rules'.
"""
- results = []
- api_deps = os.path.join(input_api.PresubmitLocalPath(), 'api', 'DEPS')
- with open(api_deps) as f:
- deps_content = _ParseDeps(f.read())
-
- include_rules = deps_content.get('include_rules', [])
- dirs_to_skip = set(['api', 'docs'])
-
- # Only check top level directories affected by the current CL.
- dirs_to_check = set()
- for f in input_api.AffectedFiles():
- path_tokens = [t for t in f.LocalPath().split(os.sep) if t]
- if len(path_tokens) > 1:
- if (path_tokens[0] not in dirs_to_skip and os.path.isdir(
- os.path.join(input_api.PresubmitLocalPath(), path_tokens[0]))):
- dirs_to_check.add(path_tokens[0])
-
- missing_include_rules = set()
- for p in dirs_to_check:
- rule = '-%s' % p
- if rule not in include_rules:
- missing_include_rules.add(rule)
-
- if missing_include_rules:
- error_msg = [
- 'include_rules = [\n',
- ' ...\n',
- ]
+ results = []
+ api_deps = os.path.join(input_api.PresubmitLocalPath(), 'api', 'DEPS')
+ with open(api_deps) as f:
+ deps_content = _ParseDeps(f.read())
+
+ include_rules = deps_content.get('include_rules', [])
+ dirs_to_skip = set(['api', 'docs'])
+
+ # Only check top level directories affected by the current CL.
+ dirs_to_check = set()
+ for f in input_api.AffectedFiles():
+ path_tokens = [t for t in f.LocalPath().split(os.sep) if t]
+ if len(path_tokens) > 1:
+ if (path_tokens[0] not in dirs_to_skip and os.path.isdir(
+ os.path.join(input_api.PresubmitLocalPath(),
+ path_tokens[0]))):
+ dirs_to_check.add(path_tokens[0])
+
+ missing_include_rules = set()
+ for p in dirs_to_check:
+ rule = '-%s' % p
+ if rule not in include_rules:
+ missing_include_rules.add(rule)
+
+ if missing_include_rules:
+ error_msg = [
+ 'include_rules = [\n',
+ ' ...\n',
+ ]
+
+ for r in sorted(missing_include_rules):
+ error_msg.append(' "%s",\n' % str(r))
+
+ error_msg.append(' ...\n')
+ error_msg.append(']\n')
- for r in sorted(missing_include_rules):
- error_msg.append(' "%s",\n' % str(r))
-
- error_msg.append(' ...\n')
- error_msg.append(']\n')
-
- results.append(
- output_api.PresubmitError(
- 'New root level directory detected! WebRTC api/ headers should '
- 'not #include headers from \n'
- 'the new directory, so please update "include_rules" in file\n'
- '"%s". Example:\n%s\n' % (api_deps, ''.join(error_msg))))
+ results.append(
+ output_api.PresubmitError(
+ 'New root level directory detected! WebRTC api/ headers should '
+ 'not #include headers from \n'
+ 'the new directory, so please update "include_rules" in file\n'
+ '"%s". Example:\n%s\n' % (api_deps, ''.join(error_msg))))
- return results
+ return results
def CheckBannedAbslMakeUnique(input_api, output_api, source_file_filter):
- file_filter = lambda f: (f.LocalPath().endswith(('.cc', '.h')) and
- source_file_filter(f))
-
- files = []
- for f in input_api.AffectedFiles(include_deletes=False,
- file_filter=file_filter):
- for _, line in f.ChangedContents():
- if 'absl::make_unique' in line:
- files.append(f)
- break
-
- if files:
- return [
- output_api.PresubmitError(
- 'Please use std::make_unique instead of absl::make_unique.\n'
- 'Affected files:', files)
- ]
- return []
+ file_filter = lambda f: (f.LocalPath().endswith(
+ ('.cc', '.h')) and source_file_filter(f))
+
+ files = []
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ for _, line in f.ChangedContents():
+ if 'absl::make_unique' in line:
+ files.append(f)
+ break
+
+ if files:
+ return [
+ output_api.PresubmitError(
+ 'Please use std::make_unique instead of absl::make_unique.\n'
+ 'Affected files:', files)
+ ]
+ return []
def CheckObjcApiSymbols(input_api, output_api, source_file_filter):
- rtc_objc_export = re.compile(r'RTC_OBJC_EXPORT(.|\n){26}',
- re.MULTILINE | re.DOTALL)
- file_filter = lambda f: (f.LocalPath().endswith(('.h')) and
- source_file_filter(f))
-
- files = []
- file_filter = lambda x: (input_api.FilterSourceFile(x) and source_file_filter(
- x))
- for f in input_api.AffectedSourceFiles(file_filter):
- if not f.LocalPath().endswith('.h') or not 'sdk/objc' in f.LocalPath():
- continue
- if f.LocalPath().endswith('sdk/objc/base/RTCMacros.h'):
- continue
- contents = input_api.ReadFile(f)
- for match in rtc_objc_export.finditer(contents):
- export_block = match.group(0)
- if 'RTC_OBJC_TYPE' not in export_block:
- files.append(f.LocalPath())
-
- if len(files) > 0:
- return [
- output_api.PresubmitError(
- 'RTC_OBJC_EXPORT types must be wrapped into an RTC_OBJC_TYPE() ' +
- 'macro.\n\n' + 'For example:\n' +
- 'RTC_OBJC_EXPORT @protocol RTC_OBJC_TYPE(RtcFoo)\n\n' +
- 'RTC_OBJC_EXPORT @interface RTC_OBJC_TYPE(RtcFoo)\n\n' +
- 'Please fix the following files:', files)
- ]
- return []
+ rtc_objc_export = re.compile(r'RTC_OBJC_EXPORT(.|\n){26}',
+ re.MULTILINE | re.DOTALL)
+ file_filter = lambda f: (f.LocalPath().endswith(
+ ('.h')) and source_file_filter(f))
+
+ files = []
+ file_filter = lambda x: (input_api.FilterSourceFile(x) and
+ source_file_filter(x))
+ for f in input_api.AffectedSourceFiles(file_filter):
+ if not f.LocalPath().endswith('.h') or not 'sdk/objc' in f.LocalPath():
+ continue
+ if f.LocalPath().endswith('sdk/objc/base/RTCMacros.h'):
+ continue
+ contents = input_api.ReadFile(f)
+ for match in rtc_objc_export.finditer(contents):
+ export_block = match.group(0)
+ if 'RTC_OBJC_TYPE' not in export_block:
+ files.append(f.LocalPath())
+
+ if len(files) > 0:
+ return [
+ output_api.PresubmitError(
+ 'RTC_OBJC_EXPORT types must be wrapped into an RTC_OBJC_TYPE() '
+ + 'macro.\n\n' + 'For example:\n' +
+ 'RTC_OBJC_EXPORT @protocol RTC_OBJC_TYPE(RtcFoo)\n\n' +
+ 'RTC_OBJC_EXPORT @interface RTC_OBJC_TYPE(RtcFoo)\n\n' +
+ 'Please fix the following files:', files)
+ ]
+ return []
def CheckAssertUsage(input_api, output_api, source_file_filter):
- pattern = input_api.re.compile(r'\bassert\(')
- file_filter = lambda f: (f.LocalPath().endswith(('.cc', '.h', '.m', '.mm'))
- and source_file_filter(f))
-
- files = []
- for f in input_api.AffectedFiles(include_deletes=False,
- file_filter=file_filter):
- for _, line in f.ChangedContents():
- if pattern.search(line):
- files.append(f.LocalPath())
- break
-
- if len(files) > 0:
- return [
- output_api.PresubmitError(
- 'Usage of assert() has been detected in the following files, '
- 'please use RTC_DCHECK() instead.\n Files:', files)
- ]
- return []
+ pattern = input_api.re.compile(r'\bassert\(')
+ file_filter = lambda f: (f.LocalPath().endswith(
+ ('.cc', '.h', '.m', '.mm')) and source_file_filter(f))
+
+ files = []
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ for _, line in f.ChangedContents():
+ if pattern.search(line):
+ files.append(f.LocalPath())
+ break
+
+ if len(files) > 0:
+ return [
+ output_api.PresubmitError(
+ 'Usage of assert() has been detected in the following files, '
+ 'please use RTC_DCHECK() instead.\n Files:', files)
+ ]
+ return []
def CheckAbslMemoryInclude(input_api, output_api, source_file_filter):
- pattern = input_api.re.compile(r'^#include\s*"absl/memory/memory.h"',
- input_api.re.MULTILINE)
- file_filter = lambda f: (f.LocalPath().endswith(('.cc', '.h')) and
- source_file_filter(f))
-
- files = []
- for f in input_api.AffectedFiles(include_deletes=False,
- file_filter=file_filter):
- contents = input_api.ReadFile(f)
- if pattern.search(contents):
- continue
- for _, line in f.ChangedContents():
- if 'absl::WrapUnique' in line:
- files.append(f)
- break
-
- if len(files) > 0:
- return [
- output_api.PresubmitError(
- 'Please include "absl/memory/memory.h" header for '
- 'absl::WrapUnique.\nThis header may or may not be included '
- 'transitively depending on the C++ standard version.', files)
- ]
- return []
+ pattern = input_api.re.compile(r'^#include\s*"absl/memory/memory.h"',
+ input_api.re.MULTILINE)
+ file_filter = lambda f: (f.LocalPath().endswith(
+ ('.cc', '.h')) and source_file_filter(f))
+
+ files = []
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ contents = input_api.ReadFile(f)
+ if pattern.search(contents):
+ continue
+ for _, line in f.ChangedContents():
+ if 'absl::WrapUnique' in line:
+ files.append(f)
+ break
+
+ if len(files) > 0:
+ return [
+ output_api.PresubmitError(
+ 'Please include "absl/memory/memory.h" header for '
+ 'absl::WrapUnique.\nThis header may or may not be included '
+ 'transitively depending on the C++ standard version.', files)
+ ]
+ return []
def CheckChangeOnUpload(input_api, output_api):
- results = []
- results.extend(CommonChecks(input_api, output_api))
- results.extend(CheckGnGen(input_api, output_api))
- results.extend(input_api.canned_checks.CheckGNFormatted(
- input_api, output_api))
- return results
+ results = []
+ results.extend(CommonChecks(input_api, output_api))
+ results.extend(CheckGnGen(input_api, output_api))
+ results.extend(
+ input_api.canned_checks.CheckGNFormatted(input_api, output_api))
+ return results
def CheckChangeOnCommit(input_api, output_api):
- results = []
- results.extend(CommonChecks(input_api, output_api))
- results.extend(VerifyNativeApiHeadersListIsValid(input_api, output_api))
- results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
- results.extend(
- input_api.canned_checks.CheckChangeWasUploaded(input_api, output_api))
- results.extend(
- input_api.canned_checks.CheckChangeHasDescription(input_api, output_api))
- results.extend(CheckChangeHasBugField(input_api, output_api))
- results.extend(CheckCommitMessageBugEntry(input_api, output_api))
- results.extend(
- input_api.canned_checks.CheckTreeIsOpen(
- input_api,
- output_api,
- json_url='http://webrtc-status.appspot.com/current?format=json'))
- return results
+ results = []
+ results.extend(CommonChecks(input_api, output_api))
+ results.extend(VerifyNativeApiHeadersListIsValid(input_api, output_api))
+ results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
+ results.extend(
+ input_api.canned_checks.CheckChangeWasUploaded(input_api, output_api))
+ results.extend(
+ input_api.canned_checks.CheckChangeHasDescription(
+ input_api, output_api))
+ results.extend(CheckChangeHasBugField(input_api, output_api))
+ results.extend(CheckCommitMessageBugEntry(input_api, output_api))
+ results.extend(
+ input_api.canned_checks.CheckTreeIsOpen(
+ input_api,
+ output_api,
+ json_url='http://webrtc-status.appspot.com/current?format=json'))
+ return results
def CheckOrphanHeaders(input_api, output_api, source_file_filter):
- # We need to wait until we have an input_api object and use this
- # roundabout construct to import prebubmit_checks_lib because this file is
- # eval-ed and thus doesn't have __file__.
- error_msg = """{} should be listed in {}."""
- results = []
- exempt_paths = [re.escape(os.path.join('tools_webrtc', 'ios', 'SDK'))]
-
- with _AddToPath(
- input_api.os_path.join(input_api.PresubmitLocalPath(), 'tools_webrtc',
- 'presubmit_checks_lib')):
- from check_orphan_headers import GetBuildGnPathFromFilePath
- from check_orphan_headers import IsHeaderInBuildGn
-
- file_filter = lambda x: input_api.FilterSourceFile(
- x, files_to_skip=exempt_paths) and source_file_filter(x)
- for f in input_api.AffectedSourceFiles(file_filter):
- if f.LocalPath().endswith('.h'):
- file_path = os.path.abspath(f.LocalPath())
- root_dir = os.getcwd()
- gn_file_path = GetBuildGnPathFromFilePath(file_path, os.path.exists,
- root_dir)
- in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path)
- if not in_build_gn:
- results.append(
- output_api.PresubmitError(
- error_msg.format(f.LocalPath(), os.path.relpath(gn_file_path))))
- return results
+ # We need to wait until we have an input_api object and use this
+ # roundabout construct to import prebubmit_checks_lib because this file is
+ # eval-ed and thus doesn't have __file__.
+ error_msg = """{} should be listed in {}."""
+ results = []
+ exempt_paths = [re.escape(os.path.join('tools_webrtc', 'ios', 'SDK'))]
+
+ with _AddToPath(
+ input_api.os_path.join(input_api.PresubmitLocalPath(),
+ 'tools_webrtc', 'presubmit_checks_lib')):
+ from check_orphan_headers import GetBuildGnPathFromFilePath
+ from check_orphan_headers import IsHeaderInBuildGn
+
+ file_filter = lambda x: input_api.FilterSourceFile(
+ x, files_to_skip=exempt_paths) and source_file_filter(x)
+ for f in input_api.AffectedSourceFiles(file_filter):
+ if f.LocalPath().endswith('.h'):
+ file_path = os.path.abspath(f.LocalPath())
+ root_dir = os.getcwd()
+ gn_file_path = GetBuildGnPathFromFilePath(file_path,
+ os.path.exists, root_dir)
+ in_build_gn = IsHeaderInBuildGn(file_path, gn_file_path)
+ if not in_build_gn:
+ results.append(
+ output_api.PresubmitError(
+ error_msg.format(f.LocalPath(),
+ os.path.relpath(gn_file_path))))
+ return results
def CheckNewlineAtTheEndOfProtoFiles(input_api, output_api,
source_file_filter):
- """Checks that all .proto files are terminated with a newline."""
- error_msg = 'File {} must end with exactly one newline.'
- results = []
- file_filter = lambda x: input_api.FilterSourceFile(
- x, files_to_check=(r'.+\.proto$', )) and source_file_filter(x)
- for f in input_api.AffectedSourceFiles(file_filter):
- file_path = f.LocalPath()
- with open(file_path) as f:
- lines = f.readlines()
- if len(lines) > 0 and not lines[-1].endswith('\n'):
- results.append(output_api.PresubmitError(error_msg.format(file_path)))
- return results
+ """Checks that all .proto files are terminated with a newline."""
+ error_msg = 'File {} must end with exactly one newline.'
+ results = []
+ file_filter = lambda x: input_api.FilterSourceFile(
+ x, files_to_check=(r'.+\.proto$', )) and source_file_filter(x)
+ for f in input_api.AffectedSourceFiles(file_filter):
+ file_path = f.LocalPath()
+ with open(file_path) as f:
+ lines = f.readlines()
+ if len(lines) > 0 and not lines[-1].endswith('\n'):
+ results.append(
+ output_api.PresubmitError(error_msg.format(file_path)))
+ return results
def _ExtractAddRulesFromParsedDeps(parsed_deps):
- """Extract the rules that add dependencies from a parsed DEPS file.
+ """Extract the rules that add dependencies from a parsed DEPS file.
Args:
parsed_deps: the locals dictionary from evaluating the DEPS file."""
- add_rules = set()
- add_rules.update([
- rule[1:] for rule in parsed_deps.get('include_rules', [])
- if rule.startswith('+') or rule.startswith('!')
- ])
- for _, rules in parsed_deps.get('specific_include_rules', {}).items():
+ add_rules = set()
add_rules.update([
- rule[1:] for rule in rules
+ rule[1:] for rule in parsed_deps.get('include_rules', [])
if rule.startswith('+') or rule.startswith('!')
])
- return add_rules
+ for _, rules in parsed_deps.get('specific_include_rules', {}).items():
+ add_rules.update([
+ rule[1:] for rule in rules
+ if rule.startswith('+') or rule.startswith('!')
+ ])
+ return add_rules
def _ParseDeps(contents):
- """Simple helper for parsing DEPS files."""
+ """Simple helper for parsing DEPS files."""
- # Stubs for handling special syntax in the root DEPS file.
- class VarImpl:
- def __init__(self, local_scope):
- self._local_scope = local_scope
+ # Stubs for handling special syntax in the root DEPS file.
+ class VarImpl:
+ def __init__(self, local_scope):
+ self._local_scope = local_scope
- def Lookup(self, var_name):
- """Implements the Var syntax."""
- try:
- return self._local_scope['vars'][var_name]
- except KeyError as var_not_defined:
- raise Exception('Var is not defined: %s' %
- var_name) from var_not_defined
+ def Lookup(self, var_name):
+ """Implements the Var syntax."""
+ try:
+ return self._local_scope['vars'][var_name]
+ except KeyError as var_not_defined:
+ raise Exception('Var is not defined: %s' %
+ var_name) from var_not_defined
- local_scope = {}
- global_scope = {
- 'Var': VarImpl(local_scope).Lookup,
- }
- exec(contents, global_scope, local_scope)
- return local_scope
+ local_scope = {}
+ global_scope = {
+ 'Var': VarImpl(local_scope).Lookup,
+ }
+ exec(contents, global_scope, local_scope)
+ return local_scope
def _CalculateAddedDeps(os_path, old_contents, new_contents):
- """Helper method for _CheckAddedDepsHaveTargetApprovals. Returns
+ """Helper method for _CheckAddedDepsHaveTargetApprovals. Returns
a set of DEPS entries that we should look up.
For a directory (rather than a specific filename) we fake a path to
a specific filename by adding /DEPS. This is chosen as a file that
will seldom or never be subject to per-file include_rules.
"""
- # We ignore deps entries on auto-generated directories.
- auto_generated_dirs = ['grit', 'jni']
+ # We ignore deps entries on auto-generated directories.
+ auto_generated_dirs = ['grit', 'jni']
- old_deps = _ExtractAddRulesFromParsedDeps(_ParseDeps(old_contents))
- new_deps = _ExtractAddRulesFromParsedDeps(_ParseDeps(new_contents))
+ old_deps = _ExtractAddRulesFromParsedDeps(_ParseDeps(old_contents))
+ new_deps = _ExtractAddRulesFromParsedDeps(_ParseDeps(new_contents))
- added_deps = new_deps.difference(old_deps)
+ added_deps = new_deps.difference(old_deps)
- results = set()
- for added_dep in added_deps:
- if added_dep.split('/')[0] in auto_generated_dirs:
- continue
- # Assume that a rule that ends in .h is a rule for a specific file.
- if added_dep.endswith('.h'):
- results.add(added_dep)
- else:
- results.add(os_path.join(added_dep, 'DEPS'))
- return results
+ results = set()
+ for added_dep in added_deps:
+ if added_dep.split('/')[0] in auto_generated_dirs:
+ continue
+ # Assume that a rule that ends in .h is a rule for a specific file.
+ if added_dep.endswith('.h'):
+ results.add(added_dep)
+ else:
+ results.add(os_path.join(added_dep, 'DEPS'))
+ return results
def CheckAddedDepsHaveTargetApprovals(input_api, output_api):
- """When a dependency prefixed with + is added to a DEPS file, we
+ """When a dependency prefixed with + is added to a DEPS file, we
want to make sure that the change is reviewed by an OWNER of the
target file or directory, to avoid layering violations from being
introduced. This check verifies that this happens.
"""
- virtual_depended_on_files = set()
-
- file_filter = lambda f: not input_api.re.match(
- r"^third_party[\\\/](WebKit|blink)[\\\/].*", f.LocalPath())
- for f in input_api.AffectedFiles(include_deletes=False,
- file_filter=file_filter):
- filename = input_api.os_path.basename(f.LocalPath())
- if filename == 'DEPS':
- virtual_depended_on_files.update(
- _CalculateAddedDeps(input_api.os_path, '\n'.join(f.OldContents()),
- '\n'.join(f.NewContents())))
-
- if not virtual_depended_on_files:
- return []
+ virtual_depended_on_files = set()
+
+ file_filter = lambda f: not input_api.re.match(
+ r"^third_party[\\\/](WebKit|blink)[\\\/].*", f.LocalPath())
+ for f in input_api.AffectedFiles(include_deletes=False,
+ file_filter=file_filter):
+ filename = input_api.os_path.basename(f.LocalPath())
+ if filename == 'DEPS':
+ virtual_depended_on_files.update(
+ _CalculateAddedDeps(input_api.os_path,
+ '\n'.join(f.OldContents()),
+ '\n'.join(f.NewContents())))
+
+ if not virtual_depended_on_files:
+ return []
- if input_api.is_committing:
- if input_api.tbr:
- return [
- output_api.PresubmitNotifyResult(
- '--tbr was specified, skipping OWNERS check for DEPS '
- 'additions')
- ]
- if input_api.dry_run:
- return [
- output_api.PresubmitNotifyResult(
- 'This is a dry run, skipping OWNERS check for DEPS '
- 'additions')
- ]
- if not input_api.change.issue:
- return [
- output_api.PresubmitError(
- "DEPS approval by OWNERS check failed: this change has "
- "no change number, so we can't check it for approvals.")
- ]
- output = output_api.PresubmitError
- else:
- output = output_api.PresubmitNotifyResult
-
- owner_email, reviewers = (
- input_api.canned_checks.GetCodereviewOwnerAndReviewers(
- input_api, None, approval_needed=input_api.is_committing))
-
- owner_email = owner_email or input_api.change.author_email
-
- approval_status = input_api.owners_client.GetFilesApprovalStatus(
- virtual_depended_on_files, reviewers.union([owner_email]), [])
- missing_files = [
- f for f in virtual_depended_on_files
- if approval_status[f] != input_api.owners_client.APPROVED
- ]
-
- # We strip the /DEPS part that was added by
- # _FilesToCheckForIncomingDeps to fake a path to a file in a
- # directory.
- def StripDeps(path):
- start_deps = path.rfind('/DEPS')
- if start_deps != -1:
- return path[:start_deps]
- return path
-
- unapproved_dependencies = [
- "'+%s'," % StripDeps(path) for path in missing_files
- ]
-
- if unapproved_dependencies:
- output_list = [
- output('You need LGTM from owners of depends-on paths in DEPS that '
- ' were modified in this CL:\n %s' %
- '\n '.join(sorted(unapproved_dependencies)))
+ if input_api.is_committing:
+ if input_api.tbr:
+ return [
+ output_api.PresubmitNotifyResult(
+ '--tbr was specified, skipping OWNERS check for DEPS '
+ 'additions')
+ ]
+ if input_api.dry_run:
+ return [
+ output_api.PresubmitNotifyResult(
+ 'This is a dry run, skipping OWNERS check for DEPS '
+ 'additions')
+ ]
+ if not input_api.change.issue:
+ return [
+ output_api.PresubmitError(
+ "DEPS approval by OWNERS check failed: this change has "
+ "no change number, so we can't check it for approvals.")
+ ]
+ output = output_api.PresubmitError
+ else:
+ output = output_api.PresubmitNotifyResult
+
+ owner_email, reviewers = (
+ input_api.canned_checks.GetCodereviewOwnerAndReviewers(
+ input_api, None, approval_needed=input_api.is_committing))
+
+ owner_email = owner_email or input_api.change.author_email
+
+ approval_status = input_api.owners_client.GetFilesApprovalStatus(
+ virtual_depended_on_files, reviewers.union([owner_email]), [])
+ missing_files = [
+ f for f in virtual_depended_on_files
+ if approval_status[f] != input_api.owners_client.APPROVED
+ ]
+
+ # We strip the /DEPS part that was added by
+ # _FilesToCheckForIncomingDeps to fake a path to a file in a
+ # directory.
+ def StripDeps(path):
+ start_deps = path.rfind('/DEPS')
+ if start_deps != -1:
+ return path[:start_deps]
+ return path
+
+ unapproved_dependencies = [
+ "'+%s'," % StripDeps(path) for path in missing_files
]
- suggested_owners = input_api.owners_client.SuggestOwners(
- missing_files, exclude=[owner_email])
- output_list.append(
- output('Suggested missing target path OWNERS:\n %s' %
- '\n '.join(suggested_owners or [])))
- return output_list
-
- return []
+
+ if unapproved_dependencies:
+ output_list = [
+ output(
+ 'You need LGTM from owners of depends-on paths in DEPS that '
+ ' were modified in this CL:\n %s' %
+ '\n '.join(sorted(unapproved_dependencies)))
+ ]
+ suggested_owners = input_api.owners_client.SuggestOwners(
+ missing_files, exclude=[owner_email])
+ output_list.append(
+ output('Suggested missing target path OWNERS:\n %s' %
+ '\n '.join(suggested_owners or [])))
+ return output_list
+
+ return []
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 46703f93ce..e9e6887987 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -35,6 +35,45 @@ rtc_source_set("callfactory_api") {
]
}
+rtc_source_set("enable_media") {
+ visibility = [ "*" ]
+ sources = [
+ "enable_media.cc",
+ "enable_media.h",
+ ]
+ deps = [
+ ":libjingle_peerconnection_api",
+ "../call",
+ "../media:rtc_audio_video",
+ "../pc:media_factory",
+ "../rtc_base/system:rtc_export",
+ ]
+}
+
+rtc_source_set("enable_media_with_defaults") {
+ visibility = [ "*" ]
+ allow_poison = [
+ "audio_codecs",
+ "default_task_queue",
+ "software_video_codecs",
+ ]
+ sources = [
+ "enable_media_with_defaults.cc",
+ "enable_media_with_defaults.h",
+ ]
+ deps = [
+ ":enable_media",
+ ":libjingle_peerconnection_api",
+ "../modules/audio_processing:api",
+ "../rtc_base/system:rtc_export",
+ "audio_codecs:builtin_audio_decoder_factory",
+ "audio_codecs:builtin_audio_encoder_factory",
+ "task_queue:default_task_queue_factory",
+ "video_codecs:builtin_video_decoder_factory",
+ "video_codecs:builtin_video_encoder_factory",
+ ]
+}
+
if (!build_with_chromium) {
rtc_library("create_peerconnection_factory") {
visibility = [ "*" ]
@@ -44,12 +83,10 @@ if (!build_with_chromium) {
"create_peerconnection_factory.h",
]
deps = [
- ":callfactory_api",
+ ":enable_media",
":libjingle_peerconnection_api",
":scoped_refptr",
"../api/rtc_event_log:rtc_event_log_factory",
- "../media:rtc_audio_video",
- "../media:rtc_media_base",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing:api",
"../pc:peer_connection_factory",
@@ -127,13 +164,14 @@ rtc_library("media_stream_interface") {
deps = [
":audio_options_api",
":make_ref_counted",
+ ":ref_count",
+ ":ref_count",
":rtp_parameters",
":scoped_refptr",
":sequence_checker",
":video_track_source_constraints",
"../modules/audio_processing:audio_processing_statistics",
"../rtc_base:checks",
- "../rtc_base:refcount",
"../rtc_base/system:no_unique_address",
"../rtc_base/system:rtc_export",
"video:recordable_encoded_frame",
@@ -181,9 +219,9 @@ rtc_source_set("ice_transport_interface") {
deps = [
":async_dns_resolver",
":packet_socket_factory",
+ ":ref_count",
":rtc_error",
":scoped_refptr",
- "../rtc_base:refcount",
"rtc_event_log:rtc_event_log",
]
}
@@ -197,9 +235,9 @@ rtc_library("dtls_transport_interface") {
]
deps = [
":ice_transport_interface",
+ ":ref_count",
":rtc_error",
":scoped_refptr",
- "../rtc_base:refcount",
"../rtc_base:ssl",
"../rtc_base/system:rtc_export",
]
@@ -212,7 +250,7 @@ rtc_library("dtmf_sender_interface") {
sources = [ "dtmf_sender_interface.h" ]
deps = [
":media_stream_interface",
- "../rtc_base:refcount",
+ ":ref_count",
]
}
@@ -228,11 +266,11 @@ rtc_library("rtp_sender_interface") {
":dtmf_sender_interface",
":frame_transformer_interface",
":media_stream_interface",
+ ":ref_count",
":rtc_error",
":rtp_parameters",
":scoped_refptr",
"../rtc_base:checks",
- "../rtc_base:refcount",
"../rtc_base/system:rtc_export",
"crypto:frame_encryptor_interface",
"video_codecs:video_codecs_api",
@@ -294,6 +332,7 @@ rtc_library("libjingle_peerconnection_api") {
":network_state_predictor_api",
":packet_socket_factory",
":priority",
+ ":ref_count",
":rtc_error",
":rtc_stats_api",
":rtp_packet_info",
@@ -305,11 +344,11 @@ rtc_library("libjingle_peerconnection_api") {
":turn_customizer",
"../call:rtp_interfaces",
"../p2p:rtc_p2p",
+ "../pc:media_factory",
"../rtc_base:copy_on_write_buffer",
"../rtc_base:logging",
"../rtc_base:network",
"../rtc_base:network_constants",
- "../rtc_base:refcount",
"../rtc_base:rtc_certificate_generator",
"../rtc_base:ssl",
"../rtc_base:stringutils",
@@ -363,8 +402,8 @@ rtc_source_set("frame_transformer_interface") {
sources = [ "frame_transformer_interface.h" ]
deps = [
":make_ref_counted",
+ ":ref_count",
":scoped_refptr",
- "../rtc_base:refcount",
"video:encoded_frame",
"video:video_frame_metadata",
]
@@ -438,6 +477,11 @@ rtc_source_set("wrapping_async_dns_resolver") {
absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
}
+rtc_source_set("ref_count") {
+ visibility = [ "*" ]
+ sources = [ "ref_count.h" ]
+}
+
rtc_source_set("scoped_refptr") {
visibility = [ "*" ]
sources = [ "scoped_refptr.h" ]
@@ -446,7 +490,10 @@ rtc_source_set("scoped_refptr") {
rtc_source_set("make_ref_counted") {
visibility = [ "*" ]
sources = [ "make_ref_counted.h" ]
- deps = [ "../rtc_base:refcount" ]
+ deps = [
+ ":ref_count",
+ "../rtc_base:refcount",
+ ]
}
rtc_source_set("video_quality_analyzer_api") {
@@ -767,6 +814,7 @@ rtc_source_set("rtc_stats_api") {
deps = [
":make_ref_counted",
+ ":ref_count",
":scoped_refptr",
"../api:refcountedbase",
"../rtc_base:checks",
@@ -899,6 +947,7 @@ rtc_source_set("refcountedbase") {
visibility = [ "*" ]
sources = [ "ref_counted_base.h" ]
deps = [
+ ":ref_count",
"../rtc_base:macromagic",
"../rtc_base:refcount",
]
@@ -1022,24 +1071,6 @@ if (rtc_include_tests) {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
- rtc_library("video_codec_stats_api") {
- visibility = [ "*" ]
- testonly = true
- sources = [
- "test/video_codec_stats.cc",
- "test/video_codec_stats.h",
- ]
- deps = [
- "../api/numerics:numerics",
- "../api/units:data_rate",
- "../api/units:data_size",
- "../api/units:frequency",
- "test/metrics:metric",
- "test/metrics:metrics_logger",
- ]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
- }
-
rtc_library("videocodec_test_fixture_api") {
visibility = [ "*" ]
testonly = true
@@ -1051,23 +1082,6 @@ if (rtc_include_tests) {
]
}
- rtc_library("video_codec_tester_api") {
- visibility = [ "*" ]
- testonly = true
- sources = [ "test/video_codec_tester.h" ]
- deps = [
- ":video_codec_stats_api",
- "../modules/video_coding/svc:scalability_mode_util",
- "video:encoded_image",
- "video:resolution",
- "video:video_frame",
- ]
- absl_deps = [
- "//third_party/abseil-cpp/absl/functional:any_invocable",
- "//third_party/abseil-cpp/absl/types:optional",
- ]
- }
-
rtc_library("create_videocodec_test_fixture_api") {
visibility = [ "*" ]
testonly = true
@@ -1083,19 +1097,6 @@ if (rtc_include_tests) {
]
}
- rtc_library("create_video_codec_tester_api") {
- visibility = [ "*" ]
- testonly = true
- sources = [
- "test/create_video_codec_tester.cc",
- "test/create_video_codec_tester.h",
- ]
- deps = [
- ":video_codec_tester_api",
- "../modules/video_coding:video_codec_tester",
- ]
- }
-
rtc_source_set("mock_audio_mixer") {
visibility = [ "*" ]
testonly = true
@@ -1197,6 +1198,7 @@ if (rtc_include_tests) {
":array_view",
":libjingle_peerconnection_api",
":make_ref_counted",
+ ":ref_count",
":rtp_parameters",
"../rtc_base:checks",
"../rtc_base:refcount",
@@ -1250,6 +1252,7 @@ if (rtc_include_tests) {
deps = [
":libjingle_peerconnection_api",
+ ":ref_count",
"../api:scoped_refptr",
"../rtc_base:refcount",
"../test:test_support",
@@ -1277,6 +1280,18 @@ if (rtc_include_tests) {
]
}
+ rtc_source_set("mock_transformable_frame") {
+ visibility = [ "*" ]
+ testonly = true
+ sources = [ "test/mock_transformable_frame.h" ]
+ deps = [
+ ":array_view",
+ ":frame_transformer_interface",
+ "../test:test_support",
+ "units:timestamp",
+ ]
+ }
+
rtc_source_set("mock_async_dns_resolver") {
visibility = [ "*" ]
testonly = true
@@ -1390,6 +1405,7 @@ if (rtc_include_tests) {
sources = [ "test/mock_video_track.h" ]
deps = [
+ ":ref_count",
"../api:media_stream_interface",
"../api:scoped_refptr",
"../rtc_base:refcount",
@@ -1407,12 +1423,18 @@ if (rtc_include_tests) {
deps = [
":callfactory_api",
+ ":enable_media_with_defaults",
+ ":libjingle_peerconnection_api",
":time_controller",
"../call",
"../call:call_interfaces",
"../call:rtp_interfaces",
+ "../pc:media_factory",
+ "../rtc_base:checks",
+ "../system_wrappers",
"../test/time_controller",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
}
rtc_library("rtc_api_unittests") {
@@ -1501,6 +1523,7 @@ if (rtc_include_tests) {
":mock_rtp",
":mock_session_description_interface",
":mock_transformable_audio_frame",
+ ":mock_transformable_frame",
":mock_transformable_video_frame",
":mock_video_bitrate_allocator",
":mock_video_bitrate_allocator_factory",
@@ -1570,10 +1593,10 @@ rtc_library("frame_transformer_factory") {
]
deps = [
":frame_transformer_interface",
+ ":ref_count",
":scoped_refptr",
"../audio:audio",
"../modules/rtp_rtcp",
- "../rtc_base:refcount",
"video:encoded_frame",
"video:video_frame_metadata",
]
diff --git a/api/DEPS b/api/DEPS
index bcfd705741..3a650b6253 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -81,7 +81,6 @@ specific_include_rules = {
"data_channel_interface\.h": [
"+rtc_base/copy_on_write_buffer.h",
- "+rtc_base/ref_count.h",
],
"data_channel_transport_interface\.h": [
@@ -89,33 +88,15 @@ specific_include_rules = {
],
"dtls_transport_interface\.h": [
- "+rtc_base/ref_count.h",
"+rtc_base/ssl_certificate.h",
],
- "dtmf_sender_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"fec_controller\.h": [
"+modules/include/module_fec_types.h",
],
- "frame_transformer_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "ice_transport_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "jsep\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"media_stream_interface\.h": [
"+modules/audio_processing/include/audio_processing_statistics.h",
- "+rtc_base/ref_count.h",
],
"packet_socket_factory\.h": [
@@ -132,7 +113,6 @@ specific_include_rules = {
"+rtc_base/network.h",
"+rtc_base/network_constants.h",
"+rtc_base/network_monitor_factory.h",
- "+rtc_base/ref_count.h",
"+rtc_base/rtc_certificate.h",
"+rtc_base/rtc_certificate_generator.h",
"+rtc_base/socket_address.h",
@@ -148,7 +128,6 @@ specific_include_rules = {
],
"ref_counted_base\.h": [
- "+rtc_base/ref_count.h",
"+rtc_base/ref_counter.h",
],
@@ -159,74 +138,19 @@ specific_include_rules = {
# For private member and constructor.
"+rtc_base/system/file_wrapper.h",
],
- "rtp_receiver_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "rtp_sender_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "rtp_transceiver_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "sctp_transport_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "set_local_description_observer_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
- "set_remote_description_observer_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
"legacy_stats_types\.h": [
- "+rtc_base/ref_count.h",
"+rtc_base/thread_checker.h",
],
- "uma_metrics\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "audio_mixer\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"audio_decoder\.h": [
"+rtc_base/buffer.h",
],
- "audio_decoder_factory\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"audio_encoder\.h": [
"+rtc_base/buffer.h",
],
- "audio_encoder_factory\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "frame_decryptor_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "frame_encryptor_interface\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "rtc_stats_collector_callback\.h": [
- "+rtc_base/ref_count.h",
- ],
-
- "rtc_stats_report\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"audioproc_float\.h": [
"+modules/audio_processing/include/audio_processing.h",
],
@@ -279,10 +203,6 @@ specific_include_rules = {
"+modules/video_coding/include/video_codec_interface.h"
],
- "video_encoder_config\.h": [
- "+rtc_base/ref_count.h",
- ],
-
"sequence_checker\.h": [
"+rtc_base/synchronization/sequence_checker_internal.h",
"+rtc_base/thread_annotations.h",
diff --git a/api/async_resolver_factory.h b/api/async_resolver_factory.h
index ffa958268d..997fe5ce57 100644
--- a/api/async_resolver_factory.h
+++ b/api/async_resolver_factory.h
@@ -19,13 +19,16 @@ namespace webrtc {
// client applications to provide WebRTC with their own mechanism for
// performing DNS resolution.
// TODO(bugs.webrtc.org/12598): Deprecate and remove.
-class AsyncResolverFactory {
+class [[deprecated("Use AsyncDnsResolverFactory")]] AsyncResolverFactory {
public:
AsyncResolverFactory() = default;
virtual ~AsyncResolverFactory() = default;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// The caller should call Destroy on the returned object to delete it.
virtual rtc::AsyncResolverInterface* Create() = 0;
+#pragma clang diagnostic pop
};
} // namespace webrtc
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn
index 4832751b5f..0ecab64086 100644
--- a/api/audio/BUILD.gn
+++ b/api/audio/BUILD.gn
@@ -55,24 +55,6 @@ rtc_library("aec3_config") {
]
}
-rtc_library("aec3_config_json") {
- visibility = [ "*" ]
- allow_poison = [ "rtc_json" ]
- sources = [
- "echo_canceller3_config_json.cc",
- "echo_canceller3_config_json.h",
- ]
- deps = [
- ":aec3_config",
- "../../rtc_base:checks",
- "../../rtc_base:logging",
- "../../rtc_base:rtc_json",
- "../../rtc_base:stringutils",
- "../../rtc_base/system:rtc_export",
- ]
- absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
-}
-
rtc_library("aec3_factory") {
visibility = [ "*" ]
configs += [ "../../modules/audio_processing:apm_debug_dump" ]
diff --git a/api/audio/test/BUILD.gn b/api/audio/test/BUILD.gn
index dfe8c32f80..8d5822fa54 100644
--- a/api/audio/test/BUILD.gn
+++ b/api/audio/test/BUILD.gn
@@ -17,13 +17,12 @@ if (rtc_include_tests) {
testonly = true
sources = [
"audio_frame_unittest.cc",
- "echo_canceller3_config_json_unittest.cc",
"echo_canceller3_config_unittest.cc",
]
deps = [
"..:aec3_config",
- "..:aec3_config_json",
"..:audio_frame_api",
+ "../../../modules/audio_processing:aec3_config_json",
"../../../test:test_support",
]
}
diff --git a/api/audio/test/echo_canceller3_config_unittest.cc b/api/audio/test/echo_canceller3_config_unittest.cc
index 91312a0f40..da0255806e 100644
--- a/api/audio/test/echo_canceller3_config_unittest.cc
+++ b/api/audio/test/echo_canceller3_config_unittest.cc
@@ -10,7 +10,7 @@
#include "api/audio/echo_canceller3_config.h"
-#include "api/audio/echo_canceller3_config_json.h"
+#include "modules/audio_processing/test/echo_canceller3_config_json.h"
#include "test/gtest.h"
namespace webrtc {
diff --git a/api/audio_codecs/BUILD.gn b/api/audio_codecs/BUILD.gn
index 82ed31a5da..158ab74cce 100644
--- a/api/audio_codecs/BUILD.gn
+++ b/api/audio_codecs/BUILD.gn
@@ -32,6 +32,7 @@ rtc_library("audio_codecs_api") {
"..:array_view",
"..:bitrate_allocation",
"..:make_ref_counted",
+ "..:ref_count",
"..:scoped_refptr",
"../../api:field_trials_view",
"../../rtc_base:buffer",
diff --git a/api/audio_codecs/audio_decoder_factory.h b/api/audio_codecs/audio_decoder_factory.h
index 2811f6704b..19b921a97f 100644
--- a/api/audio_codecs/audio_decoder_factory.h
+++ b/api/audio_codecs/audio_decoder_factory.h
@@ -18,12 +18,12 @@
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
-#include "rtc_base/ref_count.h"
+#include "api/ref_count.h"
namespace webrtc {
// A factory that creates AudioDecoders.
-class AudioDecoderFactory : public rtc::RefCountInterface {
+class AudioDecoderFactory : public RefCountInterface {
public:
virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
diff --git a/api/call/call_factory_interface.h b/api/call/call_factory_interface.h
index 6051409cc3..db53d724a6 100644
--- a/api/call/call_factory_interface.h
+++ b/api/call/call_factory_interface.h
@@ -24,14 +24,19 @@ struct CallConfig;
// This interface exists to allow webrtc to be optionally built without media
// support (i.e., if only being used for data channels). PeerConnectionFactory
// is constructed with a CallFactoryInterface, which may or may not be null.
+// TODO(bugs.webrtc.org/15574): Delete this interface when
+// `PeerConnectionFactoryDependencies::call_factory` is removed in favor of
+// `PeerConnectionFactoryDependencies::media_factory`.
class CallFactoryInterface {
public:
- virtual ~CallFactoryInterface() {}
+ virtual ~CallFactoryInterface() = default;
- virtual Call* CreateCall(const CallConfig& config) = 0;
+ virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0;
};
-RTC_EXPORT std::unique_ptr<CallFactoryInterface> CreateCallFactory();
+[[deprecated("bugs.webrtc.org/15574")]] //
+RTC_EXPORT std::unique_ptr<CallFactoryInterface>
+CreateCallFactory();
} // namespace webrtc
diff --git a/api/create_peerconnection_factory.cc b/api/create_peerconnection_factory.cc
index b7f9eb7f30..5d3aace05f 100644
--- a/api/create_peerconnection_factory.cc
+++ b/api/create_peerconnection_factory.cc
@@ -13,14 +13,12 @@
#include <memory>
#include <utility>
-#include "api/call/call_factory_interface.h"
+#include "api/enable_media.h"
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/transport/field_trial_based_config.h"
-#include "media/base/media_engine.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/thread.h"
@@ -38,8 +36,7 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
- AudioFrameProcessor* audio_frame_processor,
- std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor,
+ std::unique_ptr<AudioFrameProcessor> audio_frame_processor,
std::unique_ptr<FieldTrialsView> field_trials) {
if (!field_trials) {
field_trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
@@ -51,7 +48,6 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
dependencies.signaling_thread = signaling_thread;
dependencies.task_queue_factory =
CreateDefaultTaskQueueFactory(field_trials.get());
- dependencies.call_factory = CreateCallFactory();
dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>(
dependencies.task_queue_factory.get());
dependencies.trials = std::move(field_trials);
@@ -60,70 +56,21 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
// TODO(bugs.webrtc.org/13145): Add an rtc::SocketFactory* argument.
dependencies.socket_factory = network_thread->socketserver();
}
- cricket::MediaEngineDependencies media_dependencies;
- media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
- media_dependencies.adm = std::move(default_adm);
- media_dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
- media_dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
- if (audio_frame_processor) {
- media_dependencies.audio_frame_processor = audio_frame_processor;
- } else if (owned_audio_frame_processor) {
- media_dependencies.owned_audio_frame_processor =
- std::move(owned_audio_frame_processor);
- }
+ dependencies.adm = std::move(default_adm);
+ dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
+ dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
+ dependencies.audio_frame_processor = std::move(audio_frame_processor);
if (audio_processing) {
- media_dependencies.audio_processing = std::move(audio_processing);
+ dependencies.audio_processing = std::move(audio_processing);
} else {
- media_dependencies.audio_processing = AudioProcessingBuilder().Create();
+ dependencies.audio_processing = AudioProcessingBuilder().Create();
}
- media_dependencies.audio_mixer = std::move(audio_mixer);
- media_dependencies.video_encoder_factory = std::move(video_encoder_factory);
- media_dependencies.video_decoder_factory = std::move(video_decoder_factory);
- media_dependencies.trials = dependencies.trials.get();
- dependencies.media_engine =
- cricket::CreateMediaEngine(std::move(media_dependencies));
+ dependencies.audio_mixer = std::move(audio_mixer);
+ dependencies.video_encoder_factory = std::move(video_encoder_factory);
+ dependencies.video_decoder_factory = std::move(video_decoder_factory);
+ EnableMedia(dependencies);
return CreateModularPeerConnectionFactory(std::move(dependencies));
}
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- rtc::scoped_refptr<AudioDeviceModule> default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
- std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer,
- rtc::scoped_refptr<AudioProcessing> audio_processing,
- AudioFrameProcessor* audio_frame_processor) {
- return CreatePeerConnectionFactory(
- network_thread, worker_thread, signaling_thread, default_adm,
- audio_encoder_factory, audio_decoder_factory,
- std::move(video_encoder_factory), std::move(video_decoder_factory),
- audio_mixer, audio_processing, audio_frame_processor, nullptr, nullptr);
-}
-
-rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- rtc::scoped_refptr<AudioDeviceModule> default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
- std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer,
- rtc::scoped_refptr<AudioProcessing> audio_processing,
- std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor,
- std::unique_ptr<FieldTrialsView> field_trials) {
- return CreatePeerConnectionFactory(
- network_thread, worker_thread, signaling_thread, default_adm,
- audio_encoder_factory, audio_decoder_factory,
- std::move(video_encoder_factory), std::move(video_decoder_factory),
- audio_mixer, audio_processing, nullptr,
- std::move(owned_audio_frame_processor), std::move(field_trials));
-}
-
} // namespace webrtc
diff --git a/api/create_peerconnection_factory.h b/api/create_peerconnection_factory.h
index f8f52a0869..d829bc19be 100644
--- a/api/create_peerconnection_factory.h
+++ b/api/create_peerconnection_factory.h
@@ -37,9 +37,6 @@ class AudioProcessing;
// Create a new instance of PeerConnectionFactoryInterface with optional video
// codec factories. These video factories represents all video codecs, i.e. no
// extra internal video codecs will be added.
-// TODO(bugs.webrtc.org/15111):
-// Remove the method with the raw AudioFrameProcessor pointer in the
-// follow-up.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
@@ -52,21 +49,7 @@ CreatePeerConnectionFactory(
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
- AudioFrameProcessor* audio_frame_processor = nullptr);
-
-RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
-CreatePeerConnectionFactory(
- rtc::Thread* network_thread,
- rtc::Thread* worker_thread,
- rtc::Thread* signaling_thread,
- rtc::scoped_refptr<AudioDeviceModule> default_adm,
- rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
- rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
- std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
- std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
- rtc::scoped_refptr<AudioMixer> audio_mixer,
- rtc::scoped_refptr<AudioProcessing> audio_processing,
- std::unique_ptr<AudioFrameProcessor> owned_audio_frame_processor,
+ std::unique_ptr<AudioFrameProcessor> audio_frame_processor = nullptr,
std::unique_ptr<FieldTrialsView> field_trials = nullptr);
} // namespace webrtc
diff --git a/api/data_channel_interface.h b/api/data_channel_interface.h
index bf27c6c4f3..d2deace2e6 100644
--- a/api/data_channel_interface.h
+++ b/api/data_channel_interface.h
@@ -22,10 +22,10 @@
#include "absl/functional/any_invocable.h"
#include "absl/types/optional.h"
#include "api/priority.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "rtc_base/checks.h"
#include "rtc_base/copy_on_write_buffer.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -116,7 +116,7 @@ class DataChannelObserver {
virtual ~DataChannelObserver() = default;
};
-class RTC_EXPORT DataChannelInterface : public rtc::RefCountInterface {
+class RTC_EXPORT DataChannelInterface : public RefCountInterface {
public:
// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelstate
// Unlikely to change, but keep in sync with DataChannel.java:State and
diff --git a/api/dtls_transport_interface.h b/api/dtls_transport_interface.h
index 7b0151249c..fe64fb1947 100644
--- a/api/dtls_transport_interface.h
+++ b/api/dtls_transport_interface.h
@@ -16,9 +16,9 @@
#include "absl/types/optional.h"
#include "api/ice_transport_interface.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/ssl_certificate.h"
#include "rtc_base/system/rtc_export.h"
@@ -107,7 +107,7 @@ class DtlsTransportObserverInterface {
// accessed on that thread, except for functions explicitly marked otherwise.
// References can be held by other threads, and destruction can therefore
// be initiated by other threads.
-class DtlsTransportInterface : public rtc::RefCountInterface {
+class DtlsTransportInterface : public webrtc::RefCountInterface {
public:
// Returns a pointer to the ICE transport that is owned by the DTLS transport.
virtual rtc::scoped_refptr<IceTransportInterface> ice_transport() = 0;
diff --git a/api/dtmf_sender_interface.h b/api/dtmf_sender_interface.h
index d63e66bbf7..4aed3382ed 100644
--- a/api/dtmf_sender_interface.h
+++ b/api/dtmf_sender_interface.h
@@ -14,7 +14,7 @@
#include <string>
#include "api/media_stream_interface.h"
-#include "rtc_base/ref_count.h"
+#include "api/ref_count.h"
namespace webrtc {
@@ -42,7 +42,7 @@ class DtmfSenderObserverInterface {
// The interface of native implementation of the RTCDTMFSender defined by the
// WebRTC W3C Editor's Draft.
// See: https://www.w3.org/TR/webrtc/#peer-to-peer-dtmf
-class DtmfSenderInterface : public rtc::RefCountInterface {
+class DtmfSenderInterface : public webrtc::RefCountInterface {
public:
// Provides the spec compliant default 2 second delay for the ',' character.
static const int kDtmfDefaultCommaDelayMs = 2000;
diff --git a/api/enable_media.cc b/api/enable_media.cc
new file mode 100644
index 0000000000..566cc15dd7
--- /dev/null
+++ b/api/enable_media.cc
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "api/enable_media.h"
+
+#include <memory>
+#include <utility>
+
+#include "api/peer_connection_interface.h"
+#include "call/call_factory.h"
+#include "media/engine/webrtc_media_engine.h"
+#include "media/engine/webrtc_video_engine.h"
+#include "media/engine/webrtc_voice_engine.h"
+#include "pc/media_factory.h"
+
+namespace webrtc {
+namespace {
+
+using ::cricket::CompositeMediaEngine;
+using ::cricket::MediaEngineInterface;
+using ::cricket::WebRtcVideoEngine;
+using ::cricket::WebRtcVoiceEngine;
+
+class MediaFactoryImpl : public MediaFactory {
+ public:
+ MediaFactoryImpl() = default;
+ MediaFactoryImpl(const MediaFactoryImpl&) = delete;
+ MediaFactoryImpl& operator=(const MediaFactoryImpl&) = delete;
+ ~MediaFactoryImpl() override = default;
+
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
+ CallFactory call_factory;
+ return static_cast<CallFactoryInterface&>(call_factory).CreateCall(config);
+ }
+
+ std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
+ PeerConnectionFactoryDependencies& deps) override {
+ std::unique_ptr<FieldTrialsView> fallback_trials;
+ const FieldTrialsView* trials;
+ if (deps.trials) {
+ trials = deps.trials.get();
+ } else {
+ fallback_trials = std::make_unique<FieldTrialBasedConfig>();
+ trials = fallback_trials.get();
+ }
+ auto audio_engine = std::make_unique<WebRtcVoiceEngine>(
+ deps.task_queue_factory.get(), deps.adm.get(),
+ std::move(deps.audio_encoder_factory),
+ std::move(deps.audio_decoder_factory), std::move(deps.audio_mixer),
+ std::move(deps.audio_processing), std::move(deps.audio_frame_processor),
+ *trials);
+ auto video_engine = std::make_unique<WebRtcVideoEngine>(
+ std::move(deps.video_encoder_factory),
+ std::move(deps.video_decoder_factory), *trials);
+ return std::make_unique<CompositeMediaEngine>(std::move(fallback_trials),
+ std::move(audio_engine),
+ std::move(video_engine));
+ }
+};
+
+} // namespace
+
+void EnableMedia(PeerConnectionFactoryDependencies& deps) {
+ if (deps.media_factory != nullptr) {
+ // Do nothing if media is already enabled. Overwriting media_factory can be
+ // harmful when a different (e.g. test-only) implementation is used.
+ return;
+ }
+ deps.media_factory = std::make_unique<MediaFactoryImpl>();
+}
+
+} // namespace webrtc
diff --git a/api/enable_media.h b/api/enable_media.h
new file mode 100644
index 0000000000..85183963cf
--- /dev/null
+++ b/api/enable_media.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef API_ENABLE_MEDIA_H_
+#define API_ENABLE_MEDIA_H_
+
+#include "api/peer_connection_interface.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// Enables media support for PeerConnnectionFactory created from `deps`
+// This function is located in its own build target to allow webrtc users that
+// do not need any media to avoid linking media specific code and thus to reduce
+// binary size.
+RTC_EXPORT void EnableMedia(PeerConnectionFactoryDependencies& deps);
+
+} // namespace webrtc
+
+#endif // API_ENABLE_MEDIA_H_
diff --git a/api/enable_media_with_defaults.cc b/api/enable_media_with_defaults.cc
new file mode 100644
index 0000000000..81462f703e
--- /dev/null
+++ b/api/enable_media_with_defaults.cc
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "api/enable_media_with_defaults.h"
+
+#include "api/audio_codecs/builtin_audio_decoder_factory.h"
+#include "api/audio_codecs/builtin_audio_encoder_factory.h"
+#include "api/enable_media.h"
+#include "api/task_queue/default_task_queue_factory.h"
+#include "api/video_codecs/builtin_video_decoder_factory.h"
+#include "api/video_codecs/builtin_video_encoder_factory.h"
+#include "modules/audio_processing/include/audio_processing.h"
+
+namespace webrtc {
+
+void EnableMediaWithDefaults(PeerConnectionFactoryDependencies& deps) {
+ if (deps.task_queue_factory == nullptr) {
+ deps.task_queue_factory = CreateDefaultTaskQueueFactory();
+ }
+ if (deps.audio_encoder_factory == nullptr) {
+ deps.audio_encoder_factory = CreateBuiltinAudioEncoderFactory();
+ }
+ if (deps.audio_decoder_factory == nullptr) {
+ deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
+ }
+ if (deps.audio_processing == nullptr) {
+ deps.audio_processing = AudioProcessingBuilder().Create();
+ }
+
+ if (deps.video_encoder_factory == nullptr) {
+ deps.video_encoder_factory = CreateBuiltinVideoEncoderFactory();
+ }
+ if (deps.video_decoder_factory == nullptr) {
+ deps.video_decoder_factory = CreateBuiltinVideoDecoderFactory();
+ }
+ EnableMedia(deps);
+}
+
+} // namespace webrtc
diff --git a/api/enable_media_with_defaults.h b/api/enable_media_with_defaults.h
new file mode 100644
index 0000000000..1b13a98fc9
--- /dev/null
+++ b/api/enable_media_with_defaults.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef API_ENABLE_MEDIA_WITH_DEFAULTS_H_
+#define API_ENABLE_MEDIA_WITH_DEFAULTS_H_
+
+#include "api/peer_connection_interface.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// Fills unset media related dependencies in `deps` and enables media support
+// for a PeerConnectionFactory created from `deps`.
+// This function is located in its own build target as it pulls additional
+// dependencies compared to `EnableMedia`, and thus may add extra binary size.
+RTC_EXPORT void EnableMediaWithDefaults(
+ PeerConnectionFactoryDependencies& deps);
+
+} // namespace webrtc
+
+#endif // API_ENABLE_MEDIA_WITH_DEFAULTS_H_
diff --git a/api/environment/BUILD.gn b/api/environment/BUILD.gn
new file mode 100644
index 0000000000..b4d583fd08
--- /dev/null
+++ b/api/environment/BUILD.gn
@@ -0,0 +1,20 @@
+# Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("../../webrtc.gni")
+
+rtc_source_set("environment") {
+ visibility = [ "*" ]
+ sources = [ "environment.h" ]
+ deps = [
+ "..:refcountedbase",
+ "..:scoped_refptr",
+ "../../rtc_base/system:rtc_export",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
+}
diff --git a/api/environment/environment.h b/api/environment/environment.h
new file mode 100644
index 0000000000..a742323ce7
--- /dev/null
+++ b/api/environment/environment.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// This header file provides wrapper for common WebRTC utilities.
+// Different application may need different implementations of these utilities,
+// Moreover, single application may need to use WebRTC for multiple purposes,
+// and thus would need to provide different utilities implementations for
+// different peer connections.
+// The main purpose of the `Environment` class below is to propagate references
+// to those utilities to all WebRTC classes that need them.
+
+#ifndef API_ENVIRONMENT_ENVIRONMENT_H_
+#define API_ENVIRONMENT_ENVIRONMENT_H_
+
+#include <utility>
+
+#include "absl/base/nullability.h"
+#include "api/ref_counted_base.h"
+#include "api/scoped_refptr.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// These classes are forward declared to keep Environment dependencies
+// lightweight. Users who need any of the types below should include their
+// header explicitely.
+class Clock;
+class TaskQueueFactory;
+class FieldTrialsView;
+class RtcEventLog;
+
+// Contains references to WebRTC utilities. Object of this class should be
+// passed as a construction parameter and saved by value in each class that
+// needs it. Most classes shouldn't create a new instance of the `Environment`,
+// but instead should use a propagated copy.
+// Example:
+// class PeerConnection {
+// public:
+// PeerConnection(const Environment& env, ...)
+// : env_(env),
+// rtp_manager_(env, ...),
+// ...
+//
+// const FieldTrialsView& trials() const { return env_.field_trials(); }
+//
+// scoped_refptr<RtpTransceiverInterface> AddTransceiver(...) {
+// return make_ref_counted<RtpTransceiverImpl>(env_, ...);
+// }
+//
+// private:
+// const Environment env_;
+// RtpTransmissionManager rtp_manager_;
+// };
+// This class is thread safe.
+class RTC_EXPORT Environment final {
+ public:
+ // Default constructor is deleted in favor of creating this object using
+ // `EnvironmentFactory`. To create the default environment use
+ // `EnvironmentFactory().Create()`.
+ Environment() = delete;
+
+ Environment(const Environment&) = default;
+ Environment(Environment&&) = default;
+ Environment& operator=(const Environment&) = default;
+ Environment& operator=(Environment&&) = default;
+
+ ~Environment() = default;
+
+ // Provides means to alter behavior, mostly for A/B testing new features.
+ // See ../../g3doc/field-trials.md
+ const FieldTrialsView& field_trials() const;
+
+ // Provides an interface to query current time.
+ // See ../../g3doc/implementation_basics.md#time
+ Clock& clock() const;
+
+ // Provides a factory for task queues, WebRTC threading primitives.
+ // See ../../g3doc/implementation_basics.md#threads
+ TaskQueueFactory& task_queue_factory() const;
+
+ // Provides an interface for collecting structured logs.
+ // See ../../logging/g3doc/rtc_event_log.md
+ RtcEventLog& event_log() const;
+
+ private:
+ friend class EnvironmentFactory;
+ Environment(scoped_refptr<const rtc::RefCountedBase> storage,
+ absl::Nonnull<const FieldTrialsView*> field_trials,
+ absl::Nonnull<Clock*> clock,
+ absl::Nonnull<TaskQueueFactory*> task_queue_factory,
+ absl::Nonnull<RtcEventLog*> event_log)
+ : storage_(std::move(storage)),
+ field_trials_(field_trials),
+ clock_(clock),
+ task_queue_factory_(task_queue_factory),
+ event_log_(event_log) {}
+
+ // Container that keeps ownership of the utilities below.
+ // Defining this as a RefCountedBase allows `Environment` to share this
+ // storage with another `Environment`, in particular allows `Environment` to
+ // be copyable. It is up to the `EnvironmentFactory` to provide an object that
+ // ensures references to utilties below are valid while object in the
+ // `storage_` is alive.
+ scoped_refptr<const rtc::RefCountedBase> storage_;
+
+ absl::Nonnull<const FieldTrialsView*> field_trials_;
+ absl::Nonnull<Clock*> clock_;
+ absl::Nonnull<TaskQueueFactory*> task_queue_factory_;
+ absl::Nonnull<RtcEventLog*> event_log_;
+};
+
+//------------------------------------------------------------------------------
+// Implementation details follow
+//------------------------------------------------------------------------------
+
+inline const FieldTrialsView& Environment::field_trials() const {
+ return *field_trials_;
+}
+
+inline Clock& Environment::clock() const {
+ return *clock_;
+}
+
+inline TaskQueueFactory& Environment::task_queue_factory() const {
+ return *task_queue_factory_;
+}
+
+inline RtcEventLog& Environment::event_log() const {
+ return *event_log_;
+}
+
+} // namespace webrtc
+
+#endif // API_ENVIRONMENT_ENVIRONMENT_H_
diff --git a/api/frame_transformer_interface.h b/api/frame_transformer_interface.h
index 40d2f3655e..5bbcffe28e 100644
--- a/api/frame_transformer_interface.h
+++ b/api/frame_transformer_interface.h
@@ -12,12 +12,12 @@
#define API_FRAME_TRANSFORMER_INTERFACE_H_
#include <memory>
-#include <vector>
+#include <string>
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/video/encoded_frame.h"
#include "api/video/video_frame_metadata.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -53,6 +53,7 @@ class TransformableFrameInterface {
// sender frames to allow received frames to be directly re-transmitted on
// other PeerConnectionss.
virtual Direction GetDirection() const { return Direction::kUnknown; }
+ virtual std::string GetMimeType() const = 0;
};
class TransformableVideoFrameInterface : public TransformableFrameInterface {
@@ -93,6 +94,12 @@ class TransformedFrameCallback : public rtc::RefCountInterface {
virtual void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) = 0;
+ // Request to no longer be called on each frame, instead having frames be
+ // sent directly to OnTransformedFrame without additional work.
+ // TODO(crbug.com/1502781): Make pure virtual once all mocks have
+ // implementations.
+ virtual void StartShortCircuiting() {}
+
protected:
~TransformedFrameCallback() override = default;
};
diff --git a/api/ice_transport_interface.h b/api/ice_transport_interface.h
index 431f3330a5..ecf5dc4ffe 100644
--- a/api/ice_transport_interface.h
+++ b/api/ice_transport_interface.h
@@ -15,10 +15,10 @@
#include "api/async_dns_resolver.h"
#include "api/async_resolver_factory.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
namespace cricket {
class IceTransportInternal;
@@ -33,7 +33,7 @@ class FieldTrialsView;
// An ICE transport, as represented to the outside world.
// This object is refcounted, and is therefore alive until the
// last holder has released it.
-class IceTransportInterface : public rtc::RefCountInterface {
+class IceTransportInterface : public webrtc::RefCountInterface {
public:
// Accessor for the internal representation of an ICE transport.
// The returned object can only be safely used on the signalling thread.
@@ -115,8 +115,11 @@ struct IceTransportInit final {
private:
cricket::PortAllocator* port_allocator_ = nullptr;
AsyncDnsResolverFactoryInterface* async_dns_resolver_factory_ = nullptr;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// For backwards compatibility. Only one resolver factory can be set.
AsyncResolverFactory* async_resolver_factory_ = nullptr;
+#pragma clang diagnostic pop
RtcEventLog* event_log_ = nullptr;
cricket::IceControllerFactoryInterface* ice_controller_factory_ = nullptr;
cricket::ActiveIceControllerFactoryInterface* active_ice_controller_factory_ =
diff --git a/api/jsep.h b/api/jsep.h
index d2aa57c784..643a99d315 100644
--- a/api/jsep.h
+++ b/api/jsep.h
@@ -27,8 +27,8 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace cricket {
@@ -219,7 +219,7 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
// CreateOffer and CreateAnswer callback interface.
class RTC_EXPORT CreateSessionDescriptionObserver
- : public rtc::RefCountInterface {
+ : public webrtc::RefCountInterface {
public:
// This callback transfers the ownership of the `desc`.
// TODO(deadbeef): Make this take an std::unique_ptr<> to avoid confusion
@@ -238,7 +238,8 @@ class RTC_EXPORT CreateSessionDescriptionObserver
};
// SetLocalDescription and SetRemoteDescription callback interface.
-class RTC_EXPORT SetSessionDescriptionObserver : public rtc::RefCountInterface {
+class RTC_EXPORT SetSessionDescriptionObserver
+ : public webrtc::RefCountInterface {
public:
virtual void OnSuccess() = 0;
// See description in CreateSessionDescriptionObserver for OnFailure.
diff --git a/api/legacy_stats_types.h b/api/legacy_stats_types.h
index e49cb6d6dd..70f21d4ad9 100644
--- a/api/legacy_stats_types.h
+++ b/api/legacy_stats_types.h
@@ -20,9 +20,9 @@
#include <string>
#include <vector>
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/sequence_checker.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -240,7 +240,7 @@ class RTC_EXPORT StatsReport {
kStatsValueNameLocalCandidateRelayProtocol,
};
- class RTC_EXPORT IdBase : public rtc::RefCountInterface {
+ class RTC_EXPORT IdBase : public webrtc::RefCountInterface {
public:
~IdBase() override;
StatsType type() const;
diff --git a/api/media_stream_interface.h b/api/media_stream_interface.h
index 9d336739e4..4f9bffac85 100644
--- a/api/media_stream_interface.h
+++ b/api/media_stream_interface.h
@@ -23,6 +23,7 @@
#include "absl/types/optional.h"
#include "api/audio_options.h"
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/video/recordable_encoded_frame.h"
#include "api/video/video_frame.h"
@@ -30,7 +31,6 @@
#include "api/video/video_source_interface.h"
#include "api/video_track_source_constraints.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -54,7 +54,7 @@ class NotifierInterface {
// Base class for sources. A MediaStreamTrack has an underlying source that
// provides media. A source can be shared by multiple tracks.
-class RTC_EXPORT MediaSourceInterface : public rtc::RefCountInterface,
+class RTC_EXPORT MediaSourceInterface : public webrtc::RefCountInterface,
public NotifierInterface {
public:
enum SourceState { kInitializing, kLive, kEnded, kMuted };
@@ -69,7 +69,7 @@ class RTC_EXPORT MediaSourceInterface : public rtc::RefCountInterface,
// C++ version of MediaStreamTrack.
// See: https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack
-class RTC_EXPORT MediaStreamTrackInterface : public rtc::RefCountInterface,
+class RTC_EXPORT MediaStreamTrackInterface : public webrtc::RefCountInterface,
public NotifierInterface {
public:
enum TrackState {
@@ -267,7 +267,7 @@ class RTC_EXPORT AudioSourceInterface : public MediaSourceInterface {
// Interface of the audio processor used by the audio track to collect
// statistics.
-class AudioProcessorInterface : public rtc::RefCountInterface {
+class AudioProcessorInterface : public webrtc::RefCountInterface {
public:
struct AudioProcessorStatistics {
bool typing_noise_detected = false;
@@ -321,7 +321,7 @@ typedef std::vector<rtc::scoped_refptr<VideoTrackInterface> > VideoTrackVector;
// must be pushed down.
//
// Thus, this interface acts as simply a container for tracks.
-class MediaStreamInterface : public rtc::RefCountInterface,
+class MediaStreamInterface : public webrtc::RefCountInterface,
public NotifierInterface {
public:
virtual std::string id() const = 0;
diff --git a/api/packet_socket_factory.h b/api/packet_socket_factory.h
index 29d2606b9b..e389ccb2ff 100644
--- a/api/packet_socket_factory.h
+++ b/api/packet_socket_factory.h
@@ -76,7 +76,9 @@ class RTC_EXPORT PacketSocketFactory {
// to switch to the AsyncDnsResolverInterface.
// TODO(bugs.webrtc.org/12598): Remove once all downstream users
// are converted.
- virtual AsyncResolverInterface* CreateAsyncResolver() {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ [[deprecated]] virtual AsyncResolverInterface* CreateAsyncResolver() {
// Default implementation, so that downstream users can remove this
// immediately after changing to CreateAsyncDnsResolver
RTC_DCHECK_NOTREACHED();
@@ -89,6 +91,7 @@ class RTC_EXPORT PacketSocketFactory {
return std::make_unique<webrtc::WrappingAsyncDnsResolver>(
CreateAsyncResolver());
}
+#pragma clang diagnostic pop
private:
PacketSocketFactory(const PacketSocketFactory&) = delete;
diff --git a/api/peer_connection_interface.cc b/api/peer_connection_interface.cc
index 050b61da95..33d9755c7a 100644
--- a/api/peer_connection_interface.cc
+++ b/api/peer_connection_interface.cc
@@ -12,6 +12,8 @@
#include <utility>
+#include "pc/media_factory.h"
+
namespace webrtc {
PeerConnectionInterface::IceServer::IceServer() = default;
@@ -58,8 +60,13 @@ PeerConnectionDependencies::~PeerConnectionDependencies() = default;
PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() =
default;
+// TODO(bugs.webrtc.org/15574): Remove pragma once call_factory and media_engine
+// are removed from PeerConnectionFactoryDependencies
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies(
PeerConnectionFactoryDependencies&&) = default;
+#pragma clang diagnostic pop
PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() =
default;
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index e2f284e25e..2d0abd8156 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -120,17 +120,19 @@
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/turn_customizer.h"
#include "api/video/video_bitrate_allocator_factory.h"
+#include "api/video_codecs/video_decoder_factory.h"
+#include "api/video_codecs/video_encoder_factory.h"
#include "call/rtp_transport_controller_send_factory_interface.h"
#include "media/base/media_config.h"
#include "media/base/media_engine.h"
// TODO(bugs.webrtc.org/7447): We plan to provide a way to let applications
// inject a PacketSocketFactory and/or NetworkManager, and not expose
// PortAllocator in the PeerConnection api.
+#include "api/ref_count.h"
#include "p2p/base/port_allocator.h"
#include "rtc_base/network.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/network_monitor_factory.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/rtc_certificate.h"
#include "rtc_base/rtc_certificate_generator.h"
#include "rtc_base/socket_address.h"
@@ -145,8 +147,11 @@ class Thread;
namespace webrtc {
+// MediaFactory class definition is not part of the api.
+class MediaFactory;
+
// MediaStream container interface.
-class StreamCollectionInterface : public rtc::RefCountInterface {
+class StreamCollectionInterface : public webrtc::RefCountInterface {
public:
// TODO(ronghuawu): Update the function names to c++ style, e.g. find -> Find.
virtual size_t count() = 0;
@@ -160,7 +165,7 @@ class StreamCollectionInterface : public rtc::RefCountInterface {
~StreamCollectionInterface() override = default;
};
-class StatsObserver : public rtc::RefCountInterface {
+class StatsObserver : public webrtc::RefCountInterface {
public:
virtual void OnComplete(const StatsReports& reports) = 0;
@@ -175,7 +180,7 @@ enum class SdpSemantics {
kUnifiedPlan,
};
-class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
+class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
public:
// See https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate
enum SignalingState {
@@ -662,6 +667,7 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
bool enable_implicit_rollback = false;
// Whether network condition based codec switching is allowed.
+ // TODO(bugs.webrtc.org/11341): Remove this unsupported config value.
absl::optional<bool> allow_codec_switching;
// The delay before doing a usage histogram report for long-lived
@@ -1386,10 +1392,12 @@ struct RTC_EXPORT PeerConnectionDependencies final {
std::unique_ptr<webrtc::AsyncDnsResolverFactoryInterface>
async_dns_resolver_factory;
// Deprecated - use async_dns_resolver_factory
- // Deprecation is in abeyance until Chromium is updated.
- // TODO(crbug.com/1475925): Deprecate once Chromium is updated
- // [[deprecated("Use async_dns_resolver_factory")]]
- std::unique_ptr<webrtc::AsyncResolverFactory> async_resolver_factory;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ [[deprecated("Use async_dns_resolver_factory")]] std::unique_ptr<
+ webrtc::AsyncResolverFactory>
+ async_resolver_factory;
+#pragma clang diagnostic pop
std::unique_ptr<webrtc::IceTransportFactory> ice_transport_factory;
std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator;
std::unique_ptr<rtc::SSLCertificateVerifier> tls_cert_verifier;
@@ -1428,8 +1436,10 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
// called without a `port_allocator`.
std::unique_ptr<rtc::PacketSocketFactory> packet_socket_factory;
std::unique_ptr<TaskQueueFactory> task_queue_factory;
- std::unique_ptr<cricket::MediaEngineInterface> media_engine;
- std::unique_ptr<CallFactoryInterface> call_factory;
+ // TODO(bugs.webrtc.org/15574): Delete `media_engine` and `call_factory`
+ // after 2023-12-01
+ [[deprecated]] std::unique_ptr<cricket::MediaEngineInterface> media_engine;
+ [[deprecated]] std::unique_ptr<CallFactoryInterface> call_factory;
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
std::unique_ptr<NetworkStatePredictorFactoryInterface>
@@ -1448,6 +1458,23 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
std::unique_ptr<RtpTransportControllerSendFactoryInterface>
transport_controller_send_factory;
std::unique_ptr<Metronome> metronome;
+
+ // Media specific dependencies. Unused when `media_factory == nullptr`.
+ rtc::scoped_refptr<AudioDeviceModule> adm;
+ rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory;
+ rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory;
+ rtc::scoped_refptr<AudioMixer> audio_mixer;
+ rtc::scoped_refptr<AudioProcessing> audio_processing;
+ std::unique_ptr<AudioFrameProcessor> audio_frame_processor;
+ std::unique_ptr<VideoEncoderFactory> video_encoder_factory;
+ std::unique_ptr<VideoDecoderFactory> video_decoder_factory;
+
+ // The `media_factory` members allows webrtc to be optionally built without
+ // media support (i.e., if only being used for data channels).
+ // By default media is disabled. To enable media call
+ // `EnableMedia(PeerConnectionFactoryDependencies&)`. Definition of the
+ // `MediaFactory` interface is a webrtc implementation detail.
+ std::unique_ptr<MediaFactory> media_factory;
};
// PeerConnectionFactoryInterface is the factory interface used for creating
@@ -1464,7 +1491,7 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
// CreatePeerConnectionFactory method which accepts threads as input, and use
// the CreatePeerConnection version that takes a PortAllocator as an argument.
class RTC_EXPORT PeerConnectionFactoryInterface
- : public rtc::RefCountInterface {
+ : public webrtc::RefCountInterface {
public:
class Options {
public:
diff --git a/api/ref_count.h b/api/ref_count.h
new file mode 100644
index 0000000000..5209277038
--- /dev/null
+++ b/api/ref_count.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2011 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef API_REF_COUNT_H_
+#define API_REF_COUNT_H_
+
+namespace webrtc {
+
+// Refcounted objects should implement the following informal interface:
+//
+// void AddRef() const ;
+// RefCountReleaseStatus Release() const;
+//
+// You may access members of a reference-counted object, including the AddRef()
+// and Release() methods, only if you already own a reference to it, or if
+// you're borrowing someone else's reference. (A newly created object is a
+// special case: the reference count is zero on construction, and the code that
+// creates the object should immediately call AddRef(), bringing the reference
+// count from zero to one, e.g., by constructing an rtc::scoped_refptr).
+//
+// AddRef() creates a new reference to the object.
+//
+// Release() releases a reference to the object; the caller now has one less
+// reference than before the call. Returns kDroppedLastRef if the number of
+// references dropped to zero because of this (in which case the object destroys
+// itself). Otherwise, returns kOtherRefsRemained, to signal that at the precise
+// time the caller's reference was dropped, other references still remained (but
+// if other threads own references, this may of course have changed by the time
+// Release() returns).
+//
+// The caller of Release() must treat it in the same way as a delete operation:
+// Regardless of the return value from Release(), the caller mustn't access the
+// object. The object might still be alive, due to references held by other
+// users of the object, but the object can go away at any time, e.g., as the
+// result of another thread calling Release().
+//
+// Calling AddRef() and Release() manually is discouraged. It's recommended to
+// use rtc::scoped_refptr to manage all pointers to reference counted objects.
+// Note that rtc::scoped_refptr depends on compile-time duck-typing; formally
+// implementing the below RefCountInterface is not required.
+
+enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained };
+
+// Interfaces where refcounting is part of the public api should
+// inherit this abstract interface. The implementation of these
+// methods is usually provided by the RefCountedObject template class,
+// applied as a leaf in the inheritance tree.
+class RefCountInterface {
+ public:
+ virtual void AddRef() const = 0;
+ virtual RefCountReleaseStatus Release() const = 0;
+
+ // Non-public destructor, because Release() has exclusive responsibility for
+ // destroying the object.
+ protected:
+ virtual ~RefCountInterface() {}
+};
+
+} // namespace webrtc
+
+#endif // API_REF_COUNT_H_
diff --git a/api/rtp_receiver_interface.h b/api/rtp_receiver_interface.h
index e4ec9b5986..0bf1af972b 100644
--- a/api/rtp_receiver_interface.h
+++ b/api/rtp_receiver_interface.h
@@ -22,10 +22,10 @@
#include "api/frame_transformer_interface.h"
#include "api/media_stream_interface.h"
#include "api/media_types.h"
+#include "api/ref_count.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/transport/rtp/rtp_source.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -44,7 +44,7 @@ class RtpReceiverObserverInterface {
virtual ~RtpReceiverObserverInterface() {}
};
-class RTC_EXPORT RtpReceiverInterface : public rtc::RefCountInterface {
+class RTC_EXPORT RtpReceiverInterface : public webrtc::RefCountInterface {
public:
virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0;
diff --git a/api/rtp_sender_interface.h b/api/rtp_sender_interface.h
index 41d35bc287..7b8ab135c8 100644
--- a/api/rtp_sender_interface.h
+++ b/api/rtp_sender_interface.h
@@ -25,18 +25,18 @@
#include "api/frame_transformer_interface.h"
#include "api/media_stream_interface.h"
#include "api/media_types.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/rtp_parameters.h"
#include "api/scoped_refptr.h"
#include "api/video_codecs/video_encoder_factory.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
using SetParametersCallback = absl::AnyInvocable<void(RTCError) &&>;
-class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface {
+class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface {
public:
// Returns true if successful in setting the track.
// Fails if an audio track is set on a video RtpSender, or vice-versa.
diff --git a/api/rtp_transceiver_interface.h b/api/rtp_transceiver_interface.h
index 7d0d1a18bf..940264ef51 100644
--- a/api/rtp_transceiver_interface.h
+++ b/api/rtp_transceiver_interface.h
@@ -18,12 +18,12 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/media_types.h"
+#include "api/ref_count.h"
#include "api/rtp_parameters.h"
#include "api/rtp_receiver_interface.h"
#include "api/rtp_sender_interface.h"
#include "api/rtp_transceiver_direction.h"
#include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -58,7 +58,7 @@ struct RTC_EXPORT RtpTransceiverInit final {
//
// WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
-class RTC_EXPORT RtpTransceiverInterface : public rtc::RefCountInterface {
+class RTC_EXPORT RtpTransceiverInterface : public webrtc::RefCountInterface {
public:
// Media type of the transceiver. Any sender(s)/receiver(s) will have this
// type as well.
diff --git a/api/scoped_refptr.h b/api/scoped_refptr.h
index e145509127..61b2eb1f20 100644
--- a/api/scoped_refptr.h
+++ b/api/scoped_refptr.h
@@ -66,7 +66,7 @@
#include <memory>
#include <utility>
-namespace rtc {
+namespace webrtc {
template <class T>
class scoped_refptr {
@@ -162,61 +162,66 @@ class scoped_refptr {
};
template <typename T, typename U>
-bool operator==(const rtc::scoped_refptr<T>& a,
- const rtc::scoped_refptr<U>& b) {
+bool operator==(const scoped_refptr<T>& a, const scoped_refptr<U>& b) {
return a.get() == b.get();
}
template <typename T, typename U>
-bool operator!=(const rtc::scoped_refptr<T>& a,
- const rtc::scoped_refptr<U>& b) {
+bool operator!=(const scoped_refptr<T>& a, const scoped_refptr<U>& b) {
return !(a == b);
}
template <typename T>
-bool operator==(const rtc::scoped_refptr<T>& a, std::nullptr_t) {
+bool operator==(const scoped_refptr<T>& a, std::nullptr_t) {
return a.get() == nullptr;
}
template <typename T>
-bool operator!=(const rtc::scoped_refptr<T>& a, std::nullptr_t) {
+bool operator!=(const scoped_refptr<T>& a, std::nullptr_t) {
return !(a == nullptr);
}
template <typename T>
-bool operator==(std::nullptr_t, const rtc::scoped_refptr<T>& a) {
+bool operator==(std::nullptr_t, const scoped_refptr<T>& a) {
return a.get() == nullptr;
}
template <typename T>
-bool operator!=(std::nullptr_t, const rtc::scoped_refptr<T>& a) {
+bool operator!=(std::nullptr_t, const scoped_refptr<T>& a) {
return !(a == nullptr);
}
// Comparison with raw pointer.
template <typename T, typename U>
-bool operator==(const rtc::scoped_refptr<T>& a, const U* b) {
+bool operator==(const scoped_refptr<T>& a, const U* b) {
return a.get() == b;
}
template <typename T, typename U>
-bool operator!=(const rtc::scoped_refptr<T>& a, const U* b) {
+bool operator!=(const scoped_refptr<T>& a, const U* b) {
return !(a == b);
}
template <typename T, typename U>
-bool operator==(const T* a, const rtc::scoped_refptr<U>& b) {
+bool operator==(const T* a, const scoped_refptr<U>& b) {
return a == b.get();
}
template <typename T, typename U>
-bool operator!=(const T* a, const rtc::scoped_refptr<U>& b) {
+bool operator!=(const T* a, const scoped_refptr<U>& b) {
return !(a == b);
}
// Ordered comparison, needed for use as a std::map key.
template <typename T, typename U>
-bool operator<(const rtc::scoped_refptr<T>& a, const rtc::scoped_refptr<U>& b) {
+bool operator<(const scoped_refptr<T>& a, const scoped_refptr<U>& b) {
return a.get() < b.get();
}
+} // namespace webrtc
+
+namespace rtc {
+// Backwards compatible alias.
+// TODO(bugs.webrtc.org/15622): Deprecate and remove.
+template <typename T>
+using scoped_refptr = webrtc::scoped_refptr<T>;
} // namespace rtc
#endif // API_SCOPED_REFPTR_H_
diff --git a/api/sctp_transport_interface.h b/api/sctp_transport_interface.h
index 7080889fcf..23169ddb2b 100644
--- a/api/sctp_transport_interface.h
+++ b/api/sctp_transport_interface.h
@@ -13,9 +13,9 @@
#include "absl/types/optional.h"
#include "api/dtls_transport_interface.h"
+#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -75,7 +75,7 @@ class SctpTransportObserverInterface {
// accessed on that thread, except for functions explicitly marked otherwise.
// References can be held by other threads, and destruction can therefore
// be initiated by other threads.
-class SctpTransportInterface : public rtc::RefCountInterface {
+class SctpTransportInterface : public webrtc::RefCountInterface {
public:
// This function can be called from other threads.
virtual rtc::scoped_refptr<DtlsTransportInterface> dtls_transport() const = 0;
diff --git a/api/sequence_checker.h b/api/sequence_checker.h
index 33e0f3c074..5ff5860371 100644
--- a/api/sequence_checker.h
+++ b/api/sequence_checker.h
@@ -46,8 +46,22 @@ class RTC_LOCKABLE SequenceChecker
public:
enum InitialState : bool { kDetached = false, kAttached = true };
+ // TODO(tommi): We could maybe join these two ctors and have fewer factory
+ // functions. At the moment they're separate to minimize code changes when
+ // we added the second ctor as well as avoiding to have unnecessary code at
+ // the SequenceChecker which much only run for the SequenceCheckerImpl
+ // implementation.
+ // In theory we could have something like:
+ //
+ // SequenceChecker(InitialState initial_state = kAttached,
+ // TaskQueueBase* attached_queue = TaskQueueBase::Current());
+ //
+ // But the problem with that is having the call to `Current()` exist for
+ // `SequenceCheckerDoNothing`.
explicit SequenceChecker(InitialState initial_state = kAttached)
: Impl(initial_state) {}
+ explicit SequenceChecker(TaskQueueBase* attached_queue)
+ : Impl(attached_queue) {}
// Returns true if sequence checker is attached to the current sequence.
bool IsCurrent() const { return Impl::IsCurrent(); }
diff --git a/api/sequence_checker_unittest.cc b/api/sequence_checker_unittest.cc
index f117926d73..e54f33dba9 100644
--- a/api/sequence_checker_unittest.cc
+++ b/api/sequence_checker_unittest.cc
@@ -83,6 +83,13 @@ TEST(SequenceCheckerTest, DetachFromThreadAndUseOnTaskQueue) {
queue.SendTask([&] { EXPECT_TRUE(sequence_checker.IsCurrent()); });
}
+TEST(SequenceCheckerTest, InitializeForDifferentTaskQueue) {
+ TaskQueueForTest queue;
+ SequenceChecker sequence_checker(queue.Get());
+ EXPECT_EQ(sequence_checker.IsCurrent(), !RTC_DCHECK_IS_ON);
+ queue.SendTask([&] { EXPECT_TRUE(sequence_checker.IsCurrent()); });
+}
+
TEST(SequenceCheckerTest, DetachFromTaskQueueAndUseOnThread) {
TaskQueueForTest queue;
queue.SendTask([] {
diff --git a/api/set_local_description_observer_interface.h b/api/set_local_description_observer_interface.h
index 8e7b6258d3..40f85b944e 100644
--- a/api/set_local_description_observer_interface.h
+++ b/api/set_local_description_observer_interface.h
@@ -11,15 +11,15 @@
#ifndef API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_
#define API_SET_LOCAL_DESCRIPTION_OBSERVER_INTERFACE_H_
+#include "api/ref_count.h"
#include "api/rtc_error.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
// OnSetLocalDescriptionComplete() invokes as soon as
// PeerConnectionInterface::SetLocalDescription() operation completes, allowing
// the observer to examine the effects of the operation without delay.
-class SetLocalDescriptionObserverInterface : public rtc::RefCountInterface {
+class SetLocalDescriptionObserverInterface : public webrtc::RefCountInterface {
public:
// On success, `error.ok()` is true.
virtual void OnSetLocalDescriptionComplete(RTCError error) = 0;
diff --git a/api/set_remote_description_observer_interface.h b/api/set_remote_description_observer_interface.h
index d1c075309f..c1625410df 100644
--- a/api/set_remote_description_observer_interface.h
+++ b/api/set_remote_description_observer_interface.h
@@ -11,8 +11,8 @@
#ifndef API_SET_REMOTE_DESCRIPTION_OBSERVER_INTERFACE_H_
#define API_SET_REMOTE_DESCRIPTION_OBSERVER_INTERFACE_H_
+#include "api/ref_count.h"
#include "api/rtc_error.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
@@ -20,7 +20,7 @@ namespace webrtc {
// callback is invoked such that the state of the peer connection can be
// examined to accurately reflect the effects of the SetRemoteDescription
// operation.
-class SetRemoteDescriptionObserverInterface : public rtc::RefCountInterface {
+class SetRemoteDescriptionObserverInterface : public webrtc::RefCountInterface {
public:
// On success, `error.ok()` is true.
virtual void OnSetRemoteDescriptionComplete(RTCError error) = 0;
diff --git a/api/stats/rtc_stats_report.h b/api/stats/rtc_stats_report.h
index 1dce4d89b2..632226ef0d 100644
--- a/api/stats/rtc_stats_report.h
+++ b/api/stats/rtc_stats_report.h
@@ -124,7 +124,7 @@ class RTC_EXPORT RTCStatsReport final
std::string ToJson() const;
protected:
- friend class rtc::RefCountedNonVirtual<RTCStatsReport>;
+ friend class RefCountedNonVirtual<RTCStatsReport>;
~RTCStatsReport() = default;
private:
diff --git a/api/stats/rtcstats_objects.h b/api/stats/rtcstats_objects.h
index 8bb1ff2d05..c28b635660 100644
--- a/api/stats/rtcstats_objects.h
+++ b/api/stats/rtcstats_objects.h
@@ -286,6 +286,17 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
RTCStatsMember<double> total_processing_delay;
RTCStatsMember<double> total_assembly_time;
RTCStatsMember<uint32_t> frames_assembled_from_multiple_packets;
+ // TODO(https://crbug.com/webrtc/15600): Implement framesRendered, which is
+ // incremented at the same time that totalInterFrameDelay and
+ // totalSquaredInterFrameDelay is incremented. (Dividing inter-frame delay by
+ // framesDecoded is slightly wrong.)
+ // https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-framesrendered
+ //
+ // TODO(https://crbug.com/webrtc/15601): Inter-frame, pause and freeze metrics
+ // all related to when the frame is rendered, but our implementation measures
+ // at delivery to sink, not at actual render time. When we have an actual
+ // frame rendered callback, move the calculating of these metrics to there in
+ // order to make them more accurate.
RTCStatsMember<double> total_inter_frame_delay;
RTCStatsMember<double> total_squared_inter_frame_delay;
RTCStatsMember<uint32_t> pause_count;
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 527fac414b..e0e2e50514 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -132,7 +132,10 @@ rtc_library("pending_task_safety_flag") {
"../../rtc_base/system:no_unique_address",
"../../rtc_base/system:rtc_export",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/base:nullability",
+ "//third_party/abseil-cpp/absl/functional:any_invocable",
+ ]
}
if (rtc_include_tests) {
diff --git a/api/task_queue/pending_task_safety_flag.cc b/api/task_queue/pending_task_safety_flag.cc
index 437ce0755d..4d8fc2b9f4 100644
--- a/api/task_queue/pending_task_safety_flag.cc
+++ b/api/task_queue/pending_task_safety_flag.cc
@@ -32,6 +32,17 @@ PendingTaskSafetyFlag::CreateDetached() {
return safety_flag;
}
+// Creates a flag, but with its SequenceChecker explicitly initialized for
+// a given task queue and the `alive()` flag specified.
+rtc::scoped_refptr<PendingTaskSafetyFlag>
+PendingTaskSafetyFlag::CreateAttachedToTaskQueue(
+ bool alive,
+ absl::Nonnull<TaskQueueBase*> attached_queue) {
+ RTC_DCHECK(attached_queue) << "Null TaskQueue provided";
+ return rtc::scoped_refptr<PendingTaskSafetyFlag>(
+ new PendingTaskSafetyFlag(alive, attached_queue));
+}
+
rtc::scoped_refptr<PendingTaskSafetyFlag>
PendingTaskSafetyFlag::CreateDetachedInactive() {
rtc::scoped_refptr<PendingTaskSafetyFlag> safety_flag = CreateInternal(false);
diff --git a/api/task_queue/pending_task_safety_flag.h b/api/task_queue/pending_task_safety_flag.h
index 7f6a592856..12b1e00ee4 100644
--- a/api/task_queue/pending_task_safety_flag.h
+++ b/api/task_queue/pending_task_safety_flag.h
@@ -13,6 +13,7 @@
#include <utility>
+#include "absl/base/nullability.h"
#include "absl/functional/any_invocable.h"
#include "api/ref_counted_base.h"
#include "api/scoped_refptr.h"
@@ -68,6 +69,12 @@ class RTC_EXPORT PendingTaskSafetyFlag final
// may be created on a different thread than the flag will be used on.
static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateDetached();
+ // Creates a flag, but with its SequenceChecker explicitly initialized for
+ // a given task queue and the `alive()` flag specified.
+ static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateAttachedToTaskQueue(
+ bool alive,
+ absl::Nonnull<TaskQueueBase*> attached_queue);
+
// Same as `CreateDetached()` except the initial state of the returned flag
// will be `!alive()`.
static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateDetachedInactive();
@@ -95,6 +102,9 @@ class RTC_EXPORT PendingTaskSafetyFlag final
protected:
explicit PendingTaskSafetyFlag(bool alive) : alive_(alive) {}
+ PendingTaskSafetyFlag(bool alive,
+ absl::Nonnull<TaskQueueBase*> attached_queue)
+ : alive_(alive), main_sequence_(attached_queue) {}
private:
static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateInternal(bool alive);
diff --git a/api/task_queue/pending_task_safety_flag_unittest.cc b/api/task_queue/pending_task_safety_flag_unittest.cc
index cedf0eb8df..3a1ed268fc 100644
--- a/api/task_queue/pending_task_safety_flag_unittest.cc
+++ b/api/task_queue/pending_task_safety_flag_unittest.cc
@@ -167,6 +167,17 @@ TEST(PendingTaskSafetyFlagTest, PendingTaskNotAliveInitialized) {
EXPECT_TRUE(task_2_ran);
}
+TEST(PendingTaskSafetyFlagTest, PendingTaskInitializedForTaskQueue) {
+ TaskQueueForTest tq("PendingTaskAliveInitializedForTaskQueue");
+
+ // Create a new flag that initially `alive`, attached to a specific TQ.
+ auto flag = PendingTaskSafetyFlag::CreateAttachedToTaskQueue(true, tq.Get());
+ tq.SendTask([&flag]() { EXPECT_TRUE(flag->alive()); });
+ // Repeat the same steps but initialize as inactive.
+ flag = PendingTaskSafetyFlag::CreateAttachedToTaskQueue(false, tq.Get());
+ tq.SendTask([&flag]() { EXPECT_FALSE(flag->alive()); });
+}
+
TEST(PendingTaskSafetyFlagTest, SafeTask) {
rtc::scoped_refptr<PendingTaskSafetyFlag> flag =
PendingTaskSafetyFlag::Create();
diff --git a/api/task_queue/task_queue_base.h b/api/task_queue/task_queue_base.h
index da7a00d438..89e9e9e3b0 100644
--- a/api/task_queue/task_queue_base.h
+++ b/api/task_queue/task_queue_base.h
@@ -94,8 +94,7 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
void PostDelayedTask(absl::AnyInvocable<void() &&> task,
TimeDelta delay,
const Location& location = Location::Current()) {
- PostDelayedTaskImpl(std::move(task), delay,
- PostDelayedTaskTraits{.high_precision = false},
+ PostDelayedTaskImpl(std::move(task), delay, PostDelayedTaskTraits{},
location);
}
@@ -119,9 +118,9 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueueBase {
absl::AnyInvocable<void() &&> task,
TimeDelta delay,
const Location& location = Location::Current()) {
- PostDelayedTaskImpl(std::move(task), delay,
- PostDelayedTaskTraits{.high_precision = true},
- location);
+ PostDelayedTaskTraits traits;
+ traits.high_precision = true;
+ PostDelayedTaskImpl(std::move(task), delay, traits, location);
}
// As specified by `precision`, calls either PostDelayedTask() or
diff --git a/api/task_queue/task_queue_test.cc b/api/task_queue/task_queue_test.cc
index b02333ec58..cac7cd77cc 100644
--- a/api/task_queue/task_queue_test.cc
+++ b/api/task_queue/task_queue_test.cc
@@ -268,7 +268,7 @@ TEST_P(TaskQueueTest, PostALot) {
explicit BlockingCounter(int initial_count) : count_(initial_count) {}
void DecrementCount() {
- if (count_.DecRef() == rtc::RefCountReleaseStatus::kDroppedLastRef) {
+ if (count_.DecRef() == webrtc::RefCountReleaseStatus::kDroppedLastRef) {
event_.Set();
}
}
diff --git a/api/test/compile_all_headers.cc b/api/test/compile_all_headers.cc
index 1fcf63e97b..9d375a19f2 100644
--- a/api/test/compile_all_headers.cc
+++ b/api/test/compile_all_headers.cc
@@ -43,6 +43,7 @@
#include "api/test/mock_rtpreceiver.h"
#include "api/test/mock_rtpsender.h"
#include "api/test/mock_session_description_interface.h"
+#include "api/test/mock_transformable_frame.h"
#include "api/test/mock_transformable_video_frame.h"
#include "api/test/mock_video_bitrate_allocator.h"
#include "api/test/mock_video_bitrate_allocator_factory.h"
diff --git a/api/test/create_time_controller.cc b/api/test/create_time_controller.cc
index d198f2b0fe..3378805088 100644
--- a/api/test/create_time_controller.cc
+++ b/api/test/create_time_controller.cc
@@ -11,10 +11,17 @@
#include "api/test/create_time_controller.h"
#include <memory>
+#include <utility>
+#include "absl/base/nullability.h"
+#include "api/enable_media_with_defaults.h"
+#include "api/peer_connection_interface.h"
#include "call/call.h"
#include "call/rtp_transport_config.h"
#include "call/rtp_transport_controller_send_factory_interface.h"
+#include "pc/media_factory.h"
+#include "rtc_base/checks.h"
+#include "system_wrappers/include/clock.h"
#include "test/time_controller/external_time_controller.h"
#include "test/time_controller/simulated_time_controller.h"
@@ -36,7 +43,7 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
public:
explicit TimeControllerBasedCallFactory(TimeController* time_controller)
: time_controller_(time_controller) {}
- Call* CreateCall(const Call::Config& config) override {
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
return Call::Create(config, time_controller_->GetClock(),
@@ -50,4 +57,36 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
return std::make_unique<TimeControllerBasedCallFactory>(time_controller);
}
+void EnableMediaWithDefaultsAndTimeController(
+ TimeController& time_controller,
+ PeerConnectionFactoryDependencies& deps) {
+ class TimeControllerBasedFactory : public MediaFactory {
+ public:
+ TimeControllerBasedFactory(
+ absl::Nonnull<Clock*> clock,
+ absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory)
+ : clock_(clock), media_factory_(std::move(media_factory)) {}
+
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
+ return Call::Create(config, clock_,
+ config.rtp_transport_controller_send_factory->Create(
+ config.ExtractTransportConfig(), clock_));
+ }
+
+ std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
+ PeerConnectionFactoryDependencies& dependencies) override {
+ return media_factory_->CreateMediaEngine(dependencies);
+ }
+
+ private:
+ absl::Nonnull<Clock*> clock_;
+ absl::Nonnull<std::unique_ptr<MediaFactory>> media_factory_;
+ };
+
+ EnableMediaWithDefaults(deps);
+ RTC_CHECK(deps.media_factory);
+ deps.media_factory = std::make_unique<TimeControllerBasedFactory>(
+ time_controller.GetClock(), std::move(deps.media_factory));
+}
+
} // namespace webrtc
diff --git a/api/test/create_time_controller.h b/api/test/create_time_controller.h
index e7bc9cb465..9d0e7dde21 100644
--- a/api/test/create_time_controller.h
+++ b/api/test/create_time_controller.h
@@ -13,6 +13,7 @@
#include <memory>
#include "api/call/call_factory_interface.h"
+#include "api/peer_connection_interface.h"
#include "api/test/time_controller.h"
namespace webrtc {
@@ -26,8 +27,15 @@ std::unique_ptr<TimeController> CreateSimulatedTimeController();
// This is creates a call factory that creates Call instances that are backed by
// a time controller.
-std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
- TimeController* time_controller);
+[[deprecated("bugs.webrtc.org/15574")]] std::unique_ptr<CallFactoryInterface>
+CreateTimeControllerBasedCallFactory(TimeController* time_controller);
+
+// Adjusts media `deps` to use clock `time_controller` provides, fills media
+// related dependencies, and enables media support for a PeerConnectionFactory
+// created from `deps`.
+void EnableMediaWithDefaultsAndTimeController(
+ TimeController& time_controller,
+ PeerConnectionFactoryDependencies& deps);
} // namespace webrtc
diff --git a/api/test/create_video_codec_tester.cc b/api/test/create_video_codec_tester.cc
deleted file mode 100644
index a1efefdb48..0000000000
--- a/api/test/create_video_codec_tester.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "api/test/create_video_codec_tester.h"
-
-#include <memory>
-#include <utility>
-
-#include "api/test/video_codec_tester.h"
-#include "modules/video_coding/codecs/test/video_codec_tester_impl.h"
-
-namespace webrtc {
-namespace test {
-
-std::unique_ptr<VideoCodecTester> CreateVideoCodecTester() {
- return std::make_unique<VideoCodecTesterImpl>();
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/api/test/create_video_codec_tester.h b/api/test/create_video_codec_tester.h
deleted file mode 100644
index c68864ce85..0000000000
--- a/api/test/create_video_codec_tester.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
-#define API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
-
-#include <memory>
-
-#include "api/test/video_codec_tester.h"
-
-namespace webrtc {
-namespace test {
-
-std::unique_ptr<VideoCodecTester> CreateVideoCodecTester();
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_CREATE_VIDEO_CODEC_TESTER_H_
diff --git a/api/test/mock_transformable_audio_frame.h b/api/test/mock_transformable_audio_frame.h
index be703006ea..584c77fa54 100644
--- a/api/test/mock_transformable_audio_frame.h
+++ b/api/test/mock_transformable_audio_frame.h
@@ -11,6 +11,8 @@
#ifndef API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_
#define API_TEST_MOCK_TRANSFORMABLE_AUDIO_FRAME_H_
+#include <string>
+
#include "api/frame_transformer_interface.h"
#include "test/gmock.h"
@@ -24,6 +26,7 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(rtc::ArrayView<const uint32_t>,
GetContributingSources,
(),
diff --git a/api/test/mock_transformable_frame.h b/api/test/mock_transformable_frame.h
new file mode 100644
index 0000000000..df20b62295
--- /dev/null
+++ b/api/test/mock_transformable_frame.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
+#define API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
+
+#include <stdint.h>
+
+#include <optional>
+#include <string>
+
+#include "api/array_view.h"
+#include "api/frame_transformer_interface.h"
+#include "api/units/timestamp.h"
+#include "test/gmock.h"
+
+namespace webrtc {
+
+class MockTransformableFrame : public webrtc::TransformableFrameInterface {
+ public:
+ MOCK_METHOD(rtc::ArrayView<const uint8_t>, GetData, (), (const, override));
+ MOCK_METHOD(void, SetData, (rtc::ArrayView<const uint8_t>), (override));
+ MOCK_METHOD(uint8_t, GetPayloadType, (), (const, override));
+ MOCK_METHOD(uint32_t, GetSsrc, (), (const, override));
+ MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
+ MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
+ MOCK_METHOD(std::optional<webrtc::Timestamp>,
+ GetCaptureTimeIdentifier,
+ (),
+ (const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
+};
+
+static_assert(!std::is_abstract_v<MockTransformableFrame>, "");
+
+} // namespace webrtc
+
+#endif // API_TEST_MOCK_TRANSFORMABLE_FRAME_H_
diff --git a/api/test/mock_transformable_video_frame.h b/api/test/mock_transformable_video_frame.h
index 21c4dc2b69..b3825ddf48 100644
--- a/api/test/mock_transformable_video_frame.h
+++ b/api/test/mock_transformable_video_frame.h
@@ -11,6 +11,7 @@
#ifndef API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_
#define API_TEST_MOCK_TRANSFORMABLE_VIDEO_FRAME_H_
+#include <string>
#include <vector>
#include "api/frame_transformer_interface.h"
@@ -36,6 +37,7 @@ class MockTransformableVideoFrame
GetDirection,
(),
(const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
MOCK_METHOD(VideoFrameMetadata, Metadata, (), (const, override));
MOCK_METHOD(absl::optional<Timestamp>,
GetCaptureTimeIdentifier,
diff --git a/api/test/pclf/BUILD.gn b/api/test/pclf/BUILD.gn
index f94150f36b..372ff51f49 100644
--- a/api/test/pclf/BUILD.gn
+++ b/api/test/pclf/BUILD.gn
@@ -66,14 +66,12 @@ rtc_library("media_quality_test_params") {
deps = [
":media_configuration",
"../..:async_dns_resolver",
- "../../../api:callfactory_api",
"../../../api:fec_controller_api",
"../../../api:field_trials_view",
"../../../api:libjingle_peerconnection_api",
"../../../api:packet_socket_factory",
"../../../api/audio:audio_mixer_api",
"../../../api/rtc_event_log",
- "../../../api/task_queue",
"../../../api/transport:network_control",
"../../../api/video_codecs:video_codecs_api",
"../../../modules/audio_processing:api",
@@ -96,7 +94,6 @@ rtc_library("peer_configurer") {
":media_configuration",
":media_quality_test_params",
"../..:async_dns_resolver",
- "../../../api:callfactory_api",
"../../../api:create_peer_connection_quality_test_frame_generator",
"../../../api:fec_controller_api",
"../../../api:field_trials_view",
@@ -109,7 +106,6 @@ rtc_library("peer_configurer") {
"../../../api/audio_codecs:audio_codecs_api",
"../../../api/neteq:neteq_api",
"../../../api/rtc_event_log",
- "../../../api/task_queue",
"../../../api/transport:bitrate_settings",
"../../../api/transport:network_control",
"../../../api/video_codecs:video_codecs_api",
diff --git a/api/test/pclf/media_quality_test_params.h b/api/test/pclf/media_quality_test_params.h
index a247f342b0..aad04c3eb6 100644
--- a/api/test/pclf/media_quality_test_params.h
+++ b/api/test/pclf/media_quality_test_params.h
@@ -17,11 +17,9 @@
#include "api/async_dns_resolver.h"
#include "api/audio/audio_mixer.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/pclf/media_configuration.h"
#include "api/transport/network_control.h"
#include "api/video_codecs/video_decoder_factory.h"
@@ -46,15 +44,11 @@ namespace webrtc_pc_e2e {
// can override only some parts of media engine like video encoder/decoder
// factories.
struct PeerConnectionFactoryComponents {
- std::unique_ptr<TaskQueueFactory> task_queue_factory;
- std::unique_ptr<CallFactoryInterface> call_factory;
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory;
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory;
std::unique_ptr<NetworkControllerFactoryInterface> network_controller_factory;
std::unique_ptr<NetEqFactory> neteq_factory;
- // Will be passed to MediaEngineInterface, that will be used in
- // PeerConnectionFactory.
std::unique_ptr<VideoEncoderFactory> video_encoder_factory;
std::unique_ptr<VideoDecoderFactory> video_decoder_factory;
rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory;
diff --git a/api/test/pclf/peer_configurer.cc b/api/test/pclf/peer_configurer.cc
index 949dbd347c..5e385452b1 100644
--- a/api/test/pclf/peer_configurer.cc
+++ b/api/test/pclf/peer_configurer.cc
@@ -22,7 +22,6 @@
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/ice_transport_interface.h"
@@ -30,7 +29,6 @@
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
#include "api/scoped_refptr.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/create_peer_connection_quality_test_frame_generator.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
@@ -62,17 +60,6 @@ PeerConfigurer* PeerConfigurer::SetName(absl::string_view name) {
return this;
}
-PeerConfigurer* PeerConfigurer::SetTaskQueueFactory(
- std::unique_ptr<TaskQueueFactory> task_queue_factory) {
- components_->pcf_dependencies->task_queue_factory =
- std::move(task_queue_factory);
- return this;
-}
-PeerConfigurer* PeerConfigurer::SetCallFactory(
- std::unique_ptr<CallFactoryInterface> call_factory) {
- components_->pcf_dependencies->call_factory = std::move(call_factory);
- return this;
-}
PeerConfigurer* PeerConfigurer::SetEventLogFactory(
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory) {
components_->pcf_dependencies->event_log_factory =
diff --git a/api/test/pclf/peer_configurer.h b/api/test/pclf/peer_configurer.h
index 2012ebc28c..c0faf8573a 100644
--- a/api/test/pclf/peer_configurer.h
+++ b/api/test/pclf/peer_configurer.h
@@ -21,7 +21,6 @@
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/fec_controller.h"
#include "api/field_trials_view.h"
#include "api/ice_transport_interface.h"
@@ -29,7 +28,6 @@
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
#include "api/scoped_refptr.h"
-#include "api/task_queue/task_queue_factory.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
#include "api/test/pclf/media_quality_test_params.h"
@@ -59,13 +57,9 @@ class PeerConfigurer {
// unique.
PeerConfigurer* SetName(absl::string_view name);
- // The parameters of the following 9 methods will be passed to the
+ // The parameters of the following 7 methods will be passed to the
// PeerConnectionFactoryInterface implementation that will be created for
// this peer.
- PeerConfigurer* SetTaskQueueFactory(
- std::unique_ptr<TaskQueueFactory> task_queue_factory);
- PeerConfigurer* SetCallFactory(
- std::unique_ptr<CallFactoryInterface> call_factory);
PeerConfigurer* SetEventLogFactory(
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory);
PeerConfigurer* SetFecControllerFactory(
diff --git a/api/test/video_codec_stats.cc b/api/test/video_codec_stats.cc
deleted file mode 100644
index fb7226701e..0000000000
--- a/api/test/video_codec_stats.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "api/test/video_codec_stats.h"
-
-namespace webrtc {
-namespace test {
-
-void VideoCodecStats::Stream::LogMetrics(
- MetricsLogger* logger,
- std::string test_case_name,
- std::map<std::string, std::string> metadata) const {
- logger->LogMetric("width", test_case_name, width, Unit::kCount,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("height", test_case_name, height, Unit::kCount,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric(
- "frame_size_bytes", test_case_name, frame_size_bytes, Unit::kBytes,
- webrtc::test::ImprovementDirection::kNeitherIsBetter, metadata);
-
- logger->LogMetric("keyframe", test_case_name, keyframe, Unit::kCount,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("qp", test_case_name, qp, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric(
- "encode_time_ms", test_case_name, encode_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata);
-
- logger->LogMetric(
- "decode_time_ms", test_case_name, decode_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter, metadata);
-
- logger->LogMetric("target_bitrate_kbps", test_case_name, target_bitrate_kbps,
- Unit::kKilobitsPerSecond,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("target_framerate_fps", test_case_name,
- target_framerate_fps, Unit::kHertz,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("encoded_bitrate_kbps", test_case_name,
- encoded_bitrate_kbps, Unit::kKilobitsPerSecond,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("encoded_framerate_fps", test_case_name,
- encoded_framerate_fps, Unit::kHertz,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("bitrate_mismatch_pct", test_case_name,
- bitrate_mismatch_pct, Unit::kPercent,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("framerate_mismatch_pct", test_case_name,
- framerate_mismatch_pct, Unit::kPercent,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("transmission_time_ms", test_case_name,
- transmission_time_ms, Unit::kMilliseconds,
- webrtc::test::ImprovementDirection::kSmallerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_y_db", test_case_name, psnr.y, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_u_db", test_case_name, psnr.u, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-
- logger->LogMetric("psnr_v_db", test_case_name, psnr.v, Unit::kUnitless,
- webrtc::test::ImprovementDirection::kBiggerIsBetter,
- metadata);
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/api/test/video_codec_stats.h b/api/test/video_codec_stats.h
deleted file mode 100644
index 80f8287848..0000000000
--- a/api/test/video_codec_stats.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef API_TEST_VIDEO_CODEC_STATS_H_
-#define API_TEST_VIDEO_CODEC_STATS_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "absl/types/optional.h"
-#include "api/numerics/samples_stats_counter.h"
-#include "api/test/metrics/metric.h"
-#include "api/test/metrics/metrics_logger.h"
-#include "api/units/data_rate.h"
-#include "api/units/data_size.h"
-#include "api/units/frequency.h"
-
-namespace webrtc {
-namespace test {
-
-// Interface for encoded and/or decoded video frame and stream statistics.
-class VideoCodecStats {
- public:
- // Filter for slicing frames.
- struct Filter {
- absl::optional<int> first_frame;
- absl::optional<int> last_frame;
- absl::optional<int> spatial_idx;
- absl::optional<int> temporal_idx;
- };
-
- struct Frame {
- int frame_num = 0;
- uint32_t timestamp_rtp = 0;
-
- int spatial_idx = 0;
- int temporal_idx = 0;
-
- int width = 0;
- int height = 0;
- DataSize frame_size = DataSize::Zero();
- bool keyframe = false;
- absl::optional<int> qp;
- absl::optional<int> base_spatial_idx;
-
- Timestamp encode_start = Timestamp::Zero();
- TimeDelta encode_time = TimeDelta::Zero();
- Timestamp decode_start = Timestamp::Zero();
- TimeDelta decode_time = TimeDelta::Zero();
-
- struct Psnr {
- double y = 0.0;
- double u = 0.0;
- double v = 0.0;
- };
- absl::optional<Psnr> psnr;
-
- absl::optional<DataRate> target_bitrate;
- absl::optional<Frequency> target_framerate;
-
- bool encoded = false;
- bool decoded = false;
- };
-
- struct Stream {
- SamplesStatsCounter width;
- SamplesStatsCounter height;
- SamplesStatsCounter frame_size_bytes;
- SamplesStatsCounter keyframe;
- SamplesStatsCounter qp;
-
- SamplesStatsCounter encode_time_ms;
- SamplesStatsCounter decode_time_ms;
-
- SamplesStatsCounter target_bitrate_kbps;
- SamplesStatsCounter target_framerate_fps;
-
- SamplesStatsCounter encoded_bitrate_kbps;
- SamplesStatsCounter encoded_framerate_fps;
-
- SamplesStatsCounter bitrate_mismatch_pct;
- SamplesStatsCounter framerate_mismatch_pct;
-
- SamplesStatsCounter transmission_time_ms;
-
- struct Psnr {
- SamplesStatsCounter y;
- SamplesStatsCounter u;
- SamplesStatsCounter v;
- } psnr;
-
- // Logs `Stream` metrics to provided `MetricsLogger`.
- void LogMetrics(MetricsLogger* logger,
- std::string test_case_name,
- std::map<std::string, std::string> metadata = {}) const;
- };
-
- virtual ~VideoCodecStats() = default;
-
- // Returns frames from interval, spatial and temporal layer specified by given
- // `filter`.
- virtual std::vector<Frame> Slice(
- absl::optional<Filter> filter = absl::nullopt) const = 0;
-
- // Returns video statistics aggregated for given `frames`.
- virtual Stream Aggregate(const std::vector<Frame>& frames) const = 0;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_VIDEO_CODEC_STATS_H_
diff --git a/api/test/video_codec_tester.h b/api/test/video_codec_tester.h
deleted file mode 100644
index c2fb89e2cb..0000000000
--- a/api/test/video_codec_tester.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef API_TEST_VIDEO_CODEC_TESTER_H_
-#define API_TEST_VIDEO_CODEC_TESTER_H_
-
-#include <memory>
-#include <string>
-
-#include "absl/functional/any_invocable.h"
-#include "absl/types/optional.h"
-#include "api/test/video_codec_stats.h"
-#include "api/video/encoded_image.h"
-#include "api/video/resolution.h"
-#include "api/video/video_frame.h"
-
-namespace webrtc {
-namespace test {
-
-// Interface for a video codec tester. The interface provides minimalistic set
-// of data structures that enables implementation of decode-only, encode-only
-// and encode-decode tests.
-class VideoCodecTester {
- public:
- // Pacing settings for codec input.
- struct PacingSettings {
- enum PacingMode {
- // Pacing is not used. Frames are sent to codec back-to-back.
- kNoPacing,
- // Pace with the rate equal to the target video frame rate. Pacing time is
- // derived from RTP timestamp.
- kRealTime,
- // Pace with the explicitly provided rate.
- kConstantRate,
- };
- PacingMode mode = PacingMode::kNoPacing;
- // Pacing rate for `kConstantRate` mode.
- Frequency constant_rate = Frequency::Zero();
- };
-
- struct DecoderSettings {
- PacingSettings pacing;
- absl::optional<std::string> decoder_input_base_path;
- absl::optional<std::string> decoder_output_base_path;
- };
-
- struct EncoderSettings {
- PacingSettings pacing;
- absl::optional<std::string> encoder_input_base_path;
- absl::optional<std::string> encoder_output_base_path;
- };
-
- virtual ~VideoCodecTester() = default;
-
- // Interface for a raw video frames source.
- class RawVideoSource {
- public:
- virtual ~RawVideoSource() = default;
-
- // Returns next frame. If no more frames to pull, returns `absl::nullopt`.
- // For analysis and pacing purposes, frame must have RTP timestamp set. The
- // timestamp must represent the target video frame rate and be unique.
- virtual absl::optional<VideoFrame> PullFrame() = 0;
-
- // Returns early pulled frame with RTP timestamp equal to `timestamp_rtp`.
- virtual VideoFrame GetFrame(uint32_t timestamp_rtp,
- Resolution resolution) = 0;
- };
-
- // Interface for a coded video frames source.
- class CodedVideoSource {
- public:
- virtual ~CodedVideoSource() = default;
-
- // Returns next frame. If no more frames to pull, returns `absl::nullopt`.
- // For analysis and pacing purposes, frame must have RTP timestamp set. The
- // timestamp must represent the target video frame rate and be unique.
- virtual absl::optional<EncodedImage> PullFrame() = 0;
- };
-
- // Interface for a video encoder.
- class Encoder {
- public:
- using EncodeCallback =
- absl::AnyInvocable<void(const EncodedImage& encoded_frame)>;
-
- virtual ~Encoder() = default;
-
- virtual void Initialize() = 0;
-
- virtual void Encode(const VideoFrame& frame, EncodeCallback callback) = 0;
-
- virtual void Flush() = 0;
- };
-
- // Interface for a video decoder.
- class Decoder {
- public:
- using DecodeCallback =
- absl::AnyInvocable<void(const VideoFrame& decoded_frame)>;
-
- virtual ~Decoder() = default;
-
- virtual void Initialize() = 0;
-
- virtual void Decode(const EncodedImage& frame, DecodeCallback callback) = 0;
-
- virtual void Flush() = 0;
- };
-
- // Pulls coded video frames from `video_source` and passes them to `decoder`.
- // Returns `VideoCodecTestStats` object that contains collected per-frame
- // metrics.
- virtual std::unique_ptr<VideoCodecStats> RunDecodeTest(
- CodedVideoSource* video_source,
- Decoder* decoder,
- const DecoderSettings& decoder_settings) = 0;
-
- // Pulls raw video frames from `video_source` and passes them to `encoder`.
- // Returns `VideoCodecTestStats` object that contains collected per-frame
- // metrics.
- virtual std::unique_ptr<VideoCodecStats> RunEncodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- const EncoderSettings& encoder_settings) = 0;
-
- // Pulls raw video frames from `video_source`, passes them to `encoder` and
- // then passes encoded frames to `decoder`. Returns `VideoCodecTestStats`
- // object that contains collected per-frame metrics.
- virtual std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- Decoder* decoder,
- const EncoderSettings& encoder_settings,
- const DecoderSettings& decoder_settings) = 0;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // API_TEST_VIDEO_CODEC_TESTER_H_
diff --git a/api/transport/BUILD.gn b/api/transport/BUILD.gn
index 12a1f57066..84a0968ee9 100644
--- a/api/transport/BUILD.gn
+++ b/api/transport/BUILD.gn
@@ -53,6 +53,7 @@ rtc_library("field_trial_based_config") {
]
deps = [
"../../api:field_trials_registry",
+ "../../rtc_base/system:rtc_export",
"../../system_wrappers:field_trial",
]
absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
diff --git a/api/transport/field_trial_based_config.h b/api/transport/field_trial_based_config.h
index d47140e579..441f89e51d 100644
--- a/api/transport/field_trial_based_config.h
+++ b/api/transport/field_trial_based_config.h
@@ -14,10 +14,11 @@
#include "absl/strings/string_view.h"
#include "api/field_trials_registry.h"
+#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// Implementation using the field trial API fo the key value lookup.
-class FieldTrialBasedConfig : public FieldTrialsRegistry {
+class RTC_EXPORT FieldTrialBasedConfig : public FieldTrialsRegistry {
private:
std::string GetValue(absl::string_view key) const override;
};
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index 807fdcc3a9..5ec689c096 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -67,6 +67,7 @@ rtc_library("video_frame") {
":video_rtp_headers",
"..:array_view",
"..:make_ref_counted",
+ "..:ref_count",
"..:rtp_packet_info",
"..:scoped_refptr",
"..:video_track_source_constraints",
diff --git a/api/video/color_space.cc b/api/video/color_space.cc
index a0cd32edb2..dcb9c67da5 100644
--- a/api/video/color_space.cc
+++ b/api/video/color_space.cc
@@ -10,6 +10,8 @@
#include "api/video/color_space.h"
+#include "rtc_base/strings/string_builder.h"
+
namespace webrtc {
namespace {
// Try to convert `enum_value` into the enum class T. `enum_bitmask` is created
@@ -124,6 +126,80 @@ const HdrMetadata* ColorSpace::hdr_metadata() const {
return hdr_metadata_ ? &*hdr_metadata_ : nullptr;
}
+#define PRINT_ENUM_CASE(TYPE, NAME) \
+ case TYPE::NAME: \
+ ss << #NAME; \
+ break;
+
+std::string ColorSpace::AsString() const {
+ char buf[1024];
+ rtc::SimpleStringBuilder ss(buf);
+ ss << "{primaries:";
+ switch (primaries_) {
+ PRINT_ENUM_CASE(PrimaryID, kBT709)
+ PRINT_ENUM_CASE(PrimaryID, kUnspecified)
+ PRINT_ENUM_CASE(PrimaryID, kBT470M)
+ PRINT_ENUM_CASE(PrimaryID, kBT470BG)
+ PRINT_ENUM_CASE(PrimaryID, kSMPTE170M)
+ PRINT_ENUM_CASE(PrimaryID, kSMPTE240M)
+ PRINT_ENUM_CASE(PrimaryID, kFILM)
+ PRINT_ENUM_CASE(PrimaryID, kBT2020)
+ PRINT_ENUM_CASE(PrimaryID, kSMPTEST428)
+ PRINT_ENUM_CASE(PrimaryID, kSMPTEST431)
+ PRINT_ENUM_CASE(PrimaryID, kSMPTEST432)
+ PRINT_ENUM_CASE(PrimaryID, kJEDECP22)
+ }
+ ss << ", transfer:";
+ switch (transfer_) {
+ PRINT_ENUM_CASE(TransferID, kBT709)
+ PRINT_ENUM_CASE(TransferID, kUnspecified)
+ PRINT_ENUM_CASE(TransferID, kGAMMA22)
+ PRINT_ENUM_CASE(TransferID, kGAMMA28)
+ PRINT_ENUM_CASE(TransferID, kSMPTE170M)
+ PRINT_ENUM_CASE(TransferID, kSMPTE240M)
+ PRINT_ENUM_CASE(TransferID, kLINEAR)
+ PRINT_ENUM_CASE(TransferID, kLOG)
+ PRINT_ENUM_CASE(TransferID, kLOG_SQRT)
+ PRINT_ENUM_CASE(TransferID, kIEC61966_2_4)
+ PRINT_ENUM_CASE(TransferID, kBT1361_ECG)
+ PRINT_ENUM_CASE(TransferID, kIEC61966_2_1)
+ PRINT_ENUM_CASE(TransferID, kBT2020_10)
+ PRINT_ENUM_CASE(TransferID, kBT2020_12)
+ PRINT_ENUM_CASE(TransferID, kSMPTEST2084)
+ PRINT_ENUM_CASE(TransferID, kSMPTEST428)
+ PRINT_ENUM_CASE(TransferID, kARIB_STD_B67)
+ }
+ ss << ", matrix:";
+ switch (matrix_) {
+ PRINT_ENUM_CASE(MatrixID, kRGB)
+ PRINT_ENUM_CASE(MatrixID, kBT709)
+ PRINT_ENUM_CASE(MatrixID, kUnspecified)
+ PRINT_ENUM_CASE(MatrixID, kFCC)
+ PRINT_ENUM_CASE(MatrixID, kBT470BG)
+ PRINT_ENUM_CASE(MatrixID, kSMPTE170M)
+ PRINT_ENUM_CASE(MatrixID, kSMPTE240M)
+ PRINT_ENUM_CASE(MatrixID, kYCOCG)
+ PRINT_ENUM_CASE(MatrixID, kBT2020_NCL)
+ PRINT_ENUM_CASE(MatrixID, kBT2020_CL)
+ PRINT_ENUM_CASE(MatrixID, kSMPTE2085)
+ PRINT_ENUM_CASE(MatrixID, kCDNCLS)
+ PRINT_ENUM_CASE(MatrixID, kCDCLS)
+ PRINT_ENUM_CASE(MatrixID, kBT2100_ICTCP)
+ }
+
+ ss << ", range:";
+ switch (range_) {
+ PRINT_ENUM_CASE(RangeID, kInvalid)
+ PRINT_ENUM_CASE(RangeID, kLimited)
+ PRINT_ENUM_CASE(RangeID, kFull)
+ PRINT_ENUM_CASE(RangeID, kDerived)
+ }
+ ss << "}";
+ return ss.str();
+}
+
+#undef PRINT_ENUM_CASE
+
bool ColorSpace::set_primaries_from_uint8(uint8_t enum_value) {
constexpr PrimaryID kPrimaryIds[] = {
PrimaryID::kBT709, PrimaryID::kUnspecified, PrimaryID::kBT470M,
diff --git a/api/video/color_space.h b/api/video/color_space.h
index e491c52e72..31963a1253 100644
--- a/api/video/color_space.h
+++ b/api/video/color_space.h
@@ -13,6 +13,8 @@
#include <stdint.h>
+#include <string>
+
#include "absl/types/optional.h"
#include "api/video/hdr_metadata.h"
#include "rtc_base/system/rtc_export.h"
@@ -155,6 +157,7 @@ class RTC_EXPORT ColorSpace {
ChromaSiting chroma_siting_horizontal() const;
ChromaSiting chroma_siting_vertical() const;
const HdrMetadata* hdr_metadata() const;
+ std::string AsString() const;
bool set_primaries_from_uint8(uint8_t enum_value);
bool set_transfer_from_uint8(uint8_t enum_value);
diff --git a/api/video/encoded_image.h b/api/video/encoded_image.h
index 0e40cfecf2..8f0226c7a7 100644
--- a/api/video/encoded_image.h
+++ b/api/video/encoded_image.h
@@ -83,16 +83,10 @@ class RTC_EXPORT EncodedImage {
void SetRtpTimestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
uint32_t RtpTimestamp() const { return timestamp_rtp_; }
- // TODO(bugs.webrtc.org/9378): Delete two functions below after 2023-10-12
- [[deprecated]] void SetTimestamp(uint32_t timestamp) {
- SetRtpTimestamp(timestamp);
- }
- [[deprecated]] uint32_t Timestamp() const { return RtpTimestamp(); }
-
void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms);
// Frame capture time in local time.
- webrtc::Timestamp CaptureTime() const;
+ Timestamp CaptureTime() const;
// Frame capture time in ntp epoch time, i.e. time since 1st Jan 1900
int64_t NtpTimeMs() const { return ntp_time_ms_; }
@@ -106,11 +100,11 @@ class RTC_EXPORT EncodedImage {
simulcast_index_ = simulcast_index;
}
- const absl::optional<webrtc::Timestamp>& CaptureTimeIdentifier() const {
+ const absl::optional<Timestamp>& CaptureTimeIdentifier() const {
return capture_time_identifier_;
}
void SetCaptureTimeIdentifier(
- const absl::optional<webrtc::Timestamp>& capture_time_identifier) {
+ const absl::optional<Timestamp>& capture_time_identifier) {
capture_time_identifier_ = capture_time_identifier;
}
@@ -250,7 +244,7 @@ class RTC_EXPORT EncodedImage {
size_t size_ = 0; // Size of encoded frame data.
uint32_t timestamp_rtp_ = 0;
absl::optional<int> simulcast_index_;
- absl::optional<webrtc::Timestamp> capture_time_identifier_;
+ absl::optional<Timestamp> capture_time_identifier_;
absl::optional<int> spatial_index_;
absl::optional<int> temporal_index_;
std::map<int, size_t> spatial_layer_frame_size_bytes_;
diff --git a/api/video/test/color_space_unittest.cc b/api/video/test/color_space_unittest.cc
index 1d8b3a87f6..ae66b018f5 100644
--- a/api/video/test/color_space_unittest.cc
+++ b/api/video/test/color_space_unittest.cc
@@ -71,4 +71,13 @@ TEST(ColorSpace, TestSettingChromaSitingVerticalFromUint8) {
EXPECT_FALSE(color_space.set_chroma_siting_vertical_from_uint8(3));
}
+TEST(ColorSpace, TestAsStringFunction) {
+ ColorSpace color_space(
+ ColorSpace::PrimaryID::kBT709, ColorSpace::TransferID::kBT709,
+ ColorSpace::MatrixID::kBT709, ColorSpace::RangeID::kLimited);
+ EXPECT_EQ(
+ color_space.AsString(),
+ "{primaries:kBT709, transfer:kBT709, matrix:kBT709, range:kLimited}");
+}
+
} // namespace webrtc
diff --git a/api/video/video_frame.cc b/api/video/video_frame.cc
index 35dedce1b2..fd975dfd87 100644
--- a/api/video/video_frame.cc
+++ b/api/video/video_frame.cc
@@ -164,9 +164,9 @@ VideoFrame::Builder::~Builder() = default;
VideoFrame VideoFrame::Builder::build() {
RTC_CHECK(video_frame_buffer_ != nullptr);
return VideoFrame(id_, video_frame_buffer_, timestamp_us_,
- capture_time_identifier_, timestamp_rtp_, ntp_time_ms_,
- rotation_, color_space_, render_parameters_, update_rect_,
- packet_infos_);
+ capture_time_identifier_, reference_time_, timestamp_rtp_,
+ ntp_time_ms_, rotation_, color_space_, render_parameters_,
+ update_rect_, packet_infos_);
}
VideoFrame::Builder& VideoFrame::Builder::set_video_frame_buffer(
@@ -193,6 +193,12 @@ VideoFrame::Builder& VideoFrame::Builder::set_capture_time_identifier(
return *this;
}
+VideoFrame::Builder& VideoFrame::Builder::set_reference_time(
+ const absl::optional<Timestamp>& reference_time) {
+ reference_time_ = reference_time;
+ return *this;
+}
+
VideoFrame::Builder& VideoFrame::Builder::set_timestamp_rtp(
uint32_t timestamp_rtp) {
timestamp_rtp_ = timestamp_rtp;
@@ -264,6 +270,7 @@ VideoFrame::VideoFrame(uint16_t id,
const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
const absl::optional<Timestamp>& capture_time_identifier,
+ const absl::optional<Timestamp>& reference_time,
uint32_t timestamp_rtp,
int64_t ntp_time_ms,
VideoRotation rotation,
@@ -277,6 +284,7 @@ VideoFrame::VideoFrame(uint16_t id,
ntp_time_ms_(ntp_time_ms),
timestamp_us_(timestamp_us),
capture_time_identifier_(capture_time_identifier),
+ reference_time_(reference_time),
rotation_(rotation),
color_space_(color_space),
render_parameters_(render_parameters),
diff --git a/api/video/video_frame.h b/api/video/video_frame.h
index a257a3209e..2608f9aa42 100644
--- a/api/video/video_frame.h
+++ b/api/video/video_frame.h
@@ -109,6 +109,8 @@ class RTC_EXPORT VideoFrame {
Builder& set_timestamp_us(int64_t timestamp_us);
Builder& set_capture_time_identifier(
const absl::optional<Timestamp>& capture_time_identifier);
+ Builder& set_reference_time(
+ const absl::optional<Timestamp>& reference_time);
Builder& set_timestamp_rtp(uint32_t timestamp_rtp);
Builder& set_ntp_time_ms(int64_t ntp_time_ms);
Builder& set_rotation(VideoRotation rotation);
@@ -123,6 +125,7 @@ class RTC_EXPORT VideoFrame {
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
int64_t timestamp_us_ = 0;
absl::optional<Timestamp> capture_time_identifier_;
+ absl::optional<Timestamp> reference_time_;
uint32_t timestamp_rtp_ = 0;
int64_t ntp_time_ms_ = 0;
VideoRotation rotation_ = kVideoRotation_0;
@@ -177,6 +180,13 @@ class RTC_EXPORT VideoFrame {
capture_time_identifier_ = capture_time_identifier;
}
+ const absl::optional<Timestamp>& reference_time() const {
+ return reference_time_;
+ }
+ void set_reference_time(const absl::optional<Timestamp>& reference_time) {
+ reference_time_ = reference_time;
+ }
+
// Set frame timestamp (90kHz).
void set_timestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
@@ -274,6 +284,7 @@ class RTC_EXPORT VideoFrame {
const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
int64_t timestamp_us,
const absl::optional<Timestamp>& capture_time_identifier,
+ const absl::optional<Timestamp>& reference_time,
uint32_t timestamp_rtp,
int64_t ntp_time_ms,
VideoRotation rotation,
@@ -289,6 +300,11 @@ class RTC_EXPORT VideoFrame {
int64_t ntp_time_ms_;
int64_t timestamp_us_;
absl::optional<Timestamp> capture_time_identifier_;
+ // Contains a monotonically increasing clock time and represents the time
+ // when the frame was captured. Not all platforms provide the "true" sample
+ // capture time in |reference_time| but might instead use a somewhat delayed
+ // (by the time it took to capture the frame) version of it.
+ absl::optional<Timestamp> reference_time_;
VideoRotation rotation_;
absl::optional<ColorSpace> color_space_;
// Contains parameters that affect have the frame should be rendered.
diff --git a/api/video/video_frame_buffer.h b/api/video/video_frame_buffer.h
index aaf786699f..ca6e9067db 100644
--- a/api/video/video_frame_buffer.h
+++ b/api/video/video_frame_buffer.h
@@ -14,8 +14,8 @@
#include <stdint.h>
#include "api/array_view.h"
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -44,7 +44,7 @@ class NV12BufferInterface;
// performance by providing an optimized path without intermediate conversions.
// Frame metadata such as rotation and timestamp are stored in
// webrtc::VideoFrame, and not here.
-class RTC_EXPORT VideoFrameBuffer : public rtc::RefCountInterface {
+class RTC_EXPORT VideoFrameBuffer : public webrtc::RefCountInterface {
public:
// New frame buffer types will be added conservatively when there is an
// opportunity to optimize the path between some pair of video source and
diff --git a/api/wrapping_async_dns_resolver.h b/api/wrapping_async_dns_resolver.h
index d07f1464c5..b384f97652 100644
--- a/api/wrapping_async_dns_resolver.h
+++ b/api/wrapping_async_dns_resolver.h
@@ -33,9 +33,10 @@
namespace webrtc {
-class WrappingAsyncDnsResolver;
+class [[deprecated("Use AsyncDnsResolver directly")]] WrappingAsyncDnsResolver;
-class RTC_EXPORT WrappingAsyncDnsResolverResult
+class [[deprecated(
+ "Use AsyncDnsResolver directly")]] RTC_EXPORT WrappingAsyncDnsResolverResult
: public AsyncDnsResolverResult {
public:
explicit WrappingAsyncDnsResolverResult(WrappingAsyncDnsResolver* owner)
@@ -54,6 +55,8 @@ class RTC_EXPORT WrappingAsyncDnsResolverResult
class RTC_EXPORT WrappingAsyncDnsResolver : public AsyncDnsResolverInterface,
public sigslot::has_slots<> {
public:
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
explicit WrappingAsyncDnsResolver(rtc::AsyncResolverInterface* wrapped)
: wrapped_(absl::WrapUnique(wrapped)), result_(this) {}
@@ -124,6 +127,7 @@ class RTC_EXPORT WrappingAsyncDnsResolver : public AsyncDnsResolverInterface,
State state_ RTC_GUARDED_BY(sequence_checker_) = State::kNotStarted;
WrappingAsyncDnsResolverResult result_ RTC_GUARDED_BY(sequence_checker_);
bool within_resolve_result_ RTC_GUARDED_BY(sequence_checker_) = false;
+#pragma clang diagnostic pop
};
} // namespace webrtc
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 0caf59a20e..c9dc42c04e 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -636,12 +636,14 @@ bool AudioSendStream::SetupSendCodec(const Config& new_config) {
}
// Wrap the encoder in a RED encoder, if RED is enabled.
+ SdpAudioFormat format = spec.format;
if (spec.red_payload_type) {
AudioEncoderCopyRed::Config red_config;
red_config.payload_type = *spec.red_payload_type;
red_config.speech_encoder = std::move(encoder);
encoder = std::make_unique<AudioEncoderCopyRed>(std::move(red_config),
field_trials_);
+ format.name = cricket::kRedCodecName;
}
// Set currently known overhead (used in ANA, opus only).
@@ -655,7 +657,7 @@ bool AudioSendStream::SetupSendCodec(const Config& new_config) {
}
StoreEncoderProperties(encoder->SampleRateHz(), encoder->NumChannels());
- channel_send_->SetEncoder(new_config.send_codec_spec->payload_type,
+ channel_send_->SetEncoder(new_config.send_codec_spec->payload_type, format,
std::move(encoder));
return true;
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index d842afdfe5..c854f734b5 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -242,11 +242,11 @@ struct ConfigHelper {
void SetupMockForSetupSendCodec(bool expect_set_encoder_call) {
if (expect_set_encoder_call) {
EXPECT_CALL(*channel_send_, SetEncoder)
- .WillOnce(
- [this](int payload_type, std::unique_ptr<AudioEncoder> encoder) {
- this->audio_encoder_ = std::move(encoder);
- return true;
- });
+ .WillOnce([this](int payload_type, const SdpAudioFormat& format,
+ std::unique_ptr<AudioEncoder> encoder) {
+ this->audio_encoder_ = std::move(encoder);
+ return true;
+ });
}
}
@@ -595,6 +595,7 @@ TEST(AudioSendStreamTest, SendCodecCanApplyVad) {
std::unique_ptr<AudioEncoder> stolen_encoder;
EXPECT_CALL(*helper.channel_send(), SetEncoder)
.WillOnce([&stolen_encoder](int payload_type,
+ const SdpAudioFormat& format,
std::unique_ptr<AudioEncoder> encoder) {
stolen_encoder = std::move(encoder);
return true;
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc
index f5d214f672..efd9668c18 100644
--- a/audio/channel_receive.cc
+++ b/audio/channel_receive.cc
@@ -47,6 +47,7 @@
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/numerics/sequence_number_unwrapper.h"
#include "rtc_base/race_checker.h"
+#include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/system/no_unique_address.h"
#include "rtc_base/time_utils.h"
@@ -312,6 +313,8 @@ class ChannelReceive : public ChannelReceiveInterface,
mutable Mutex rtcp_counter_mutex_;
RtcpPacketTypeCounter rtcp_packet_type_counter_
RTC_GUARDED_BY(rtcp_counter_mutex_);
+
+ std::map<int, SdpAudioFormat> payload_type_map_;
};
void ChannelReceive::OnReceivedPayloadData(
@@ -636,6 +639,7 @@ void ChannelReceive::SetReceiveCodecs(
RTC_DCHECK_GE(kv.second.clockrate_hz, 1000);
payload_type_frequencies_[kv.first] = kv.second.clockrate_hz;
}
+ payload_type_map_ = codecs;
acm_receiver_.SetCodecs(codecs);
}
@@ -722,7 +726,14 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
if (frame_transformer_delegate_) {
// Asynchronously transform the received payload. After the payload is
// transformed, the delegate will call OnReceivedPayloadData to handle it.
- frame_transformer_delegate_->Transform(payload_data, header, remote_ssrc_);
+ char buf[1024];
+ rtc::SimpleStringBuilder mime_type(buf);
+ auto it = payload_type_map_.find(header.payloadType);
+ mime_type << MediaTypeToString(cricket::MEDIA_TYPE_AUDIO) << "/"
+ << (it != payload_type_map_.end() ? it->second.name
+ : "x-unknown");
+ frame_transformer_delegate_->Transform(payload_data, header, remote_ssrc_,
+ mime_type.str());
} else {
OnReceivedPayloadData(payload_data, header);
}
diff --git a/audio/channel_receive_frame_transformer_delegate.cc b/audio/channel_receive_frame_transformer_delegate.cc
index 2d2893b8f7..3cad530936 100644
--- a/audio/channel_receive_frame_transformer_delegate.cc
+++ b/audio/channel_receive_frame_transformer_delegate.cc
@@ -10,6 +10,7 @@
#include "audio/channel_receive_frame_transformer_delegate.h"
+#include <string>
#include <utility>
#include "rtc_base/buffer.h"
@@ -22,10 +23,12 @@ class TransformableIncomingAudioFrame
public:
TransformableIncomingAudioFrame(rtc::ArrayView<const uint8_t> payload,
const RTPHeader& header,
- uint32_t ssrc)
+ uint32_t ssrc,
+ const std::string& codec_mime_type)
: payload_(payload.data(), payload.size()),
header_(header),
- ssrc_(ssrc) {}
+ ssrc_(ssrc),
+ codec_mime_type_(codec_mime_type) {}
~TransformableIncomingAudioFrame() override = default;
rtc::ArrayView<const uint8_t> GetData() const override { return payload_; }
@@ -45,6 +48,7 @@ class TransformableIncomingAudioFrame
}
Direction GetDirection() const override { return Direction::kReceiver; }
+ std::string GetMimeType() const override { return codec_mime_type_; }
const absl::optional<uint16_t> SequenceNumber() const override {
return header_.sequenceNumber;
}
@@ -65,6 +69,7 @@ class TransformableIncomingAudioFrame
rtc::Buffer payload_;
RTPHeader header_;
uint32_t ssrc_;
+ std::string codec_mime_type_;
};
} // namespace
@@ -92,10 +97,16 @@ void ChannelReceiveFrameTransformerDelegate::Reset() {
void ChannelReceiveFrameTransformerDelegate::Transform(
rtc::ArrayView<const uint8_t> packet,
const RTPHeader& header,
- uint32_t ssrc) {
+ uint32_t ssrc,
+ const std::string& codec_mime_type) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
- frame_transformer_->Transform(
- std::make_unique<TransformableIncomingAudioFrame>(packet, header, ssrc));
+ if (short_circuit_) {
+ receive_frame_callback_(packet, header);
+ } else {
+ frame_transformer_->Transform(
+ std::make_unique<TransformableIncomingAudioFrame>(packet, header, ssrc,
+ codec_mime_type));
+ }
}
void ChannelReceiveFrameTransformerDelegate::OnTransformedFrame(
@@ -107,6 +118,14 @@ void ChannelReceiveFrameTransformerDelegate::OnTransformedFrame(
});
}
+void ChannelReceiveFrameTransformerDelegate::StartShortCircuiting() {
+ rtc::scoped_refptr<ChannelReceiveFrameTransformerDelegate> delegate(this);
+ channel_receive_thread_->PostTask([delegate = std::move(delegate)]() mutable {
+ RTC_DCHECK_RUN_ON(&delegate->sequence_checker_);
+ delegate->short_circuit_ = true;
+ });
+}
+
void ChannelReceiveFrameTransformerDelegate::ReceiveFrame(
std::unique_ptr<TransformableFrameInterface> frame) const {
RTC_DCHECK_RUN_ON(&sequence_checker_);
diff --git a/audio/channel_receive_frame_transformer_delegate.h b/audio/channel_receive_frame_transformer_delegate.h
index 04ad7c4695..ac7cef0f76 100644
--- a/audio/channel_receive_frame_transformer_delegate.h
+++ b/audio/channel_receive_frame_transformer_delegate.h
@@ -12,6 +12,7 @@
#define AUDIO_CHANNEL_RECEIVE_FRAME_TRANSFORMER_DELEGATE_H_
#include <memory>
+#include <string>
#include "api/frame_transformer_interface.h"
#include "api/sequence_checker.h"
@@ -48,12 +49,15 @@ class ChannelReceiveFrameTransformerDelegate : public TransformedFrameCallback {
// the frame asynchronously.
void Transform(rtc::ArrayView<const uint8_t> packet,
const RTPHeader& header,
- uint32_t ssrc);
+ uint32_t ssrc,
+ const std::string& codec_mime_type);
// Implements TransformedFrameCallback. Can be called on any thread.
void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) override;
+ void StartShortCircuiting() override;
+
// Delegates the call to ChannelReceive::OnReceivedPayloadData on the
// `channel_receive_thread_`, by calling `receive_frame_callback_`.
void ReceiveFrame(std::unique_ptr<TransformableFrameInterface> frame) const;
@@ -68,6 +72,7 @@ class ChannelReceiveFrameTransformerDelegate : public TransformedFrameCallback {
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_
RTC_GUARDED_BY(sequence_checker_);
TaskQueueBase* const channel_receive_thread_;
+ bool short_circuit_ RTC_GUARDED_BY(sequence_checker_) = false;
};
} // namespace webrtc
diff --git a/audio/channel_receive_frame_transformer_delegate_unittest.cc b/audio/channel_receive_frame_transformer_delegate_unittest.cc
index 38ceb6d96d..8bdf217d5a 100644
--- a/audio/channel_receive_frame_transformer_delegate_unittest.cc
+++ b/audio/channel_receive_frame_transformer_delegate_unittest.cc
@@ -93,7 +93,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
[&callback](std::unique_ptr<TransformableFrameInterface> frame) {
callback->OnTransformedFrame(std::move(frame));
});
- delegate->Transform(packet, header, 1111 /*ssrc*/);
+ delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus");
rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
}
@@ -126,7 +126,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
static_cast<TransformableAudioFrameInterface*>(frame.get());
callback->OnTransformedFrame(CloneSenderAudioFrame(transformed_frame));
});
- delegate->Transform(packet, header, 1111 /*ssrc*/);
+ delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus");
rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
}
@@ -150,5 +150,29 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
}
+TEST(ChannelReceiveFrameTransformerDelegateTest,
+ ShortCircuitingSkipsTransform) {
+ rtc::AutoThread main_thread;
+ rtc::scoped_refptr<MockFrameTransformer> mock_frame_transformer =
+ rtc::make_ref_counted<testing::NiceMock<MockFrameTransformer>>();
+ MockChannelReceive mock_channel;
+ rtc::scoped_refptr<ChannelReceiveFrameTransformerDelegate> delegate =
+ rtc::make_ref_counted<ChannelReceiveFrameTransformerDelegate>(
+ mock_channel.callback(), mock_frame_transformer,
+ rtc::Thread::Current());
+ const uint8_t data[] = {1, 2, 3, 4};
+ rtc::ArrayView<const uint8_t> packet(data, sizeof(data));
+ RTPHeader header;
+
+ delegate->StartShortCircuiting();
+ rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
+
+ // Will not call the actual transformer.
+ EXPECT_CALL(*mock_frame_transformer, Transform).Times(0);
+ // Will pass the frame straight to the channel.
+ EXPECT_CALL(mock_channel, ReceiveFrame);
+ delegate->Transform(packet, header, /*ssrc=*/1111, /*mimeType=*/"audio/opus");
+}
+
} // namespace
} // namespace webrtc
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index e3058fca0d..b71f564498 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -37,6 +37,7 @@
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/race_checker.h"
#include "rtc_base/rate_limiter.h"
+#include "rtc_base/strings/string_builder.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/time_utils.h"
@@ -79,6 +80,7 @@ class ChannelSend : public ChannelSendInterface,
// Send using this encoder, with this payload type.
void SetEncoder(int payload_type,
+ const SdpAudioFormat& encoder_format,
std::unique_ptr<AudioEncoder> encoder) override;
void ModifyEncoder(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)>
modifier) override;
@@ -237,6 +239,8 @@ class ChannelSend : public ChannelSendInterface,
// Defined last to ensure that there are no running tasks when the other
// members are destroyed.
rtc::TaskQueue encoder_queue_;
+
+ SdpAudioFormat encoder_format_;
};
const int kTelephoneEventAttenuationdB = 10;
@@ -279,10 +283,14 @@ int32_t ChannelSend::SendData(AudioFrameType frameType,
if (frame_transformer_delegate_) {
// Asynchronously transform the payload before sending it. After the payload
// is transformed, the delegate will call SendRtpAudio to send it.
+ char buf[1024];
+ rtc::SimpleStringBuilder mime_type(buf);
+ mime_type << MediaTypeToString(cricket::MEDIA_TYPE_AUDIO) << "/"
+ << encoder_format_.name;
frame_transformer_delegate_->Transform(
frameType, payloadType, rtp_timestamp + rtp_rtcp_->StartTimestamp(),
payloadData, payloadSize, absolute_capture_timestamp_ms,
- rtp_rtcp_->SSRC());
+ rtp_rtcp_->SSRC(), mime_type.str());
return 0;
}
return SendRtpAudio(frameType, payloadType, rtp_timestamp, payload,
@@ -394,7 +402,8 @@ ChannelSend::ChannelSend(
crypto_options_(crypto_options),
encoder_queue_(task_queue_factory->CreateTaskQueue(
"AudioEncoder",
- TaskQueueFactory::Priority::NORMAL)) {
+ TaskQueueFactory::Priority::NORMAL)),
+ encoder_format_("x-unknown", 0, 0) {
audio_coding_ = AudioCodingModule::Create();
RtpRtcpInterface::Configuration configuration;
@@ -411,8 +420,10 @@ ChannelSend::ChannelSend(
configuration.event_log = event_log_;
configuration.rtt_stats = rtcp_rtt_stats;
- configuration.retransmission_rate_limiter =
- retransmission_rate_limiter_.get();
+ if (field_trials.IsDisabled("WebRTC-DisableRtxRateLimiter")) {
+ configuration.retransmission_rate_limiter =
+ retransmission_rate_limiter_.get();
+ }
configuration.extmap_allow_mixed = extmap_allow_mixed;
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
configuration.rtcp_packet_type_counter_observer = this;
@@ -493,6 +504,7 @@ void ChannelSend::StopSend() {
}
void ChannelSend::SetEncoder(int payload_type,
+ const SdpAudioFormat& encoder_format,
std::unique_ptr<AudioEncoder> encoder) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_DCHECK_GE(payload_type, 0);
@@ -506,6 +518,7 @@ void ChannelSend::SetEncoder(int payload_type,
encoder->RtpTimestampRateHz(),
encoder->NumChannels(), 0);
+ encoder_format_ = encoder_format;
audio_coding_->SetEncoder(std::move(encoder));
}
diff --git a/audio/channel_send.h b/audio/channel_send.h
index 00d954c952..b6a6a37bf5 100644
--- a/audio/channel_send.h
+++ b/audio/channel_send.h
@@ -62,6 +62,7 @@ class ChannelSendInterface {
virtual CallSendStatistics GetRTCPStatistics() const = 0;
virtual void SetEncoder(int payload_type,
+ const SdpAudioFormat& encoder_format,
std::unique_ptr<AudioEncoder> encoder) = 0;
virtual void ModifyEncoder(
rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) = 0;
diff --git a/audio/channel_send_frame_transformer_delegate.cc b/audio/channel_send_frame_transformer_delegate.cc
index 0f85216e92..f66f29df08 100644
--- a/audio/channel_send_frame_transformer_delegate.cc
+++ b/audio/channel_send_frame_transformer_delegate.cc
@@ -55,13 +55,15 @@ class TransformableOutgoingAudioFrame
const uint8_t* payload_data,
size_t payload_size,
absl::optional<uint64_t> absolute_capture_timestamp_ms,
- uint32_t ssrc)
+ uint32_t ssrc,
+ const std::string& codec_mime_type)
: frame_type_(frame_type),
payload_type_(payload_type),
rtp_timestamp_with_offset_(rtp_timestamp_with_offset),
payload_(payload_data, payload_size),
absolute_capture_timestamp_ms_(absolute_capture_timestamp_ms),
- ssrc_(ssrc) {}
+ ssrc_(ssrc),
+ codec_mime_type_(codec_mime_type) {}
~TransformableOutgoingAudioFrame() override = default;
rtc::ArrayView<const uint8_t> GetData() const override { return payload_; }
void SetData(rtc::ArrayView<const uint8_t> data) override {
@@ -76,6 +78,7 @@ class TransformableOutgoingAudioFrame
uint8_t GetPayloadType() const override { return payload_type_; }
Direction GetDirection() const override { return Direction::kSender; }
+ std::string GetMimeType() const override { return codec_mime_type_; }
rtc::ArrayView<const uint32_t> GetContributingSources() const override {
return {};
@@ -100,6 +103,7 @@ class TransformableOutgoingAudioFrame
rtc::Buffer payload_;
absl::optional<uint64_t> absolute_capture_timestamp_ms_;
uint32_t ssrc_;
+ std::string codec_mime_type_;
};
} // namespace
@@ -131,11 +135,22 @@ void ChannelSendFrameTransformerDelegate::Transform(
const uint8_t* payload_data,
size_t payload_size,
int64_t absolute_capture_timestamp_ms,
- uint32_t ssrc) {
+ uint32_t ssrc,
+ const std::string& codec_mimetype) {
+ {
+ MutexLock lock(&send_lock_);
+ if (short_circuit_) {
+ send_frame_callback_(
+ frame_type, payload_type, rtp_timestamp,
+ rtc::ArrayView<const uint8_t>(payload_data, payload_size),
+ absolute_capture_timestamp_ms);
+ return;
+ }
+ }
frame_transformer_->Transform(
std::make_unique<TransformableOutgoingAudioFrame>(
frame_type, payload_type, rtp_timestamp, payload_data, payload_size,
- absolute_capture_timestamp_ms, ssrc));
+ absolute_capture_timestamp_ms, ssrc, codec_mimetype));
}
void ChannelSendFrameTransformerDelegate::OnTransformedFrame(
@@ -150,6 +165,11 @@ void ChannelSendFrameTransformerDelegate::OnTransformedFrame(
});
}
+void ChannelSendFrameTransformerDelegate::StartShortCircuiting() {
+ MutexLock lock(&send_lock_);
+ short_circuit_ = true;
+}
+
void ChannelSendFrameTransformerDelegate::SendFrame(
std::unique_ptr<TransformableFrameInterface> frame) const {
MutexLock lock(&send_lock_);
@@ -173,7 +193,8 @@ std::unique_ptr<TransformableAudioFrameInterface> CloneSenderAudioFrame(
InterfaceFrameTypeToInternalFrameType(original->Type()),
original->GetPayloadType(), original->GetTimestamp(),
original->GetData().data(), original->GetData().size(),
- original->AbsoluteCaptureTimestamp(), original->GetSsrc());
+ original->AbsoluteCaptureTimestamp(), original->GetSsrc(),
+ original->GetMimeType());
}
} // namespace webrtc
diff --git a/audio/channel_send_frame_transformer_delegate.h b/audio/channel_send_frame_transformer_delegate.h
index eb0027e4c8..bcec018922 100644
--- a/audio/channel_send_frame_transformer_delegate.h
+++ b/audio/channel_send_frame_transformer_delegate.h
@@ -12,6 +12,7 @@
#define AUDIO_CHANNEL_SEND_FRAME_TRANSFORMER_DELEGATE_H_
#include <memory>
+#include <string>
#include "api/frame_transformer_interface.h"
#include "api/sequence_checker.h"
@@ -57,12 +58,15 @@ class ChannelSendFrameTransformerDelegate : public TransformedFrameCallback {
const uint8_t* payload_data,
size_t payload_size,
int64_t absolute_capture_timestamp_ms,
- uint32_t ssrc);
+ uint32_t ssrc,
+ const std::string& codec_mime_type);
// Implements TransformedFrameCallback. Can be called on any thread.
void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) override;
+ void StartShortCircuiting() override;
+
// Delegates the call to ChannelSend::SendRtpAudio on the `encoder_queue_`,
// by calling `send_audio_callback_`.
void SendFrame(std::unique_ptr<TransformableFrameInterface> frame) const;
@@ -75,6 +79,7 @@ class ChannelSendFrameTransformerDelegate : public TransformedFrameCallback {
SendFrameCallback send_frame_callback_ RTC_GUARDED_BY(send_lock_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_;
rtc::TaskQueue* encoder_queue_ RTC_GUARDED_BY(send_lock_);
+ bool short_circuit_ RTC_GUARDED_BY(send_lock_) = false;
};
std::unique_ptr<TransformableAudioFrameInterface> CloneSenderAudioFrame(
diff --git a/audio/channel_send_frame_transformer_delegate_unittest.cc b/audio/channel_send_frame_transformer_delegate_unittest.cc
index f75d4a8ab7..a47cbd59c8 100644
--- a/audio/channel_send_frame_transformer_delegate_unittest.cc
+++ b/audio/channel_send_frame_transformer_delegate_unittest.cc
@@ -115,7 +115,7 @@ TEST(ChannelSendFrameTransformerDelegateTest,
callback->OnTransformedFrame(std::move(frame));
});
delegate->Transform(AudioFrameType::kEmptyFrame, 0, 0, data, sizeof(data), 0,
- 0);
+ /*ssrc=*/0, /*mimeType=*/"audio/opus");
channel_queue.WaitForPreviouslyPostedTasks();
}
@@ -145,7 +145,7 @@ TEST(ChannelSendFrameTransformerDelegateTest,
callback->OnTransformedFrame(CreateMockReceiverFrame());
});
delegate->Transform(AudioFrameType::kEmptyFrame, 0, 0, data, sizeof(data), 0,
- 0);
+ /*ssrc=*/0, /*mimeType=*/"audio/opus");
channel_queue.WaitForPreviouslyPostedTasks();
}
@@ -168,5 +168,25 @@ TEST(ChannelSendFrameTransformerDelegateTest,
channel_queue.WaitForPreviouslyPostedTasks();
}
+TEST(ChannelSendFrameTransformerDelegateTest, ShortCircuitingSkipsTransform) {
+ TaskQueueForTest channel_queue("channel_queue");
+ rtc::scoped_refptr<MockFrameTransformer> mock_frame_transformer =
+ rtc::make_ref_counted<testing::NiceMock<MockFrameTransformer>>();
+ MockChannelSend mock_channel;
+ rtc::scoped_refptr<ChannelSendFrameTransformerDelegate> delegate =
+ rtc::make_ref_counted<ChannelSendFrameTransformerDelegate>(
+ mock_channel.callback(), mock_frame_transformer, &channel_queue);
+
+ delegate->StartShortCircuiting();
+
+ // Will not call the actual transformer.
+ EXPECT_CALL(*mock_frame_transformer, Transform).Times(0);
+ // Will pass the frame straight to the channel.
+ EXPECT_CALL(mock_channel, SendFrame);
+ const uint8_t data[] = {1, 2, 3, 4};
+ delegate->Transform(AudioFrameType::kEmptyFrame, 0, 0, data, sizeof(data), 0,
+ /*ssrc=*/0, /*mimeType=*/"audio/opus");
+}
+
} // namespace
} // namespace webrtc
diff --git a/audio/channel_send_unittest.cc b/audio/channel_send_unittest.cc
index b9406e1523..58d7c93c1e 100644
--- a/audio/channel_send_unittest.cc
+++ b/audio/channel_send_unittest.cc
@@ -66,9 +66,10 @@ class ChannelSendTest : public ::testing::Test {
&transport_, nullptr, &event_log_, nullptr, crypto_options_, false,
kRtcpIntervalMs, kSsrc, nullptr, &transport_controller_, field_trials_);
encoder_factory_ = CreateBuiltinAudioEncoderFactory();
- std::unique_ptr<AudioEncoder> encoder = encoder_factory_->MakeAudioEncoder(
- kPayloadType, SdpAudioFormat("opus", kRtpRateHz, 2), {});
- channel_->SetEncoder(kPayloadType, std::move(encoder));
+ SdpAudioFormat opus = SdpAudioFormat("opus", kRtpRateHz, 2);
+ std::unique_ptr<AudioEncoder> encoder =
+ encoder_factory_->MakeAudioEncoder(kPayloadType, opus, {});
+ channel_->SetEncoder(kPayloadType, opus, std::move(encoder));
transport_controller_.EnsureStarted();
channel_->RegisterSenderCongestionControlObjects(&transport_controller_);
ON_CALL(transport_, SendRtcp).WillByDefault(Return(true));
diff --git a/audio/mock_voe_channel_proxy.h b/audio/mock_voe_channel_proxy.h
index 29005173df..71ef5d12fb 100644
--- a/audio/mock_voe_channel_proxy.h
+++ b/audio/mock_voe_channel_proxy.h
@@ -113,7 +113,9 @@ class MockChannelSend : public voe::ChannelSendInterface {
public:
MOCK_METHOD(void,
SetEncoder,
- (int payload_type, std::unique_ptr<AudioEncoder> encoder),
+ (int payload_type,
+ const SdpAudioFormat& encoder_format,
+ std::unique_ptr<AudioEncoder> encoder),
(override));
MOCK_METHOD(
void,
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 39cbc0a9c1..4cc42fd99f 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -345,7 +345,6 @@ rtc_library("call") {
]
absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
- "//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
@@ -544,7 +543,6 @@ if (rtc_include_tests) {
absl_deps = [
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/functional:any_invocable",
- "//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
@@ -606,6 +604,7 @@ if (rtc_include_tests) {
"../test:frame_generator_capturer",
"../test:null_transport",
"../test:test_common",
+ "../test:test_flags",
"../test:test_support",
"../test:video_test_common",
"../test:video_test_constants",
diff --git a/call/call.cc b/call/call.cc
index fa5d14d204..6b975edc6a 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -184,7 +184,7 @@ class Call final : public webrtc::Call,
public BitrateAllocator::LimitObserver {
public:
Call(Clock* clock,
- const Call::Config& config,
+ const CallConfig& config,
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
TaskQueueFactory* task_queue_factory);
~Call() override;
@@ -355,7 +355,7 @@ class Call final : public webrtc::Call,
const int num_cpu_cores_;
const std::unique_ptr<CallStats> call_stats_;
const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
- const Call::Config config_ RTC_GUARDED_BY(worker_thread_);
+ const CallConfig config_ RTC_GUARDED_BY(worker_thread_);
// Maps to config_.trials, can be used from any thread via `trials()`.
const FieldTrialsView& trials_;
@@ -388,11 +388,6 @@ class Call final : public webrtc::Call,
RTC_NO_UNIQUE_ADDRESS SequenceChecker receive_11993_checker_;
- // TODO(bugs.webrtc.org/11993): Move receive_rtp_config_ over to the
- // network thread.
- std::map<uint32_t, ReceiveStreamInterface*> receive_rtp_config_
- RTC_GUARDED_BY(&receive_11993_checker_);
-
// Audio and Video send streams are owned by the client that creates them.
// TODO(bugs.webrtc.org/11993): `audio_send_ssrcs_` and `video_send_ssrcs_`
// should be accessed on the network thread.
@@ -478,20 +473,22 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
return ss.str();
}
-Call* Call::Create(const Call::Config& config) {
+std::unique_ptr<Call> Call::Create(const CallConfig& config) {
Clock* clock = Clock::GetRealTimeClock();
return Create(config, clock,
RtpTransportControllerSendFactory().Create(
config.ExtractTransportConfig(), clock));
}
-Call* Call::Create(const Call::Config& config,
- Clock* clock,
- std::unique_ptr<RtpTransportControllerSendInterface>
- transportControllerSend) {
+std::unique_ptr<Call> Call::Create(
+ const CallConfig& config,
+ Clock* clock,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend) {
RTC_DCHECK(config.task_queue_factory);
- return new internal::Call(clock, config, std::move(transportControllerSend),
- config.task_queue_factory);
+ return std::make_unique<internal::Call>(clock, config,
+ std::move(transportControllerSend),
+ config.task_queue_factory);
}
// This method here to avoid subclasses has to implement this method.
@@ -658,7 +655,7 @@ void Call::SendStats::SetMinAllocatableRate(BitrateAllocationLimits limits) {
}
Call::Call(Clock* clock,
- const Call::Config& config,
+ const CallConfig& config,
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
TaskQueueFactory* task_queue_factory)
: clock_(clock),
@@ -844,11 +841,6 @@ webrtc::AudioReceiveStreamInterface* Call::CreateAudioReceiveStream(
// to live on the network thread.
receive_stream->RegisterWithTransport(&audio_receiver_controller_);
- // TODO(bugs.webrtc.org/11993): Update the below on the network thread.
- // We could possibly set up the audio_receiver_controller_ association up
- // as part of the async setup.
- RegisterReceiveStream(config.rtp.remote_ssrc, receive_stream);
-
ConfigureSync(config.sync_group);
auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
@@ -883,8 +875,6 @@ void Call::DestroyAudioReceiveStream(
// for this sync_group.
ConfigureSync(audio_receive_stream->sync_group());
- UnregisterReceiveStream(ssrc);
-
UpdateAggregateNetworkState();
// TODO(bugs.webrtc.org/11993): Consider if deleting `audio_receive_stream`
// on the network thread would be better or if we'd need to tear down the
@@ -1021,15 +1011,6 @@ webrtc::VideoReceiveStreamInterface* Call::CreateVideoReceiveStream(
// TODO(bugs.webrtc.org/11993): Set this up asynchronously on the network
// thread.
receive_stream->RegisterWithTransport(&video_receiver_controller_);
-
- if (receive_stream->rtx_ssrc()) {
- // We record identical config for the rtx stream as for the main
- // stream. Since the transport_send_cc negotiation is per payload
- // type, we may get an incorrect value for the rtx stream, but
- // that is unlikely to matter in practice.
- RegisterReceiveStream(receive_stream->rtx_ssrc(), receive_stream);
- }
- RegisterReceiveStream(receive_stream->remote_ssrc(), receive_stream);
video_receive_streams_.insert(receive_stream);
ConfigureSync(receive_stream->sync_group());
@@ -1048,14 +1029,6 @@ void Call::DestroyVideoReceiveStream(
static_cast<VideoReceiveStream2*>(receive_stream);
// TODO(bugs.webrtc.org/11993): Unregister on the network thread.
receive_stream_impl->UnregisterFromTransport();
-
- // Remove all ssrcs pointing to a receive stream. As RTX retransmits on a
- // separate SSRC there can be either one or two.
- UnregisterReceiveStream(receive_stream_impl->remote_ssrc());
-
- if (receive_stream_impl->rtx_ssrc()) {
- UnregisterReceiveStream(receive_stream_impl->rtx_ssrc());
- }
video_receive_streams_.erase(receive_stream_impl);
ConfigureSync(receive_stream_impl->sync_group());
@@ -1083,8 +1056,6 @@ FlexfecReceiveStream* Call::CreateFlexfecReceiveStream(
// TODO(bugs.webrtc.org/11993): Set this up asynchronously on the network
// thread.
receive_stream->RegisterWithTransport(&video_receiver_controller_);
- RegisterReceiveStream(receive_stream->remote_ssrc(), receive_stream);
-
// TODO(brandtr): Store config in RtcEventLog here.
return receive_stream;
@@ -1100,8 +1071,6 @@ void Call::DestroyFlexfecReceiveStream(FlexfecReceiveStream* receive_stream) {
receive_stream_impl->UnregisterFromTransport();
auto ssrc = receive_stream_impl->remote_ssrc();
- UnregisterReceiveStream(ssrc);
-
// Remove all SSRCs pointing to the FlexfecReceiveStreamImpl to be
// destroyed.
receive_side_cc_.RemoveStream(ssrc);
@@ -1465,26 +1434,6 @@ void Call::NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
receive_side_cc_.OnReceivedPacket(packet, media_type);
}
-bool Call::RegisterReceiveStream(uint32_t ssrc,
- ReceiveStreamInterface* stream) {
- RTC_DCHECK_RUN_ON(&receive_11993_checker_);
- RTC_DCHECK(stream);
- auto inserted = receive_rtp_config_.emplace(ssrc, stream);
- if (!inserted.second) {
- RTC_DLOG(LS_WARNING) << "ssrc already registered: " << ssrc;
- }
- return inserted.second;
-}
-
-bool Call::UnregisterReceiveStream(uint32_t ssrc) {
- RTC_DCHECK_RUN_ON(&receive_11993_checker_);
- size_t erased = receive_rtp_config_.erase(ssrc);
- if (!erased) {
- RTC_DLOG(LS_WARNING) << "ssrc wasn't registered: " << ssrc;
- }
- return erased != 0u;
-}
-
} // namespace internal
} // namespace webrtc
diff --git a/call/call.h b/call/call.h
index 366978392e..6f8e4cd6d7 100644
--- a/call/call.h
+++ b/call/call.h
@@ -46,8 +46,6 @@ namespace webrtc {
class Call {
public:
- using Config = CallConfig;
-
struct Stats {
std::string ToString(int64_t time_ms) const;
@@ -58,11 +56,12 @@ class Call {
int64_t rtt_ms = -1;
};
- static Call* Create(const Call::Config& config);
- static Call* Create(const Call::Config& config,
- Clock* clock,
- std::unique_ptr<RtpTransportControllerSendInterface>
- transportControllerSend);
+ static std::unique_ptr<Call> Create(const CallConfig& config);
+ static std::unique_ptr<Call> Create(
+ const CallConfig& config,
+ Clock* clock,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend);
virtual AudioSendStream* CreateAudioSendStream(
const AudioSendStream::Config& config) = 0;
diff --git a/call/call_factory.cc b/call/call_factory.cc
index 380e80ce12..043b11da37 100644
--- a/call/call_factory.cc
+++ b/call/call_factory.cc
@@ -17,7 +17,6 @@
#include <utility>
#include <vector>
-#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "api/test/simulated_network.h"
#include "api/units/time_delta.h"
@@ -83,7 +82,7 @@ CallFactory::CallFactory() {
call_thread_.Detach();
}
-Call* CallFactory::CreateCall(const Call::Config& config) {
+std::unique_ptr<Call> CallFactory::CreateCall(const CallConfig& config) {
RTC_DCHECK_RUN_ON(&call_thread_);
RTC_DCHECK(config.trials);
@@ -95,22 +94,22 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
- Call* call =
+ std::unique_ptr<Call> call =
Call::Create(config, Clock::GetRealTimeClock(),
config.rtp_transport_controller_send_factory->Create(
transportConfig, Clock::GetRealTimeClock()));
if (!send_degradation_configs.empty() ||
!receive_degradation_configs.empty()) {
- return new DegradedCall(absl::WrapUnique(call), send_degradation_configs,
- receive_degradation_configs);
+ return std::make_unique<DegradedCall>(
+ std::move(call), send_degradation_configs, receive_degradation_configs);
}
return call;
}
std::unique_ptr<CallFactoryInterface> CreateCallFactory() {
- return std::unique_ptr<CallFactoryInterface>(new CallFactory());
+ return std::make_unique<CallFactory>();
}
} // namespace webrtc
diff --git a/call/call_factory.h b/call/call_factory.h
index 9feed7bbb6..f75b1bd71b 100644
--- a/call/call_factory.h
+++ b/call/call_factory.h
@@ -11,6 +11,8 @@
#ifndef CALL_CALL_FACTORY_H_
#define CALL_CALL_FACTORY_H_
+#include <memory>
+
#include "api/call/call_factory_interface.h"
#include "api/sequence_checker.h"
#include "call/call.h"
@@ -22,11 +24,10 @@ namespace webrtc {
class CallFactory : public CallFactoryInterface {
public:
CallFactory();
+ ~CallFactory() override = default;
private:
- ~CallFactory() override {}
-
- Call* CreateCall(const CallConfig& config) override;
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override;
RTC_NO_UNIQUE_ADDRESS SequenceChecker call_thread_;
};
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index f1ea970db8..0ba6d05b19 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <string>
+#include "absl/flags/flag.h"
#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/numerics/samples_stats_counter.h"
@@ -52,6 +53,7 @@
#include "test/gtest.h"
#include "test/null_transport.h"
#include "test/rtp_rtcp_observer.h"
+#include "test/test_flags.h"
#include "test/testsupport/file_utils.h"
#include "test/video_encoder_proxy_factory.h"
#include "test/video_test_constants.h"
@@ -221,12 +223,12 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
send_audio_state_config.audio_processing =
AudioProcessingBuilder().Create();
send_audio_state_config.audio_device_module = fake_audio_device;
- Call::Config sender_config(send_event_log_.get());
+ CallConfig sender_config(send_event_log_.get());
auto audio_state = AudioState::Create(send_audio_state_config);
fake_audio_device->RegisterAudioCallback(audio_state->audio_transport());
sender_config.audio_state = audio_state;
- Call::Config receiver_config(recv_event_log_.get());
+ CallConfig receiver_config(recv_event_log_.get());
receiver_config.audio_state = audio_state;
CreateCalls(sender_config, receiver_config);
@@ -361,7 +363,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
observer->PrintResults();
// In quick test synchronization may not be achieved in time.
- if (!field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
+ if (!absl::GetFlag(FLAGS_webrtc_quick_perf_test)) {
// TODO(bugs.webrtc.org/10417): Reenable this for iOS
#if !defined(WEBRTC_IOS)
EXPECT_METRIC_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
@@ -975,8 +977,8 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
void PerformTest() override {
// Quick test mode, just to exercise all the code paths without actually
// caring about performance measurements.
- const bool quick_perf_test =
- field_trial::IsEnabled("WebRTC-QuickPerfTest");
+ const bool quick_perf_test = absl::GetFlag(FLAGS_webrtc_quick_perf_test);
+
int last_passed_test_bitrate = -1;
for (int test_bitrate = test_bitrate_from_;
test_bitrate_from_ < test_bitrate_to_
@@ -1125,8 +1127,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
}
void VerifyStats() const {
- const bool quick_perf_test =
- field_trial::IsEnabled("WebRTC-QuickPerfTest");
+ const bool quick_perf_test = absl::GetFlag(FLAGS_webrtc_quick_perf_test);
double input_fps = 0.0;
for (const auto& configured_framerate : configured_framerates_) {
input_fps = std::max(configured_framerate.second, input_fps);
diff --git a/call/call_unittest.cc b/call/call_unittest.cc
index 01476eed19..886a15aaf0 100644
--- a/call/call_unittest.cc
+++ b/call/call_unittest.cc
@@ -15,7 +15,6 @@
#include <memory>
#include <utility>
-#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/media_types.h"
@@ -40,6 +39,7 @@
#include "test/mock_transport.h"
#include "test/run_loop.h"
+namespace webrtc {
namespace {
using ::testing::_;
@@ -47,41 +47,38 @@ using ::testing::Contains;
using ::testing::MockFunction;
using ::testing::NiceMock;
using ::testing::StrictMock;
+using ::webrtc::test::MockAudioDeviceModule;
+using ::webrtc::test::MockAudioMixer;
+using ::webrtc::test::MockAudioProcessing;
+using ::webrtc::test::RunLoop;
struct CallHelper {
explicit CallHelper(bool use_null_audio_processing) {
- task_queue_factory_ = webrtc::CreateDefaultTaskQueueFactory();
- webrtc::AudioState::Config audio_state_config;
- audio_state_config.audio_mixer =
- rtc::make_ref_counted<webrtc::test::MockAudioMixer>();
+ task_queue_factory_ = CreateDefaultTaskQueueFactory();
+ AudioState::Config audio_state_config;
+ audio_state_config.audio_mixer = rtc::make_ref_counted<MockAudioMixer>();
audio_state_config.audio_processing =
use_null_audio_processing
? nullptr
- : rtc::make_ref_counted<
- NiceMock<webrtc::test::MockAudioProcessing>>();
+ : rtc::make_ref_counted<NiceMock<MockAudioProcessing>>();
audio_state_config.audio_device_module =
- rtc::make_ref_counted<webrtc::test::MockAudioDeviceModule>();
- webrtc::Call::Config config(&event_log_);
- config.audio_state = webrtc::AudioState::Create(audio_state_config);
+ rtc::make_ref_counted<MockAudioDeviceModule>();
+ CallConfig config(&event_log_);
+ config.audio_state = AudioState::Create(audio_state_config);
config.task_queue_factory = task_queue_factory_.get();
config.trials = &field_trials_;
- call_.reset(webrtc::Call::Create(config));
+ call_ = Call::Create(config);
}
- webrtc::Call* operator->() { return call_.get(); }
+ Call* operator->() { return call_.get(); }
private:
- webrtc::test::RunLoop loop_;
- webrtc::RtcEventLogNull event_log_;
- webrtc::FieldTrialBasedConfig field_trials_;
- std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ RunLoop loop_;
+ RtcEventLogNull event_log_;
+ FieldTrialBasedConfig field_trials_;
+ std::unique_ptr<TaskQueueFactory> task_queue_factory_;
+ std::unique_ptr<Call> call_;
};
-} // namespace
-
-namespace webrtc {
-
-namespace {
rtc::scoped_refptr<Resource> FindResourceWhoseNameContains(
const std::vector<rtc::scoped_refptr<Resource>>& resources,
diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc
index 8ddce83a2e..232fe0b3fe 100644
--- a/call/rampup_tests.cc
+++ b/call/rampup_tests.cc
@@ -329,7 +329,7 @@ void RampUpTester::TriggerTestDone() {
RTC_DCHECK_GE(test_start_ms_, 0);
// Stop polling stats.
- // Corner case for field_trials=WebRTC-QuickPerfTest/Enabled/
+ // Corner case for webrtc_quick_perf_test
SendTask(task_queue_, [this] { pending_task_.Stop(); });
// TODO(holmer): Add audio send stats here too when those APIs are available.
diff --git a/call/rtp_demuxer.cc b/call/rtp_demuxer.cc
index 0b74f2ac0a..841d7e3b94 100644
--- a/call/rtp_demuxer.cc
+++ b/call/rtp_demuxer.cc
@@ -255,6 +255,19 @@ bool RtpDemuxer::RemoveSink(const RtpPacketSinkInterface* sink) {
return num_removed > 0;
}
+flat_set<uint32_t> RtpDemuxer::GetSsrcsForSink(
+ const RtpPacketSinkInterface* sink) const {
+ flat_set<uint32_t> ssrcs;
+ if (sink) {
+ for (const auto& it : sink_by_ssrc_) {
+ if (it.second == sink) {
+ ssrcs.insert(it.first);
+ }
+ }
+ }
+ return ssrcs;
+}
+
bool RtpDemuxer::OnRtpPacket(const RtpPacketReceived& packet) {
RtpPacketSinkInterface* sink = ResolveSink(packet);
if (sink != nullptr) {
diff --git a/call/rtp_demuxer.h b/call/rtp_demuxer.h
index 53eeb0b6b6..80427b82a7 100644
--- a/call/rtp_demuxer.h
+++ b/call/rtp_demuxer.h
@@ -151,6 +151,9 @@ class RtpDemuxer {
// Null pointer is not allowed.
bool RemoveSink(const RtpPacketSinkInterface* sink);
+ // Returns the set of SSRCs associated with a sink.
+ flat_set<uint32_t> GetSsrcsForSink(const RtpPacketSinkInterface* sink) const;
+
// Demuxes the given packet and forwards it to the chosen sink. Returns true
// if the packet was forwarded and false if the packet was dropped.
bool OnRtpPacket(const RtpPacketReceived& packet);
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index dc1d37168e..556a4dd89a 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -343,12 +343,13 @@ void RtpTransportControllerSend::OnNetworkAvailability(bool network_available) {
is_congested_ = false;
pacer_.SetCongested(false);
+ if (!controller_) {
+ MaybeCreateControllers();
+ }
if (controller_) {
control_handler_->SetNetworkAvailability(network_available);
PostUpdates(controller_->OnNetworkAvailability(msg));
UpdateControlState();
- } else {
- MaybeCreateControllers();
}
for (auto& rtp_sender : video_rtp_senders_) {
rtp_sender->OnNetworkAvailability(network_available);
diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc
index c7907a0224..1ace08fa32 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -226,7 +226,9 @@ std::vector<RtpStreamSender> CreateRtpStreamSenders(
configuration.send_bitrate_observer = observers.bitrate_observer;
configuration.send_packet_observer = observers.send_packet_observer;
configuration.event_log = event_log;
- configuration.retransmission_rate_limiter = retransmission_rate_limiter;
+ if (trials.IsDisabled("WebRTC-DisableRtxRateLimiter")) {
+ configuration.retransmission_rate_limiter = retransmission_rate_limiter;
+ }
configuration.rtp_stats_callback = observers.rtp_stats;
configuration.frame_encryptor = frame_encryptor;
configuration.require_frame_encryption =
diff --git a/call/version.cc b/call/version.cc
index 3d3dd321da..a4ede9cd34 100644
--- a/call/version.cc
+++ b/call/version.cc
@@ -13,7 +13,7 @@
namespace webrtc {
// The timestamp is always in UTC.
-const char* const kSourceTimestamp = "WebRTC source stamp 2023-10-05T04:12:20";
+const char* const kSourceTimestamp = "WebRTC source stamp 2023-11-20T04:11:35";
void LoadWebRTCVersionInRegister() {
// Using volatile to instruct the compiler to not optimize `p` away even
diff --git a/call/video_receive_stream.cc b/call/video_receive_stream.cc
index 3e2a51322f..8d88ce23c6 100644
--- a/call/video_receive_stream.cc
+++ b/call/video_receive_stream.cc
@@ -84,7 +84,7 @@ std::string VideoReceiveStreamInterface::Stats::ToString(
<< jitter_buffer_target_delay.seconds<double>() << ", ";
ss << "jitterBufferEmittedCount: " << jitter_buffer_emitted_count << ", ";
ss << "jitterBufferMinimumDelay: "
- << jitter_buffer_minimum_delay.seconds<double>();
+ << jitter_buffer_minimum_delay.seconds<double>() << ", ";
ss << "totalDecodeTime: " << total_decode_time.seconds<double>() << ", ";
ss << "totalProcessingDelay: " << total_processing_delay.seconds<double>()
<< ", ";
diff --git a/common_audio/signal_processing/cross_correlation_neon.c b/common_audio/signal_processing/cross_correlation_neon.c
index f2afbdf9f5..d3ecf138e3 100644
--- a/common_audio/signal_processing/cross_correlation_neon.c
+++ b/common_audio/signal_processing/cross_correlation_neon.c
@@ -72,9 +72,9 @@ void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation,
size_t dim_cross_correlation,
int right_shifts,
int step_seq2) {
- size_t i = 0;
+ int i = 0;
- for (i = 0; i < dim_cross_correlation; i++) {
+ for (i = 0; i < (int)dim_cross_correlation; i++) {
const int16_t* seq1_ptr = seq1;
const int16_t* seq2_ptr = seq2 + (step_seq2 * i);
diff --git a/common_audio/signal_processing/downsample_fast_neon.c b/common_audio/signal_processing/downsample_fast_neon.c
index 36fc0c8aee..f1b754b798 100644
--- a/common_audio/signal_processing/downsample_fast_neon.c
+++ b/common_audio/signal_processing/downsample_fast_neon.c
@@ -8,9 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <arm_neon.h>
+
#include "common_audio/signal_processing/include/signal_processing_library.h"
-#include <arm_neon.h>
+#include "rtc_base/checks.h"
// NEON intrinsics version of WebRtcSpl_DownsampleFast()
// for ARM 32-bit/64-bit platforms.
@@ -22,19 +24,24 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
size_t coefficients_length,
int factor,
size_t delay) {
- size_t i = 0;
- size_t j = 0;
+ // Using signed indexes to be able to compute negative i-j that
+ // is used to index data_in.
+ int i = 0;
+ int j = 0;
int32_t out_s32 = 0;
- size_t endpos = delay + factor * (data_out_length - 1) + 1;
+ int endpos = delay + factor * (data_out_length - 1) + 1;
size_t res = data_out_length & 0x7;
- size_t endpos1 = endpos - factor * res;
+ int endpos1 = endpos - factor * res;
// Return error if any of the running conditions doesn't meet.
if (data_out_length == 0 || coefficients_length == 0
- || data_in_length < endpos) {
+ || (int)data_in_length < endpos) {
return -1;
}
+ RTC_DCHECK_GE(endpos, 0);
+ RTC_DCHECK_GE(endpos1, 0);
+
// First part, unroll the loop 8 times, with 3 subcases
// (factor == 2, 4, others).
switch (factor) {
@@ -46,7 +53,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
#if defined(WEBRTC_ARCH_ARM64)
// Unroll the loop 2 times.
- for (j = 0; j < coefficients_length - 1; j += 2) {
+ for (j = 0; j < (int)coefficients_length - 1; j += 2) {
int32x2_t coeff32 = vld1_dup_s32((int32_t*)&coefficients[j]);
int16x4_t coeff16x4 = vreinterpret_s16_s32(coeff32);
int16x8x2_t in16x8x2 = vld2q_s16(&data_in[i - j - 1]);
@@ -68,7 +75,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
out32x4_1 = vmlal_lane_s16(out32x4_1, in16x4_3, coeff16x4, 0);
}
- for (; j < coefficients_length; j++) {
+ for (; j < (int)coefficients_length; j++) {
int16x4_t coeff16x4 = vld1_dup_s16(&coefficients[j]);
int16x8x2_t in16x8x2 = vld2q_s16(&data_in[i - j]);
@@ -87,7 +94,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
#else
// On ARMv7, the loop unrolling 2 times results in performance
// regression.
- for (j = 0; j < coefficients_length; j++) {
+ for (j = 0; j < (int)coefficients_length; j++) {
int16x4_t coeff16x4 = vld1_dup_s16(&coefficients[j]);
int16x8x2_t in16x8x2 = vld2q_s16(&data_in[i - j]);
@@ -114,7 +121,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
int32x4_t out32x4_1 = vdupq_n_s32(2048);
// Unroll the loop 4 times.
- for (j = 0; j < coefficients_length - 3; j += 4) {
+ for (j = 0; j < (int)coefficients_length - 3; j += 4) {
int16x4_t coeff16x4 = vld1_s16(&coefficients[j]);
int16x8x4_t in16x8x4 = vld4q_s16(&data_in[i - j - 3]);
@@ -143,7 +150,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
out32x4_1 = vmlal_lane_s16(out32x4_1, in16x4_7, coeff16x4, 0);
}
- for (; j < coefficients_length; j++) {
+ for (; j < (int)coefficients_length; j++) {
int16x4_t coeff16x4 = vld1_dup_s16(&coefficients[j]);
int16x8x4_t in16x8x4 = vld4q_s16(&data_in[i - j]);
@@ -174,7 +181,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
int32x4_t out32x4_0 = vdupq_n_s32(2048);
int32x4_t out32x4_1 = vdupq_n_s32(2048);
- for (j = 0; j < coefficients_length; j++) {
+ for (j = 0; j < (int)coefficients_length; j++) {
int16x4_t coeff16x4 = vld1_dup_s16(&coefficients[j]);
int16x4_t in16x4_0 = vld1_dup_s16(&data_in[i - j]);
in16x4_0 = vld1_lane_s16(&data_in[i + factor - j], in16x4_0, 1);
@@ -204,7 +211,7 @@ int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in,
for (; i < endpos; i += factor) {
out_s32 = 2048; // Round value, 0.5 in Q12.
- for (j = 0; j < coefficients_length; j++) {
+ for (j = 0; j < (int)coefficients_length; j++) {
out_s32 = WebRtc_MulAccumW16(coefficients[j], data_in[i - j], out_s32);
}
diff --git a/common_video/h265/h265_bitstream_parser.cc b/common_video/h265/h265_bitstream_parser.cc
index 1093add102..f8dc242c7d 100644
--- a/common_video/h265/h265_bitstream_parser.cc
+++ b/common_video/h265/h265_bitstream_parser.cc
@@ -475,8 +475,8 @@ void H265BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) {
case H265::NaluType::kAud:
case H265::NaluType::kPrefixSei:
case H265::NaluType::kSuffixSei:
- case H265::NaluType::kAP:
- case H265::NaluType::kFU:
+ case H265::NaluType::kAp:
+ case H265::NaluType::kFu:
break;
default:
Result res = ParseNonParameterSetNalu(slice, length, nalu_type);
diff --git a/common_video/h265/h265_common.h b/common_video/h265/h265_common.h
index fcb97815ff..643726f701 100644
--- a/common_video/h265/h265_common.h
+++ b/common_video/h265/h265_common.h
@@ -55,8 +55,8 @@ enum NaluType : uint8_t {
kAud = 35,
kPrefixSei = 39,
kSuffixSei = 40,
- kAP = 48,
- kFU = 49
+ kAp = 48,
+ kFu = 49
};
// Slice type definition. See table 7-7 of the H265 spec
diff --git a/docs/native-code/rtp-hdrext/video-layers-allocation00/README.md b/docs/native-code/rtp-hdrext/video-layers-allocation00/README.md
index c4454d8ee1..cfa8c4cb0d 100644
--- a/docs/native-code/rtp-hdrext/video-layers-allocation00/README.md
+++ b/docs/native-code/rtp-hdrext/video-layers-allocation00/README.md
@@ -22,6 +22,10 @@ rtp stream (SVC), or independent spatial layers sent on multiple rtp streams
## RTP header extension format
+Note: when including the optional width, height and maximum framerate
+fields, the total data length of the extension can exceed 16 bytes
+and is sent as a two-byte header extension [1]
+
### Data layout
```
@@ -68,7 +72,7 @@ alignment.
layers. Values are stored in ascending order of spatial id. Zero-padded to byte
alignment.
-Target bitrate in kbps. Values are stored using leb128 encoding [1]. One value per
+Target bitrate in kbps. Values are stored using leb128 encoding [2]. One value per
temporal layer. Values are stored in (RTP stream id, spatial id, temporal id)
ascending order. All bitrates are total required bitrate to receive the
corresponding layer, i.e. in simulcast mode they include only corresponding
@@ -78,9 +82,11 @@ temporal layers are also included.
Resolution and framerate. Optional. Presence is inferred from the rtp header
extension size. Encoded (width - 1), 16-bit, (height - 1), 16-bit, max frame
rate 8-bit per spatial layer per RTP stream. Values are stored in (RTP stream
-id, spatial id) ascending order.
+id, spatial id) ascending order. Only sent when the resolution differs from the
+last values, the framerate changed by more than 5fps and on key frames.
An empty layer allocation (i.e nothing sent on ssrc) is encoded as
special case with a single 0 byte.
-[1] https://aomediacodec.github.io/av1-spec/#leb128
+[1] https://www.rfc-editor.org/rfc/rfc8285#section-4.3
+[2] https://aomediacodec.github.io/av1-spec/#leb128
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 55a94fe007..4ace29bb7e 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -489,6 +489,7 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
]
deps = [
+ "../api:enable_media",
"../api:libjingle_peerconnection_api",
"../api:scoped_refptr",
"../api:sequence_checker",
@@ -496,7 +497,6 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
"../api/audio_codecs:builtin_audio_encoder_factory",
"../api/rtc_event_log:rtc_event_log_factory",
"../api/task_queue:default_task_queue_factory",
- "../media:rtc_audio_video",
"../modules/audio_processing",
"../modules/audio_processing:api",
"../pc:libjingle_peerconnection",
@@ -686,6 +686,7 @@ if (is_linux || is_chromeos || is_win) {
]
deps = [
+ "../api:async_dns_resolver",
"../api:audio_options_api",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
@@ -703,6 +704,7 @@ if (is_linux || is_chromeos || is_win) {
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../pc:video_track_source",
+ "../rtc_base:async_dns_resolver",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:macromagic",
diff --git a/examples/androidnativeapi/BUILD.gn b/examples/androidnativeapi/BUILD.gn
index e0eb6d8b24..d1088b3e61 100644
--- a/examples/androidnativeapi/BUILD.gn
+++ b/examples/androidnativeapi/BUILD.gn
@@ -47,6 +47,7 @@ if (is_android) {
deps = [
":generated_jni",
+ "../../api:enable_media_with_defaults",
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../rtc_base:ssl",
@@ -56,7 +57,6 @@ if (is_android) {
"//api/task_queue:default_task_queue_factory",
"//media:rtc_audio_video",
"//media:rtc_internal_video_codecs",
- "//media:rtc_media_engine_defaults",
"//modules/utility",
"//pc:libjingle_peerconnection",
"//sdk/android:native_api_base",
diff --git a/examples/androidnativeapi/jni/android_call_client.cc b/examples/androidnativeapi/jni/android_call_client.cc
index 2713a563cd..40af78cdac 100644
--- a/examples/androidnativeapi/jni/android_call_client.cc
+++ b/examples/androidnativeapi/jni/android_call_client.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <utility>
+#include "api/enable_media_with_defaults.h"
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
@@ -20,7 +21,6 @@
#include "media/engine/internal_decoder_factory.h"
#include "media/engine/internal_encoder_factory.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "sdk/android/native_api/video/wrapper.h"
@@ -154,19 +154,14 @@ void AndroidCallClient::CreatePeerConnectionFactory() {
pcf_deps.worker_thread = worker_thread_.get();
pcf_deps.signaling_thread = signaling_thread_.get();
pcf_deps.task_queue_factory = webrtc::CreateDefaultTaskQueueFactory();
- pcf_deps.call_factory = webrtc::CreateCallFactory();
pcf_deps.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>(
pcf_deps.task_queue_factory.get());
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = pcf_deps.task_queue_factory.get();
- media_deps.video_encoder_factory =
+ pcf_deps.video_encoder_factory =
std::make_unique<webrtc::InternalEncoderFactory>();
- media_deps.video_decoder_factory =
+ pcf_deps.video_decoder_factory =
std::make_unique<webrtc::InternalDecoderFactory>();
- webrtc::SetMediaEngineDefaults(&media_deps);
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
- RTC_LOG(LS_INFO) << "Media engine created: " << pcf_deps.media_engine.get();
+ EnableMediaWithDefaults(pcf_deps);
pcf_ = CreateModularPeerConnectionFactory(std::move(pcf_deps));
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << pcf_.get();
diff --git a/examples/objcnativeapi/objc/objc_call_client.mm b/examples/objcnativeapi/objc/objc_call_client.mm
index 90bcfcc35b..996c6a9c7f 100644
--- a/examples/objcnativeapi/objc/objc_call_client.mm
+++ b/examples/objcnativeapi/objc/objc_call_client.mm
@@ -20,10 +20,10 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
+#include "api/enable_media.h"
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "sdk/objc/native/api/video_capturer.h"
#include "sdk/objc/native/api/video_decoder_factory.h"
@@ -118,18 +118,14 @@ void ObjCCallClient::CreatePeerConnectionFactory() {
dependencies.worker_thread = worker_thread_.get();
dependencies.signaling_thread = signaling_thread_.get();
dependencies.task_queue_factory = webrtc::CreateDefaultTaskQueueFactory();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = dependencies.task_queue_factory.get();
- media_deps.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory();
- media_deps.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory();
- media_deps.video_encoder_factory = webrtc::ObjCToNativeVideoEncoderFactory(
+ dependencies.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory();
+ dependencies.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory();
+ dependencies.video_encoder_factory = webrtc::ObjCToNativeVideoEncoderFactory(
[[RTC_OBJC_TYPE(RTCDefaultVideoEncoderFactory) alloc] init]);
- media_deps.video_decoder_factory = webrtc::ObjCToNativeVideoDecoderFactory(
+ dependencies.video_decoder_factory = webrtc::ObjCToNativeVideoDecoderFactory(
[[RTC_OBJC_TYPE(RTCDefaultVideoDecoderFactory) alloc] init]);
- media_deps.audio_processing = webrtc::AudioProcessingBuilder().Create();
- dependencies.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
- RTC_LOG(LS_INFO) << "Media engine created: " << dependencies.media_engine.get();
- dependencies.call_factory = webrtc::CreateCallFactory();
+ dependencies.audio_processing = webrtc::AudioProcessingBuilder().Create();
+ webrtc::EnableMedia(dependencies);
dependencies.event_log_factory =
std::make_unique<webrtc::RtcEventLogFactory>(dependencies.task_queue_factory.get());
pcf_ = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies));
diff --git a/examples/peerconnection/client/peer_connection_client.cc b/examples/peerconnection/client/peer_connection_client.cc
index 2746752d80..48d5bb6545 100644
--- a/examples/peerconnection/client/peer_connection_client.cc
+++ b/examples/peerconnection/client/peer_connection_client.cc
@@ -12,6 +12,7 @@
#include "api/units/time_delta.h"
#include "examples/peerconnection/client/defaults.h"
+#include "rtc_base/async_dns_resolver.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/net_helpers.h"
@@ -32,7 +33,7 @@ rtc::Socket* CreateClientSocket(int family) {
} // namespace
PeerConnectionClient::PeerConnectionClient()
- : callback_(NULL), resolver_(NULL), state_(NOT_CONNECTED), my_id_(-1) {}
+ : callback_(NULL), resolver_(nullptr), state_(NOT_CONNECTED), my_id_(-1) {}
PeerConnectionClient::~PeerConnectionClient() = default;
@@ -95,26 +96,32 @@ void PeerConnectionClient::Connect(const std::string& server,
client_name_ = client_name;
if (server_address_.IsUnresolvedIP()) {
+ RTC_DCHECK_NE(state_, RESOLVING);
+ RTC_DCHECK(!resolver_);
state_ = RESOLVING;
- resolver_ = new rtc::AsyncResolver();
- resolver_->SignalDone.connect(this, &PeerConnectionClient::OnResolveResult);
- resolver_->Start(server_address_);
+ resolver_ = std::make_unique<webrtc::AsyncDnsResolver>();
+ resolver_->Start(server_address_,
+ [this] { OnResolveResult(resolver_->result()); });
} else {
DoConnect();
}
}
void PeerConnectionClient::OnResolveResult(
- rtc::AsyncResolverInterface* resolver) {
- if (resolver_->GetError() != 0) {
+ const webrtc::AsyncDnsResolverResult& result) {
+ if (result.GetError() != 0) {
callback_->OnServerConnectionFailure();
- resolver_->Destroy(false);
- resolver_ = NULL;
+ resolver_.reset();
state_ = NOT_CONNECTED;
- } else {
- server_address_ = resolver_->address();
- DoConnect();
+ return;
+ }
+ if (!result.GetResolvedAddress(AF_INET, &server_address_)) {
+ callback_->OnServerConnectionFailure();
+ resolver_.reset();
+ state_ = NOT_CONNECTED;
+ return;
}
+ DoConnect();
}
void PeerConnectionClient::DoConnect() {
@@ -196,10 +203,7 @@ void PeerConnectionClient::Close() {
hanging_get_->Close();
onconnect_data_.clear();
peers_.clear();
- if (resolver_ != NULL) {
- resolver_->Destroy(false);
- resolver_ = NULL;
- }
+ resolver_.reset();
my_id_ = -1;
state_ = NOT_CONNECTED;
}
diff --git a/examples/peerconnection/client/peer_connection_client.h b/examples/peerconnection/client/peer_connection_client.h
index 8f9c5b6a75..d56752a7fa 100644
--- a/examples/peerconnection/client/peer_connection_client.h
+++ b/examples/peerconnection/client/peer_connection_client.h
@@ -15,6 +15,7 @@
#include <memory>
#include <string>
+#include "api/async_dns_resolver.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/physical_socket_server.h"
@@ -109,11 +110,11 @@ class PeerConnectionClient : public sigslot::has_slots<> {
void OnClose(rtc::Socket* socket, int err);
- void OnResolveResult(rtc::AsyncResolverInterface* resolver);
+ void OnResolveResult(const webrtc::AsyncDnsResolverResult& result);
PeerConnectionClientObserver* callback_;
rtc::SocketAddress server_address_;
- rtc::AsyncResolver* resolver_;
+ std::unique_ptr<webrtc::AsyncDnsResolverInterface> resolver_;
std::unique_ptr<rtc::Socket> control_socket_;
std::unique_ptr<rtc::Socket> hanging_get_;
std::string onconnect_data_;
diff --git a/experiments/field_trials.py b/experiments/field_trials.py
index f98abde567..5b2dd7fb34 100755
--- a/experiments/field_trials.py
+++ b/experiments/field_trials.py
@@ -107,6 +107,9 @@ ACTIVE_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-SendPacketsOnWorkerThread',
'webrtc:14502',
date(2024, 4, 1)),
+ FieldTrial('WebRTC-SrtpRemoveReceiveStream',
+ 'webrtc:15604',
+ date(2024, 10, 1)),
FieldTrial('WebRTC-Stats-RtxReceiveStats',
'webrtc:15096',
date(2024, 4, 1)),
@@ -700,9 +703,6 @@ POLICY_EXEMPT_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-QpParsingKillSwitch',
'webrtc:12542',
date(2024, 4, 1)),
- FieldTrial('WebRTC-QuickPerfTest',
- 'webrtc:7101',
- INDEFINITE),
FieldTrial('WebRTC-RtcEventLogKillSwitch',
'webrtc:12084',
INDEFINITE),
@@ -718,6 +718,9 @@ POLICY_EXEMPT_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-SendBufferSizeBytes',
'webrtc:11905',
date(2024, 4, 1)),
+ FieldTrial('WebRTC-ReceiveBufferSize',
+ 'webrtc:15585',
+ date(2024, 4, 1)),
FieldTrial('WebRTC-SendNackDelayMs',
'webrtc:9953',
date(2024, 4, 1)),
@@ -787,6 +790,9 @@ POLICY_EXEMPT_FIELD_TRIALS: FrozenSet[FieldTrial] = frozenset([
FieldTrial('WebRTC-VP8-GetEncoderInfoOverride',
'webrtc:11832',
INDEFINITE),
+ FieldTrial('WebRTC-VP8-MaxFrameInterval',
+ 'webrtc:15530',
+ date(2024, 4, 1)),
FieldTrial('WebRTC-VP8-Postproc-Config',
'webrtc:11551',
date(2024, 4, 1)),
diff --git a/g3doc/abseil-in-webrtc.md b/g3doc/abseil-in-webrtc.md
index 32fc42d953..034f6c2fb4 100644
--- a/g3doc/abseil-in-webrtc.md
+++ b/g3doc/abseil-in-webrtc.md
@@ -29,6 +29,7 @@ will generate a shared library.
* `absl::bind_front`
* `absl::Cleanup`
* `absl::InlinedVector`
+* `absl::Nonnull` and `absl::Nullable`
* `absl::WrapUnique`
* `absl::optional` and related stuff from `absl/types/optional.h`.
* `absl::string_view`
diff --git a/g3doc/style-guide.md b/g3doc/style-guide.md
index 71d1196df2..8e6570a786 100644
--- a/g3doc/style-guide.md
+++ b/g3doc/style-guide.md
@@ -127,6 +127,20 @@ For example,
See the [source code for `rtc::ArrayView`](api/array_view.h) for more detailed
docs.
+### Strings
+
+WebRTC uses std::string, with content assumed to be UTF-8. Note that this
+has to be verified whenever accepting external input.
+
+For concatenation of strings, use webrtc::StrJoin or rtc::SimpleStringBuilder
+directly.
+
+The following string building tools are NOT recommended:
+* The + operator. See https://abseil.io/tips/3 for why not.
+* absl::StrCat, absl::StrAppend, absl::StrJoin. These are optimized for
+ speed, not code size, and have significant code size overhead.
+* strcat. It is too easy to create buffer overflows.
+
### sigslot
SIGSLOT IS DEPRECATED.
diff --git a/infra/config/commit-queue.cfg b/infra/config/commit-queue.cfg
index 162590f0b4..c51eb0cd8b 100644
--- a/infra/config/commit-queue.cfg
+++ b/infra/config/commit-queue.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see Config message:
-# https://luci-config.appspot.com/schemas/projects:commit-queue.cfg
+# https://config.luci.app/schemas/projects:commit-queue.cfg
cq_status_host: "chromium-cq-status.appspot.com"
submit_options {
diff --git a/infra/config/config.star b/infra/config/config.star
index 103b4ae318..eecac11c94 100755
--- a/infra/config/config.star
+++ b/infra/config/config.star
@@ -13,7 +13,7 @@ lucicfg.check_version("1.30.9")
WEBRTC_GIT = "https://webrtc.googlesource.com/src"
WEBRTC_GERRIT = "https://webrtc-review.googlesource.com/src"
WEBRTC_TROOPER_EMAIL = "webrtc-troopers-robots@google.com"
-WEBRTC_XCODE13 = "13c100"
+WEBRTC_XCODE14 = "14c18"
DEFAULT_CPU = "x86-64"
# Helpers:
@@ -677,10 +677,10 @@ def normal_builder_factory(**common_kwargs):
# Mixins:
ios_builder, ios_try_job = normal_builder_factory(
- properties = {"xcode_build_version": WEBRTC_XCODE13},
+ properties = {"xcode_build_version": WEBRTC_XCODE14},
caches = [swarming.cache(
- name = "xcode_ios_" + WEBRTC_XCODE13,
- path = "xcode_ios_" + WEBRTC_XCODE13 + ".app",
+ name = "xcode_ios_" + WEBRTC_XCODE14,
+ path = "xcode_ios_" + WEBRTC_XCODE14 + ".app",
)],
)
diff --git a/infra/config/cr-buildbucket.cfg b/infra/config/cr-buildbucket.cfg
index e9ab652b45..cc36dc359c 100644
--- a/infra/config/cr-buildbucket.cfg
+++ b/infra/config/cr-buildbucket.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see BuildbucketCfg message:
-# https://luci-config.appspot.com/schemas/projects:buildbucket.cfg
+# https://config.luci.app/schemas/projects:buildbucket.cfg
buckets {
name: "ci"
@@ -1593,13 +1593,13 @@ buckets {
' },'
' "builder_group": "client.webrtc",'
' "recipe": "webrtc/ios_api_framework",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 29
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -1645,13 +1645,13 @@ buckets {
' },'
' "builder_group": "client.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -1697,13 +1697,13 @@ buckets {
' },'
' "builder_group": "client.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -1749,13 +1749,13 @@ buckets {
' },'
' "builder_group": "client.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-ci-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -3395,13 +3395,13 @@ buckets {
' },'
' "builder_group": "tryserver.webrtc",'
' "recipe": "webrtc/ios_api_framework",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-try-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -3447,13 +3447,13 @@ buckets {
' },'
' "builder_group": "tryserver.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-try-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -3499,13 +3499,13 @@ buckets {
' },'
' "builder_group": "tryserver.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-try-builder@chops-service-accounts.iam.gserviceaccount.com"
@@ -3551,13 +3551,13 @@ buckets {
' },'
' "builder_group": "tryserver.webrtc",'
' "recipe": "webrtc/standalone",'
- ' "xcode_build_version": "13c100"'
+ ' "xcode_build_version": "14c18"'
'}'
priority: 30
execution_timeout_secs: 7200
caches {
- name: "xcode_ios_13c100"
- path: "xcode_ios_13c100.app"
+ name: "xcode_ios_14c18"
+ path: "xcode_ios_14c18.app"
}
build_numbers: YES
service_account: "webrtc-try-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/luci-analysis.cfg b/infra/config/luci-analysis.cfg
index 3a08bae367..6150da33f7 100644
--- a/infra/config/luci-analysis.cfg
+++ b/infra/config/luci-analysis.cfg
@@ -1,20 +1,18 @@
# Schema for this config file: ProjectConfig in:
# https://luci-config.appspot.com/schemas/projects:luci-analysis.cfg
-bug_filing_thresholds {
- metric_id: "human-cls-failed-presubmit"
- threshold {
- # clusters blocking developers should have bugs filed.
- one_day: 3
- }
-}
-bug_filing_thresholds {
- metric_id: "test-runs-failed"
- threshold {
- # clusters that aren't blocking developers but are failing a significant
- # amount of tasks should have bugs filed to look into optimizing machine
- # resource usage.
- one_day: 500
+bug_management {
+ default_bug_system: MONORAIL
+ monorail {
+ project: "webrtc"
+ default_field_values {
+ # Type field.
+ field_id: 38
+ value: "Bug"
+ }
+ priority_field_id: 36
+ monorail_hostname: "bugs.chromium.org"
+ display_prefix: "bugs.webrtc.org"
}
}
@@ -30,107 +28,4 @@ clustering {
like_template: "ninja:${target}/%${suite}.${case}%"
}
}
-monorail {
- project: "webrtc"
- default_field_values {
- # Type field.
- field_id: 38
- value: "Bug"
- }
- priority_field_id: 36
- priorities {
- priority: "0"
- thresholds {
- metric_id: "human-cls-failed-presubmit"
- threshold {
- one_day: 20
- }
- }
- }
- priorities {
- priority: "1"
- thresholds {
- metric_id: "human-cls-failed-presubmit"
- threshold {
- one_day: 10
- }
- }
- }
- priorities {
- priority: "2"
- thresholds {
- metric_id: "human-cls-failed-presubmit"
- threshold {
- one_day: 2
- }
- }
- }
- priorities {
- priority: "3"
- # Clusters which fail to meet this threshold will be closed.
- thresholds {
- metric_id: "test-runs-failed"
- threshold {
- one_day: 2
- }
- }
- thresholds {
- metric_id: "human-cls-failed-presubmit"
- threshold {
- one_day: 1
- seven_day: 1
- }
- }
- }
- priority_hysteresis_percent: 50
- monorail_hostname: "bugs.chromium.org"
- display_prefix: "bugs.webrtc.org"
-}
-realms {
- name: "ci"
- test_variant_analysis {
- update_test_variant_task {
- update_test_variant_task_interval {
- seconds: 3600 # 1 hour
- }
- test_variant_status_update_duration {
- seconds: 86400 # 24 hours
- }
- }
- bq_exports {
- table {
- cloud_project: "webrtc-ci"
- dataset: "weetbix"
- table: "ci_flaky_test_variants"
- }
- predicate {
- status: FLAKY
- }
- }
- }
-}
-
-realms {
- name: "try"
- test_variant_analysis {
- update_test_variant_task {
- update_test_variant_task_interval {
- seconds: 3600 # 1 hour
- }
- test_variant_status_update_duration {
- seconds: 86400 # 24 hours
- }
- }
- bq_exports {
- table {
- cloud_project: "webrtc-ci"
- dataset: "weetbix"
- table: "try_flaky_test_variants"
- }
- predicate {
- status: FLAKY
- }
- }
- }
-}
diff --git a/infra/config/luci-logdog.cfg b/infra/config/luci-logdog.cfg
index adc75bef49..01a391261d 100644
--- a/infra/config/luci-logdog.cfg
+++ b/infra/config/luci-logdog.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see ProjectConfig message:
-# https://luci-config.appspot.com/schemas/projects:luci-logdog.cfg
+# https://config.luci.app/schemas/projects:luci-logdog.cfg
reader_auth_groups: "all"
writer_auth_groups: "luci-logdog-chromium-writers"
diff --git a/infra/config/luci-milo.cfg b/infra/config/luci-milo.cfg
index c3319ddb63..cca46cd157 100644
--- a/infra/config/luci-milo.cfg
+++ b/infra/config/luci-milo.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see Project message:
-# https://luci-config.appspot.com/schemas/projects:luci-milo.cfg
+# https://config.luci.app/schemas/projects:luci-milo.cfg
consoles {
id: "ci"
diff --git a/infra/config/luci-notify.cfg b/infra/config/luci-notify.cfg
index 0c22a488fa..8cae9b3f93 100644
--- a/infra/config/luci-notify.cfg
+++ b/infra/config/luci-notify.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see ProjectConfig message:
-# https://luci-config.appspot.com/schemas/projects:luci-notify.cfg
+# https://config.luci.app/schemas/projects:luci-notify.cfg
notifiers {
notifications {
diff --git a/infra/config/luci-scheduler.cfg b/infra/config/luci-scheduler.cfg
index c1bafa7a66..275b169bd9 100644
--- a/infra/config/luci-scheduler.cfg
+++ b/infra/config/luci-scheduler.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see ProjectConfig message:
-# https://luci-config.appspot.com/schemas/projects:luci-scheduler.cfg
+# https://config.luci.app/schemas/projects:luci-scheduler.cfg
job {
id: "Android32"
diff --git a/infra/config/project.cfg b/infra/config/project.cfg
index f4a6bbb47c..ce5419c65c 100644
--- a/infra/config/project.cfg
+++ b/infra/config/project.cfg
@@ -2,12 +2,12 @@
# Do not modify manually.
#
# For the schema of this file, see ProjectCfg message:
-# https://luci-config.appspot.com/schemas/projects:project.cfg
+# https://config.luci.app/schemas/projects:project.cfg
name: "webrtc"
access: "group:all"
lucicfg {
- version: "1.39.11"
+ version: "1.40.0"
package_dir: "."
config_dir: "."
entry_point: "config.star"
diff --git a/infra/config/realms.cfg b/infra/config/realms.cfg
index 6d5937a89b..171667555f 100644
--- a/infra/config/realms.cfg
+++ b/infra/config/realms.cfg
@@ -2,7 +2,7 @@
# Do not modify manually.
#
# For the schema of this file, see RealmsCfg message:
-# https://luci-config.appspot.com/schemas/projects:realms.cfg
+# https://config.luci.app/schemas/projects:realms.cfg
realms {
name: "@root"
diff --git a/infra/specs/client.webrtc.json b/infra/specs/client.webrtc.json
index 68632f1ad0..6f8bfb5ba5 100644
--- a/infra/specs/client.webrtc.json
+++ b/infra/specs/client.webrtc.json
@@ -7,6 +7,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -26,6 +27,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -45,6 +47,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -64,6 +67,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -83,6 +87,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -102,6 +107,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -121,6 +127,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -141,6 +148,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -161,6 +169,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -181,6 +190,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -200,6 +210,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -219,6 +230,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -238,6 +250,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -258,6 +271,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -277,6 +291,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -284,11 +299,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -297,6 +312,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -316,6 +332,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -335,6 +352,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -354,6 +372,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -374,6 +393,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -393,6 +413,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -439,6 +460,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -458,6 +480,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -477,6 +500,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -496,6 +520,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -515,6 +540,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -534,6 +560,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -553,6 +580,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -573,6 +601,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -593,6 +622,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -613,6 +643,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -632,6 +663,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -651,6 +683,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -670,6 +703,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -690,6 +724,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -709,6 +744,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -716,11 +752,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -729,6 +765,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -748,6 +785,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -767,6 +805,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -786,6 +825,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -806,6 +846,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -825,6 +866,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -871,6 +913,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -898,6 +941,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -917,6 +961,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -936,6 +981,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -955,6 +1001,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -974,6 +1021,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -993,6 +1041,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1012,6 +1061,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1032,6 +1082,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1052,6 +1103,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1072,6 +1124,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1091,6 +1144,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1110,6 +1164,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1129,6 +1184,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1149,6 +1205,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1168,6 +1225,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1175,11 +1233,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -1188,6 +1246,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1207,6 +1266,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1226,6 +1286,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1245,6 +1306,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1265,6 +1327,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1284,6 +1347,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1330,6 +1394,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1349,6 +1414,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1368,6 +1434,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1387,6 +1454,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1406,6 +1474,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1425,6 +1494,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1444,6 +1514,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1464,6 +1535,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1484,6 +1556,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1504,6 +1577,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1523,6 +1597,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1542,6 +1617,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1561,6 +1637,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1581,6 +1658,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1600,6 +1678,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1607,11 +1686,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -1620,6 +1699,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1639,6 +1719,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1658,6 +1739,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1677,6 +1759,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1697,6 +1780,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1716,6 +1800,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1768,7 +1853,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1783,6 +1867,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
@@ -1792,7 +1877,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1807,6 +1891,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
@@ -1816,7 +1901,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1831,6 +1915,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
@@ -1840,7 +1925,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1855,6 +1939,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
@@ -1864,7 +1949,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1879,6 +1963,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
@@ -1888,7 +1973,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1903,6 +1987,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
@@ -1912,7 +1997,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1928,6 +2012,7 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
@@ -1937,7 +2022,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1952,6 +2036,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
@@ -1961,7 +2046,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1977,6 +2061,7 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
@@ -1986,7 +2071,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2001,6 +2085,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
@@ -2010,7 +2095,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2025,6 +2109,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -2032,7 +2117,6 @@
"Linux (more configs)": {
"isolated_scripts": [
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2047,6 +2131,7 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
}
]
@@ -2054,7 +2139,6 @@
"Linux Asan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2068,10 +2152,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2085,10 +2169,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2102,10 +2186,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2119,10 +2203,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2137,10 +2221,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2155,10 +2239,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2173,10 +2257,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2190,10 +2274,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2207,10 +2291,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2224,10 +2308,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2242,10 +2326,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2259,10 +2343,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2276,10 +2360,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2294,10 +2378,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2311,10 +2395,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2328,10 +2412,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2345,10 +2429,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2363,10 +2447,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2380,10 +2464,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2397,6 +2481,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -2404,7 +2489,6 @@
"Linux MSan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2418,10 +2502,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2435,10 +2519,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2452,10 +2536,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2469,10 +2553,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2487,10 +2571,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2505,10 +2589,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2523,10 +2607,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2540,10 +2624,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2557,10 +2641,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2574,10 +2658,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2592,10 +2676,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2609,10 +2693,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2627,10 +2711,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2644,10 +2728,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2661,10 +2745,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2678,10 +2762,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2696,10 +2780,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2713,10 +2797,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2730,6 +2814,7 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -2737,7 +2822,6 @@
"Linux Tsan v2": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2751,10 +2835,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2768,10 +2852,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2785,10 +2869,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2802,10 +2886,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2820,10 +2904,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2838,10 +2922,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2856,10 +2940,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2873,10 +2957,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2890,10 +2974,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2907,10 +2991,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2925,10 +3009,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2942,10 +3026,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2960,10 +3044,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2977,10 +3061,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2994,10 +3078,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3011,10 +3095,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3029,10 +3113,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3046,10 +3130,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3063,6 +3147,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -3070,7 +3155,6 @@
"Linux UBSan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3084,10 +3168,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3101,10 +3185,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3118,10 +3202,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3135,10 +3219,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3153,10 +3237,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3171,10 +3255,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3189,10 +3273,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3206,10 +3290,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3223,10 +3307,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3240,10 +3324,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3258,10 +3342,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3275,10 +3359,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3292,10 +3376,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3310,10 +3394,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3327,10 +3411,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3344,10 +3428,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3361,10 +3445,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3379,10 +3463,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3396,10 +3480,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3413,6 +3497,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -3420,7 +3505,6 @@
"Linux UBSan vptr": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3434,10 +3518,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3451,10 +3535,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3468,10 +3552,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3485,10 +3569,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3503,10 +3587,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3521,10 +3605,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3539,10 +3623,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3556,10 +3640,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3573,10 +3657,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3590,10 +3674,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3608,10 +3692,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3625,10 +3709,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3642,10 +3726,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3660,10 +3744,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3677,10 +3761,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3694,10 +3778,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3711,10 +3795,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3729,10 +3813,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3746,10 +3830,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3763,6 +3847,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -3770,7 +3855,6 @@
"Linux32 Debug": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3784,10 +3868,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3801,10 +3885,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3818,10 +3902,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3835,10 +3919,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3853,10 +3937,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3871,10 +3955,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3889,10 +3973,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3906,10 +3990,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3923,10 +4007,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3940,10 +4024,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3958,10 +4042,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3975,10 +4059,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3993,10 +4077,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4010,10 +4094,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4027,10 +4111,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4044,10 +4128,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4062,10 +4146,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4079,10 +4163,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4096,6 +4180,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -4104,7 +4189,6 @@
"Linux32 Release": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4118,10 +4202,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4135,10 +4219,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4152,10 +4236,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4169,10 +4253,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4187,10 +4271,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4205,10 +4289,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4223,10 +4307,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4240,10 +4324,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4257,10 +4341,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4274,10 +4358,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4292,10 +4376,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4309,10 +4393,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4327,10 +4411,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4344,10 +4428,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4361,10 +4445,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4378,10 +4462,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4396,10 +4480,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4413,10 +4497,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4430,6 +4514,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -4439,7 +4524,6 @@
"Linux64 Debug": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4453,10 +4537,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4470,10 +4554,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4487,10 +4571,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4504,10 +4588,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4522,10 +4606,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4540,10 +4624,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4558,10 +4642,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4575,10 +4659,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4592,10 +4676,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4609,10 +4693,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4627,10 +4711,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4644,10 +4728,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4661,10 +4745,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4679,10 +4763,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4696,10 +4780,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4713,10 +4797,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4730,10 +4814,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4748,10 +4832,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4765,10 +4849,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4782,6 +4866,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -4790,7 +4875,6 @@
"Linux64 Release": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4804,10 +4888,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4821,10 +4905,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4838,10 +4922,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4855,10 +4939,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4873,10 +4957,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4891,10 +4975,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4909,10 +4993,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4926,10 +5010,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4943,10 +5027,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4960,10 +5044,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4978,10 +5062,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4995,10 +5079,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5012,10 +5096,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5030,10 +5114,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5047,10 +5131,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5064,10 +5148,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5081,10 +5165,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5099,10 +5183,10 @@
"pool": "WebRTC-baremetal"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5117,10 +5201,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5134,10 +5218,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5151,6 +5235,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -5160,7 +5245,6 @@
"Mac Asan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5175,10 +5259,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5193,10 +5277,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5211,10 +5295,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5229,10 +5313,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5248,10 +5332,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5267,10 +5351,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5286,10 +5370,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5304,10 +5388,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5322,10 +5406,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5340,10 +5424,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5359,10 +5443,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5377,10 +5461,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5396,10 +5480,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5414,10 +5498,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5432,10 +5516,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5450,10 +5534,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5469,10 +5553,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5487,10 +5571,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5505,6 +5589,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -5513,7 +5598,6 @@
"Mac64 Debug": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5528,10 +5612,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5546,10 +5630,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5564,10 +5648,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5582,10 +5666,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5601,10 +5685,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5620,10 +5704,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5639,10 +5723,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5657,10 +5741,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5675,10 +5759,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5693,10 +5777,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5712,10 +5796,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5730,10 +5814,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5749,10 +5833,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5767,10 +5851,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5785,10 +5869,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5803,10 +5887,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5822,10 +5906,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5840,10 +5924,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5858,6 +5942,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -5865,7 +5950,6 @@
"Mac64 Release": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5879,10 +5963,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5896,10 +5980,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5913,10 +5997,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5930,10 +6014,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5948,10 +6032,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5966,10 +6050,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5984,10 +6068,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6001,10 +6085,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6018,10 +6102,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6035,10 +6119,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6053,10 +6137,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6070,10 +6154,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6088,10 +6172,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6105,10 +6189,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6122,10 +6206,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6139,10 +6223,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6157,10 +6241,10 @@
"pool": "WebRTC-baremetal"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6175,10 +6259,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6192,10 +6276,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6209,6 +6293,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -6216,7 +6301,6 @@
"MacARM64 M1 Release": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6230,10 +6314,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6247,10 +6331,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6264,10 +6348,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6281,10 +6365,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6299,10 +6383,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6317,10 +6401,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6335,10 +6419,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6352,10 +6436,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6369,10 +6453,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6386,10 +6470,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6404,10 +6488,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6421,10 +6505,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6439,10 +6523,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6456,10 +6540,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6473,10 +6557,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6490,10 +6574,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6508,10 +6592,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6525,10 +6609,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6542,6 +6626,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -6550,7 +6635,6 @@
"Win (more configs)": {
"isolated_scripts": [
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6565,6 +6649,7 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
}
]
@@ -6574,7 +6659,6 @@
"Win32 Release (Clang)": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6588,10 +6672,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6605,10 +6689,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6622,10 +6706,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6639,10 +6723,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6657,10 +6741,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6675,10 +6759,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6693,10 +6777,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6710,10 +6794,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6727,10 +6811,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6744,10 +6828,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6762,10 +6846,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6779,10 +6863,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6797,10 +6881,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6814,10 +6898,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6831,10 +6915,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6848,10 +6932,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6866,10 +6950,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6883,10 +6967,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6900,6 +6984,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -6907,7 +6992,6 @@
"Win64 ASan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6921,10 +7005,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6938,10 +7022,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6955,10 +7039,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6972,10 +7056,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6990,10 +7074,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7008,10 +7092,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7026,10 +7110,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7043,10 +7127,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7060,10 +7144,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7077,10 +7161,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7095,10 +7179,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7112,10 +7196,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7130,10 +7214,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7147,10 +7231,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7164,10 +7248,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7181,10 +7265,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7199,10 +7283,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7216,10 +7300,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7233,6 +7317,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -7240,7 +7325,6 @@
"Win64 Debug (Clang)": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7254,10 +7338,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7271,10 +7355,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7288,10 +7372,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7305,10 +7389,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7323,10 +7407,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7341,10 +7425,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7359,10 +7443,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7376,10 +7460,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7393,10 +7477,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7410,10 +7494,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7428,10 +7512,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7445,10 +7529,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7463,10 +7547,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7480,10 +7564,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7497,10 +7581,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7514,10 +7598,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7532,10 +7616,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7549,10 +7633,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7566,6 +7650,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -7573,7 +7658,6 @@
"Win64 Release (Clang)": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7587,10 +7671,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7604,10 +7688,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7621,10 +7705,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7638,10 +7722,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7656,10 +7740,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7674,10 +7758,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7692,10 +7776,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7709,10 +7793,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7726,10 +7810,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7743,10 +7827,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7761,10 +7845,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7778,10 +7862,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7796,10 +7880,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7813,10 +7897,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7830,10 +7914,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7847,10 +7931,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7865,10 +7949,10 @@
"pool": "WebRTC-baremetal"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7883,10 +7967,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7900,10 +7984,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7917,6 +8001,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -7936,7 +8021,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7950,10 +8034,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -7969,6 +8054,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -7985,7 +8071,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7999,10 +8084,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8018,6 +8104,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -8034,7 +8121,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8048,10 +8134,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8067,6 +8154,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -8082,7 +8170,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8096,10 +8183,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8115,6 +8203,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -8130,7 +8219,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8144,10 +8232,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8163,6 +8252,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -8178,7 +8268,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8192,10 +8281,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8211,6 +8301,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -8226,7 +8317,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8240,10 +8330,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8259,6 +8350,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -8274,7 +8366,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8288,10 +8379,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8307,6 +8399,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -8322,7 +8415,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8336,10 +8428,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8355,6 +8448,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -8370,7 +8464,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8384,10 +8477,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8403,6 +8497,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -8418,7 +8513,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8432,10 +8526,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8451,6 +8546,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -8466,7 +8562,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8480,10 +8575,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8499,6 +8595,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -8514,7 +8611,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8528,10 +8624,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8547,6 +8644,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -8562,7 +8660,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8576,10 +8673,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8595,6 +8693,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -8610,7 +8709,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8624,10 +8722,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8643,6 +8742,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -8658,7 +8758,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8672,10 +8771,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8692,6 +8792,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -8707,7 +8808,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8721,10 +8821,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8741,6 +8842,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -8756,7 +8858,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8770,10 +8871,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8790,6 +8892,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -8805,7 +8908,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8819,10 +8921,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -8840,6 +8943,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -8855,7 +8959,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8869,10 +8972,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -8890,6 +8994,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -8905,7 +9010,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8919,10 +9023,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -8940,6 +9045,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -8955,7 +9061,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8969,10 +9074,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -8988,6 +9094,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9003,7 +9110,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9017,10 +9123,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9036,6 +9143,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9051,7 +9159,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9065,10 +9172,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9084,6 +9192,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9099,7 +9208,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9113,10 +9221,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9132,6 +9241,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9147,7 +9257,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9161,10 +9270,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9180,6 +9290,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9195,7 +9306,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9209,10 +9319,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9228,6 +9339,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9243,7 +9355,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9257,10 +9368,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9276,6 +9388,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9291,7 +9404,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9305,10 +9417,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9324,6 +9437,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9339,7 +9453,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9353,10 +9466,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9372,6 +9486,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9387,7 +9502,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9401,10 +9515,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9421,6 +9536,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9436,7 +9552,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9450,10 +9565,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9470,6 +9586,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9485,7 +9602,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9499,10 +9615,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9519,6 +9636,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9535,7 +9653,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9549,10 +9666,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9568,6 +9686,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9584,7 +9703,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9598,10 +9716,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9617,6 +9736,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9633,7 +9753,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9647,10 +9766,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9666,6 +9786,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9682,7 +9803,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9696,10 +9816,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9715,6 +9836,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -9731,7 +9853,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9745,10 +9866,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9764,6 +9886,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -9780,7 +9903,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9794,10 +9916,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -9813,6 +9936,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -9828,7 +9952,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9842,10 +9965,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -9863,6 +9987,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -9878,7 +10003,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9892,10 +10016,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -9913,6 +10038,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -9928,7 +10054,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9942,10 +10067,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -9963,6 +10089,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -9978,7 +10105,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9992,10 +10118,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10011,6 +10138,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -10026,7 +10154,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10040,10 +10167,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10059,6 +10187,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -10074,7 +10203,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10088,10 +10216,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10107,6 +10236,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -10122,7 +10252,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10136,10 +10265,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10155,6 +10285,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -10170,7 +10301,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10184,10 +10314,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10203,6 +10334,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -10218,7 +10350,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10232,10 +10363,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10251,6 +10383,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -10266,7 +10399,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10280,10 +10412,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10299,6 +10432,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -10314,7 +10448,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10328,10 +10461,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10347,6 +10481,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -10362,7 +10497,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10376,10 +10510,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10395,6 +10530,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -10410,7 +10546,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10424,10 +10559,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10443,6 +10579,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -10458,7 +10595,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10472,10 +10608,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10491,6 +10628,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -10506,7 +10644,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10520,10 +10657,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10539,6 +10677,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -10554,7 +10693,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10568,10 +10706,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10588,6 +10727,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -10603,7 +10743,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10617,10 +10756,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10637,6 +10777,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -10652,7 +10793,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10666,10 +10806,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10686,6 +10827,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -10701,7 +10843,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10715,10 +10856,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10734,6 +10876,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -10749,7 +10892,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10763,10 +10905,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10782,6 +10925,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -10797,7 +10941,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10811,10 +10954,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10830,6 +10974,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -10845,7 +10990,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10859,10 +11003,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10878,6 +11023,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -10893,7 +11039,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10907,10 +11052,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10926,6 +11072,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -10941,7 +11088,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10955,10 +11101,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -10974,6 +11121,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 16.2"
}
diff --git a/infra/specs/client.webrtc.perf.json b/infra/specs/client.webrtc.perf.json
index 80a1bc21b7..bb05e580ca 100644
--- a/infra/specs/client.webrtc.perf.json
+++ b/infra/specs/client.webrtc.perf.json
@@ -14,6 +14,7 @@
],
"script": "//tools_webrtc/perf/process_perf_results.py"
},
+ "name": "video_codec_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -47,6 +48,7 @@
],
"script": "//tools_webrtc/perf/process_perf_results.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -83,6 +85,7 @@
],
"script": "//tools_webrtc/perf/process_perf_results.py"
},
+ "name": "video_codec_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -116,6 +119,7 @@
],
"script": "//tools_webrtc/perf/process_perf_results.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -149,7 +153,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--isolated-script-test-perf-output=${ISOLATED_OUTDIR}/perftest-output.pb"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -174,6 +177,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
@@ -185,7 +189,6 @@
"--isolated-script-test-perf-output=${ISOLATED_OUTDIR}/perftest-output.pb",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -210,6 +213,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -220,7 +224,6 @@
"args": [
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -244,6 +247,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
@@ -253,7 +257,6 @@
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -277,6 +280,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -287,7 +291,6 @@
"args": [
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -312,6 +315,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
@@ -321,7 +325,6 @@
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -346,6 +349,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -356,7 +360,6 @@
"args": [
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -381,6 +384,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
@@ -390,7 +394,6 @@
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -415,6 +418,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -425,7 +429,6 @@
"args": [
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -449,6 +452,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
@@ -458,7 +462,6 @@
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -482,6 +485,7 @@
"idempotent": false,
"io_timeout": 10800
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
diff --git a/infra/specs/internal.client.webrtc.json b/infra/specs/internal.client.webrtc.json
index 67033dff3f..59547fc132 100644
--- a/infra/specs/internal.client.webrtc.json
+++ b/infra/specs/internal.client.webrtc.json
@@ -7,11 +7,10 @@
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -25,7 +24,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -35,23 +34,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -65,7 +64,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -75,12 +74,13 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
@@ -88,11 +88,10 @@
"--readline-timeout=1200",
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -106,7 +105,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -118,24 +117,24 @@
"io_timeout": 7200,
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -149,7 +148,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -159,24 +158,24 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -190,7 +189,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -200,23 +199,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -230,7 +229,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -240,23 +239,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -270,7 +269,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -280,23 +279,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -310,7 +309,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -320,23 +319,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -350,7 +349,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -360,23 +359,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -390,7 +389,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -400,23 +399,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -430,7 +429,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -440,13 +439,14 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
}
]
@@ -463,7 +463,6 @@
"${ISOLATED_OUTDIR}",
"--nologs"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"args": [
"--test-suite",
@@ -481,10 +480,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"device_status": "available",
"id": "mac-254-e504",
"os": "iOS-15.7.8",
@@ -501,6 +501,7 @@
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -511,11 +512,10 @@
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -529,7 +529,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -539,23 +539,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -569,7 +569,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -579,12 +579,13 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
@@ -592,11 +593,10 @@
"--readline-timeout=1200",
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -610,7 +610,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -622,24 +622,24 @@
"io_timeout": 7200,
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -653,7 +653,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -663,24 +663,24 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -694,7 +694,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -704,23 +704,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -734,7 +734,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -744,23 +744,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -774,7 +774,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -784,23 +784,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -814,7 +814,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -824,23 +824,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -854,7 +854,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -864,23 +864,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -894,7 +894,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -904,23 +904,23 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
"--xctest",
"--xcode-build-version",
- "15a5229h",
+ "15a507",
"--out-dir",
"${ISOLATED_OUTDIR}"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -934,7 +934,7 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
@@ -944,13 +944,14 @@
},
"named_caches": [
{
- "name": "xcode_ios_15a5229h",
+ "name": "xcode_ios_15a507",
"path": "Xcode.app"
}
],
"service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
}
]
diff --git a/infra/specs/mixins.pyl b/infra/specs/mixins.pyl
index 1fcb3d206e..e436846ef0 100644
--- a/infra/specs/mixins.pyl
+++ b/infra/specs/mixins.pyl
@@ -51,6 +51,14 @@
}
}
},
+ 'crosshatch': {
+ 'swarming': {
+ 'dimensions': {
+ 'device_type': 'crosshatch',
+ 'os': 'Android'
+ }
+ }
+ },
'fuchsia-gtest-output': {
'args': [
'--test-launcher-summary-output=${ISOLATED_OUTDIR}/gtest_output.json',
@@ -168,7 +176,7 @@
'location':
'.',
'revision':
- 'git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb'
+ 'git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce'
}]
}
},
@@ -212,7 +220,7 @@
'args': ['--nologs']
},
'quick-perf-tests': {
- 'args': ['--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/', '--nologs']
+ 'args': ['--webrtc_quick_perf_test', '--nologs']
},
'redfin': {
'swarming': {
@@ -249,6 +257,11 @@
'shards': 6
}
},
+ 'shards-8': {
+ 'swarming': {
+ 'shards': 8
+ }
+ },
'timeout-2h': {
'swarming': {
'hard_timeout': 7200,
@@ -296,6 +309,9 @@
'xcode_13_main': {
'args': ['--xcode-build-version', '13c100'],
'swarming': {
+ 'dimensions': {
+ 'caches': 'xcode_ios_13c100'
+ },
'named_caches': [{
'name': 'xcode_ios_13c100',
'path': 'Xcode.app'
@@ -305,6 +321,9 @@
'xcode_14_main': {
'args': ['--xcode-build-version', '14c18'],
'swarming': {
+ 'dimensions': {
+ 'caches': 'xcode_ios_14c18'
+ },
'named_caches': [{
'name': 'xcode_ios_14c18',
'path': 'Xcode.app'
@@ -312,10 +331,10 @@
}
},
'xcode_15_main': {
- 'args': ['--xcode-build-version', '15a5229h'],
+ 'args': ['--xcode-build-version', '15a507'],
'swarming': {
'named_caches': [{
- 'name': 'xcode_ios_15a5229h',
+ 'name': 'xcode_ios_15a507',
'path': 'Xcode.app'
}]
}
diff --git a/infra/specs/mixins_webrtc.pyl b/infra/specs/mixins_webrtc.pyl
index ded32c10e3..443a4450eb 100644
--- a/infra/specs/mixins_webrtc.pyl
+++ b/infra/specs/mixins_webrtc.pyl
@@ -35,6 +35,14 @@
}
}
},
+ 'crosshatch': {
+ 'swarming': {
+ 'dimensions': {
+ 'device_type': 'crosshatch',
+ 'os': 'Android',
+ },
+ },
+ },
# Hack to use the test-launcher-summary-output flag + emulator folders for gtest-output
# but it's currently the only way to get the file out of the emulator.
'fuchsia-gtest-output': {
@@ -150,7 +158,7 @@
},
'quick-perf-tests': {
'args': [
- '--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/',
+ '--webrtc_quick_perf_test',
'--nologs',
],
},
@@ -191,6 +199,11 @@
'shards': 6,
},
},
+ 'shards-8': {
+ 'swarming': {
+ 'shards': 8,
+ },
+ },
'timeout-2h': {
'swarming': {
'hard_timeout': 7200,
@@ -211,6 +224,9 @@
'xcode_13_main': {
'args': ['--xcode-build-version', '13c100'],
'swarming': {
+ 'dimensions': {
+ 'caches': 'xcode_ios_13c100',
+ },
'named_caches': [{
'name': 'xcode_ios_13c100',
'path': 'Xcode.app'
@@ -220,6 +236,9 @@
'xcode_14_main': {
'args': ['--xcode-build-version', '14c18'],
'swarming': {
+ 'dimensions': {
+ 'caches': 'xcode_ios_14c18',
+ },
'named_caches': [{
'name': 'xcode_ios_14c18',
'path': 'Xcode.app'
diff --git a/infra/specs/test_suites.pyl b/infra/specs/test_suites.pyl
index 9430d45a39..570314c9bd 100644
--- a/infra/specs/test_suites.pyl
+++ b/infra/specs/test_suites.pyl
@@ -42,7 +42,7 @@
},
'slow_peer_connection_unittests': {},
'svc_tests': {
- 'mixins': ['shards-4'],
+ 'mixins': ['shards-8', 'crosshatch'],
},
'system_wrappers_unittests': {},
'test_support_unittests': {},
diff --git a/infra/specs/tryserver.webrtc.json b/infra/specs/tryserver.webrtc.json
index b89ee5f731..61e47fd0f8 100644
--- a/infra/specs/tryserver.webrtc.json
+++ b/infra/specs/tryserver.webrtc.json
@@ -7,6 +7,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -26,6 +27,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -45,6 +47,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -64,6 +67,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -83,6 +87,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -102,6 +107,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -121,6 +127,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -141,6 +148,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -161,6 +169,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -181,6 +190,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -200,6 +210,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -219,6 +230,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -238,6 +250,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -258,6 +271,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -277,6 +291,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -284,11 +299,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -297,6 +312,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -316,6 +332,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -335,6 +352,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -354,6 +372,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -374,6 +393,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -393,6 +413,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -410,12 +431,13 @@
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs"
],
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -462,6 +484,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -481,6 +504,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -500,6 +524,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -519,6 +544,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -538,6 +564,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -557,6 +584,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -576,6 +604,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -596,6 +625,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -616,6 +646,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -636,6 +667,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -655,6 +687,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -674,6 +707,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -693,6 +727,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -713,6 +748,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -732,6 +768,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -739,11 +776,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -752,6 +789,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -771,6 +809,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -790,6 +829,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -809,6 +849,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -829,6 +870,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -848,6 +890,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -865,12 +908,13 @@
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs"
],
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -917,6 +961,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -936,6 +981,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -955,6 +1001,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -974,6 +1021,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -993,6 +1041,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1012,6 +1061,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1031,6 +1081,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1051,6 +1102,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1071,6 +1123,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1091,6 +1144,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1110,6 +1164,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1129,6 +1184,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1148,6 +1204,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1168,6 +1225,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1187,6 +1245,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1194,11 +1253,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -1207,6 +1266,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1226,6 +1286,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1245,6 +1306,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1264,6 +1326,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1284,6 +1347,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1303,6 +1367,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1320,12 +1385,13 @@
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs"
],
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1372,6 +1438,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1396,6 +1463,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "AppRTCMobile_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1415,6 +1483,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "android_instrumentation_test_apk",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1434,6 +1503,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "audio_decoder_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1453,6 +1523,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_audio_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1472,6 +1543,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "common_video_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1491,6 +1563,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "dcsctp_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1510,6 +1583,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1530,6 +1604,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "modules_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1550,6 +1625,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "peerconnection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1570,6 +1646,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_media_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1589,6 +1666,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_pc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1608,6 +1686,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_stats_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1627,6 +1706,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "rtc_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1647,6 +1727,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "slow_peer_connection_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1666,6 +1747,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "svc_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1673,11 +1755,11 @@
"swarming": {
"dimensions": {
"android_devices": "1",
- "device_type": "walleye",
+ "device_type": "crosshatch",
"os": "Android"
},
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
- "shards": 4
+ "shards": 8
},
"test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
@@ -1686,6 +1768,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "system_wrappers_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1705,6 +1788,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "test_support_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1724,6 +1808,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "tools_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1743,6 +1828,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "video_engine_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1763,6 +1849,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "voip_unittests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1782,6 +1869,7 @@
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_nonparallel_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1799,12 +1887,13 @@
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs"
],
"merge": {
"script": "//testing/merge_scripts/standard_gtest_merge.py"
},
+ "name": "webrtc_perf_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
@@ -1862,7 +1951,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1877,6 +1965,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
@@ -1886,7 +1975,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1901,6 +1989,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
@@ -1910,7 +1999,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1925,6 +2013,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
@@ -1934,7 +2023,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1949,6 +2037,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
@@ -1958,7 +2047,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1973,6 +2061,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
@@ -1982,7 +2071,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -1997,6 +2085,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
@@ -2006,7 +2095,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2022,6 +2110,7 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
@@ -2031,7 +2120,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2046,6 +2134,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
@@ -2055,7 +2144,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2071,6 +2159,7 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
@@ -2080,7 +2169,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2095,6 +2183,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
@@ -2104,7 +2193,6 @@
"--test-arg=--undefok=test_launcher_summary_output",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2119,6 +2207,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -2140,7 +2229,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2154,10 +2242,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2173,6 +2262,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -2189,7 +2279,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2203,10 +2292,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2222,6 +2312,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -2238,7 +2329,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "apprtcmobile_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2252,10 +2342,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2271,6 +2362,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "apprtcmobile_tests",
"test_id_prefix": "ninja://examples:apprtcmobile_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -2286,7 +2378,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2300,10 +2391,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2319,6 +2411,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -2334,7 +2427,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2348,10 +2440,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2367,6 +2460,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -2382,7 +2476,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2396,10 +2489,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2415,6 +2509,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -2430,7 +2525,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2444,10 +2538,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2463,6 +2558,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -2478,7 +2574,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2492,10 +2587,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2511,6 +2607,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -2526,7 +2623,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2540,10 +2636,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2559,6 +2656,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -2574,7 +2672,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2588,10 +2685,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2607,6 +2705,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -2622,7 +2721,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2636,10 +2734,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2655,6 +2754,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -2670,7 +2770,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2684,10 +2783,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2703,6 +2803,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -2718,7 +2819,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2732,10 +2832,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2751,6 +2852,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -2766,7 +2868,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2780,10 +2881,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2799,6 +2901,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -2814,7 +2917,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2828,10 +2930,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2847,6 +2950,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -2862,7 +2966,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2876,10 +2979,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2896,6 +3000,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -2911,7 +3016,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2925,10 +3029,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2945,6 +3050,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -2960,7 +3066,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -2974,10 +3079,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -2994,6 +3100,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -3009,7 +3116,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3023,10 +3129,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -3044,6 +3151,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3059,7 +3167,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3073,10 +3180,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -3094,6 +3202,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3109,7 +3218,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3123,10 +3231,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -3144,6 +3253,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3159,7 +3269,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3173,10 +3282,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3192,6 +3302,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3207,7 +3318,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3221,10 +3331,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3240,6 +3351,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3255,7 +3367,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3269,10 +3380,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3288,6 +3400,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3303,7 +3416,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3317,10 +3429,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3336,6 +3449,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3351,7 +3465,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3365,10 +3478,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3384,6 +3498,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3399,7 +3514,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3413,10 +3527,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3432,6 +3547,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3447,7 +3563,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3461,10 +3576,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3480,6 +3596,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3495,7 +3612,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3509,10 +3625,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3528,6 +3645,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3543,7 +3661,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3557,10 +3674,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3576,6 +3694,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3591,7 +3710,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3605,10 +3723,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3625,6 +3744,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3640,7 +3760,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3654,10 +3773,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3674,6 +3794,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3689,7 +3810,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3703,10 +3823,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3723,6 +3844,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3739,7 +3861,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3753,10 +3874,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3772,6 +3894,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3788,7 +3911,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3802,10 +3924,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3821,6 +3944,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3837,7 +3961,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_framework_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3851,10 +3974,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3870,6 +3994,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_framework_unittests",
"test_id_prefix": "ninja://sdk:sdk_framework_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -3886,7 +4011,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3900,10 +4024,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3919,6 +4044,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -3935,7 +4061,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3949,10 +4074,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -3968,6 +4094,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -3984,7 +4111,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "sdk_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -3998,10 +4124,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4017,6 +4144,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "sdk_unittests",
"test_id_prefix": "ninja://sdk:sdk_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -4032,7 +4160,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4046,10 +4173,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -4067,6 +4195,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -4082,7 +4211,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4096,10 +4224,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -4117,6 +4246,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -4132,7 +4262,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4146,10 +4275,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cores": "12",
"cpu": "x86-64",
"os": "Mac-12"
@@ -4167,6 +4297,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -4182,7 +4313,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4196,10 +4326,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4215,6 +4346,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -4230,7 +4362,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4244,10 +4375,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4263,6 +4395,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -4278,7 +4411,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4292,10 +4424,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4311,6 +4444,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -4326,7 +4460,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4340,10 +4473,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4359,6 +4493,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -4374,7 +4509,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4388,10 +4522,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4407,6 +4542,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -4422,7 +4558,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4436,10 +4571,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4455,6 +4591,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -4470,7 +4607,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4484,10 +4620,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4503,6 +4640,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -4518,7 +4656,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4532,10 +4669,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4551,6 +4689,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -4566,7 +4705,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4580,10 +4718,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4599,6 +4738,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -4614,7 +4754,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4628,10 +4767,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4647,6 +4787,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -4662,7 +4803,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4676,10 +4816,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4695,6 +4836,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -4710,7 +4852,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4724,10 +4865,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4743,6 +4885,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -4758,7 +4901,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4772,10 +4914,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4792,6 +4935,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -4807,7 +4951,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4821,10 +4964,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4841,6 +4985,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -4856,7 +5001,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4870,10 +5014,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4890,6 +5035,7 @@
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com",
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/",
"variant_id": "iPhone X 16.2"
},
@@ -4905,7 +5051,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4919,10 +5064,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4938,6 +5084,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 14.5"
},
@@ -4953,7 +5100,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -4967,10 +5113,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -4986,6 +5133,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 15.5"
},
@@ -5001,7 +5149,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5015,10 +5162,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -5034,6 +5182,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/",
"variant_id": "iPhone X 16.2"
},
@@ -5049,7 +5198,6 @@
"--xcode-build-version",
"13c100"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5063,10 +5211,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_13c100",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -5082,6 +5231,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 14.5"
},
@@ -5097,7 +5247,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5111,10 +5260,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -5130,6 +5280,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 15.5"
},
@@ -5145,7 +5296,6 @@
"--xcode-build-version",
"14c18"
],
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5159,10 +5309,11 @@
{
"cipd_package": "infra/tools/mac_toolchain/${platform}",
"location": ".",
- "revision": "git_revision:59ddedfe3849abf560cbe0b41bb8e431041cd2bb"
+ "revision": "git_revision:32d81d877ee07af07bf03b7f70ce597e323b80ce"
}
],
"dimensions": {
+ "caches": "xcode_ios_14c18",
"cpu": "x86-64",
"os": "Mac-12"
},
@@ -5178,6 +5329,7 @@
],
"service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com"
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/",
"variant_id": "iPhone X 16.2"
}
@@ -5186,7 +5338,6 @@
"linux_asan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5200,10 +5351,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5217,10 +5368,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5234,10 +5385,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5251,10 +5402,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5269,10 +5420,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5287,10 +5438,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5305,10 +5456,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5322,10 +5473,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5339,10 +5490,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5356,10 +5507,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5374,10 +5525,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5391,10 +5542,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5408,10 +5559,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5426,10 +5577,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5443,10 +5594,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5460,10 +5611,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5477,10 +5628,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5495,10 +5646,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5512,10 +5663,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5529,6 +5680,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -5542,7 +5694,6 @@
"linux_coverage": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5557,10 +5708,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5575,10 +5726,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5593,10 +5744,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5611,10 +5762,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5630,10 +5781,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5649,10 +5800,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5668,10 +5819,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5686,10 +5837,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5704,10 +5855,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5722,10 +5873,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5741,10 +5892,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5759,10 +5910,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5777,10 +5928,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5796,10 +5947,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5814,10 +5965,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5832,10 +5983,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5850,10 +6001,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5869,15 +6020,15 @@
"pool": "WebRTC-baremetal-try"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5893,10 +6044,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
- "isolate_name": "video_engine_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5912,10 +6063,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5930,10 +6081,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5948,15 +6099,15 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_perf_tests",
"isolate_profile_data": true,
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
@@ -5972,6 +6123,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -5979,7 +6131,6 @@
"linux_dbg": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -5993,10 +6144,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6010,10 +6161,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6027,10 +6178,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6044,10 +6195,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6062,10 +6213,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6080,10 +6231,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6098,10 +6249,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6115,10 +6266,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6132,10 +6283,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6149,10 +6300,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6167,10 +6318,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6184,10 +6335,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6201,10 +6352,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6219,10 +6370,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6236,10 +6387,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6253,10 +6404,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6270,10 +6421,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6288,10 +6439,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6305,10 +6456,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6322,6 +6473,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -6330,7 +6482,6 @@
"linux_memcheck": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6344,10 +6495,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6361,10 +6512,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6378,10 +6529,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6395,10 +6546,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6413,10 +6564,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6431,10 +6582,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6449,10 +6600,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6466,10 +6617,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6483,10 +6634,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6500,10 +6651,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6518,10 +6669,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6535,10 +6686,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6552,10 +6703,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6570,10 +6721,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6587,10 +6738,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6604,10 +6755,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6621,10 +6772,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6639,10 +6790,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6656,10 +6807,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6673,6 +6824,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -6680,7 +6832,6 @@
"linux_more_configs": {
"isolated_scripts": [
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6695,6 +6846,7 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
}
]
@@ -6702,7 +6854,6 @@
"linux_msan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6716,10 +6867,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6733,10 +6884,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6750,10 +6901,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6767,10 +6918,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6785,10 +6936,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6803,10 +6954,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6821,10 +6972,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6838,10 +6989,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6855,10 +7006,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6872,10 +7023,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6890,10 +7041,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6907,10 +7058,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6925,10 +7076,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6942,10 +7093,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6959,10 +7110,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6976,10 +7127,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -6994,10 +7145,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7011,10 +7162,10 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7028,6 +7179,7 @@
"os": "Ubuntu-20.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -7035,7 +7187,6 @@
"linux_rel": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7049,10 +7200,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7066,10 +7217,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7083,10 +7234,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7100,10 +7251,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7118,10 +7269,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7136,10 +7287,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7154,10 +7305,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7171,10 +7322,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7188,10 +7339,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7205,10 +7356,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7223,10 +7374,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7240,10 +7391,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7257,10 +7408,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7275,10 +7426,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7292,10 +7443,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7309,10 +7460,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7326,10 +7477,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7344,15 +7495,15 @@
"pool": "WebRTC-baremetal-try"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7367,10 +7518,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7385,10 +7536,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7402,10 +7553,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7419,15 +7570,15 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7442,6 +7593,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -7449,7 +7601,6 @@
"linux_tsan2": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7463,10 +7614,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7480,10 +7631,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7497,10 +7648,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7514,10 +7665,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7532,10 +7683,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7550,10 +7701,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7568,10 +7719,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7585,10 +7736,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7602,10 +7753,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7619,10 +7770,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7637,10 +7788,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7654,10 +7805,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7672,10 +7823,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7689,10 +7840,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7706,10 +7857,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7723,10 +7874,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7741,10 +7892,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7758,10 +7909,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7775,6 +7926,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -7782,7 +7934,6 @@
"linux_ubsan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7796,10 +7947,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7813,10 +7964,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7830,10 +7981,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7847,10 +7998,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7865,10 +8016,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7883,10 +8034,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7901,10 +8052,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7918,10 +8069,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7935,10 +8086,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7952,10 +8103,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7970,10 +8121,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -7987,10 +8138,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8004,10 +8155,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8022,10 +8173,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8039,10 +8190,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8056,10 +8207,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8073,10 +8224,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8091,10 +8242,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8108,10 +8259,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8125,6 +8276,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -8132,7 +8284,6 @@
"linux_ubsan_vptr": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8146,10 +8297,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8163,10 +8314,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8180,10 +8331,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8197,10 +8348,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8215,10 +8366,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8233,10 +8384,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8251,10 +8402,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8268,10 +8419,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8285,10 +8436,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8302,10 +8453,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8320,10 +8471,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "shared_screencast_stream_test",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8337,10 +8488,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "shared_screencast_stream_test",
"test_id_prefix": "ninja://modules/desktop_capture:shared_screencast_stream_test/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8354,10 +8505,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8372,10 +8523,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8389,10 +8540,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8406,10 +8557,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8423,10 +8574,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8441,10 +8592,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8458,10 +8609,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8475,6 +8626,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -8482,7 +8634,6 @@
"linux_x86_dbg": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8496,10 +8647,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8513,10 +8664,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8530,10 +8681,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8547,10 +8698,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8565,10 +8716,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8583,10 +8734,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8601,10 +8752,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8618,10 +8769,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8635,10 +8786,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8652,10 +8803,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8670,10 +8821,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8687,10 +8838,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8705,10 +8856,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8722,10 +8873,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8739,10 +8890,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8756,10 +8907,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8774,10 +8925,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8791,10 +8942,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8808,6 +8959,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -8815,7 +8967,6 @@
"linux_x86_rel": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8829,10 +8980,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8846,10 +8997,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8863,10 +9014,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8880,10 +9031,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8898,10 +9049,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8916,10 +9067,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8934,10 +9085,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8951,10 +9102,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8968,10 +9119,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -8985,10 +9136,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9003,10 +9154,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9020,10 +9171,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9038,10 +9189,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9055,10 +9206,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9072,10 +9223,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9089,10 +9240,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9107,10 +9258,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9124,10 +9275,10 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9141,6 +9292,7 @@
"os": "Ubuntu-18.04"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -9148,7 +9300,6 @@
"mac_asan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9163,10 +9314,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9181,10 +9332,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9199,10 +9350,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9217,10 +9368,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9236,10 +9387,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9255,10 +9406,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9274,10 +9425,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9292,10 +9443,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9310,10 +9461,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9328,10 +9479,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9347,10 +9498,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9365,10 +9516,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9384,10 +9535,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9402,10 +9553,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9420,10 +9571,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9438,10 +9589,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9457,10 +9608,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9475,10 +9626,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9493,6 +9644,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -9502,7 +9654,6 @@
"mac_dbg": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9517,10 +9668,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9535,10 +9686,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9553,10 +9704,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9571,10 +9722,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9590,10 +9741,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9609,10 +9760,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9628,10 +9779,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9646,10 +9797,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9664,10 +9815,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9682,10 +9833,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9701,10 +9852,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9719,10 +9870,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9738,10 +9889,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9756,10 +9907,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9774,10 +9925,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9792,10 +9943,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9811,10 +9962,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9829,10 +9980,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9847,6 +9998,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -9854,7 +10006,6 @@
"mac_dbg_m1": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9868,10 +10019,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9885,10 +10036,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9902,10 +10053,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9919,10 +10070,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9937,10 +10088,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9955,10 +10106,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9973,10 +10124,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -9990,10 +10141,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10007,10 +10158,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10024,10 +10175,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10042,10 +10193,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10059,10 +10210,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10077,10 +10228,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10094,10 +10245,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10111,10 +10262,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10128,10 +10279,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10146,10 +10297,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10163,10 +10314,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10180,6 +10331,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -10187,7 +10339,6 @@
"mac_rel": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10201,10 +10352,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10218,10 +10369,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10235,10 +10386,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10252,10 +10403,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10270,10 +10421,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10288,10 +10439,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10306,10 +10457,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10323,10 +10474,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10340,10 +10491,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10357,10 +10508,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10375,10 +10526,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10392,10 +10543,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10410,10 +10561,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10427,10 +10578,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10444,10 +10595,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10461,10 +10612,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10479,15 +10630,15 @@
"pool": "WebRTC-baremetal-try"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10502,10 +10653,10 @@
"os": "Mac-12"
}
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10520,10 +10671,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10537,10 +10688,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10554,15 +10705,15 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10577,6 +10728,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -10584,7 +10736,6 @@
"mac_rel_m1": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10598,10 +10749,10 @@
"os": "Mac-12"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10615,10 +10766,10 @@
"os": "Mac-12"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10632,10 +10783,10 @@
"os": "Mac-12"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10649,10 +10800,10 @@
"os": "Mac-12"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10667,10 +10818,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10685,10 +10836,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10703,10 +10854,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10720,10 +10871,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10737,10 +10888,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10754,10 +10905,10 @@
"os": "Mac-12"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10772,10 +10923,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10789,10 +10940,10 @@
"os": "Mac-12"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10807,10 +10958,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10824,10 +10975,10 @@
"os": "Mac-12"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10841,10 +10992,10 @@
"os": "Mac-12"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10858,10 +11009,10 @@
"os": "Mac-12"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10876,10 +11027,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10893,10 +11044,10 @@
"os": "Mac-12"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10910,6 +11061,7 @@
"os": "Mac-12"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -10917,7 +11069,6 @@
"win_asan": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10931,10 +11082,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10948,10 +11099,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10965,10 +11116,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -10982,10 +11133,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11000,10 +11151,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11018,10 +11169,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11036,10 +11187,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11053,10 +11204,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11070,10 +11221,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11087,10 +11238,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11105,10 +11256,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11122,10 +11273,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11140,10 +11291,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11157,10 +11308,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11174,10 +11325,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11191,10 +11342,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11209,10 +11360,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11226,10 +11377,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11243,6 +11394,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -11254,7 +11406,6 @@
"win_x64_clang_dbg": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11268,10 +11419,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11285,10 +11436,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11302,10 +11453,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11319,10 +11470,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11337,10 +11488,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11355,10 +11506,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11373,10 +11524,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11390,10 +11541,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11407,10 +11558,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11424,10 +11575,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11442,10 +11593,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11459,10 +11610,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11477,10 +11628,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11494,10 +11645,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11511,10 +11662,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11528,10 +11679,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11546,10 +11697,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11563,10 +11714,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11580,6 +11731,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -11587,7 +11739,6 @@
"win_x64_clang_rel": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11601,10 +11752,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11618,10 +11769,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11635,10 +11786,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11652,10 +11803,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11670,10 +11821,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11688,10 +11839,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11706,10 +11857,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11723,10 +11874,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11740,10 +11891,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11757,10 +11908,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11775,10 +11926,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11792,10 +11943,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11810,10 +11961,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11827,10 +11978,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11844,10 +11995,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11861,10 +12012,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11879,10 +12030,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11896,10 +12047,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11913,6 +12064,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -11920,7 +12072,6 @@
"win_x86_clang_dbg": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11934,10 +12085,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11951,10 +12102,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11968,10 +12119,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -11985,10 +12136,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12003,10 +12154,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12021,10 +12172,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12039,10 +12190,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12056,10 +12207,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12073,10 +12224,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12090,10 +12241,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12108,10 +12259,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12125,10 +12276,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12143,10 +12294,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12160,10 +12311,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12177,10 +12328,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12194,10 +12345,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12212,10 +12363,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12229,10 +12380,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12246,6 +12397,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
}
]
@@ -12253,7 +12405,6 @@
"win_x86_clang_rel": {
"isolated_scripts": [
{
- "isolate_name": "audio_decoder_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12267,10 +12418,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "audio_decoder_unittests",
"test_id_prefix": "ninja://modules/audio_coding:audio_decoder_unittests/"
},
{
- "isolate_name": "common_audio_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12284,10 +12435,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_audio_unittests",
"test_id_prefix": "ninja://common_audio:common_audio_unittests/"
},
{
- "isolate_name": "common_video_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12301,10 +12452,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "common_video_unittests",
"test_id_prefix": "ninja://common_video:common_video_unittests/"
},
{
- "isolate_name": "dcsctp_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12318,10 +12469,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "dcsctp_unittests",
"test_id_prefix": "ninja://net/dcsctp:dcsctp_unittests/"
},
{
- "isolate_name": "modules_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12336,10 +12487,10 @@
},
"shards": 2
},
+ "test": "modules_tests",
"test_id_prefix": "ninja://modules:modules_tests/"
},
{
- "isolate_name": "modules_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12354,10 +12505,10 @@
},
"shards": 6
},
+ "test": "modules_unittests",
"test_id_prefix": "ninja://modules:modules_unittests/"
},
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12372,10 +12523,10 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
},
{
- "isolate_name": "rtc_media_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12389,10 +12540,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_media_unittests",
"test_id_prefix": "ninja://media:rtc_media_unittests/"
},
{
- "isolate_name": "rtc_pc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12406,10 +12557,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_pc_unittests",
"test_id_prefix": "ninja://pc:rtc_pc_unittests/"
},
{
- "isolate_name": "rtc_stats_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12423,10 +12574,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "rtc_stats_unittests",
"test_id_prefix": "ninja://stats:rtc_stats_unittests/"
},
{
- "isolate_name": "rtc_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12441,10 +12592,10 @@
},
"shards": 6
},
+ "test": "rtc_unittests",
"test_id_prefix": "ninja://:rtc_unittests/"
},
{
- "isolate_name": "slow_peer_connection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12458,10 +12609,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "slow_peer_connection_unittests",
"test_id_prefix": "ninja://pc:slow_peer_connection_unittests/"
},
{
- "isolate_name": "svc_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12476,10 +12627,10 @@
},
"shards": 4
},
+ "test": "svc_tests",
"test_id_prefix": "ninja://pc:svc_tests/"
},
{
- "isolate_name": "system_wrappers_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12493,10 +12644,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "system_wrappers_unittests",
"test_id_prefix": "ninja://system_wrappers:system_wrappers_unittests/"
},
{
- "isolate_name": "test_support_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12510,10 +12661,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "test_support_unittests",
"test_id_prefix": "ninja://test:test_support_unittests/"
},
{
- "isolate_name": "tools_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12527,10 +12678,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "tools_unittests",
"test_id_prefix": "ninja://rtc_tools:tools_unittests/"
},
{
- "isolate_name": "video_capture_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12545,15 +12696,15 @@
"pool": "WebRTC-baremetal-try"
}
},
+ "test": "video_capture_tests",
"test_id_prefix": "ninja://modules/video_capture:video_capture_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "video_codec_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12568,10 +12719,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "video_codec_perf_tests",
"test_id_prefix": "ninja://modules/video_coding:video_codec_perf_tests/"
},
{
- "isolate_name": "video_engine_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12586,10 +12737,10 @@
},
"shards": 4
},
+ "test": "video_engine_tests",
"test_id_prefix": "ninja://:video_engine_tests/"
},
{
- "isolate_name": "voip_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12603,10 +12754,10 @@
"os": "Windows-10-19045"
}
},
+ "test": "voip_unittests",
"test_id_prefix": "ninja://:voip_unittests/"
},
{
- "isolate_name": "webrtc_nonparallel_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12620,15 +12771,15 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_nonparallel_tests",
"test_id_prefix": "ninja://:webrtc_nonparallel_tests/"
},
{
"args": [
- "--force_fieldtrials=WebRTC-QuickPerfTest/Enabled/",
+ "--webrtc_quick_perf_test",
"--nologs",
"--gtest_output=json:${ISOLATED_OUTDIR}/gtest_output.json"
],
- "isolate_name": "webrtc_perf_tests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12643,6 +12794,7 @@
"os": "Windows-10-19045"
}
},
+ "test": "webrtc_perf_tests",
"test_id_prefix": "ninja://:webrtc_perf_tests/"
}
]
@@ -12650,7 +12802,6 @@
"win_x86_more_configs": {
"isolated_scripts": [
{
- "isolate_name": "peerconnection_unittests",
"merge": {
"script": "//testing/merge_scripts/standard_isolated_script_merge.py"
},
@@ -12665,6 +12816,7 @@
},
"shards": 4
},
+ "test": "peerconnection_unittests",
"test_id_prefix": "ninja://pc:peerconnection_unittests/"
}
]
diff --git a/infra/specs/variants.pyl b/infra/specs/variants.pyl
index cf050c671e..e764f698e3 100644
--- a/infra/specs/variants.pyl
+++ b/infra/specs/variants.pyl
@@ -15,10 +15,7 @@
'14.5',
],
'identifier': 'iPhone X 14.5',
- 'mixins': [
- 'xcode_13_main',
- 'ios_runtime_cache_14_5',
- ],
+ 'mixins': ['xcode_13_main', 'ios_runtime_cache_14_5'],
},
'SIM_IPHONE_X_15_5': {
'args': [
@@ -28,10 +25,7 @@
'15.5',
],
'identifier': 'iPhone X 15.5',
- 'mixins': [
- 'xcode_14_main',
- 'ios_runtime_cache_15_5',
- ],
+ 'mixins': ['xcode_14_main', 'ios_runtime_cache_15_5'],
},
'SIM_IPHONE_X_16_2': {
'args': [
@@ -41,9 +35,6 @@
'16.2',
],
'identifier': 'iPhone X 16.2',
- 'mixins': [
- 'xcode_14_main',
- 'ios_runtime_cache_16_2',
- ],
+ 'mixins': ['xcode_14_main', 'ios_runtime_cache_16_2'],
},
}
diff --git a/logging/BUILD.gn b/logging/BUILD.gn
index ab1fbbc52b..95c2c901b2 100644
--- a/logging/BUILD.gn
+++ b/logging/BUILD.gn
@@ -281,7 +281,6 @@ rtc_library("rtc_event_number_encodings") {
"../rtc_base:bit_buffer",
"../rtc_base:bitstream_reader",
"../rtc_base:checks",
- "../rtc_base:ignore_wundef",
"../rtc_base:macromagic",
]
absl_deps = [
@@ -355,7 +354,6 @@ rtc_library("rtc_event_log_impl_encoder") {
"../rtc_base:bitstream_reader",
"../rtc_base:buffer",
"../rtc_base:checks",
- "../rtc_base:ignore_wundef",
"../rtc_base:logging",
"../rtc_base:safe_conversions",
"../system_wrappers:field_trial",
@@ -427,10 +425,7 @@ if (rtc_enable_protobuf) {
if (rtc_enable_protobuf) {
rtc_source_set("rtc_event_log2_proto_include") {
sources = [ "rtc_event_log/rtc_event_log2_proto_include.h" ]
- deps = [
- ":rtc_event_log2_proto",
- "../rtc_base:ignore_wundef",
- ]
+ deps = [ ":rtc_event_log2_proto" ]
}
}
@@ -549,7 +544,6 @@ if (rtc_enable_protobuf) {
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:checks",
"../rtc_base:copy_on_write_buffer",
- "../rtc_base:ignore_wundef",
"../rtc_base:logging",
"../rtc_base:protobuf_utils",
"../rtc_base:rtc_numerics",
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
index 5619827246..2c1444af07 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.cc
@@ -53,17 +53,14 @@
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
#include "rtc_base/checks.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/logging.h"
// *.pb.h files are generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
#else
#include "logging/rtc_event_log/rtc_event_log.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
diff --git a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
index 2c9e42e064..01bd89718d 100644
--- a/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
+++ b/logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.cc
@@ -61,18 +61,15 @@
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet.h"
#include "rtc_base/checks.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/field_trial.h"
// *.pb.h files are generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h"
#else
#include "logging/rtc_event_log/rtc_event_log2.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
using webrtc_event_logging::ToUnsigned;
diff --git a/logging/rtc_event_log/rtc_event_log2_proto_include.h b/logging/rtc_event_log/rtc_event_log2_proto_include.h
index 3e43103897..43b914fd0c 100644
--- a/logging/rtc_event_log/rtc_event_log2_proto_include.h
+++ b/logging/rtc_event_log/rtc_event_log2_proto_include.h
@@ -11,15 +11,11 @@
#ifndef LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_
#define LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_
-#include "rtc_base/ignore_wundef.h"
-
// *.pb.h files are generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h"
#else
#include "logging/rtc_event_log/rtc_event_log2.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif // LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG2_PROTO_INCLUDE_H_
diff --git a/logging/rtc_event_log/rtc_event_log_parser.h b/logging/rtc_event_log/rtc_event_log_parser.h
index 9ad96274d3..def9f0ab35 100644
--- a/logging/rtc_event_log/rtc_event_log_parser.h
+++ b/logging/rtc_event_log/rtc_event_log_parser.h
@@ -54,10 +54,8 @@
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
-#include "rtc_base/ignore_wundef.h"
// Files generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log2.pb.h"
@@ -65,7 +63,6 @@ RTC_PUSH_IGNORING_WUNDEF()
#include "logging/rtc_event_log/rtc_event_log.pb.h"
#include "logging/rtc_event_log/rtc_event_log2.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 22eb02ab4f..d12c9296ae 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -251,7 +251,6 @@ rtc_library("codec") {
]
deps = [
":media_constants",
- "../api:field_trials_view",
"../api:rtp_parameters",
"../api/audio_codecs:audio_codecs_api",
"../api/video_codecs:video_codecs_api",
@@ -339,8 +338,10 @@ rtc_library("rtc_simulcast_encoder_adapter") {
deps = [
":rtc_media_base",
"../api:fec_controller_api",
+ "../api:field_trials_view",
"../api:scoped_refptr",
"../api:sequence_checker",
+ "../api/transport:field_trial_based_config",
"../api/video:video_codec_constants",
"../api/video:video_frame",
"../api/video:video_rtp_headers",
@@ -348,6 +349,7 @@ rtc_library("rtc_simulcast_encoder_adapter") {
"../api/video_codecs:video_codecs_api",
"../call:video_stream_api",
"../common_video",
+ "../media:media_constants",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:video_coding_utility",
"../rtc_base:checks",
@@ -357,7 +359,6 @@ rtc_library("rtc_simulcast_encoder_adapter") {
"../rtc_base/system:no_unique_address",
"../rtc_base/system:rtc_export",
"../system_wrappers",
- "../system_wrappers:field_trial",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
@@ -511,7 +512,6 @@ rtc_library("rtc_audio_video") {
"../rtc_base:copy_on_write_buffer",
"../rtc_base:dscp",
"../rtc_base:event_tracer",
- "../rtc_base:ignore_wundef",
"../rtc_base:logging",
"../rtc_base:macromagic",
"../rtc_base:network_route",
@@ -813,6 +813,7 @@ if (rtc_include_tests) {
":stream_params",
":turn_utils",
"../api:create_simulcast_test_fixture_api",
+ "../api:field_trials_view",
"../api:libjingle_peerconnection_api",
"../api:mock_encoder_selector",
"../api:mock_video_bitrate_allocator",
diff --git a/media/base/codec.cc b/media/base/codec.cc
index 5a67696fb0..612a994081 100644
--- a/media/base/codec.cc
+++ b/media/base/codec.cc
@@ -62,6 +62,58 @@ bool IsSameCodecSpecific(const std::string& name1,
return true;
}
+bool MatchesMediaSubtype(const Codec& lhs, const Codec& rhs) {
+ // Match the codec id/name based on the typical static/dynamic name rules.
+ // Matching is case-insensitive.
+
+ // We support the ranges [96, 127] and more recently [35, 65].
+ // https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-1
+ // Within those ranges we match by codec name, outside by codec id.
+ // Since no codecs are assigned an id in the range [66, 95] by us, these will
+ // never match.
+ auto id_in_dynamic_range = [](int id) {
+ const int kLowerDynamicRangeMin = 35;
+ const int kLowerDynamicRangeMax = 65;
+ const int kUpperDynamicRangeMin = 96;
+ const int kUpperDynamicRangeMax = 127;
+ return (id >= kLowerDynamicRangeMin && id <= kLowerDynamicRangeMax) ||
+ (id >= kUpperDynamicRangeMin && id <= kUpperDynamicRangeMax);
+ };
+
+ if (lhs.type != rhs.type) {
+ return false;
+ }
+
+ return (id_in_dynamic_range(lhs.id) && id_in_dynamic_range(rhs.id))
+ ? absl::EqualsIgnoreCase(lhs.name, rhs.name)
+ : lhs.id == rhs.id;
+}
+
+bool MatchesMediaParameters(const Codec& lhs, const Codec& rhs) {
+ switch (lhs.type) {
+ case Codec::Type::kAudio:
+ // If a nonzero clockrate is specified, it must match the actual
+ // clockrate. If a nonzero bitrate is specified, it must match the
+ // actual bitrate, unless the codec is VBR (0), where we just force
+ // the supplied value. The number of channels must match exactly, with
+ // the exception that channels=0 is treated synonymously as
+ // channels=1, per RFC 4566 section 6: " [The channels] parameter is
+ // OPTIONAL and may be omitted if the number of channels is one."
+ // Preference is ignored.
+ // TODO(juberti): Treat a zero clockrate as 8000Hz, the RTP default
+ // clockrate.
+ return ((rhs.clockrate == 0 /*&& lsh.clockrate == 8000*/) ||
+ lhs.clockrate == rhs.clockrate) &&
+ (rhs.bitrate == 0 || lhs.bitrate <= 0 ||
+ lhs.bitrate == rhs.bitrate) &&
+ ((rhs.channels < 2 && lhs.channels < 2) ||
+ lhs.channels == rhs.channels);
+
+ case Codec::Type::kVideo:
+ return IsSameCodecSpecific(lhs.name, lhs.params, rhs.name, rhs.params);
+ }
+}
+
} // namespace
FeedbackParams::FeedbackParams() = default;
@@ -158,57 +210,15 @@ bool Codec::operator==(const Codec& c) const {
: (packetization == c.packetization));
}
-bool Codec::Matches(const Codec& codec,
- const webrtc::FieldTrialsView* field_trials) const {
- // Match the codec id/name based on the typical static/dynamic name rules.
- // Matching is case-insensitive.
-
- // We support the ranges [96, 127] and more recently [35, 65].
- // https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-1
- // Within those ranges we match by codec name, outside by codec id.
- // Since no codecs are assigned an id in the range [66, 95] by us, these will
- // never match.
- const int kLowerDynamicRangeMin = 35;
- const int kLowerDynamicRangeMax = 65;
- const int kUpperDynamicRangeMin = 96;
- const int kUpperDynamicRangeMax = 127;
- const bool is_id_in_dynamic_range =
- (id >= kLowerDynamicRangeMin && id <= kLowerDynamicRangeMax) ||
- (id >= kUpperDynamicRangeMin && id <= kUpperDynamicRangeMax);
- const bool is_codec_id_in_dynamic_range =
- (codec.id >= kLowerDynamicRangeMin &&
- codec.id <= kLowerDynamicRangeMax) ||
- (codec.id >= kUpperDynamicRangeMin && codec.id <= kUpperDynamicRangeMax);
- bool matches_id = is_id_in_dynamic_range && is_codec_id_in_dynamic_range
- ? (absl::EqualsIgnoreCase(name, codec.name))
- : (id == codec.id);
-
- auto matches_type_specific = [&]() {
- switch (type) {
- case Type::kAudio:
- // If a nonzero clockrate is specified, it must match the actual
- // clockrate. If a nonzero bitrate is specified, it must match the
- // actual bitrate, unless the codec is VBR (0), where we just force the
- // supplied value. The number of channels must match exactly, with the
- // exception that channels=0 is treated synonymously as channels=1, per
- // RFC 4566 section 6: " [The channels] parameter is OPTIONAL and may be
- // omitted if the number of channels is one."
- // Preference is ignored.
- // TODO(juberti): Treat a zero clockrate as 8000Hz, the RTP default
- // clockrate.
- return ((codec.clockrate == 0 /*&& clockrate == 8000*/) ||
- clockrate == codec.clockrate) &&
- (codec.bitrate == 0 || bitrate <= 0 ||
- bitrate == codec.bitrate) &&
- ((codec.channels < 2 && channels < 2) ||
- channels == codec.channels);
-
- case Type::kVideo:
- return IsSameCodecSpecific(name, params, codec.name, codec.params);
- }
- };
+bool Codec::Matches(const Codec& codec) const {
+ return MatchesMediaSubtype(*this, codec) &&
+ MatchesMediaParameters(*this, codec) &&
+ (packetization == codec.packetization);
+}
- return matches_id && matches_type_specific();
+bool Codec::MatchesWithoutPacketization(const Codec& codec) const {
+ return MatchesMediaSubtype(*this, codec) &&
+ MatchesMediaParameters(*this, codec);
}
bool Codec::MatchesRtpCodec(const webrtc::RtpCodec& codec_capability) const {
@@ -362,6 +372,14 @@ Codec CreateVideoRtxCodec(int rtx_payload_type, int associated_payload_type) {
return rtx_codec;
}
+const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
+ for (const auto& codec : codecs) {
+ if (codec.id == payload_type)
+ return &codec;
+ }
+ return nullptr;
+}
+
bool HasLntf(const Codec& codec) {
return codec.HasFeedbackParam(
FeedbackParam(kRtcpFbParamLntf, kParamValueEmpty));
diff --git a/media/base/codec.h b/media/base/codec.h
index 53b674fe8e..f40b42fe10 100644
--- a/media/base/codec.h
+++ b/media/base/codec.h
@@ -20,7 +20,6 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_format.h"
-#include "api/field_trials_view.h"
#include "api/rtp_parameters.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/media_constants.h"
@@ -28,7 +27,7 @@
namespace cricket {
-typedef std::map<std::string, std::string> CodecParameterMap;
+using CodecParameterMap = std::map<std::string, std::string>;
class FeedbackParam {
public:
@@ -112,8 +111,11 @@ struct RTC_EXPORT Codec {
// Indicates if this codec is compatible with the specified codec by
// checking the assigned id and profile values for the relevant video codecs.
// H264 levels are not compared.
- bool Matches(const Codec& codec,
- const webrtc::FieldTrialsView* field_trials = nullptr) const;
+ bool Matches(const Codec& codec) const;
+
+ // Like `Matches` but does not consider the packetization.
+ bool MatchesWithoutPacketization(const Codec& codec) const;
+
bool MatchesRtpCodec(const webrtc::RtpCodec& capability) const;
// Find the parameter for `name` and write the value to `out`.
@@ -187,6 +189,9 @@ struct RTC_EXPORT Codec {
using VideoCodec = Codec;
using AudioCodec = Codec;
+using VideoCodecs = std::vector<Codec>;
+using AudioCodecs = std::vector<Codec>;
+
Codec CreateAudioCodec(int id,
const std::string& name,
int clockrate,
@@ -200,14 +205,7 @@ Codec CreateVideoRtxCodec(int rtx_payload_type, int associated_payload_type);
// Get the codec setting associated with `payload_type`. If there
// is no codec associated with that payload type it returns nullptr.
-template <class Codec>
-const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type) {
- for (const auto& codec : codecs) {
- if (codec.id == payload_type)
- return &codec;
- }
- return nullptr;
-}
+const Codec* FindCodecById(const std::vector<Codec>& codecs, int payload_type);
bool HasLntf(const Codec& codec);
bool HasNack(const Codec& codec);
diff --git a/media/base/codec_unittest.cc b/media/base/codec_unittest.cc
index eb34530c38..f947592509 100644
--- a/media/base/codec_unittest.cc
+++ b/media/base/codec_unittest.cc
@@ -210,13 +210,22 @@ TEST(CodecTest, TestVideoCodecMatches) {
EXPECT_FALSE(c1.Matches(cricket::CreateVideoCodec(34, "V")));
}
-TEST(CodecTest, TestVideoCodecMatchesWithDifferentPacketization) {
+TEST(CodecTest, CodecsWithDifferentPacketizationDoesntMatch) {
VideoCodec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
VideoCodec c1 = cricket::CreateVideoCodec(101, cricket::kVp8CodecName);
c1.packetization = "raw";
- EXPECT_TRUE(c0.Matches(c1));
- EXPECT_TRUE(c1.Matches(c0));
+ EXPECT_FALSE(c0.Matches(c1));
+ EXPECT_FALSE(c1.Matches(c0));
+}
+
+TEST(CodecTest, CodecsWithDifferentPacketizationMatchesWithoutPacketization) {
+ VideoCodec c0 = cricket::CreateVideoCodec(100, cricket::kVp8CodecName);
+ VideoCodec c1 = cricket::CreateVideoCodec(101, cricket::kVp8CodecName);
+ c1.packetization = "raw";
+
+ EXPECT_TRUE(c0.MatchesWithoutPacketization(c1));
+ EXPECT_TRUE(c1.MatchesWithoutPacketization(c0));
}
// AV1 codecs compare profile information.
diff --git a/media/base/fake_media_engine.h b/media/base/fake_media_engine.h
index 51828c3535..eddc76057d 100644
--- a/media/base/fake_media_engine.h
+++ b/media/base/fake_media_engine.h
@@ -741,7 +741,6 @@ class FakeVideoMediaSendChannel
void SetSsrcListChangedCallback(
absl::AnyInvocable<void(const std::set<uint32_t>&)> callback) override {}
- void SetVideoCodecSwitchingEnabled(bool enabled) override {}
bool SendCodecHasLntf() const override { return false; }
bool SendCodecHasNack() const override { return false; }
absl::optional<int> SendCodecRtxTime() const override {
diff --git a/media/base/media_channel.h b/media/base/media_channel.h
index 2282b57d7e..f941823323 100644
--- a/media/base/media_channel.h
+++ b/media/base/media_channel.h
@@ -949,8 +949,6 @@ class VideoMediaSendChannelInterface : public MediaSendChannelInterface {
// Cause generation of a keyframe for `ssrc` on a sending channel.
virtual void GenerateSendKeyFrame(uint32_t ssrc,
const std::vector<std::string>& rids) = 0;
- // Enable network condition based codec switching.
- virtual void SetVideoCodecSwitchingEnabled(bool enabled) = 0;
virtual bool GetStats(VideoMediaSendInfo* stats) = 0;
// This fills the "bitrate parts" (rtx, video bitrate) of the
// BandwidthEstimationInfo, since that part that isn't possible to get
diff --git a/media/base/media_constants.cc b/media/base/media_constants.cc
index 94ce3c7b21..2af0295a5a 100644
--- a/media/base/media_constants.cc
+++ b/media/base/media_constants.cc
@@ -127,6 +127,11 @@ const char kH265FmtpTxMode[] = "tx-mode";
const char kVP9ProfileId[] = "profile-id";
const int kDefaultVideoMaxFramerate = 60;
+// Max encode quantizer for VP8/9 and AV1 encoders assuming libvpx/libaom API
+// range [0, 63]
+const int kDefaultVideoMaxQpVpx = 56;
+// Max encode quantizer for H264/5 assuming the bitstream range [0, 51].
+const int kDefaultVideoMaxQpH26x = 51;
const size_t kConferenceMaxNumSpatialLayers = 3;
const size_t kConferenceMaxNumTemporalLayers = 3;
diff --git a/media/base/media_constants.h b/media/base/media_constants.h
index 3321aac41d..877cc7a296 100644
--- a/media/base/media_constants.h
+++ b/media/base/media_constants.h
@@ -150,6 +150,8 @@ RTC_EXPORT extern const char kH265FmtpTxMode[];
extern const char kVP9ProfileId[];
extern const int kDefaultVideoMaxFramerate;
+extern const int kDefaultVideoMaxQpVpx;
+extern const int kDefaultVideoMaxQpH26x;
extern const size_t kConferenceMaxNumSpatialLayers;
extern const size_t kConferenceMaxNumTemporalLayers;
diff --git a/media/base/test_utils.h b/media/base/test_utils.h
index fb18485d32..dc14e44046 100644
--- a/media/base/test_utils.h
+++ b/media/base/test_utils.h
@@ -35,20 +35,6 @@ inline std::vector<T> MakeVector(const T a[], size_t s) {
}
#define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a))
-// Checks whether `codecs` contains `codec`; checks using Codec::Matches().
-template <class C>
-bool ContainsMatchingCodec(const std::vector<C>& codecs,
- const C& codec,
- const webrtc::FieldTrialsView* field_trials) {
- typename std::vector<C>::const_iterator it;
- for (it = codecs.begin(); it != codecs.end(); ++it) {
- if (it->Matches(codec, field_trials)) {
- return true;
- }
- }
- return false;
-}
-
// Create Simulcast StreamParams with given `ssrcs` and `cname`.
cricket::StreamParams CreateSimStreamParams(const std::string& cname,
const std::vector<uint32_t>& ssrcs);
diff --git a/media/engine/null_webrtc_video_engine_unittest.cc b/media/engine/null_webrtc_video_engine_unittest.cc
index 31c442d53d..9515d44be9 100644
--- a/media/engine/null_webrtc_video_engine_unittest.cc
+++ b/media/engine/null_webrtc_video_engine_unittest.cc
@@ -37,7 +37,7 @@ TEST(NullWebRtcVideoEngineTest, CheckInterface) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr,
- webrtc::AudioProcessingBuilder().Create(), nullptr, nullptr, trials);
+ webrtc::AudioProcessingBuilder().Create(), nullptr, trials);
CompositeMediaEngine engine(std::move(audio_engine),
std::make_unique<NullWebRtcVideoEngine>());
diff --git a/media/engine/simulcast_encoder_adapter.cc b/media/engine/simulcast_encoder_adapter.cc
index 7ee95b1a30..4853e68996 100644
--- a/media/engine/simulcast_encoder_adapter.cc
+++ b/media/engine/simulcast_encoder_adapter.cc
@@ -19,7 +19,9 @@
#include <utility>
#include "absl/algorithm/container.h"
+#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
+#include "api/transport/field_trial_based_config.h"
#include "api/video/i420_buffer.h"
#include "api/video/video_codec_constants.h"
#include "api/video/video_frame_buffer.h"
@@ -27,24 +29,23 @@
#include "api/video_codecs/video_encoder.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "api/video_codecs/video_encoder_software_fallback_wrapper.h"
+#include "media/base/media_constants.h"
#include "media/base/video_common.h"
#include "modules/video_coding/include/video_error_codes.h"
#include "modules/video_coding/utility/simulcast_rate_allocator.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/rate_control_settings.h"
#include "rtc_base/logging.h"
-#include "system_wrappers/include/field_trial.h"
namespace {
-const unsigned int kDefaultMinQp = 2;
-const unsigned int kDefaultMaxQp = 56;
// Max qp for lowest spatial resolution when doing simulcast.
const unsigned int kLowestResMaxQp = 45;
-absl::optional<unsigned int> GetScreenshareBoostedQpValue() {
+absl::optional<unsigned int> GetScreenshareBoostedQpValue(
+ const webrtc::FieldTrialsView& field_trials) {
std::string experiment_group =
- webrtc::field_trial::FindFullName("WebRTC-BoostedScreenshareQp");
+ field_trials.Lookup("WebRTC-BoostedScreenshareQp");
unsigned int qp;
if (sscanf(experiment_group.c_str(), "%u", &qp) != 1)
return absl::nullopt;
@@ -244,12 +245,16 @@ void SimulcastEncoderAdapter::StreamContext::OnDroppedFrame(
SimulcastEncoderAdapter::SimulcastEncoderAdapter(VideoEncoderFactory* factory,
const SdpVideoFormat& format)
- : SimulcastEncoderAdapter(factory, nullptr, format) {}
+ : SimulcastEncoderAdapter(factory,
+ nullptr,
+ format,
+ FieldTrialBasedConfig()) {}
SimulcastEncoderAdapter::SimulcastEncoderAdapter(
VideoEncoderFactory* primary_factory,
VideoEncoderFactory* fallback_factory,
- const SdpVideoFormat& format)
+ const SdpVideoFormat& format,
+ const FieldTrialsView& field_trials)
: inited_(0),
primary_encoder_factory_(primary_factory),
fallback_encoder_factory_(fallback_factory),
@@ -257,10 +262,12 @@ SimulcastEncoderAdapter::SimulcastEncoderAdapter(
total_streams_count_(0),
bypass_mode_(false),
encoded_complete_callback_(nullptr),
- experimental_boosted_screenshare_qp_(GetScreenshareBoostedQpValue()),
- boost_base_layer_quality_(RateControlSettings::ParseFromFieldTrials()
- .Vp8BoostBaseLayerQuality()),
- prefer_temporal_support_on_base_layer_(field_trial::IsEnabled(
+ experimental_boosted_screenshare_qp_(
+ GetScreenshareBoostedQpValue(field_trials)),
+ boost_base_layer_quality_(
+ RateControlSettings::ParseFromKeyValueConfig(&field_trials)
+ .Vp8BoostBaseLayerQuality()),
+ prefer_temporal_support_on_base_layer_(field_trials.IsEnabled(
"WebRTC-Video-PreferTemporalSupportOnBaseLayer")) {
RTC_DCHECK(primary_factory);
@@ -319,11 +326,6 @@ int SimulcastEncoderAdapter::InitEncode(
codec_ = *codec_settings;
total_streams_count_ = CountAllStreams(*codec_settings);
- // TODO(ronghuawu): Remove once this is handled in LibvpxVp8Encoder.
- if (codec_.qpMax < kDefaultMinQp) {
- codec_.qpMax = kDefaultMaxQp;
- }
-
bool is_legacy_singlecast = codec_.numberOfSimulcastStreams == 0;
int lowest_quality_stream_idx = 0;
int highest_quality_stream_idx = 0;
diff --git a/media/engine/simulcast_encoder_adapter.h b/media/engine/simulcast_encoder_adapter.h
index ef8205e91a..553a6a0819 100644
--- a/media/engine/simulcast_encoder_adapter.h
+++ b/media/engine/simulcast_encoder_adapter.h
@@ -22,6 +22,7 @@
#include "absl/types/optional.h"
#include "api/fec_controller_override.h"
+#include "api/field_trials_view.h"
#include "api/sequence_checker.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_encoder.h"
@@ -48,7 +49,8 @@ class RTC_EXPORT SimulcastEncoderAdapter : public VideoEncoder {
// will be used if InitEncode() fails for the primary encoder.
SimulcastEncoderAdapter(VideoEncoderFactory* primary_factory,
VideoEncoderFactory* fallback_factory,
- const SdpVideoFormat& format);
+ const SdpVideoFormat& format,
+ const FieldTrialsView& field_trials);
~SimulcastEncoderAdapter() override;
// Implements VideoEncoder.
diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc
index d1ea7c5f90..e2ac5ea390 100644
--- a/media/engine/simulcast_encoder_adapter_unittest.cc
+++ b/media/engine/simulcast_encoder_adapter_unittest.cc
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "api/field_trials_view.h"
#include "api/test/create_simulcast_test_fixture.h"
#include "api/test/simulcast_test_fixture.h"
#include "api/test/video/function_video_decoder_factory.h"
@@ -29,9 +30,9 @@
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/utility/simulcast_test_fixture_impl.h"
#include "rtc_base/checks.h"
-#include "test/field_trial.h"
#include "test/gmock.h"
#include "test/gtest.h"
+#include "test/scoped_key_value_config.h"
using ::testing::_;
using ::testing::Return;
@@ -402,17 +403,20 @@ class TestSimulcastEncoderAdapterFakeHelper {
public:
explicit TestSimulcastEncoderAdapterFakeHelper(
bool use_fallback_factory,
- const SdpVideoFormat& video_format)
+ const SdpVideoFormat& video_format,
+ const FieldTrialsView& field_trials)
: primary_factory_(new MockVideoEncoderFactory()),
fallback_factory_(use_fallback_factory ? new MockVideoEncoderFactory()
: nullptr),
- video_format_(video_format) {}
+ video_format_(video_format),
+ field_trials_(field_trials) {}
// Can only be called once as the SimulcastEncoderAdapter will take the
// ownership of `factory_`.
VideoEncoder* CreateMockEncoderAdapter() {
return new SimulcastEncoderAdapter(primary_factory_.get(),
- fallback_factory_.get(), video_format_);
+ fallback_factory_.get(), video_format_,
+ field_trials_);
}
MockVideoEncoderFactory* factory() { return primary_factory_.get(); }
@@ -424,6 +428,7 @@ class TestSimulcastEncoderAdapterFakeHelper {
std::unique_ptr<MockVideoEncoderFactory> primary_factory_;
std::unique_ptr<MockVideoEncoderFactory> fallback_factory_;
SdpVideoFormat video_format_;
+ const FieldTrialsView& field_trials_;
};
static const int kTestTemporalLayerProfile[3] = {3, 2, 1};
@@ -441,7 +446,8 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test,
void SetUp() override {
helper_.reset(new TestSimulcastEncoderAdapterFakeHelper(
- use_fallback_factory_, SdpVideoFormat("VP8", sdp_video_parameters_)));
+ use_fallback_factory_, SdpVideoFormat("VP8", sdp_video_parameters_),
+ field_trials_));
adapter_.reset(helper_->CreateMockEncoderAdapter());
last_encoded_image_width_ = absl::nullopt;
last_encoded_image_height_ = absl::nullopt;
@@ -581,6 +587,7 @@ class TestSimulcastEncoderAdapterFake : public ::testing::Test,
std::unique_ptr<SimulcastRateAllocator> rate_allocator_;
bool use_fallback_factory_;
SdpVideoFormat::Parameters sdp_video_parameters_;
+ test::ScopedKeyValueConfig field_trials_;
};
TEST_F(TestSimulcastEncoderAdapterFake, InitEncode) {
@@ -1435,12 +1442,14 @@ TEST_F(TestSimulcastEncoderAdapterFake,
TEST_F(
TestSimulcastEncoderAdapterFake,
EncoderInfoFromFieldTrialDoesNotOverrideExistingBitrateLimitsInSinglecast) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
+ field_trials_,
"WebRTC-SimulcastEncoderAdapter-GetEncoderInfoOverride/"
"frame_size_pixels:123|456|789,"
"min_start_bitrate_bps:11000|22000|33000,"
"min_bitrate_bps:44000|55000|66000,"
"max_bitrate_bps:77000|88000|99000/");
+ SetUp();
std::vector<VideoEncoder::ResolutionBitrateLimits> bitrate_limits;
bitrate_limits.push_back(
@@ -1463,7 +1472,8 @@ TEST_F(
}
TEST_F(TestSimulcastEncoderAdapterFake, EncoderInfoFromFieldTrial) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
+ field_trials_,
"WebRTC-SimulcastEncoderAdapter-GetEncoderInfoOverride/"
"requested_resolution_alignment:8,"
"apply_alignment_to_all_simulcast_layers/");
@@ -1483,7 +1493,8 @@ TEST_F(TestSimulcastEncoderAdapterFake, EncoderInfoFromFieldTrial) {
TEST_F(TestSimulcastEncoderAdapterFake,
EncoderInfoFromFieldTrialForSingleStream) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
+ field_trials_,
"WebRTC-SimulcastEncoderAdapter-GetEncoderInfoOverride/"
"requested_resolution_alignment:9,"
"frame_size_pixels:123|456|789,"
@@ -1798,8 +1809,8 @@ TEST_F(TestSimulcastEncoderAdapterFake,
// Normally SEA reuses encoders. But, when TL-based SW fallback is enabled,
// the encoder which served the lowest stream should be recreated before it
// can be used to process an upper layer and vice-versa.
- test::ScopedFieldTrials field_trials(
- "WebRTC-Video-PreferTemporalSupportOnBaseLayer/Enabled/");
+ test::ScopedKeyValueConfig field_trials(
+ field_trials_, "WebRTC-Video-PreferTemporalSupportOnBaseLayer/Enabled/");
use_fallback_factory_ = true;
ReSetUp();
diff --git a/media/engine/webrtc_media_engine.cc b/media/engine/webrtc_media_engine.cc
index 99d7dd2704..463ed29109 100644
--- a/media/engine/webrtc_media_engine.cc
+++ b/media/engine/webrtc_media_engine.cc
@@ -46,7 +46,6 @@ std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
std::move(dependencies.audio_decoder_factory),
std::move(dependencies.audio_mixer),
std::move(dependencies.audio_processing),
- dependencies.audio_frame_processor,
std::move(dependencies.owned_audio_frame_processor), trials);
#ifdef HAVE_WEBRTC_VIDEO
auto video_engine = std::make_unique<WebRtcVideoEngine>(
diff --git a/media/engine/webrtc_media_engine.h b/media/engine/webrtc_media_engine.h
index 0f6dce35b5..863db9f278 100644
--- a/media/engine/webrtc_media_engine.h
+++ b/media/engine/webrtc_media_engine.h
@@ -49,9 +49,6 @@ struct MediaEngineDependencies {
rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory;
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer;
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing;
- // TODO(bugs.webrtc.org/15111):
- // Remove the raw AudioFrameProcessor pointer in the follow-up.
- webrtc::AudioFrameProcessor* audio_frame_processor = nullptr;
std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor;
std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory;
@@ -63,8 +60,9 @@ struct MediaEngineDependencies {
// CreateMediaEngine may be called on any thread, though the engine is
// only expected to be used on one thread, internally called the "worker
// thread". This is the thread Init must be called on.
-RTC_EXPORT std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
- MediaEngineDependencies dependencies);
+[[deprecated("bugs.webrtc.org/15574")]] //
+RTC_EXPORT std::unique_ptr<MediaEngineInterface>
+CreateMediaEngine(MediaEngineDependencies dependencies);
// Verify that extension IDs are within 1-byte extension range and are not
// overlapping, and that they form a legal change from previously registerd
diff --git a/media/engine/webrtc_media_engine_defaults.cc b/media/engine/webrtc_media_engine_defaults.cc
index 1660873e8b..fed646610b 100644
--- a/media/engine/webrtc_media_engine_defaults.cc
+++ b/media/engine/webrtc_media_engine_defaults.cc
@@ -20,7 +20,7 @@
namespace webrtc {
-void SetMediaEngineDefaults(cricket::MediaEngineDependencies* deps) {
+void DeprecatedSetMediaEngineDefaults(cricket::MediaEngineDependencies* deps) {
RTC_DCHECK(deps);
if (deps->task_queue_factory == nullptr) {
static TaskQueueFactory* const task_queue_factory =
diff --git a/media/engine/webrtc_media_engine_defaults.h b/media/engine/webrtc_media_engine_defaults.h
index 16b1d462e3..a0ed059a2b 100644
--- a/media/engine/webrtc_media_engine_defaults.h
+++ b/media/engine/webrtc_media_engine_defaults.h
@@ -17,7 +17,13 @@
namespace webrtc {
// Sets required but null dependencies with default factories.
-RTC_EXPORT void SetMediaEngineDefaults(cricket::MediaEngineDependencies* deps);
+// Deprecated in favor of EnableMediaWithDefaults.
+RTC_EXPORT void DeprecatedSetMediaEngineDefaults(
+ cricket::MediaEngineDependencies* deps);
+[[deprecated("bugs.webrc.org/15574")]] inline void SetMediaEngineDefaults(
+ cricket::MediaEngineDependencies* deps) {
+ DeprecatedSetMediaEngineDefaults(deps);
+}
} // namespace webrtc
diff --git a/media/engine/webrtc_media_engine_unittest.cc b/media/engine/webrtc_media_engine_unittest.cc
index 4615f03deb..b89c98fe5e 100644
--- a/media/engine/webrtc_media_engine_unittest.cc
+++ b/media/engine/webrtc_media_engine_unittest.cc
@@ -322,9 +322,12 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensionsRemoveRedundantBwe3) {
EXPECT_EQ(RtpExtension::kTimestampOffsetUri, filtered[0].uri);
}
+// Deprecated as part of the bugs.webrtc.org/15574 effort.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
TEST(WebRtcMediaEngineTest, Create) {
MediaEngineDependencies deps;
- webrtc::SetMediaEngineDefaults(&deps);
+ webrtc::DeprecatedSetMediaEngineDefaults(&deps);
webrtc::test::ScopedKeyValueConfig trials;
deps.trials = &trials;
@@ -333,5 +336,6 @@ TEST(WebRtcMediaEngineTest, Create) {
EXPECT_TRUE(engine);
}
+#pragma clang diagnostic pop
} // namespace cricket
diff --git a/media/engine/webrtc_video_engine.cc b/media/engine/webrtc_video_engine.cc
index fad0f4fc55..8a9d6ff95c 100644
--- a/media/engine/webrtc_video_engine.cc
+++ b/media/engine/webrtc_video_engine.cc
@@ -29,6 +29,7 @@
#include "api/media_stream_interface.h"
#include "api/media_types.h"
#include "api/priority.h"
+#include "api/rtc_error.h"
#include "api/rtp_transceiver_direction.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@@ -47,6 +48,7 @@
#include "common_video/frame_counts.h"
#include "common_video/include/quality_limitation_reason.h"
#include "media/base/codec.h"
+#include "media/base/media_channel.h"
#include "media/base/media_constants.h"
#include "media/base/rid_description.h"
#include "media/base/rtp_utils.h"
@@ -356,8 +358,11 @@ static bool ValidateStreamParams(const StreamParams& sp) {
}
}
for (const auto& group : sp.ssrc_groups) {
- if (group.semantics != kSimSsrcGroupSemantics)
+ if (!(group.semantics == kFidSsrcGroupSemantics ||
+ group.semantics == kSimSsrcGroupSemantics ||
+ group.semantics == kFecFrSsrcGroupSemantics)) {
continue;
+ }
for (uint32_t group_ssrc : group.ssrcs) {
auto it = absl::c_find_if(sp.ssrcs, [&group_ssrc](uint32_t ssrc) {
return ssrc == group_ssrc;
@@ -365,7 +370,7 @@ static bool ValidateStreamParams(const StreamParams& sp) {
if (it == sp.ssrcs.end()) {
RTC_LOG(LS_ERROR) << "SSRC '" << group_ssrc
<< "' missing from StreamParams ssrcs with semantics "
- << kSimSsrcGroupSemantics << ": " << sp.ToString();
+ << group.semantics << ": " << sp.ToString();
return false;
}
}
@@ -740,6 +745,19 @@ void ExtractCodecInformation(
}
}
+int ParseReceiveBufferSize(const webrtc::FieldTrialsView& trials) {
+ webrtc::FieldTrialParameter<int> size_bytes("size_bytes",
+ kVideoRtpRecvBufferSize);
+ webrtc::ParseFieldTrial({&size_bytes},
+ trials.Lookup("WebRTC-ReceiveBufferSize"));
+ if (size_bytes.Get() < 10'000 || size_bytes.Get() > 10'000'000) {
+ RTC_LOG(LS_WARNING) << "WebRTC-ReceiveBufferSize out of bounds: "
+ << size_bytes.Get();
+ return kVideoRtpRecvBufferSize;
+ }
+ return size_bytes.Get();
+}
+
} // namespace
// --------------- WebRtcVideoEngine ---------------------------
@@ -1333,17 +1351,24 @@ webrtc::RTCError WebRtcVideoSendChannel::SetRtpSendParameters(
break;
}
+ // Since we validate that all layers have the same value, we can just check
+ // the first layer.
// TODO(orphis): Support mixed-codec simulcast
if (parameters.encodings[0].codec && send_codec_ &&
!send_codec_->codec.MatchesRtpCodec(*parameters.encodings[0].codec)) {
- RTC_LOG(LS_ERROR) << "Trying to change codec to "
- << parameters.encodings[0].codec->name;
+ RTC_LOG(LS_VERBOSE) << "Trying to change codec to "
+ << parameters.encodings[0].codec->name;
auto matched_codec =
absl::c_find_if(negotiated_codecs_, [&](auto negotiated_codec) {
return negotiated_codec.codec.MatchesRtpCodec(
*parameters.encodings[0].codec);
});
- RTC_CHECK(matched_codec != negotiated_codecs_.end());
+ if (matched_codec == negotiated_codecs_.end()) {
+ return webrtc::InvokeSetParametersCallback(
+ callback, webrtc::RTCError(
+ webrtc::RTCErrorType::INVALID_MODIFICATION,
+ "Attempted to use an unsupported codec for layer 0"));
+ }
ChangedSenderParameters params;
params.send_codec = *matched_codec;
@@ -1649,14 +1674,6 @@ void WebRtcVideoSendChannel::SetEncoderSelector(
}
}
-void WebRtcVideoSendChannel::SetVideoCodecSwitchingEnabled(bool enabled) {
- RTC_DCHECK_RUN_ON(&thread_checker_);
- allow_codec_switching_ = enabled;
- if (allow_codec_switching_) {
- RTC_LOG(LS_INFO) << "Encoder switching enabled.";
- }
-}
-
WebRtcVideoSendChannel::WebRtcVideoSendStream::VideoSendStreamParameters::
VideoSendStreamParameters(
webrtc::VideoSendStream::Config config,
@@ -2211,7 +2228,20 @@ WebRtcVideoSendChannel::WebRtcVideoSendStream::CreateVideoEncoderConfig(
// Ensure frame dropping is always enabled.
encoder_config.frame_drop_enabled = true;
- int max_qp = kDefaultQpMax;
+ int max_qp;
+ switch (encoder_config.codec_type) {
+ case webrtc::kVideoCodecH264:
+ case webrtc::kVideoCodecH265:
+ max_qp = kDefaultVideoMaxQpH26x;
+ break;
+ case webrtc::kVideoCodecVP8:
+ case webrtc::kVideoCodecVP9:
+ case webrtc::kVideoCodecAV1:
+ case webrtc::kVideoCodecGeneric:
+ case webrtc::kVideoCodecMultiplex:
+ max_qp = kDefaultVideoMaxQpVpx;
+ break;
+ }
codec.GetParam(kCodecParamMaxQuantization, &max_qp);
encoder_config.max_qp = max_qp;
@@ -2573,7 +2603,8 @@ WebRtcVideoReceiveChannel::WebRtcVideoReceiveChannel(
discard_unknown_ssrc_packets_(
IsEnabled(call_->trials(),
"WebRTC-Video-DiscardPacketsWithUnknownSsrc")),
- crypto_options_(crypto_options) {
+ crypto_options_(crypto_options),
+ receive_buffer_size_(ParseReceiveBufferSize(call_->trials())) {
RTC_DCHECK_RUN_ON(&thread_checker_);
rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
recv_codecs_ = MapCodecs(GetPayloadTypesAndDefaultCodecs(
@@ -3170,7 +3201,7 @@ void WebRtcVideoReceiveChannel::SetInterface(
MediaChannelUtil::SetInterface(iface);
// Set the RTP recv/send buffer to a bigger size.
MediaChannelUtil::SetOption(MediaChannelNetworkInterface::ST_RTP,
- rtc::Socket::OPT_RCVBUF, kVideoRtpRecvBufferSize);
+ rtc::Socket::OPT_RCVBUF, receive_buffer_size_);
}
void WebRtcVideoReceiveChannel::SetFrameDecryptor(
diff --git a/media/engine/webrtc_video_engine.h b/media/engine/webrtc_video_engine.h
index 11f1b99ac2..e4b1b2765b 100644
--- a/media/engine/webrtc_video_engine.h
+++ b/media/engine/webrtc_video_engine.h
@@ -225,8 +225,6 @@ class WebRtcVideoSendChannel : public MediaChannelUtil,
webrtc::VideoEncoderFactory::EncoderSelectorInterface*
encoder_selector) override;
- void SetVideoCodecSwitchingEnabled(bool enabled) override;
-
void SetSendCodecChangedCallback(
absl::AnyInvocable<void()> callback) override {
send_codec_changed_callback_ = std::move(callback);
@@ -252,6 +250,8 @@ class WebRtcVideoSendChannel : public MediaChannelUtil,
ADAPTREASON_BANDWIDTH = 2,
};
+ // TODO(webrtc:14852): Update downstream projects to use
+ // cricket::kDefaultVideoMaxQpVpx/H26x and remove.
static constexpr int kDefaultQpMax = 56;
// Implements webrtc::EncoderSwitchRequestCallback.
@@ -549,11 +549,6 @@ class WebRtcVideoSendChannel : public MediaChannelUtil,
rtc::scoped_refptr<webrtc::FrameTransformerInterface>
unsignaled_frame_transformer_ RTC_GUARDED_BY(thread_checker_);
- // TODO(bugs.webrtc.org/11341): Remove this and relevant PC API. Presence
- // of multiple negotiated codecs allows generic encoder fallback on failures.
- // Presence of EncoderSelector allows switching to specific encoders.
- bool allow_codec_switching_ = false;
-
// RTP parameters that need to be set when creating a video receive stream.
// Only used in Receiver mode - in Both mode, it reads those things from the
// codec.
@@ -891,6 +886,8 @@ class WebRtcVideoReceiveChannel : public MediaChannelUtil,
// Callback invoked whenever the list of SSRCs changes.
absl::AnyInvocable<void(const std::set<uint32_t>&)>
ssrc_list_changed_callback_;
+
+ const int receive_buffer_size_;
};
// Keeping the old name "WebRtcVideoChannel" around because some external
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index 0f416aaeea..645413bced 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -19,7 +19,6 @@
#include <vector>
#include "absl/algorithm/container.h"
-#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtp_parameters.h"
@@ -38,6 +37,7 @@
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/h264_profile_level_id.h"
#include "api/video_codecs/sdp_video_format.h"
+#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_decoder_factory_template.h"
#include "api/video_codecs/video_decoder_factory_template_dav1d_adapter.h"
@@ -99,6 +99,8 @@ using ::testing::StrNe;
using ::testing::Values;
using ::testing::WithArg;
using ::webrtc::BitrateConstraints;
+using ::webrtc::Call;
+using ::webrtc::CallConfig;
using ::webrtc::kDefaultScalabilityModeStr;
using ::webrtc::RtpExtension;
using ::webrtc::RtpPacket;
@@ -109,7 +111,6 @@ using ::webrtc::Timestamp;
using ::webrtc::test::RtcpPacketParser;
namespace {
-static const int kDefaultQpMax = 56;
static const uint8_t kRedRtxPayloadType = 125;
@@ -355,8 +356,8 @@ class WebRtcVideoEngineTest : public ::testing::Test {
: field_trials_(field_trials),
time_controller_(webrtc::Timestamp::Millis(4711)),
task_queue_factory_(time_controller_.CreateTaskQueueFactory()),
- call_(webrtc::Call::Create([&] {
- webrtc::Call::Config call_config(&event_log_);
+ call_(Call::Create([&] {
+ CallConfig call_config(&event_log_);
call_config.task_queue_factory = task_queue_factory_.get();
call_config.trials = &field_trials_;
return call_config;
@@ -401,7 +402,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
// Used in WebRtcVideoEngineVoiceTest, but defined here so it's properly
// initialized when the constructor is called.
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
cricket::FakeWebRtcVideoEncoderFactory* encoder_factory_;
cricket::FakeWebRtcVideoDecoderFactory* decoder_factory_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
@@ -976,6 +977,45 @@ TEST_F(WebRtcVideoEngineTest, SendsFeedbackAfterUnsignaledRtxPacket) {
receive_channel->SetInterface(nullptr);
}
+TEST_F(WebRtcVideoEngineTest, ReceiveBufferSizeViaFieldTrial) {
+ webrtc::test::ScopedKeyValueConfig override_field_trials(
+ field_trials_, "WebRTC-ReceiveBufferSize/size_bytes:10000/");
+ std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel =
+ engine_.CreateReceiveChannel(call_.get(), GetMediaConfig(),
+ VideoOptions(), webrtc::CryptoOptions());
+ cricket::FakeNetworkInterface network;
+ receive_channel->SetInterface(&network);
+ EXPECT_EQ(10000, network.recvbuf_size());
+ receive_channel->SetInterface(nullptr);
+}
+
+TEST_F(WebRtcVideoEngineTest, TooLowReceiveBufferSizeViaFieldTrial) {
+ // 10000001 is too high, it will revert to the default
+ // kVideoRtpRecvBufferSize.
+ webrtc::test::ScopedKeyValueConfig override_field_trials(
+ field_trials_, "WebRTC-ReceiveBufferSize/size_bytes:10000001/");
+ std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel =
+ engine_.CreateReceiveChannel(call_.get(), GetMediaConfig(),
+ VideoOptions(), webrtc::CryptoOptions());
+ cricket::FakeNetworkInterface network;
+ receive_channel->SetInterface(&network);
+ EXPECT_EQ(kVideoRtpRecvBufferSize, network.recvbuf_size());
+ receive_channel->SetInterface(nullptr);
+}
+
+TEST_F(WebRtcVideoEngineTest, TooHighReceiveBufferSizeViaFieldTrial) {
+ // 9999 is too low, it will revert to the default kVideoRtpRecvBufferSize.
+ webrtc::test::ScopedKeyValueConfig override_field_trials(
+ field_trials_, "WebRTC-ReceiveBufferSize/size_bytes:9999/");
+ std::unique_ptr<VideoMediaReceiveChannelInterface> receive_channel =
+ engine_.CreateReceiveChannel(call_.get(), GetMediaConfig(),
+ VideoOptions(), webrtc::CryptoOptions());
+ cricket::FakeNetworkInterface network;
+ receive_channel->SetInterface(&network);
+ EXPECT_EQ(kVideoRtpRecvBufferSize, network.recvbuf_size());
+ receive_channel->SetInterface(nullptr);
+}
+
TEST_F(WebRtcVideoEngineTest, UpdatesUnsignaledRtxSsrcAndRecoversPayload) {
// Setup a channel with VP8, RTX and transport sequence number header
// extension. Receive stream is not explicitly configured.
@@ -1443,11 +1483,11 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) {
webrtc::GlobalSimulatedTimeController time_controller(
webrtc::Timestamp::Millis(4711));
auto task_queue_factory = time_controller.CreateTaskQueueFactory();
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
webrtc::FieldTrialBasedConfig field_trials;
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- const auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ const std::unique_ptr<Call> call = Call::Create(call_config);
// Create send channel.
const int send_ssrc = 123;
@@ -1575,10 +1615,9 @@ TEST_F(WebRtcVideoEngineTest, SetVideoRtxEnabled) {
class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
protected:
- webrtc::Call::Config GetCallConfig(
- webrtc::RtcEventLogNull* event_log,
- webrtc::TaskQueueFactory* task_queue_factory) {
- webrtc::Call::Config call_config(event_log);
+ CallConfig GetCallConfig(webrtc::RtcEventLogNull* event_log,
+ webrtc::TaskQueueFactory* task_queue_factory) {
+ CallConfig call_config(event_log);
call_config.task_queue_factory = task_queue_factory;
call_config.trials = &field_trials_;
return call_config;
@@ -1586,8 +1625,8 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
WebRtcVideoChannelEncodedFrameCallbackTest()
: task_queue_factory_(time_controller_.CreateTaskQueueFactory()),
- call_(absl::WrapUnique(webrtc::Call::Create(
- GetCallConfig(&event_log_, task_queue_factory_.get())))),
+ call_(Call::Create(
+ GetCallConfig(&event_log_, task_queue_factory_.get()))),
video_bitrate_allocator_factory_(
webrtc::CreateBuiltinVideoBitrateAllocatorFactory()),
engine_(
@@ -1639,7 +1678,7 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
webrtc::test::ScopedKeyValueConfig field_trials_;
webrtc::RtcEventLogNull event_log_;
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
WebRtcVideoEngine engine_;
@@ -1775,10 +1814,10 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
void SetUp() override {
// One testcase calls SetUp in a loop, only create call_ once.
if (!call_) {
- webrtc::Call::Config call_config(&event_log_);
+ CallConfig call_config(&event_log_);
call_config.task_queue_factory = task_queue_factory_.get();
call_config.trials = &field_trials_;
- call_.reset(webrtc::Call::Create(call_config));
+ call_ = Call::Create(call_config);
}
cricket::MediaConfig media_config;
@@ -1981,7 +2020,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
webrtc::test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<webrtc::test::ScopedKeyValueConfig> override_field_trials_;
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
WebRtcVideoEngine engine_;
@@ -2621,7 +2660,6 @@ TEST_F(WebRtcVideoChannelBaseTest, SendCodecIsMovedToFrontInRtpParameters) {
parameters.codecs.push_back(GetEngineCodec("VP9"));
parameters.codecs.push_back(GetEngineCodec("VP8"));
EXPECT_TRUE(send_channel_->SetSenderParameters(parameters));
- send_channel_->SetVideoCodecSwitchingEnabled(true);
auto send_codecs = send_channel_->GetRtpSendParameters(kSsrc).codecs;
ASSERT_EQ(send_codecs.size(), 2u);
@@ -4340,7 +4378,7 @@ TEST_F(WebRtcVideoChannelTest, SetDefaultSendCodecs) {
absl::optional<VideoCodec> codec = send_channel_->GetSendCodec();
ASSERT_TRUE(codec);
- EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0], &field_trials_));
+ EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0]));
// Using a RTX setup to verify that the default RTX payload type is good.
const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1);
@@ -4828,7 +4866,7 @@ TEST_F(WebRtcVideoChannelFlexfecSendRecvTest,
TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
cricket::VideoSenderParameters parameters;
cricket::VideoCodec codec = cricket::CreateVideoCodec(100, "VP8");
- codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax);
+ codec.SetParam(kCodecParamMaxQuantization, kDefaultVideoMaxQpVpx);
parameters.codecs.push_back(codec);
ASSERT_TRUE(send_channel_->SetSenderParameters(parameters));
@@ -4840,14 +4878,14 @@ TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
send_channel_->SetVideoSend(last_ssrc_, nullptr, &frame_forwarder));
std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
- EXPECT_EQ(kDefaultQpMax, streams[0].max_qp);
+ EXPECT_EQ(kDefaultVideoMaxQpVpx, streams[0].max_qp);
parameters.codecs.clear();
- codec.SetParam(kCodecParamMaxQuantization, kDefaultQpMax + 1);
+ codec.SetParam(kCodecParamMaxQuantization, kDefaultVideoMaxQpVpx + 1);
parameters.codecs.push_back(codec);
ASSERT_TRUE(send_channel_->SetSenderParameters(parameters));
streams = fake_call_->GetVideoSendStreams()[0]->GetVideoStreams();
- EXPECT_EQ(kDefaultQpMax + 1, streams[0].max_qp);
+ EXPECT_EQ(kDefaultVideoMaxQpVpx + 1, streams[0].max_qp);
EXPECT_TRUE(send_channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
@@ -6777,7 +6815,7 @@ TEST_F(WebRtcVideoChannelTest, GetStatsTranslatesReceivePacketStatsCorrectly) {
TEST_F(WebRtcVideoChannelTest, TranslatesCallStatsCorrectly) {
AddSendStream();
AddSendStream();
- webrtc::Call::Stats stats;
+ Call::Stats stats;
stats.rtt_ms = 123;
fake_call_->SetStats(stats);
@@ -9734,8 +9772,9 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
if (num_configured_streams > 1 || conference_mode) {
expected_streams = GetSimulcastConfig(
/*min_layers=*/1, num_configured_streams, capture_width,
- capture_height, webrtc::kDefaultBitratePriority, kDefaultQpMax,
- screenshare && conference_mode, true, field_trials_);
+ capture_height, webrtc::kDefaultBitratePriority,
+ kDefaultVideoMaxQpVpx, screenshare && conference_mode, true,
+ field_trials_);
if (screenshare && conference_mode) {
for (const webrtc::VideoStream& stream : expected_streams) {
// Never scale screen content.
@@ -9751,7 +9790,7 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
stream.min_bitrate_bps = webrtc::kDefaultMinVideoBitrateBps;
stream.target_bitrate_bps = stream.max_bitrate_bps =
GetMaxDefaultBitrateBps(capture_width, capture_height);
- stream.max_qp = kDefaultQpMax;
+ stream.max_qp = kDefaultVideoMaxQpVpx;
expected_streams.push_back(stream);
}
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index f055a0000a..adf662074d 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -66,7 +66,6 @@
#include "rtc_base/checks.h"
#include "rtc_base/dscp.h"
#include "rtc_base/experiments/struct_parameters_parser.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/logging.h"
#include "rtc_base/race_checker.h"
#include "rtc_base/string_encode.h"
@@ -79,13 +78,12 @@
#include "system_wrappers/include/metrics.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
+
#endif
namespace cricket {
@@ -147,12 +145,10 @@ bool IsCodec(const AudioCodec& codec, const char* ref_name) {
return absl::EqualsIgnoreCase(codec.name, ref_name);
}
-absl::optional<AudioCodec> FindCodec(
- const std::vector<AudioCodec>& codecs,
- const AudioCodec& codec,
- const webrtc::FieldTrialsView* field_trials) {
+absl::optional<AudioCodec> FindCodec(const std::vector<AudioCodec>& codecs,
+ const AudioCodec& codec) {
for (const AudioCodec& c : codecs) {
- if (c.Matches(codec, field_trials)) {
+ if (c.Matches(codec)) {
return c;
}
}
@@ -344,10 +340,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing,
- // TODO(bugs.webrtc.org/15111):
- // Remove the raw AudioFrameProcessor pointer in the follow-up.
- webrtc::AudioFrameProcessor* audio_frame_processor,
- std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor,
+ std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor,
const webrtc::FieldTrialsView& trials)
: task_queue_factory_(task_queue_factory),
adm_(adm),
@@ -355,8 +348,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
decoder_factory_(decoder_factory),
audio_mixer_(audio_mixer),
apm_(audio_processing),
- audio_frame_processor_(audio_frame_processor),
- owned_audio_frame_processor_(std::move(owned_audio_frame_processor)),
+ audio_frame_processor_(std::move(audio_frame_processor)),
minimized_remsampling_on_mobile_trial_enabled_(
IsEnabled(trials, "WebRTC-Audio-MinimizeResamplingOnMobile")) {
RTC_LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine";
@@ -425,11 +417,7 @@ void WebRtcVoiceEngine::Init() {
if (audio_frame_processor_) {
config.async_audio_processing_factory =
rtc::make_ref_counted<webrtc::AsyncAudioProcessing::Factory>(
- *audio_frame_processor_, *task_queue_factory_);
- } else if (owned_audio_frame_processor_) {
- config.async_audio_processing_factory =
- rtc::make_ref_counted<webrtc::AsyncAudioProcessing::Factory>(
- std::move(owned_audio_frame_processor_), *task_queue_factory_);
+ std::move(audio_frame_processor_), *task_queue_factory_);
}
audio_state_ = webrtc::AudioState::Create(config);
}
@@ -1105,9 +1093,10 @@ class WebRtcVoiceSendChannel::WebRtcAudioSendStream : public AudioSource::Sink {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_DCHECK(stream_);
RTC_DCHECK_EQ(1UL, rtp_parameters_.encodings.size());
- if (send_ && source_ != nullptr && rtp_parameters_.encodings[0].active) {
+ // Stream can be started without |source_| being set.
+ if (send_ && rtp_parameters_.encodings[0].active) {
stream_->Start();
- } else { // !send || source_ = nullptr
+ } else {
stream_->Stop();
}
}
@@ -1870,6 +1859,8 @@ webrtc::RTCError WebRtcVoiceSendChannel::SetRtpSendParameters(
SetPreferredDscp(new_dscp);
absl::optional<cricket::Codec> send_codec = GetSendCodec();
+ // Since we validate that all layers have the same value, we can just check
+ // the first layer.
// TODO(orphis): Support mixed-codec simulcast
if (parameters.encodings[0].codec && send_codec &&
!send_codec->MatchesRtpCodec(*parameters.encodings[0].codec)) {
@@ -1880,7 +1871,13 @@ webrtc::RTCError WebRtcVoiceSendChannel::SetRtpSendParameters(
return negotiated_codec.MatchesRtpCodec(
*parameters.encodings[0].codec);
});
- RTC_DCHECK(matched_codec != send_codecs_.end());
+
+ if (matched_codec == send_codecs_.end()) {
+ return webrtc::InvokeSetParametersCallback(
+ callback, webrtc::RTCError(
+ webrtc::RTCErrorType::INVALID_MODIFICATION,
+ "Attempted to use an unsupported codec for layer 0"));
+ }
SetSendCodecs(send_codecs_, *matched_codec);
}
@@ -2142,8 +2139,7 @@ bool WebRtcVoiceReceiveChannel::SetRecvCodecs(
for (const AudioCodec& codec : codecs) {
// Log a warning if a codec's payload type is changing. This used to be
// treated as an error. It's abnormal, but not really illegal.
- absl::optional<AudioCodec> old_codec =
- FindCodec(recv_codecs_, codec, &call_->trials());
+ absl::optional<AudioCodec> old_codec = FindCodec(recv_codecs_, codec);
if (old_codec && old_codec->id != codec.id) {
RTC_LOG(LS_WARNING) << codec.name << " mapped to a second payload type ("
<< codec.id << ", was already mapped to "
diff --git a/media/engine/webrtc_voice_engine.h b/media/engine/webrtc_voice_engine.h
index a3e6d3acab..ed71667525 100644
--- a/media/engine/webrtc_voice_engine.h
+++ b/media/engine/webrtc_voice_engine.h
@@ -90,9 +90,6 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing,
- // TODO(bugs.webrtc.org/15111):
- // Remove the raw AudioFrameProcessor pointer in the follow-up.
- webrtc::AudioFrameProcessor* audio_frame_processor,
std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor,
const webrtc::FieldTrialsView& trials);
@@ -166,10 +163,7 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
// The audio processing module.
rtc::scoped_refptr<webrtc::AudioProcessing> apm_;
// Asynchronous audio processing.
- // TODO(bugs.webrtc.org/15111):
- // Remove the raw AudioFrameProcessor pointer in the follow-up.
- webrtc::AudioFrameProcessor* const audio_frame_processor_;
- std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor_;
+ std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor_;
// The primary instance of WebRtc VoiceEngine.
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
std::vector<AudioCodec> send_codecs_;
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index e1d7805180..4c5d850533 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -55,6 +55,8 @@ using ::testing::ReturnPointee;
using ::testing::SaveArg;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAreArray;
+using ::webrtc::Call;
+using ::webrtc::CallConfig;
namespace {
using webrtc::BitrateConstraints;
@@ -172,7 +174,7 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
- nullptr, nullptr, trials);
+ nullptr, trials);
engine.Init();
}
}
@@ -218,7 +220,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> {
auto decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory();
engine_.reset(new cricket::WebRtcVoiceEngine(
task_queue_factory_.get(), adm_.get(), encoder_factory, decoder_factory,
- nullptr, apm_, nullptr, nullptr, field_trials_));
+ nullptr, apm_, nullptr, field_trials_));
engine_->Init();
send_parameters_.codecs.push_back(kPcmuCodec);
recv_parameters_.codecs.push_back(kPcmuCodec);
@@ -2248,20 +2250,6 @@ TEST_P(WebRtcVoiceEngineTestFake, Send) {
EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
}
-// Test that a channel will send if and only if it has a source and is enabled
-// for sending.
-TEST_P(WebRtcVoiceEngineTestFake, SendStateWithAndWithoutSource) {
- EXPECT_TRUE(SetupSendStream());
- SetSenderParameters(send_parameters_);
- SetAudioSend(kSsrcX, true, nullptr);
- SetSend(true);
- EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
- SetAudioSend(kSsrcX, true, &fake_source_);
- EXPECT_TRUE(GetSendStream(kSsrcX).IsSending());
- SetAudioSend(kSsrcX, true, nullptr);
- EXPECT_FALSE(GetSendStream(kSsrcX).IsSending());
-}
-
// Test that a channel is muted/unmuted.
TEST_P(WebRtcVoiceEngineTestFake, SendStateMuteUnmute) {
EXPECT_TRUE(SetupSendStream());
@@ -3701,13 +3689,13 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
- nullptr, nullptr, field_trials);
+ nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel =
engine.CreateSendChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions(),
@@ -3737,13 +3725,13 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
- nullptr, nullptr, field_trials);
+ nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel =
engine.CreateSendChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions(),
@@ -3777,7 +3765,7 @@ TEST(WebRtcVoiceEngineTest, HasCorrectPayloadTypeMapping) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
- nullptr, nullptr, field_trials);
+ nullptr, field_trials);
engine.Init();
for (const cricket::AudioCodec& codec : engine.send_codecs()) {
auto is_codec = [&codec](const char* name, int clockrate = 0) {
@@ -3827,13 +3815,13 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm,
- nullptr, nullptr, field_trials);
+ nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::vector<std::unique_ptr<cricket::VoiceMediaSendChannelInterface>>
channels;
@@ -3873,13 +3861,13 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
task_queue_factory.get(), adm.get(),
webrtc::MockAudioEncoderFactory::CreateUnusedFactory(),
webrtc::CreateBuiltinAudioDecoderFactory(), nullptr, apm, nullptr,
- nullptr, field_trials);
+ field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
cricket::WebRtcVoiceReceiveChannel channel(
&engine, cricket::MediaConfig(), cricket::AudioOptions(),
webrtc::CryptoOptions(), call.get(),
@@ -3901,11 +3889,10 @@ TEST(WebRtcVoiceEngineTest, SetRtpSendParametersMaxBitrate) {
cricket::WebRtcVoiceEngine engine(task_queue_factory.get(), adm.get(),
webrtc::CreateBuiltinAudioEncoderFactory(),
webrtc::CreateBuiltinAudioDecoderFactory(),
- nullptr, nullptr, nullptr, nullptr,
- field_trials);
+ nullptr, nullptr, nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
{
@@ -3915,7 +3902,7 @@ TEST(WebRtcVoiceEngineTest, SetRtpSendParametersMaxBitrate) {
webrtc::test::MockAudioDeviceModule::CreateNice();
call_config.audio_state = webrtc::AudioState::Create(config);
}
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
cricket::WebRtcVoiceSendChannel channel(
&engine, cricket::MediaConfig(), cricket::AudioOptions(),
webrtc::CryptoOptions(), call.get(), webrtc::AudioCodecPairId::Create());
@@ -3977,7 +3964,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
webrtc::FieldTrialBasedConfig field_trials;
cricket::WebRtcVoiceEngine engine(
task_queue_factory.get(), adm.get(), unused_encoder_factory,
- mock_decoder_factory, nullptr, apm, nullptr, nullptr, field_trials);
+ mock_decoder_factory, nullptr, apm, nullptr, field_trials);
engine.Init();
auto codecs = engine.recv_codecs();
EXPECT_EQ(11u, codecs.size());
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 8f5019b4c2..5de99efa45 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -618,7 +618,6 @@ rtc_library("audio_network_adaptor") {
"../../common_audio",
"../../logging:rtc_event_audio",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:logging",
"../../rtc_base:protobuf_utils",
"../../rtc_base:safe_conversions",
@@ -957,7 +956,6 @@ rtc_library("audio_coding_modules_tests_shared") {
"../../api/audio_codecs:builtin_audio_encoder_factory",
"../../api/neteq:neteq_api",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:ssl",
"../../rtc_base:stringutils",
"../../system_wrappers",
@@ -1122,10 +1120,11 @@ if (rtc_include_tests) {
"../../rtc_base:macromagic",
"../../rtc_base:timeutils",
"../../system_wrappers",
- "../../system_wrappers:field_trial",
"../../test:fileutils",
+ "../../test:test_flags",
"../../test:test_support",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
}
rtc_library("acm_receive_test") {
@@ -1643,6 +1642,7 @@ if (rtc_include_tests) {
"neteq/mock/mock_expand.h",
"neteq/mock/mock_histogram.h",
"neteq/mock/mock_neteq_controller.h",
+ "neteq/mock/mock_packet_arrival_history.h",
"neteq/mock/mock_packet_buffer.h",
"neteq/mock/mock_red_payload_splitter.h",
"neteq/mock/mock_statistics_calculator.h",
@@ -1716,7 +1716,6 @@ if (rtc_include_tests) {
"../../logging:rtc_event_audio",
"../../modules/rtp_rtcp:rtp_rtcp_format",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread",
"../../rtc_base:refcount",
diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
index 210244154a..2d9ea91106 100644
--- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc
+++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
@@ -707,7 +707,7 @@ class AcmSenderBitExactnessNewApi : public AcmSenderBitExactnessOldApi {};
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_8000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80));
- Run(/*audio_checksum_ref=*/"69118ed438ac76252d023e0463819471",
+ Run(/*audio_checksum_ref=*/"3e43fd5d3c73a59e8118e68fbfafe2c7",
/*payload_checksum_ref=*/"c1edd36339ce0326cc4550041ad719a0",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -715,7 +715,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcm16_8000khz_10ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_16000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 16000, 1, 108, 160, 160));
- Run(/*audio_checksum_ref=*/"f95c87bdd33f631bcf80f4b19445bbd2",
+ Run(/*audio_checksum_ref=*/"608750138315cbab33d76d38e8367807",
/*payload_checksum_ref=*/"ad786526383178b08d80d6eee06e9bad",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -723,7 +723,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcm16_16000khz_10ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_32000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 32000, 1, 109, 320, 320));
- Run(/*audio_checksum_ref=*/"c50244419c5c3a2f04cc69a022c266a2",
+ Run(/*audio_checksum_ref=*/"02e9927ef5e4d2cd792a5df0bdee5e19",
/*payload_checksum_ref=*/"5ef82ea885e922263606c6fdbc49f651",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -731,7 +731,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcm16_32000khz_10ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_8000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 2, 111, 80, 80));
- Run(/*audio_checksum_ref=*/"4fccf4cc96f1e8e8de4b9fadf62ded9e",
+ Run(/*audio_checksum_ref=*/"4ff38de045b19f64de9c7e229ba36317",
/*payload_checksum_ref=*/"62ce5adb0d4965d0a52ec98ae7f98974",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
@@ -739,7 +739,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_8000khz_10ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_16000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 16000, 2, 112, 160, 160));
- Run(/*audio_checksum_ref=*/"e15e388d9d4af8c02a59fe1552fedee3",
+ Run(/*audio_checksum_ref=*/"1ee35394cfca78ad6d55468441af36fa",
/*payload_checksum_ref=*/"41ca8edac4b8c71cd54fd9f25ec14870",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
@@ -747,7 +747,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_16000khz_10ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_32000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 32000, 2, 113, 320, 320));
- Run(/*audio_checksum_ref=*/"b240520c0d05003fde7a174ae5957286",
+ Run(/*audio_checksum_ref=*/"19cae34730a0f6a17cf4e76bf21b69d6",
/*payload_checksum_ref=*/"50e58502fb04421bf5b857dda4c96879",
/*expected_packets=*/100,
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
@@ -763,7 +763,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcmu_20ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcma_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 1, 8, 160, 160));
- Run(/*audio_checksum_ref=*/"47eb60e855eb12d1b0e6da9c975754a4",
+ Run(/*audio_checksum_ref=*/"ae259cab624095270b7369e53a7b53a3",
/*payload_checksum_ref=*/"6ad745e55aa48981bfc790d0eeef2dd1",
/*expected_packets=*/50,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -779,7 +779,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcmu_stereo_20ms) {
TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 2, 118, 160, 160));
- Run(/*audio_checksum_ref=*/"a84d75e098d87ab6b260687eb4b612a2",
+ Run(/*audio_checksum_ref=*/"f2e81d2531a805c40e61da5106b50006",
/*payload_checksum_ref=*/"92b282c83efd20e7eeef52ba40842cf7",
/*expected_packets=*/50,
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
@@ -789,7 +789,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
defined(WEBRTC_ARCH_X86_64)
TEST_F(AcmSenderBitExactnessOldApi, Ilbc_30ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("ILBC", 8000, 1, 102, 240, 240));
- Run(/*audio_checksum_ref=*/"b14dba0de36efa5ec88a32c0b320b70f",
+ Run(/*audio_checksum_ref=*/"a739434bec8a754e9356ce2115603ce5",
/*payload_checksum_ref=*/"cfae2e9f6aba96e145f2bcdd5050ce78",
/*expected_packets=*/33,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -799,7 +799,7 @@ TEST_F(AcmSenderBitExactnessOldApi, Ilbc_30ms) {
#if defined(WEBRTC_LINUX) && defined(WEBRTC_ARCH_X86_64)
TEST_F(AcmSenderBitExactnessOldApi, G722_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 1, 9, 320, 160));
- Run(/*audio_checksum_ref=*/"f5264affff25cf2cbd2e1e8a5217f9a3",
+ Run(/*audio_checksum_ref=*/"b875d9a3e41f5470857bdff02e3b368f",
/*payload_checksum_ref=*/"fc68a87e1380614e658087cb35d5ca10",
/*expected_packets=*/50,
/*expected_channels=*/test::AcmReceiveTestOldApi::kMonoOutput);
@@ -809,7 +809,7 @@ TEST_F(AcmSenderBitExactnessOldApi, G722_20ms) {
#if defined(WEBRTC_LINUX) && defined(WEBRTC_ARCH_X86_64)
TEST_F(AcmSenderBitExactnessOldApi, G722_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 2, 119, 320, 160));
- Run(/*audio_checksum_ref=*/"be0b8528ff9db3a2219f55ddd36faf7f",
+ Run(/*audio_checksum_ref=*/"02c427d73363b2f37853a0dd17fe1aba",
/*payload_checksum_ref=*/"66516152eeaa1e650ad94ff85f668dac",
/*expected_packets=*/50,
/*expected_channels=*/test::AcmReceiveTestOldApi::kStereoOutput);
@@ -897,8 +897,8 @@ TEST_F(AcmSenderBitExactnessNewApi, OpusFromFormat_stereo_20ms_voip) {
ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(
AudioEncoderOpus::MakeAudioEncoder(*config, 120), 120));
const std::string audio_maybe_sse =
- "1010e60ad34cee73c939edaf563d0593"
- "|c05b4523d4c3fad2bab96d2a56baa2d0";
+ "cb644fc17d9666a0f5986eef24818159"
+ "|4a74024473c7c729543c2790829b1e42";
const std::string payload_maybe_sse =
"ea48d94e43217793af9b7e15ece94e54"
diff --git a/modules/audio_coding/audio_network_adaptor/controller_manager.cc b/modules/audio_coding/audio_network_adaptor/controller_manager.cc
index 42dd8a8786..793c73a380 100644
--- a/modules/audio_coding/audio_network_adaptor/controller_manager.cc
+++ b/modules/audio_coding/audio_network_adaptor/controller_manager.cc
@@ -24,18 +24,16 @@
#include "modules/audio_coding/audio_network_adaptor/frame_length_controller.h"
#include "modules/audio_coding/audio_network_adaptor/frame_length_controller_v2.h"
#include "modules/audio_coding/audio_network_adaptor/util/threshold_curve.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/logging.h"
#include "rtc_base/time_utils.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
+
#endif
namespace webrtc {
diff --git a/modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc b/modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc
index 3e6ecf6def..f399511757 100644
--- a/modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc
+++ b/modules/audio_coding/audio_network_adaptor/controller_manager_unittest.cc
@@ -17,17 +17,14 @@
#include "modules/audio_coding/audio_network_adaptor/mock/mock_controller.h"
#include "modules/audio_coding/audio_network_adaptor/mock/mock_debug_dump_writer.h"
#include "rtc_base/fake_clock.h"
-#include "rtc_base/ignore_wundef.h"
#include "test/gtest.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif
namespace webrtc {
diff --git a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.cc b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.cc
index 2616706ee5..5ffbee219c 100644
--- a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.cc
+++ b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.cc
@@ -14,18 +14,15 @@
#include "absl/types/optional.h"
#include "rtc_base/checks.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/system/file_wrapper.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/debug_dump.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/debug_dump.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif
namespace webrtc {
diff --git a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h
index 8fdf2f7728..fd3a64dbb1 100644
--- a/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h
+++ b/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h
@@ -15,16 +15,14 @@
#include "modules/audio_coding/audio_network_adaptor/controller.h"
#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/system/file_wrapper.h"
+
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif
namespace webrtc {
diff --git a/modules/audio_coding/neteq/decision_logic.cc b/modules/audio_coding/neteq/decision_logic.cc
index fd4f2f5a20..6648fd8709 100644
--- a/modules/audio_coding/neteq/decision_logic.cc
+++ b/modules/audio_coding/neteq/decision_logic.cc
@@ -95,10 +95,14 @@ DecisionLogic::DecisionLogic(NetEqController::Config config)
DecisionLogic::DecisionLogic(
NetEqController::Config config,
std::unique_ptr<DelayManager> delay_manager,
- std::unique_ptr<BufferLevelFilter> buffer_level_filter)
+ std::unique_ptr<BufferLevelFilter> buffer_level_filter,
+ std::unique_ptr<PacketArrivalHistory> packet_arrival_history)
: delay_manager_(std::move(delay_manager)),
buffer_level_filter_(std::move(buffer_level_filter)),
- packet_arrival_history_(config_.packet_history_size_ms),
+ packet_arrival_history_(packet_arrival_history
+ ? std::move(packet_arrival_history)
+ : std::make_unique<PacketArrivalHistory>(
+ config_.packet_history_size_ms)),
tick_timer_(config.tick_timer),
disallow_time_stretching_(!config.allow_time_stretching),
timescale_countdown_(
@@ -115,7 +119,7 @@ void DecisionLogic::SoftReset() {
time_stretched_cn_samples_ = 0;
delay_manager_->Reset();
buffer_level_filter_->Reset();
- packet_arrival_history_.Reset();
+ packet_arrival_history_->Reset();
}
void DecisionLogic::SetSampleRate(int fs_hz, size_t output_size_samples) {
@@ -124,7 +128,7 @@ void DecisionLogic::SetSampleRate(int fs_hz, size_t output_size_samples) {
fs_hz == 48000);
sample_rate_khz_ = fs_hz / 1000;
output_size_samples_ = output_size_samples;
- packet_arrival_history_.set_sample_rate(fs_hz);
+ packet_arrival_history_->set_sample_rate(fs_hz);
}
NetEq::Operation DecisionLogic::GetDecision(const NetEqStatus& status,
@@ -218,15 +222,15 @@ absl::optional<int> DecisionLogic::PacketArrived(
delay_manager_->SetPacketAudioLength(packet_length_samples_ * 1000 / fs_hz);
}
int64_t time_now_ms = tick_timer_->ticks() * tick_timer_->ms_per_tick();
- packet_arrival_history_.Insert(info.main_timestamp, time_now_ms);
- if (packet_arrival_history_.size() < 2) {
+ packet_arrival_history_->Insert(info.main_timestamp, time_now_ms);
+ if (packet_arrival_history_->size() < 2) {
// No meaningful delay estimate unless at least 2 packets have arrived.
return absl::nullopt;
}
int arrival_delay_ms =
- packet_arrival_history_.GetDelayMs(info.main_timestamp, time_now_ms);
+ packet_arrival_history_->GetDelayMs(info.main_timestamp, time_now_ms);
bool reordered =
- !packet_arrival_history_.IsNewestRtpTimestamp(info.main_timestamp);
+ !packet_arrival_history_->IsNewestRtpTimestamp(info.main_timestamp);
delay_manager_->Update(arrival_delay_ms, reordered);
return arrival_delay_ms;
}
@@ -306,10 +310,10 @@ NetEq::Operation DecisionLogic::ExpectedPacketAvailable(
!status.play_dtmf) {
if (config_.enable_stable_delay_mode) {
const int playout_delay_ms = GetPlayoutDelayMs(status);
- const int low_limit = TargetLevelMs();
- const int high_limit = low_limit +
- packet_arrival_history_.GetMaxDelayMs() +
- kDelayAdjustmentGranularityMs;
+ const int64_t low_limit = TargetLevelMs();
+ const int64_t high_limit = low_limit +
+ packet_arrival_history_->GetMaxDelayMs() +
+ kDelayAdjustmentGranularityMs;
if (playout_delay_ms >= high_limit * 4) {
return NetEq::Operation::kFastAccelerate;
}
@@ -460,7 +464,7 @@ int DecisionLogic::GetPlayoutDelayMs(
NetEqController::NetEqStatus status) const {
uint32_t playout_timestamp =
status.target_timestamp - status.sync_buffer_samples;
- return packet_arrival_history_.GetDelayMs(
+ return packet_arrival_history_->GetDelayMs(
playout_timestamp, tick_timer_->ticks() * tick_timer_->ms_per_tick());
}
diff --git a/modules/audio_coding/neteq/decision_logic.h b/modules/audio_coding/neteq/decision_logic.h
index d96fbecd6a..a6b02c69cd 100644
--- a/modules/audio_coding/neteq/decision_logic.h
+++ b/modules/audio_coding/neteq/decision_logic.h
@@ -27,9 +27,11 @@ namespace webrtc {
class DecisionLogic : public NetEqController {
public:
DecisionLogic(NetEqController::Config config);
- DecisionLogic(NetEqController::Config config,
- std::unique_ptr<DelayManager> delay_manager,
- std::unique_ptr<BufferLevelFilter> buffer_level_filter);
+ DecisionLogic(
+ NetEqController::Config config,
+ std::unique_ptr<DelayManager> delay_manager,
+ std::unique_ptr<BufferLevelFilter> buffer_level_filter,
+ std::unique_ptr<PacketArrivalHistory> packet_arrival_history = nullptr);
~DecisionLogic() override;
@@ -154,16 +156,16 @@ class DecisionLogic : public NetEqController {
struct Config {
Config();
- bool enable_stable_delay_mode = false;
- bool combine_concealment_decision = false;
+ bool enable_stable_delay_mode = true;
+ bool combine_concealment_decision = true;
int deceleration_target_level_offset_ms = 85;
int packet_history_size_ms = 2000;
- absl::optional<int> cng_timeout_ms;
+ absl::optional<int> cng_timeout_ms = 1000;
};
Config config_;
std::unique_ptr<DelayManager> delay_manager_;
std::unique_ptr<BufferLevelFilter> buffer_level_filter_;
- PacketArrivalHistory packet_arrival_history_;
+ std::unique_ptr<PacketArrivalHistory> packet_arrival_history_;
const TickTimer* tick_timer_;
int sample_rate_khz_;
size_t output_size_samples_;
diff --git a/modules/audio_coding/neteq/decision_logic_unittest.cc b/modules/audio_coding/neteq/decision_logic_unittest.cc
index 97e20dd883..9e9902af50 100644
--- a/modules/audio_coding/neteq/decision_logic_unittest.cc
+++ b/modules/audio_coding/neteq/decision_logic_unittest.cc
@@ -18,6 +18,7 @@
#include "modules/audio_coding/neteq/delay_manager.h"
#include "modules/audio_coding/neteq/mock/mock_buffer_level_filter.h"
#include "modules/audio_coding/neteq/mock/mock_delay_manager.h"
+#include "modules/audio_coding/neteq/mock/mock_packet_arrival_history.h"
#include "test/field_trial.h"
#include "test/gtest.h"
@@ -47,6 +48,7 @@ NetEqController::NetEqStatus CreateNetEqStatus(NetEq::Mode last_mode,
return status;
}
+using ::testing::_;
using ::testing::Return;
} // namespace
@@ -54,8 +56,6 @@ using ::testing::Return;
class DecisionLogicTest : public ::testing::Test {
protected:
DecisionLogicTest() {
- test::ScopedFieldTrials trials(
- "WebRTC-Audio-NetEqDecisionLogicConfig/cng_timeout_ms:1000/");
NetEqController::Config config;
config.tick_timer = &tick_timer_;
config.allow_time_stretching = true;
@@ -64,8 +64,11 @@ class DecisionLogicTest : public ::testing::Test {
mock_delay_manager_ = delay_manager.get();
auto buffer_level_filter = std::make_unique<MockBufferLevelFilter>();
mock_buffer_level_filter_ = buffer_level_filter.get();
+ auto packet_arrival_history = std::make_unique<MockPacketArrivalHistory>();
+ mock_packet_arrival_history_ = packet_arrival_history.get();
decision_logic_ = std::make_unique<DecisionLogic>(
- config, std::move(delay_manager), std::move(buffer_level_filter));
+ config, std::move(delay_manager), std::move(buffer_level_filter),
+ std::move(packet_arrival_history));
decision_logic_->SetSampleRate(kSampleRate, kOutputSizeSamples);
}
@@ -73,13 +76,16 @@ class DecisionLogicTest : public ::testing::Test {
std::unique_ptr<DecisionLogic> decision_logic_;
MockDelayManager* mock_delay_manager_;
MockBufferLevelFilter* mock_buffer_level_filter_;
+ MockPacketArrivalHistory* mock_packet_arrival_history_;
};
TEST_F(DecisionLogicTest, NormalOperation) {
EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
.WillRepeatedly(Return(100));
- EXPECT_CALL(*mock_buffer_level_filter_, filtered_current_level())
- .WillRepeatedly(Return(90 * kSamplesPerMs));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetDelayMs(_, _))
+ .WillRepeatedly(Return(100));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetMaxDelayMs())
+ .WillRepeatedly(Return(0));
bool reset_decoder = false;
tick_timer_.Increment(kMinTimescaleInterval + 1);
@@ -92,8 +98,10 @@ TEST_F(DecisionLogicTest, NormalOperation) {
TEST_F(DecisionLogicTest, Accelerate) {
EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
.WillRepeatedly(Return(100));
- EXPECT_CALL(*mock_buffer_level_filter_, filtered_current_level())
- .WillRepeatedly(Return(110 * kSamplesPerMs));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetDelayMs(_, _))
+ .WillRepeatedly(Return(150));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetMaxDelayMs())
+ .WillRepeatedly(Return(0));
bool reset_decoder = false;
tick_timer_.Increment(kMinTimescaleInterval + 1);
@@ -106,8 +114,10 @@ TEST_F(DecisionLogicTest, Accelerate) {
TEST_F(DecisionLogicTest, FastAccelerate) {
EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
.WillRepeatedly(Return(100));
- EXPECT_CALL(*mock_buffer_level_filter_, filtered_current_level())
- .WillRepeatedly(Return(400 * kSamplesPerMs));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetDelayMs(_, _))
+ .WillRepeatedly(Return(500));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetMaxDelayMs())
+ .WillRepeatedly(Return(0));
bool reset_decoder = false;
tick_timer_.Increment(kMinTimescaleInterval + 1);
@@ -120,8 +130,10 @@ TEST_F(DecisionLogicTest, FastAccelerate) {
TEST_F(DecisionLogicTest, PreemptiveExpand) {
EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
.WillRepeatedly(Return(100));
- EXPECT_CALL(*mock_buffer_level_filter_, filtered_current_level())
- .WillRepeatedly(Return(50 * kSamplesPerMs));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetDelayMs(_, _))
+ .WillRepeatedly(Return(50));
+ EXPECT_CALL(*mock_packet_arrival_history_, GetMaxDelayMs())
+ .WillRepeatedly(Return(0));
bool reset_decoder = false;
tick_timer_.Increment(kMinTimescaleInterval + 1);
@@ -131,20 +143,6 @@ TEST_F(DecisionLogicTest, PreemptiveExpand) {
EXPECT_FALSE(reset_decoder);
}
-TEST_F(DecisionLogicTest, DecelerationTargetLevelOffset) {
- EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
- .WillRepeatedly(Return(500));
- EXPECT_CALL(*mock_buffer_level_filter_, filtered_current_level())
- .WillRepeatedly(Return(400 * kSamplesPerMs));
-
- bool reset_decoder = false;
- tick_timer_.Increment(kMinTimescaleInterval + 1);
- EXPECT_EQ(decision_logic_->GetDecision(
- CreateNetEqStatus(NetEq::Mode::kNormal, 400), &reset_decoder),
- NetEq::Operation::kPreemptiveExpand);
- EXPECT_FALSE(reset_decoder);
-}
-
TEST_F(DecisionLogicTest, PostponeDecodeAfterExpand) {
EXPECT_CALL(*mock_delay_manager_, TargetDelayMs())
.WillRepeatedly(Return(500));
@@ -170,7 +168,7 @@ TEST_F(DecisionLogicTest, TimeStrechComfortNoise) {
{
bool reset_decoder = false;
// Below target window.
- auto status = CreateNetEqStatus(NetEq::Mode::kCodecInternalCng, 400);
+ auto status = CreateNetEqStatus(NetEq::Mode::kCodecInternalCng, 200);
status.generated_noise_samples = 400 * kSamplesPerMs;
status.next_packet->timestamp =
status.target_timestamp + 400 * kSamplesPerMs;
@@ -189,18 +187,6 @@ TEST_F(DecisionLogicTest, TimeStrechComfortNoise) {
EXPECT_EQ(decision_logic_->GetDecision(status, &reset_decoder),
NetEq::Operation::kNormal);
EXPECT_FALSE(reset_decoder);
-
- // The buffer level filter should be adjusted with the number of samples
- // that was skipped.
- int timestamp_leap = status.next_packet->timestamp -
- status.target_timestamp -
- status.generated_noise_samples;
- EXPECT_CALL(*mock_buffer_level_filter_,
- Update(400 * kSamplesPerMs, timestamp_leap));
- EXPECT_EQ(decision_logic_->GetDecision(
- CreateNetEqStatus(NetEq::Mode::kNormal, 400), &reset_decoder),
- NetEq::Operation::kNormal);
- EXPECT_FALSE(reset_decoder);
}
}
diff --git a/modules/audio_coding/neteq/mock/mock_packet_arrival_history.h b/modules/audio_coding/neteq/mock/mock_packet_arrival_history.h
new file mode 100644
index 0000000000..1b2080cd94
--- /dev/null
+++ b/modules/audio_coding/neteq/mock/mock_packet_arrival_history.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_ARRIVAL_HISTORY_H_
+#define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_ARRIVAL_HISTORY_H_
+
+#include "modules/audio_coding/neteq/packet_arrival_history.h"
+#include "test/gmock.h"
+
+namespace webrtc {
+
+class MockPacketArrivalHistory : public PacketArrivalHistory {
+ public:
+ MockPacketArrivalHistory() : PacketArrivalHistory(0) {}
+
+ MOCK_METHOD(int,
+ GetDelayMs,
+ (uint32_t rtp_timestamp, int64_t time_ms),
+ (const override));
+ MOCK_METHOD(int, GetMaxDelayMs, (), (const override));
+};
+
+} // namespace webrtc
+
+#endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_ARRIVAL_HISTORY_H_
diff --git a/modules/audio_coding/neteq/mock/mock_packet_buffer.h b/modules/audio_coding/neteq/mock/mock_packet_buffer.h
index 48357ea466..ac883f7692 100644
--- a/modules/audio_coding/neteq/mock/mock_packet_buffer.h
+++ b/modules/audio_coding/neteq/mock/mock_packet_buffer.h
@@ -18,38 +18,21 @@ namespace webrtc {
class MockPacketBuffer : public PacketBuffer {
public:
- MockPacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer)
- : PacketBuffer(max_number_of_packets, tick_timer) {}
+ MockPacketBuffer(size_t max_number_of_packets,
+ const TickTimer* tick_timer,
+ StatisticsCalculator* stats)
+ : PacketBuffer(max_number_of_packets, tick_timer, stats) {}
~MockPacketBuffer() override { Die(); }
MOCK_METHOD(void, Die, ());
- MOCK_METHOD(void, Flush, (StatisticsCalculator * stats), (override));
- MOCK_METHOD(void,
- PartialFlush,
- (int target_level_ms,
- size_t sample_rate,
- size_t last_decoded_length,
- StatisticsCalculator* stats),
- (override));
+ MOCK_METHOD(void, Flush, (), (override));
MOCK_METHOD(bool, Empty, (), (const, override));
- MOCK_METHOD(int,
- InsertPacket,
- (Packet && packet,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms,
- const DecoderDatabase& decoder_database),
- (override));
+ MOCK_METHOD(int, InsertPacket, (Packet && packet), (override));
MOCK_METHOD(int,
InsertPacketList,
(PacketList * packet_list,
const DecoderDatabase& decoder_database,
absl::optional<uint8_t>* current_rtp_payload_type,
- absl::optional<uint8_t>* current_cng_rtp_payload_type,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms),
+ absl::optional<uint8_t>* current_cng_rtp_payload_type),
(override));
MOCK_METHOD(int,
NextTimestamp,
@@ -61,19 +44,14 @@ class MockPacketBuffer : public PacketBuffer {
(const, override));
MOCK_METHOD(const Packet*, PeekNextPacket, (), (const, override));
MOCK_METHOD(absl::optional<Packet>, GetNextPacket, (), (override));
- MOCK_METHOD(int,
- DiscardNextPacket,
- (StatisticsCalculator * stats),
- (override));
+ MOCK_METHOD(int, DiscardNextPacket, (), (override));
MOCK_METHOD(void,
DiscardOldPackets,
- (uint32_t timestamp_limit,
- uint32_t horizon_samples,
- StatisticsCalculator* stats),
+ (uint32_t timestamp_limit, uint32_t horizon_samples),
(override));
MOCK_METHOD(void,
DiscardAllOldPackets,
- (uint32_t timestamp_limit, StatisticsCalculator* stats),
+ (uint32_t timestamp_limit),
(override));
MOCK_METHOD(size_t, NumPacketsInBuffer, (), (const, override));
};
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 52e8cbad3a..d444ff74fd 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -84,8 +84,9 @@ NetEqImpl::Dependencies::Dependencies(
new DecoderDatabase(decoder_factory, config.codec_pair_id)),
dtmf_buffer(new DtmfBuffer(config.sample_rate_hz)),
dtmf_tone_generator(new DtmfToneGenerator),
- packet_buffer(
- new PacketBuffer(config.max_packets_in_buffer, tick_timer.get())),
+ packet_buffer(new PacketBuffer(config.max_packets_in_buffer,
+ tick_timer.get(),
+ stats.get())),
neteq_controller(
CreateNetEqController(controller_factory,
config.min_delay_ms,
@@ -265,7 +266,7 @@ void NetEqImpl::SetCodecs(const std::map<int, SdpAudioFormat>& codecs) {
const std::vector<int> changed_payload_types =
decoder_database_->SetCodecs(codecs);
for (const int pt : changed_payload_types) {
- packet_buffer_->DiscardPacketsWithPayloadType(pt, stats_.get());
+ packet_buffer_->DiscardPacketsWithPayloadType(pt);
}
}
@@ -283,8 +284,7 @@ int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {
MutexLock lock(&mutex_);
int ret = decoder_database_->Remove(rtp_payload_type);
if (ret == DecoderDatabase::kOK || ret == DecoderDatabase::kDecoderNotFound) {
- packet_buffer_->DiscardPacketsWithPayloadType(rtp_payload_type,
- stats_.get());
+ packet_buffer_->DiscardPacketsWithPayloadType(rtp_payload_type);
return kOK;
}
return kFail;
@@ -441,7 +441,7 @@ absl::optional<NetEq::DecoderFormat> NetEqImpl::GetDecoderFormat(
void NetEqImpl::FlushBuffers() {
MutexLock lock(&mutex_);
RTC_LOG(LS_VERBOSE) << "FlushBuffers";
- packet_buffer_->Flush(stats_.get());
+ packet_buffer_->Flush();
RTC_DCHECK(sync_buffer_.get());
RTC_DCHECK(expand_.get());
sync_buffer_->Flush();
@@ -542,7 +542,7 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
// the packet has been successfully inserted into the packet buffer.
// Flush the packet buffer and DTMF buffer.
- packet_buffer_->Flush(stats_.get());
+ packet_buffer_->Flush();
dtmf_buffer_->Flush();
// Update audio buffer timestamp.
@@ -682,23 +682,15 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
}
// Insert packets in buffer.
- const int target_level_ms = controller_->TargetLevelMs();
const int ret = packet_buffer_->InsertPacketList(
&parsed_packet_list, *decoder_database_, &current_rtp_payload_type_,
- &current_cng_rtp_payload_type_, stats_.get(), decoder_frame_length_,
- last_output_sample_rate_hz_, target_level_ms);
+ &current_cng_rtp_payload_type_);
bool buffer_flush_occured = false;
if (ret == PacketBuffer::kFlushed) {
// Reset DSP timestamp etc. if packet buffer flushed.
new_codec_ = true;
update_sample_rate_and_channels = true;
buffer_flush_occured = true;
- } else if (ret == PacketBuffer::kPartialFlush) {
- // Forward sync buffer timestamp
- timestamp_ = packet_buffer_->PeekNextPacket()->timestamp;
- sync_buffer_->IncreaseEndTimestamp(timestamp_ -
- sync_buffer_->end_timestamp());
- buffer_flush_occured = true;
} else if (ret != PacketBuffer::kOK) {
return kOtherError;
}
@@ -1037,8 +1029,7 @@ int NetEqImpl::GetDecision(Operation* operation,
uint32_t end_timestamp = sync_buffer_->end_timestamp();
if (!new_codec_) {
const uint32_t five_seconds_samples = 5 * fs_hz_;
- packet_buffer_->DiscardOldPackets(end_timestamp, five_seconds_samples,
- stats_.get());
+ packet_buffer_->DiscardOldPackets(end_timestamp, five_seconds_samples);
}
const Packet* packet = packet_buffer_->PeekNextPacket();
@@ -1058,14 +1049,12 @@ int NetEqImpl::GetDecision(Operation* operation,
(end_timestamp >= packet->timestamp ||
end_timestamp + generated_noise_samples > packet->timestamp)) {
// Don't use this packet, discard it.
- if (packet_buffer_->DiscardNextPacket(stats_.get()) !=
- PacketBuffer::kOK) {
+ if (packet_buffer_->DiscardNextPacket() != PacketBuffer::kOK) {
RTC_DCHECK_NOTREACHED(); // Must be ok by design.
}
// Check buffer again.
if (!new_codec_) {
- packet_buffer_->DiscardOldPackets(end_timestamp, 5 * fs_hz_,
- stats_.get());
+ packet_buffer_->DiscardOldPackets(end_timestamp, 5 * fs_hz_);
}
packet = packet_buffer_->PeekNextPacket();
}
@@ -2024,7 +2013,7 @@ int NetEqImpl::ExtractPackets(size_t required_samples,
// we could end up in the situation where we never decode anything, since
// all incoming packets are considered too old but the buffer will also
// never be flooded and flushed.
- packet_buffer_->DiscardAllOldPackets(timestamp_, stats_.get());
+ packet_buffer_->DiscardAllOldPackets(timestamp_);
}
return rtc::dchecked_cast<int>(extracted_samples);
diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc
index e61cd52502..e3bbe498b3 100644
--- a/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -108,8 +108,8 @@ class NetEqImplTest : public ::testing::Test {
dtmf_tone_generator_ = deps.dtmf_tone_generator.get();
if (use_mock_packet_buffer_) {
- std::unique_ptr<MockPacketBuffer> mock(
- new MockPacketBuffer(config_.max_packets_in_buffer, tick_timer_));
+ std::unique_ptr<MockPacketBuffer> mock(new MockPacketBuffer(
+ config_.max_packets_in_buffer, tick_timer_, deps.stats.get()));
mock_packet_buffer_ = mock.get();
deps.packet_buffer = std::move(mock);
}
@@ -120,7 +120,6 @@ class NetEqImplTest : public ::testing::Test {
mock_neteq_controller_ = mock.get();
deps.neteq_controller = std::move(mock);
} else {
- deps.stats = std::make_unique<StatisticsCalculator>();
NetEqController::Config controller_config;
controller_config.tick_timer = tick_timer_;
controller_config.base_min_delay_ms = config_.min_delay_ms;
@@ -329,8 +328,8 @@ TEST_F(NetEqImplTest, InsertPacket) {
// Expectations for packet buffer.
EXPECT_CALL(*mock_packet_buffer_, Empty())
.WillOnce(Return(false)); // Called once after first packet is inserted.
- EXPECT_CALL(*mock_packet_buffer_, Flush(_)).Times(1);
- EXPECT_CALL(*mock_packet_buffer_, InsertPacketList(_, _, _, _, _, _, _, _))
+ EXPECT_CALL(*mock_packet_buffer_, Flush()).Times(1);
+ EXPECT_CALL(*mock_packet_buffer_, InsertPacketList(_, _, _, _))
.Times(2)
.WillRepeatedly(DoAll(SetArgPointee<2>(kPayloadType),
WithArg<0>(Invoke(DeletePacketsAndReturnOk))));
@@ -1246,12 +1245,15 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) {
EXPECT_EQ(kChannels, output.num_channels_);
EXPECT_THAT(output.packet_infos_, IsEmpty());
- // Second call to GetAudio will decode the packet that is ok. No errors are
- // expected.
- EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
- EXPECT_EQ(kExpectedOutputSize, output.samples_per_channel_ * kChannels);
- EXPECT_EQ(kChannels, output.num_channels_);
- EXPECT_THAT(output.packet_infos_, SizeIs(1));
+ // Call GetAudio until the next packet is decoded.
+ int calls = 0;
+ int kTimeout = 10;
+ while (output.packet_infos_.empty() && calls < kTimeout) {
+ EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
+ EXPECT_EQ(kExpectedOutputSize, output.samples_per_channel_ * kChannels);
+ EXPECT_EQ(kChannels, output.num_channels_);
+ }
+ EXPECT_LT(calls, kTimeout);
// Die isn't called through NiceMock (since it's called by the
// MockAudioDecoder constructor), so it needs to be mocked explicitly.
diff --git a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index a669ad727e..da516982c7 100644
--- a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -273,15 +273,16 @@ class NetEqNetworkStatsTest {
// Next we introduce packet losses.
SetPacketLossRate(0.1);
- expects.stats_ref.expand_rate = expects.stats_ref.speech_expand_rate = 898;
+ expects.expand_rate = expects.speech_expand_rate = kLargerThan;
RunTest(50, expects);
// Next we enable FEC.
decoder_->set_fec_enabled(true);
// If FEC fills in the lost packets, no packet loss will be counted.
+ expects.expand_rate = expects.speech_expand_rate = kEqual;
expects.stats_ref.expand_rate = expects.stats_ref.speech_expand_rate = 0;
- expects.stats_ref.secondary_decoded_rate = 2006;
- expects.stats_ref.secondary_discarded_rate = 14336;
+ expects.secondary_decoded_rate = kLargerThan;
+ expects.secondary_discarded_rate = kLargerThan;
RunTest(50, expects);
}
diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc
index 77bd5b5035..aec7e580ec 100644
--- a/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_unittest.cc
@@ -31,7 +31,6 @@
#include "modules/include/module_common_types_public.h"
#include "modules/rtp_rtcp/include/rtcp_statistics.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/message_digest.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/strings/string_builder.h"
@@ -77,11 +76,11 @@ TEST_F(NetEqDecodingTest, MAYBE_TestOpusBitExactness) {
webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp");
const std::string output_checksum =
- "fec6827bb9ee0b21770bbbb4a3a6f8823bf537dc|"
- "3610cc7be4b3407b9c273b1299ab7f8f47cca96b";
+ "2efdbea92c3fb2383c59f89d881efec9f94001d0|"
+ "a6831b946b59913852ae3e53f99fa8f209bb23cd";
const std::string network_stats_checksum =
- "3d043e47e5f4bb81d37e7bce8c44bf802965c853|"
+ "dfaf4399fd60293405290476ccf1c05c807c71a0|"
"076662525572dba753b11578330bd491923f7f5e";
DecodeAndCompare(input_rtp_file, output_checksum, network_stats_checksum,
@@ -99,11 +98,11 @@ TEST_F(NetEqDecodingTest, MAYBE_TestOpusDtxBitExactness) {
webrtc::test::ResourcePath("audio_coding/neteq_opus_dtx", "rtp");
const std::string output_checksum =
- "b3c4899eab5378ef5e54f2302948872149f6ad5e|"
- "589e975ec31ea13f302457fea1425be9380ffb96";
+ "7eddce841cbfa500964c91cdae78b01b9f448948|"
+ "5d13affec87bf4cc8c7667f0cd0d25e1ad09c7c3";
const std::string network_stats_checksum =
- "dc8447b9fee1a21fd5d1f4045d62b982a3fb0215";
+ "92b0fdcbf8bb9354d40140b7312f2fb76a078555";
DecodeAndCompare(input_rtp_file, output_checksum, network_stats_checksum,
absl::GetFlag(FLAGS_gen_ref));
@@ -165,7 +164,7 @@ TEST_F(NetEqDecodingTest, LongCngWithNegativeClockDrift) {
const double kDriftFactor = 1000.0 / (1000.0 + 25.0);
const double kNetworkFreezeTimeMs = 0.0;
const bool kGetAudioDuringFreezeRecovery = false;
- const int kDelayToleranceMs = 20;
+ const int kDelayToleranceMs = 60;
const int kMaxTimeToSpeechMs = 100;
LongCngWithClockDrift(kDriftFactor, kNetworkFreezeTimeMs,
kGetAudioDuringFreezeRecovery, kDelayToleranceMs,
@@ -495,7 +494,7 @@ TEST_F(NetEqDecodingTest, DiscardDuplicateCng) {
timestamp += kCngPeriodSamples;
uint32_t first_speech_timestamp = timestamp;
// Insert speech again.
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < 4; ++i) {
PopulateRtpInfo(seq_no, timestamp, &rtp_info);
ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload));
++seq_no;
@@ -700,8 +699,7 @@ TEST_F(NetEqDecodingTestWithMutedState, MutedStateOldPacket) {
for (int i = 0; i < 5; ++i) {
InsertPacket(kSamples * (i - 1000));
}
- EXPECT_FALSE(GetAudioReturnMuted());
- EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
+ GetAudioUntilNormal();
}
// Verifies that NetEq doesn't enter muted state when CNG mode is active and the
diff --git a/modules/audio_coding/neteq/packet_arrival_history.h b/modules/audio_coding/neteq/packet_arrival_history.h
index cad362b469..722caf5688 100644
--- a/modules/audio_coding/neteq/packet_arrival_history.h
+++ b/modules/audio_coding/neteq/packet_arrival_history.h
@@ -26,6 +26,7 @@ namespace webrtc {
class PacketArrivalHistory {
public:
explicit PacketArrivalHistory(int window_size_ms);
+ virtual ~PacketArrivalHistory() = default;
// Insert packet with `rtp_timestamp` and `arrival_time_ms` into the history.
void Insert(uint32_t rtp_timestamp, int64_t arrival_time_ms);
@@ -34,10 +35,10 @@ class PacketArrivalHistory {
// `(time_ms - p.arrival_time_ms) - (rtp_timestamp - p.rtp_timestamp)`
// where `p` is chosen as the packet arrival in the history that maximizes the
// delay.
- int GetDelayMs(uint32_t rtp_timestamp, int64_t time_ms) const;
+ virtual int GetDelayMs(uint32_t rtp_timestamp, int64_t time_ms) const;
// Get the maximum packet arrival delay observed in the history.
- int GetMaxDelayMs() const;
+ virtual int GetMaxDelayMs() const;
bool IsNewestRtpTimestamp(uint32_t rtp_timestamp) const;
diff --git a/modules/audio_coding/neteq/packet_buffer.cc b/modules/audio_coding/neteq/packet_buffer.cc
index 9bfa908ab9..412bf66ee8 100644
--- a/modules/audio_coding/neteq/packet_buffer.cc
+++ b/modules/audio_coding/neteq/packet_buffer.cc
@@ -54,43 +54,14 @@ bool EqualSampleRates(uint8_t pt1,
return di1 && di2 && di1->SampleRateHz() == di2->SampleRateHz();
}
-void LogPacketDiscarded(int codec_level, StatisticsCalculator* stats) {
- RTC_CHECK(stats);
- if (codec_level > 0) {
- stats->SecondaryPacketsDiscarded(1);
- } else {
- stats->PacketsDiscarded(1);
- }
-}
-
-absl::optional<SmartFlushingConfig> GetSmartflushingConfig() {
- absl::optional<SmartFlushingConfig> result;
- std::string field_trial_string =
- field_trial::FindFullName("WebRTC-Audio-NetEqSmartFlushing");
- result = SmartFlushingConfig();
- bool enabled = false;
- auto parser = StructParametersParser::Create(
- "enabled", &enabled, "target_level_threshold_ms",
- &result->target_level_threshold_ms, "target_level_multiplier",
- &result->target_level_multiplier);
- parser->Parse(field_trial_string);
- if (!enabled) {
- return absl::nullopt;
- }
- RTC_LOG(LS_INFO) << "Using smart flushing, target_level_threshold_ms: "
- << result->target_level_threshold_ms
- << ", target_level_multiplier: "
- << result->target_level_multiplier;
- return result;
-}
-
} // namespace
PacketBuffer::PacketBuffer(size_t max_number_of_packets,
- const TickTimer* tick_timer)
- : smart_flushing_config_(GetSmartflushingConfig()),
- max_number_of_packets_(max_number_of_packets),
- tick_timer_(tick_timer) {}
+ const TickTimer* tick_timer,
+ StatisticsCalculator* stats)
+ : max_number_of_packets_(max_number_of_packets),
+ tick_timer_(tick_timer),
+ stats_(stats) {}
// Destructor. All packets in the buffer will be destroyed.
PacketBuffer::~PacketBuffer() {
@@ -98,45 +69,19 @@ PacketBuffer::~PacketBuffer() {
}
// Flush the buffer. All packets in the buffer will be destroyed.
-void PacketBuffer::Flush(StatisticsCalculator* stats) {
+void PacketBuffer::Flush() {
for (auto& p : buffer_) {
- LogPacketDiscarded(p.priority.codec_level, stats);
+ LogPacketDiscarded(p.priority.codec_level);
}
buffer_.clear();
- stats->FlushedPacketBuffer();
-}
-
-void PacketBuffer::PartialFlush(int target_level_ms,
- size_t sample_rate,
- size_t last_decoded_length,
- StatisticsCalculator* stats) {
- // Make sure that at least half the packet buffer capacity will be available
- // after the flush. This is done to avoid getting stuck if the target level is
- // very high.
- int target_level_samples =
- std::min(target_level_ms * sample_rate / 1000,
- max_number_of_packets_ * last_decoded_length / 2);
- // We should avoid flushing to very low levels.
- target_level_samples = std::max(
- target_level_samples, smart_flushing_config_->target_level_threshold_ms);
- while (GetSpanSamples(last_decoded_length, sample_rate, false) >
- static_cast<size_t>(target_level_samples) ||
- buffer_.size() > max_number_of_packets_ / 2) {
- LogPacketDiscarded(PeekNextPacket()->priority.codec_level, stats);
- buffer_.pop_front();
- }
+ stats_->FlushedPacketBuffer();
}
bool PacketBuffer::Empty() const {
return buffer_.empty();
}
-int PacketBuffer::InsertPacket(Packet&& packet,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms,
- const DecoderDatabase& decoder_database) {
+int PacketBuffer::InsertPacket(Packet&& packet) {
if (packet.empty()) {
RTC_LOG(LS_WARNING) << "InsertPacket invalid packet";
return kInvalidPacket;
@@ -149,32 +94,11 @@ int PacketBuffer::InsertPacket(Packet&& packet,
packet.waiting_time = tick_timer_->GetNewStopwatch();
- // Perform a smart flush if the buffer size exceeds a multiple of the target
- // level.
- const size_t span_threshold =
- smart_flushing_config_
- ? smart_flushing_config_->target_level_multiplier *
- std::max(smart_flushing_config_->target_level_threshold_ms,
- target_level_ms) *
- sample_rate / 1000
- : 0;
- const bool smart_flush =
- smart_flushing_config_.has_value() &&
- GetSpanSamples(last_decoded_length, sample_rate, false) >= span_threshold;
- if (buffer_.size() >= max_number_of_packets_ || smart_flush) {
- size_t buffer_size_before_flush = buffer_.size();
- if (smart_flushing_config_.has_value()) {
- // Flush down to the target level.
- PartialFlush(target_level_ms, sample_rate, last_decoded_length, stats);
- return_val = kPartialFlush;
- } else {
- // Buffer is full.
- Flush(stats);
- return_val = kFlushed;
- }
- RTC_LOG(LS_WARNING) << "Packet buffer flushed, "
- << (buffer_size_before_flush - buffer_.size())
- << " packets discarded.";
+ if (buffer_.size() >= max_number_of_packets_) {
+ // Buffer is full.
+ Flush();
+ return_val = kFlushed;
+ RTC_LOG(LS_WARNING) << "Packet buffer flushed.";
}
// Get an iterator pointing to the place in the buffer where the new packet
@@ -187,7 +111,7 @@ int PacketBuffer::InsertPacket(Packet&& packet,
// timestamp as `rit`, which has a higher priority, do not insert the new
// packet to list.
if (rit != buffer_.rend() && packet.timestamp == rit->timestamp) {
- LogPacketDiscarded(packet.priority.codec_level, stats);
+ LogPacketDiscarded(packet.priority.codec_level);
return return_val;
}
@@ -196,7 +120,7 @@ int PacketBuffer::InsertPacket(Packet&& packet,
// packet.
PacketList::iterator it = rit.base();
if (it != buffer_.end() && packet.timestamp == it->timestamp) {
- LogPacketDiscarded(it->priority.codec_level, stats);
+ LogPacketDiscarded(it->priority.codec_level);
it = buffer_.erase(it);
}
buffer_.insert(it, std::move(packet)); // Insert the packet at that position.
@@ -208,12 +132,7 @@ int PacketBuffer::InsertPacketList(
PacketList* packet_list,
const DecoderDatabase& decoder_database,
absl::optional<uint8_t>* current_rtp_payload_type,
- absl::optional<uint8_t>* current_cng_rtp_payload_type,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms) {
- RTC_DCHECK(stats);
+ absl::optional<uint8_t>* current_cng_rtp_payload_type) {
bool flushed = false;
for (auto& packet : *packet_list) {
if (decoder_database.IsComfortNoise(packet.payload_type)) {
@@ -221,7 +140,7 @@ int PacketBuffer::InsertPacketList(
**current_cng_rtp_payload_type != packet.payload_type) {
// New CNG payload type implies new codec type.
*current_rtp_payload_type = absl::nullopt;
- Flush(stats);
+ Flush();
flushed = true;
}
*current_cng_rtp_payload_type = packet.payload_type;
@@ -234,14 +153,12 @@ int PacketBuffer::InsertPacketList(
**current_cng_rtp_payload_type,
decoder_database))) {
*current_cng_rtp_payload_type = absl::nullopt;
- Flush(stats);
+ Flush();
flushed = true;
}
*current_rtp_payload_type = packet.payload_type;
}
- int return_val =
- InsertPacket(std::move(packet), stats, last_decoded_length, sample_rate,
- target_level_ms, decoder_database);
+ int return_val = InsertPacket(std::move(packet));
if (return_val == kFlushed) {
// The buffer flushed, but this is not an error. We can still continue.
flushed = true;
@@ -303,43 +220,40 @@ absl::optional<Packet> PacketBuffer::GetNextPacket() {
return packet;
}
-int PacketBuffer::DiscardNextPacket(StatisticsCalculator* stats) {
+int PacketBuffer::DiscardNextPacket() {
if (Empty()) {
return kBufferEmpty;
}
// Assert that the packet sanity checks in InsertPacket method works.
const Packet& packet = buffer_.front();
RTC_DCHECK(!packet.empty());
- LogPacketDiscarded(packet.priority.codec_level, stats);
+ LogPacketDiscarded(packet.priority.codec_level);
buffer_.pop_front();
return kOK;
}
void PacketBuffer::DiscardOldPackets(uint32_t timestamp_limit,
- uint32_t horizon_samples,
- StatisticsCalculator* stats) {
- buffer_.remove_if([timestamp_limit, horizon_samples, stats](const Packet& p) {
+ uint32_t horizon_samples) {
+ buffer_.remove_if([this, timestamp_limit, horizon_samples](const Packet& p) {
if (timestamp_limit == p.timestamp ||
!IsObsoleteTimestamp(p.timestamp, timestamp_limit, horizon_samples)) {
return false;
}
- LogPacketDiscarded(p.priority.codec_level, stats);
+ LogPacketDiscarded(p.priority.codec_level);
return true;
});
}
-void PacketBuffer::DiscardAllOldPackets(uint32_t timestamp_limit,
- StatisticsCalculator* stats) {
- DiscardOldPackets(timestamp_limit, 0, stats);
+void PacketBuffer::DiscardAllOldPackets(uint32_t timestamp_limit) {
+ DiscardOldPackets(timestamp_limit, 0);
}
-void PacketBuffer::DiscardPacketsWithPayloadType(uint8_t payload_type,
- StatisticsCalculator* stats) {
- buffer_.remove_if([payload_type, stats](const Packet& p) {
+void PacketBuffer::DiscardPacketsWithPayloadType(uint8_t payload_type) {
+ buffer_.remove_if([this, payload_type](const Packet& p) {
if (p.payload_type != payload_type) {
return false;
}
- LogPacketDiscarded(p.priority.codec_level, stats);
+ LogPacketDiscarded(p.priority.codec_level);
return true;
});
}
@@ -404,4 +318,12 @@ bool PacketBuffer::ContainsDtxOrCngPacket(
return false;
}
+void PacketBuffer::LogPacketDiscarded(int codec_level) {
+ if (codec_level > 0) {
+ stats_->SecondaryPacketsDiscarded(1);
+ } else {
+ stats_->PacketsDiscarded(1);
+ }
+}
+
} // namespace webrtc
diff --git a/modules/audio_coding/neteq/packet_buffer.h b/modules/audio_coding/neteq/packet_buffer.h
index 1eef64a02c..05ae315b68 100644
--- a/modules/audio_coding/neteq/packet_buffer.h
+++ b/modules/audio_coding/neteq/packet_buffer.h
@@ -21,14 +21,6 @@ namespace webrtc {
class DecoderDatabase;
class StatisticsCalculator;
class TickTimer;
-struct SmartFlushingConfig {
- // When calculating the flushing threshold, the maximum between the target
- // level and this value is used.
- int target_level_threshold_ms = 500;
- // A smart flush is triggered when the packet buffer contains a multiple of
- // the target level.
- int target_level_multiplier = 3;
-};
// This is the actual buffer holding the packets before decoding.
class PacketBuffer {
@@ -36,7 +28,6 @@ class PacketBuffer {
enum BufferReturnCodes {
kOK = 0,
kFlushed,
- kPartialFlush,
kNotFound,
kBufferEmpty,
kInvalidPacket,
@@ -45,7 +36,9 @@ class PacketBuffer {
// Constructor creates a buffer which can hold a maximum of
// `max_number_of_packets` packets.
- PacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer);
+ PacketBuffer(size_t max_number_of_packets,
+ const TickTimer* tick_timer,
+ StatisticsCalculator* stats);
// Deletes all packets in the buffer before destroying the buffer.
virtual ~PacketBuffer();
@@ -54,13 +47,7 @@ class PacketBuffer {
PacketBuffer& operator=(const PacketBuffer&) = delete;
// Flushes the buffer and deletes all packets in it.
- virtual void Flush(StatisticsCalculator* stats);
-
- // Partial flush. Flush packets but leave some packets behind.
- virtual void PartialFlush(int target_level_ms,
- size_t sample_rate,
- size_t last_decoded_length,
- StatisticsCalculator* stats);
+ virtual void Flush();
// Returns true for an empty buffer.
virtual bool Empty() const;
@@ -69,12 +56,7 @@ class PacketBuffer {
// the packet object.
// Returns PacketBuffer::kOK on success, PacketBuffer::kFlushed if the buffer
// was flushed due to overfilling.
- virtual int InsertPacket(Packet&& packet,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms,
- const DecoderDatabase& decoder_database);
+ virtual int InsertPacket(Packet&& packet);
// Inserts a list of packets into the buffer. The buffer will take over
// ownership of the packet objects.
@@ -88,11 +70,7 @@ class PacketBuffer {
PacketList* packet_list,
const DecoderDatabase& decoder_database,
absl::optional<uint8_t>* current_rtp_payload_type,
- absl::optional<uint8_t>* current_cng_rtp_payload_type,
- StatisticsCalculator* stats,
- size_t last_decoded_length,
- size_t sample_rate,
- int target_level_ms);
+ absl::optional<uint8_t>* current_cng_rtp_payload_type);
// Gets the timestamp for the first packet in the buffer and writes it to the
// output variable `next_timestamp`.
@@ -119,7 +97,7 @@ class PacketBuffer {
// Discards the first packet in the buffer. The packet is deleted.
// Returns PacketBuffer::kBufferEmpty if the buffer is empty,
// PacketBuffer::kOK otherwise.
- virtual int DiscardNextPacket(StatisticsCalculator* stats);
+ virtual int DiscardNextPacket();
// Discards all packets that are (strictly) older than timestamp_limit,
// but newer than timestamp_limit - horizon_samples. Setting horizon_samples
@@ -127,16 +105,13 @@ class PacketBuffer {
// is, if a packet is more than 2^31 timestamps into the future compared with
// timestamp_limit (including wrap-around), it is considered old.
virtual void DiscardOldPackets(uint32_t timestamp_limit,
- uint32_t horizon_samples,
- StatisticsCalculator* stats);
+ uint32_t horizon_samples);
// Discards all packets that are (strictly) older than timestamp_limit.
- virtual void DiscardAllOldPackets(uint32_t timestamp_limit,
- StatisticsCalculator* stats);
+ virtual void DiscardAllOldPackets(uint32_t timestamp_limit);
// Removes all packets with a specific payload type from the buffer.
- virtual void DiscardPacketsWithPayloadType(uint8_t payload_type,
- StatisticsCalculator* stats);
+ virtual void DiscardPacketsWithPayloadType(uint8_t payload_type);
// Returns the number of packets in the buffer, including duplicates and
// redundant packets.
@@ -171,10 +146,12 @@ class PacketBuffer {
}
private:
- absl::optional<SmartFlushingConfig> smart_flushing_config_;
+ void LogPacketDiscarded(int codec_level);
+
size_t max_number_of_packets_;
PacketList buffer_;
const TickTimer* tick_timer_;
+ StatisticsCalculator* stats_;
};
} // namespace webrtc
diff --git a/modules/audio_coding/neteq/packet_buffer_unittest.cc b/modules/audio_coding/neteq/packet_buffer_unittest.cc
index b0079645ff..9c7ded50f9 100644
--- a/modules/audio_coding/neteq/packet_buffer_unittest.cc
+++ b/modules/audio_coding/neteq/packet_buffer_unittest.cc
@@ -108,26 +108,23 @@ namespace webrtc {
TEST(PacketBuffer, CreateAndDestroy) {
TickTimer tick_timer;
- PacketBuffer* buffer = new PacketBuffer(10, &tick_timer); // 10 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer* buffer =
+ new PacketBuffer(10, &tick_timer, &mock_stats); // 10 packets.
EXPECT_TRUE(buffer->Empty());
delete buffer;
}
TEST(PacketBuffer, InsertPacket) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
- PacketGenerator gen(17u, 4711u, 0, 10);
StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
+ PacketGenerator gen(17u, 4711u, 0, 10);
MockDecoderDatabase decoder_database;
const int payload_len = 100;
const Packet packet = gen.NextPacket(payload_len, nullptr);
- EXPECT_EQ(0, buffer.InsertPacket(/*packet=*/packet.Clone(),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/10000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ EXPECT_EQ(0, buffer.InsertPacket(/*packet=*/packet.Clone()));
uint32_t next_ts;
EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
EXPECT_EQ(4711u, next_ts);
@@ -144,28 +141,22 @@ TEST(PacketBuffer, InsertPacket) {
// Test to flush buffer.
TEST(PacketBuffer, FlushBuffer) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
PacketGenerator gen(0, 0, 0, 10);
const int payload_len = 10;
- StrictMock<MockStatisticsCalculator> mock_stats;
MockDecoderDatabase decoder_database;
// Insert 10 small packets; should be ok.
for (int i = 0; i < 10; ++i) {
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/gen.NextPacket(
+ payload_len, nullptr)));
}
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
EXPECT_FALSE(buffer.Empty());
EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(10);
- buffer.Flush(&mock_stats);
+ buffer.Flush();
// Buffer should delete the payloads itself.
EXPECT_EQ(0u, buffer.NumPacketsInBuffer());
EXPECT_TRUE(buffer.Empty());
@@ -175,23 +166,17 @@ TEST(PacketBuffer, FlushBuffer) {
// Test to fill the buffer over the limits, and verify that it flushes.
TEST(PacketBuffer, OverfillBuffer) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
- PacketGenerator gen(0, 0, 0, 10);
StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
+ PacketGenerator gen(0, 0, 0, 10);
MockDecoderDatabase decoder_database;
// Insert 10 small packets; should be ok.
const int payload_len = 10;
int i;
for (i = 0; i < 10; ++i) {
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/gen.NextPacket(
+ payload_len, nullptr)));
}
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
uint32_t next_ts;
@@ -202,12 +187,7 @@ TEST(PacketBuffer, OverfillBuffer) {
const Packet packet = gen.NextPacket(payload_len, nullptr);
// Insert 11th packet; should flush the buffer and insert it after flushing.
EXPECT_EQ(PacketBuffer::kFlushed,
- buffer.InsertPacket(/*packet=*/packet.Clone(),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer.InsertPacket(/*packet=*/packet.Clone()));
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
// Expect last inserted packet to be first in line.
@@ -216,94 +196,11 @@ TEST(PacketBuffer, OverfillBuffer) {
EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
}
-// Test a partial buffer flush.
-TEST(PacketBuffer, PartialFlush) {
- // Use a field trial to configure smart flushing.
- test::ScopedFieldTrials field_trials(
- "WebRTC-Audio-NetEqSmartFlushing/enabled:true,"
- "target_level_threshold_ms:0,target_level_multiplier:2/");
- TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
- PacketGenerator gen(0, 0, 0, 10);
- const int payload_len = 10;
- StrictMock<MockStatisticsCalculator> mock_stats;
- MockDecoderDatabase decoder_database;
-
- // Insert 10 small packets; should be ok.
- for (int i = 0; i < 10; ++i) {
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/100,
- /*decoder_database=*/decoder_database));
- }
- EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
- EXPECT_FALSE(buffer.Empty());
-
- EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(7);
- buffer.PartialFlush(/*target_level_ms=*/30,
- /*sample_rate=*/1000,
- /*last_decoded_length=*/payload_len,
- /*stats=*/&mock_stats);
- // There should still be some packets left in the buffer.
- EXPECT_EQ(3u, buffer.NumPacketsInBuffer());
- EXPECT_FALSE(buffer.Empty());
- EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
-}
-
-// Test to fill the buffer over the limits, and verify that the smart flush
-// functionality works as expected.
-TEST(PacketBuffer, SmartFlushOverfillBuffer) {
- // Use a field trial to configure smart flushing.
- test::ScopedFieldTrials field_trials(
- "WebRTC-Audio-NetEqSmartFlushing/enabled:true,"
- "target_level_threshold_ms:0,target_level_multiplier:2/");
- TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
- PacketGenerator gen(0, 0, 0, 10);
- StrictMock<MockStatisticsCalculator> mock_stats;
- MockDecoderDatabase decoder_database;
-
- // Insert 10 small packets; should be ok.
- const int payload_len = 10;
- int i;
- for (i = 0; i < 10; ++i) {
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/100,
- /*decoder_database=*/decoder_database));
- }
- EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
- uint32_t next_ts;
- EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
- EXPECT_EQ(0u, next_ts); // Expect first inserted packet to be first in line.
-
- const Packet packet = gen.NextPacket(payload_len, nullptr);
- EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(6);
- // Insert 11th packet; should cause a partial flush and insert the packet
- // after flushing.
- EXPECT_EQ(PacketBuffer::kPartialFlush,
- buffer.InsertPacket(/*packet=*/packet.Clone(),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/40,
- /*decoder_database=*/decoder_database));
- EXPECT_EQ(5u, buffer.NumPacketsInBuffer());
- EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
-}
-
// Test inserting a list of packets.
TEST(PacketBuffer, InsertPacketList) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
PacketGenerator gen(0, 0, 0, 10);
PacketList list;
const int payload_len = 10;
@@ -320,20 +217,14 @@ TEST(PacketBuffer, InsertPacketList) {
EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(&info));
- StrictMock<MockStatisticsCalculator> mock_stats;
-
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kOK,
+ buffer.InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
EXPECT_EQ(0, current_pt); // Current payload type changed to 0.
@@ -347,7 +238,8 @@ TEST(PacketBuffer, InsertPacketList) {
// TODO(hlundin): Remove this test when legacy operation is no longer needed.
TEST(PacketBuffer, InsertPacketListChangePayloadType) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
PacketGenerator gen(0, 0, 0, 10);
PacketList list;
const int payload_len = 10;
@@ -374,21 +266,15 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
EXPECT_CALL(decoder_database, GetDecoderInfo(1))
.WillRepeatedly(Return(&info1));
- StrictMock<MockStatisticsCalculator> mock_stats;
-
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(10);
- EXPECT_EQ(
- PacketBuffer::kFlushed,
- buffer.InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kFlushed,
+ buffer.InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet.
EXPECT_EQ(1, current_pt); // Current payload type changed to 1.
@@ -399,7 +285,8 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
TEST(PacketBuffer, ExtractOrderRedundancy) {
TickTimer tick_timer;
- PacketBuffer buffer(100, &tick_timer); // 100 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(100, &tick_timer, &mock_stats); // 100 packets.
const int kPackets = 18;
const int kFrameSize = 10;
const int kPayloadLength = 10;
@@ -423,8 +310,6 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
PacketGenerator gen(0, 0, 0, kFrameSize);
- StrictMock<MockStatisticsCalculator> mock_stats;
-
// Interleaving the EXPECT_CALL sequence with expectations on the MockFunction
// check ensures that exactly one call to PacketsDiscarded happens in each
// DiscardNextPacket call.
@@ -444,12 +329,7 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
}
EXPECT_CALL(check, Call(i));
EXPECT_EQ(PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/packet.Clone(),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kPayloadLength,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer.InsertPacket(/*packet=*/packet.Clone()));
if (packet_facts[i].extract_order >= 0) {
expect_order[packet_facts[i].extract_order] = std::move(packet);
}
@@ -468,25 +348,20 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
TEST(PacketBuffer, DiscardPackets) {
TickTimer tick_timer;
- PacketBuffer buffer(100, &tick_timer); // 100 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(100, &tick_timer, &mock_stats); // 100 packets.
const uint16_t start_seq_no = 17;
const uint32_t start_ts = 4711;
const uint32_t ts_increment = 10;
PacketGenerator gen(start_seq_no, start_ts, 0, ts_increment);
PacketList list;
const int payload_len = 10;
- StrictMock<MockStatisticsCalculator> mock_stats;
MockDecoderDatabase decoder_database;
constexpr int kTotalPackets = 10;
// Insert 10 small packets.
for (int i = 0; i < kTotalPackets; ++i) {
- buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database);
+ buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr));
}
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
@@ -507,7 +382,7 @@ TEST(PacketBuffer, DiscardPackets) {
EXPECT_EQ(current_ts, ts);
EXPECT_CALL(mock_stats, PacketsDiscarded(1));
EXPECT_CALL(check, Call(i));
- EXPECT_EQ(PacketBuffer::kOK, buffer.DiscardNextPacket(&mock_stats));
+ EXPECT_EQ(PacketBuffer::kOK, buffer.DiscardNextPacket());
current_ts += ts_increment;
check.Call(i);
}
@@ -520,7 +395,7 @@ TEST(PacketBuffer, DiscardPackets) {
.Times(kRemainingPackets - kSkipPackets);
EXPECT_CALL(check, Call(17)); // Arbitrary id number.
buffer.DiscardOldPackets(start_ts + kTotalPackets * ts_increment,
- kRemainingPackets * ts_increment, &mock_stats);
+ kRemainingPackets * ts_increment);
check.Call(17); // Same arbitrary id number.
EXPECT_EQ(kSkipPackets, buffer.NumPacketsInBuffer());
@@ -530,8 +405,7 @@ TEST(PacketBuffer, DiscardPackets) {
// Discard all remaining packets.
EXPECT_CALL(mock_stats, PacketsDiscarded(kSkipPackets));
- buffer.DiscardAllOldPackets(start_ts + kTotalPackets * ts_increment,
- &mock_stats);
+ buffer.DiscardAllOldPackets(start_ts + kTotalPackets * ts_increment);
EXPECT_TRUE(buffer.Empty());
EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
@@ -539,7 +413,8 @@ TEST(PacketBuffer, DiscardPackets) {
TEST(PacketBuffer, Reordering) {
TickTimer tick_timer;
- PacketBuffer buffer(100, &tick_timer); // 100 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(100, &tick_timer, &mock_stats); // 100 packets.
const uint16_t start_seq_no = 17;
const uint32_t start_ts = 4711;
const uint32_t ts_increment = 10;
@@ -568,18 +443,12 @@ TEST(PacketBuffer, Reordering) {
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
- StrictMock<MockStatisticsCalculator> mock_stats;
-
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kOK,
+ buffer.InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
// Extract them and make sure that come out in the right order.
@@ -601,7 +470,8 @@ TEST(PacketBuffer, Reordering) {
// and flush out the CNG packet.
TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
TickTimer tick_timer;
- PacketBuffer buffer(10, &tick_timer); // 10 packets.
+ StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(10, &tick_timer, &mock_stats); // 10 packets.
const uint8_t kCngPt = 13;
const int kPayloadLen = 10;
const uint8_t kSpeechPt = 100;
@@ -624,18 +494,12 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
- StrictMock<MockStatisticsCalculator> mock_stats;
-
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer.InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kPayloadLen,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kOK,
+ buffer.InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_TRUE(list.empty());
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
ASSERT_TRUE(buffer.PeekNextPacket());
@@ -652,16 +516,12 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
// Expect the buffer to flush out the CNG packet, since it does not match the
// new speech sample rate.
EXPECT_CALL(mock_stats, PacketsDiscarded(1));
- EXPECT_EQ(
- PacketBuffer::kFlushed,
- buffer.InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kPayloadLen,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kFlushed,
+ buffer.InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_TRUE(list.empty());
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
ASSERT_TRUE(buffer.PeekNextPacket());
@@ -683,17 +543,13 @@ TEST(PacketBuffer, Failures) {
StrictMock<MockStatisticsCalculator> mock_stats;
MockDecoderDatabase decoder_database;
- PacketBuffer* buffer = new PacketBuffer(100, &tick_timer); // 100 packets.
+ PacketBuffer* buffer =
+ new PacketBuffer(100, &tick_timer, &mock_stats); // 100 packets.
{
Packet packet = gen.NextPacket(payload_len, nullptr);
packet.payload.Clear();
EXPECT_EQ(PacketBuffer::kInvalidPacket,
- buffer->InsertPacket(/*packet=*/std::move(packet),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer->InsertPacket(/*packet=*/std::move(packet)));
}
// Buffer should still be empty. Test all empty-checks.
uint32_t temp_ts;
@@ -705,18 +561,12 @@ TEST(PacketBuffer, Failures) {
// Discarding packets will not invoke mock_stats.PacketDiscarded() because the
// packet buffer is empty.
- EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket(&mock_stats));
- buffer->DiscardAllOldPackets(0, &mock_stats);
+ EXPECT_EQ(PacketBuffer::kBufferEmpty, buffer->DiscardNextPacket());
+ buffer->DiscardAllOldPackets(0);
// Insert one packet to make the buffer non-empty.
- EXPECT_EQ(
- PacketBuffer::kOK,
- buffer->InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ EXPECT_EQ(PacketBuffer::kOK, buffer->InsertPacket(/*packet=*/gen.NextPacket(
+ payload_len, nullptr)));
EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(NULL));
EXPECT_EQ(PacketBuffer::kInvalidPointer,
buffer->NextHigherTimestamp(0, NULL));
@@ -725,7 +575,7 @@ TEST(PacketBuffer, Failures) {
// Insert packet list of three packets, where the second packet has an invalid
// payload. Expect first packet to be inserted, and the remaining two to be
// discarded.
- buffer = new PacketBuffer(100, &tick_timer); // 100 packets.
+ buffer = new PacketBuffer(100, &tick_timer, &mock_stats); // 100 packets.
PacketList list;
list.push_back(gen.NextPacket(payload_len, nullptr)); // Valid packet.
{
@@ -741,16 +591,12 @@ TEST(PacketBuffer, Failures) {
.WillRepeatedly(Return(&info));
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
- EXPECT_EQ(
- PacketBuffer::kInvalidPacket,
- buffer->InsertPacketList(/*packet_list=*/&list,
- /*decoder_database=*/decoder_database,
- /*current_rtp_payload_type=*/&current_pt,
- /*current_cng_rtp_payload_type=*/&current_cng_pt,
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/payload_len,
- /*sample_rate=*/1000,
- /*target_level_ms=*/30));
+ EXPECT_EQ(PacketBuffer::kInvalidPacket,
+ buffer->InsertPacketList(
+ /*packet_list=*/&list,
+ /*decoder_database=*/decoder_database,
+ /*current_rtp_payload_type=*/&current_pt,
+ /*current_cng_rtp_payload_type=*/&current_cng_pt));
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
EXPECT_EQ(1u, buffer->NumPacketsInBuffer());
delete buffer;
@@ -873,9 +719,9 @@ TEST(PacketBuffer, GetSpanSamples) {
constexpr int kSampleRateHz = 48000;
constexpr bool kCountWaitingTime = false;
TickTimer tick_timer;
- PacketBuffer buffer(3, &tick_timer);
- PacketGenerator gen(0, kStartTimeStamp, 0, kFrameSizeSamples);
StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(3, &tick_timer, &mock_stats);
+ PacketGenerator gen(0, kStartTimeStamp, 0, kFrameSizeSamples);
MockDecoderDatabase decoder_database;
Packet packet_1 = gen.NextPacket(kPayloadSizeBytes, nullptr);
@@ -891,12 +737,7 @@ TEST(PacketBuffer, GetSpanSamples) {
packet_2.timestamp); // Tmestamp wrapped around.
EXPECT_EQ(PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/std::move(packet_1),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kFrameSizeSamples,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer.InsertPacket(/*packet=*/std::move(packet_1)));
constexpr size_t kLastDecodedSizeSamples = 2;
// packet_1 has no access to duration, and relies last decoded duration as
@@ -906,12 +747,7 @@ TEST(PacketBuffer, GetSpanSamples) {
kCountWaitingTime));
EXPECT_EQ(PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/std::move(packet_2),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kFrameSizeSamples,
- /*sample_rate=*/1000,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer.InsertPacket(/*packet=*/std::move(packet_2)));
EXPECT_EQ(kFrameSizeSamples * 2,
buffer.GetSpanSamples(0, kSampleRateHz, kCountWaitingTime));
@@ -931,20 +767,15 @@ TEST(PacketBuffer, GetSpanSamplesCountWaitingTime) {
constexpr bool kCountWaitingTime = true;
constexpr size_t kLastDecodedSizeSamples = 0;
TickTimer tick_timer;
- PacketBuffer buffer(3, &tick_timer);
- PacketGenerator gen(0, kStartTimeStamp, 0, kFrameSizeSamples);
StrictMock<MockStatisticsCalculator> mock_stats;
+ PacketBuffer buffer(3, &tick_timer, &mock_stats);
+ PacketGenerator gen(0, kStartTimeStamp, 0, kFrameSizeSamples);
MockDecoderDatabase decoder_database;
Packet packet = gen.NextPacket(kPayloadSizeBytes, nullptr);
EXPECT_EQ(PacketBuffer::kOK,
- buffer.InsertPacket(/*packet=*/std::move(packet),
- /*stats=*/&mock_stats,
- /*last_decoded_length=*/kFrameSizeSamples,
- /*sample_rate=*/kSampleRateHz,
- /*target_level_ms=*/60,
- /*decoder_database=*/decoder_database));
+ buffer.InsertPacket(/*packet=*/std::move(packet)));
EXPECT_EQ(0u, buffer.GetSpanSamples(kLastDecodedSizeSamples, kSampleRateHz,
kCountWaitingTime));
diff --git a/modules/audio_coding/neteq/test/neteq_decoding_test.cc b/modules/audio_coding/neteq/test/neteq_decoding_test.cc
index e6c1809fb6..e626d09c99 100644
--- a/modules/audio_coding/neteq/test/neteq_decoding_test.cc
+++ b/modules/audio_coding/neteq/test/neteq_decoding_test.cc
@@ -19,13 +19,13 @@
#include "test/testsupport/file_utils.h"
#ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
-RTC_PUSH_IGNORING_WUNDEF()
+
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h"
#else
#include "modules/audio_coding/neteq/neteq_unittest.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
+
#endif
namespace webrtc {
diff --git a/modules/audio_coding/neteq/test/neteq_performance_unittest.cc b/modules/audio_coding/neteq/test/neteq_performance_unittest.cc
index 961f74ab66..1b453cf7bf 100644
--- a/modules/audio_coding/neteq/test/neteq_performance_unittest.cc
+++ b/modules/audio_coding/neteq/test/neteq_performance_unittest.cc
@@ -8,11 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "absl/flags/flag.h"
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
#include "api/test/metrics/metric.h"
#include "modules/audio_coding/neteq/tools/neteq_performance_test.h"
-#include "system_wrappers/include/field_trial.h"
#include "test/gtest.h"
+#include "test/test_flags.h"
namespace webrtc {
namespace {
@@ -29,8 +30,8 @@ TEST(NetEqPerformanceTest, 10_Pl_10_Drift) {
const int kLossPeriod = 10; // Drop every 10th packet.
const double kDriftFactor = 0.1;
int64_t runtime = test::NetEqPerformanceTest::Run(
- field_trial::IsEnabled("WebRTC-QuickPerfTest") ? kQuickSimulationTimeMs
- : kSimulationTimeMs,
+ absl::GetFlag(FLAGS_webrtc_quick_perf_test) ? kQuickSimulationTimeMs
+ : kSimulationTimeMs,
kLossPeriod, kDriftFactor);
ASSERT_GT(runtime, 0);
GetGlobalMetricsLogger()->LogSingleValueMetric(
@@ -47,8 +48,8 @@ TEST(NetEqPerformanceTest, 0_Pl_0_Drift) {
const int kLossPeriod = 0; // No losses.
const double kDriftFactor = 0.0; // No clock drift.
int64_t runtime = test::NetEqPerformanceTest::Run(
- field_trial::IsEnabled("WebRTC-QuickPerfTest") ? kQuickSimulationTimeMs
- : kSimulationTimeMs,
+ absl::GetFlag(FLAGS_webrtc_quick_perf_test) ? kQuickSimulationTimeMs
+ : kSimulationTimeMs,
kLossPeriod, kDriftFactor);
ASSERT_GT(runtime, 0);
GetGlobalMetricsLogger()->LogSingleValueMetric(
diff --git a/modules/audio_coding/neteq/test/result_sink.cc b/modules/audio_coding/neteq/test/result_sink.cc
index f5d50dc859..fee7b49eb3 100644
--- a/modules/audio_coding/neteq/test/result_sink.cc
+++ b/modules/audio_coding/neteq/test/result_sink.cc
@@ -13,19 +13,18 @@
#include <string>
#include "absl/strings/string_view.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/message_digest.h"
#include "rtc_base/string_encode.h"
#include "test/gtest.h"
#ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
-RTC_PUSH_IGNORING_WUNDEF()
+
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h"
#else
#include "modules/audio_coding/neteq/neteq_unittest.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
+
#endif
namespace webrtc {
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index f1ab09d154..6f52cf8af1 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -48,6 +48,7 @@ rtc_source_set("audio_device_api") {
"include/audio_device_defines.h",
]
deps = [
+ "../../api:ref_count",
"../../api:scoped_refptr",
"../../api/task_queue",
"../../rtc_base:checks",
@@ -481,7 +482,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../../common_audio",
"../../rtc_base:buffer",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:race_checker",
diff --git a/modules/audio_device/include/audio_device.h b/modules/audio_device/include/audio_device.h
index 936ee6cb04..47d2aecfa7 100644
--- a/modules/audio_device/include/audio_device.h
+++ b/modules/audio_device/include/audio_device.h
@@ -12,16 +12,16 @@
#define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_H_
#include "absl/types/optional.h"
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_factory.h"
#include "modules/audio_device/include/audio_device_defines.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
class AudioDeviceModuleForTest;
-class AudioDeviceModule : public rtc::RefCountInterface {
+class AudioDeviceModule : public webrtc::RefCountInterface {
public:
enum AudioLayer {
kPlatformDefaultAudio = 0,
diff --git a/modules/audio_device/include/fake_audio_device.h b/modules/audio_device/include/fake_audio_device.h
index 2322ce0263..2a303173e9 100644
--- a/modules/audio_device/include/fake_audio_device.h
+++ b/modules/audio_device/include/fake_audio_device.h
@@ -23,8 +23,8 @@ class FakeAudioDeviceModule
// references using scoped_refptr. Current code doesn't always use refcounting
// for this class.
void AddRef() const override {}
- rtc::RefCountReleaseStatus Release() const override {
- return rtc::RefCountReleaseStatus::kDroppedLastRef;
+ webrtc::RefCountReleaseStatus Release() const override {
+ return webrtc::RefCountReleaseStatus::kDroppedLastRef;
}
};
diff --git a/modules/audio_mixer/audio_mixer_impl_unittest.cc b/modules/audio_mixer/audio_mixer_impl_unittest.cc
index 641c966570..2044cb9b90 100644
--- a/modules/audio_mixer/audio_mixer_impl_unittest.cc
+++ b/modules/audio_mixer/audio_mixer_impl_unittest.cc
@@ -142,6 +142,7 @@ void MixMonoAtGivenNativeRate(int native_sample_rate,
}
TEST(AudioMixer, UpdatesSourceCountHistogram) {
+ metrics::Reset();
constexpr int kAudioSourcesGroup1 = 5;
constexpr int kAudioSourcesGroup2 = 3;
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 64e83a006b..6aca7dee46 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -29,6 +29,7 @@ rtc_library("api") {
":audio_frame_view",
":audio_processing_statistics",
"../../api:array_view",
+ "../../api:ref_count",
"../../api:scoped_refptr",
"../../api/audio:aec3_config",
"../../api/audio:audio_frame_api",
@@ -190,7 +191,6 @@ rtc_library("audio_processing") {
"../../rtc_base:checks",
"../../rtc_base:event_tracer",
"../../rtc_base:gtest_prod",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:safe_minmax",
@@ -371,10 +371,12 @@ if (rtc_include_tests) {
"echo_control_mobile_unittest.cc",
"gain_controller2_unittest.cc",
"splitting_filter_unittest.cc",
+ "test/echo_canceller3_config_json_unittest.cc",
"test/fake_recording_device_unittest.cc",
]
deps = [
+ ":aec3_config_json",
":analog_mic_simulation",
":api",
":apm_logging",
@@ -395,7 +397,6 @@ if (rtc_include_tests) {
"../../common_audio:common_audio_c",
"../../rtc_base:checks",
"../../rtc_base:gtest_prod",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:macromagic",
"../../rtc_base:platform_thread",
"../../rtc_base:protobuf_utils",
@@ -558,6 +559,7 @@ if (rtc_include_tests) {
]
deps = [
+ ":aec3_config_json",
":analog_mic_simulation",
":api",
":apm_logging",
@@ -566,12 +568,10 @@ if (rtc_include_tests) {
":audioproc_protobuf_utils",
":audioproc_test_utils",
":runtime_settings_protobuf_utils",
- "../../api/audio:aec3_config_json",
"../../api/audio:aec3_factory",
"../../api/audio:echo_detector_creator",
"../../common_audio",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:logging",
"../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_json",
@@ -611,7 +611,6 @@ if (rtc_include_tests) {
deps = [
":audioproc_debug_proto",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:protobuf_utils",
"../../rtc_base/system:arch",
]
@@ -675,3 +674,21 @@ rtc_library("audioproc_test_utils") {
"//third_party/abseil-cpp/absl/types:optional",
]
}
+
+rtc_library("aec3_config_json") {
+ visibility = [ "*" ]
+ testonly = true
+ sources = [
+ "test/echo_canceller3_config_json.cc",
+ "test/echo_canceller3_config_json.h",
+ ]
+ deps = [
+ "../../api/audio:aec3_config",
+ "../../rtc_base:checks",
+ "../../rtc_base:logging",
+ "../../rtc_base:rtc_json",
+ "../../rtc_base:stringutils",
+ "../../rtc_base/system:rtc_export",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
+}
diff --git a/modules/audio_processing/aec_dump/BUILD.gn b/modules/audio_processing/aec_dump/BUILD.gn
index 38d8776258..78bae56835 100644
--- a/modules/audio_processing/aec_dump/BUILD.gn
+++ b/modules/audio_processing/aec_dump/BUILD.gn
@@ -66,7 +66,6 @@ if (rtc_enable_protobuf) {
"../../../api/audio:audio_frame_api",
"../../../api/task_queue",
"../../../rtc_base:checks",
- "../../../rtc_base:ignore_wundef",
"../../../rtc_base:logging",
"../../../rtc_base:macromagic",
"../../../rtc_base:protobuf_utils",
diff --git a/modules/audio_processing/aec_dump/aec_dump_impl.h b/modules/audio_processing/aec_dump/aec_dump_impl.h
index fac3712b7a..429808f9af 100644
--- a/modules/audio_processing/aec_dump/aec_dump_impl.h
+++ b/modules/audio_processing/aec_dump/aec_dump_impl.h
@@ -17,20 +17,17 @@
#include "modules/audio_processing/aec_dump/capture_stream_info.h"
#include "modules/audio_processing/include/aec_dump.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/race_checker.h"
#include "rtc_base/system/file_wrapper.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h"
// Files generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
#else
#include "modules/audio_processing/debug.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
diff --git a/modules/audio_processing/aec_dump/capture_stream_info.h b/modules/audio_processing/aec_dump/capture_stream_info.h
index 0819bbcb23..572990c150 100644
--- a/modules/audio_processing/aec_dump/capture_stream_info.h
+++ b/modules/audio_processing/aec_dump/capture_stream_info.h
@@ -15,16 +15,13 @@
#include <utility>
#include "modules/audio_processing/include/aec_dump.h"
-#include "rtc_base/ignore_wundef.h"
// Files generated at build-time by the protobuf compiler.
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
#else
#include "modules/audio_processing/debug.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h
index fe80e0d912..1e058b5a32 100644
--- a/modules/audio_processing/audio_processing_impl.h
+++ b/modules/audio_processing/audio_processing_impl.h
@@ -43,7 +43,6 @@
#include "modules/audio_processing/rms_level.h"
#include "modules/audio_processing/transient/transient_suppressor.h"
#include "rtc_base/gtest_prod_util.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/swap_queue.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
diff --git a/modules/audio_processing/audio_processing_impl_unittest.cc b/modules/audio_processing/audio_processing_impl_unittest.cc
index 9e50f994b1..e03f966b06 100644
--- a/modules/audio_processing/audio_processing_impl_unittest.cc
+++ b/modules/audio_processing/audio_processing_impl_unittest.cc
@@ -48,7 +48,7 @@ class MockInitialize : public AudioProcessingImpl {
}
MOCK_METHOD(void, AddRef, (), (const, override));
- MOCK_METHOD(rtc::RefCountReleaseStatus, Release, (), (const, override));
+ MOCK_METHOD(RefCountReleaseStatus, Release, (), (const, override));
};
// Creates MockEchoControl instances and provides a raw pointer access to
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc
index e320e71405..c2bedb2da4 100644
--- a/modules/audio_processing/audio_processing_unittest.cc
+++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -38,7 +38,6 @@
#include "rtc_base/checks.h"
#include "rtc_base/fake_clock.h"
#include "rtc_base/gtest_prod_util.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/protobuf_utils.h"
@@ -51,14 +50,13 @@
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
-RTC_PUSH_IGNORING_WUNDEF()
-#include "modules/audio_processing/debug.pb.h"
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
+#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
#include "external/webrtc/webrtc/modules/audio_processing/test/unittest.pb.h"
#else
+#include "modules/audio_processing/debug.pb.h"
#include "modules/audio_processing/test/unittest.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
ABSL_FLAG(bool,
write_apm_ref_data,
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index f613a38de1..e3223513af 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -28,10 +28,10 @@
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h"
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
#include "rtc_base/arraysize.h"
-#include "rtc_base/ref_count.h"
#include "rtc_base/system/file_wrapper.h"
#include "rtc_base/system/rtc_export.h"
@@ -127,7 +127,7 @@ class CustomProcessing;
// // Close the application...
// apm.reset();
//
-class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
+class RTC_EXPORT AudioProcessing : public RefCountInterface {
public:
// The struct below constitutes the new parameter scheme for the audio
// processing. It is being introduced gradually and until it is fully
@@ -912,7 +912,7 @@ class CustomProcessing {
};
// Interface for an echo detector submodule.
-class EchoDetector : public rtc::RefCountInterface {
+class EchoDetector : public RefCountInterface {
public:
// (Re-)Initializes the submodule.
virtual void Initialize(int capture_sample_rate_hz,
diff --git a/modules/audio_processing/test/aec_dump_based_simulator.h b/modules/audio_processing/test/aec_dump_based_simulator.h
index e2c1f3e4ba..4713c800ec 100644
--- a/modules/audio_processing/test/aec_dump_based_simulator.h
+++ b/modules/audio_processing/test/aec_dump_based_simulator.h
@@ -15,15 +15,12 @@
#include <string>
#include "modules/audio_processing/test/audio_processing_simulator.h"
-#include "rtc_base/ignore_wundef.h"
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
#else
#include "modules/audio_processing/debug.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
namespace test {
diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc
index 7497d49fde..7bd6da0133 100644
--- a/modules/audio_processing/test/audio_processing_simulator.cc
+++ b/modules/audio_processing/test/audio_processing_simulator.cc
@@ -19,13 +19,13 @@
#include <vector>
#include "absl/strings/string_view.h"
-#include "api/audio/echo_canceller3_config_json.h"
#include "api/audio/echo_canceller3_factory.h"
#include "api/audio/echo_detector_creator.h"
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
#include "modules/audio_processing/echo_control_mobile_impl.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
+#include "modules/audio_processing/test/echo_canceller3_config_json.h"
#include "modules/audio_processing/test/fake_recording_device.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
diff --git a/modules/audio_processing/test/debug_dump_replayer.h b/modules/audio_processing/test/debug_dump_replayer.h
index be21c68663..077147eb68 100644
--- a/modules/audio_processing/test/debug_dump_replayer.h
+++ b/modules/audio_processing/test/debug_dump_replayer.h
@@ -16,11 +16,9 @@
#include "absl/strings/string_view.h"
#include "common_audio/channel_buffer.h"
#include "modules/audio_processing/include/audio_processing.h"
-#include "rtc_base/ignore_wundef.h"
-RTC_PUSH_IGNORING_WUNDEF()
+// Generated at build-time by the protobuf compiler.
#include "modules/audio_processing/debug.pb.h"
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
namespace test {
diff --git a/api/audio/echo_canceller3_config_json.cc b/modules/audio_processing/test/echo_canceller3_config_json.cc
index 96e45ffe6d..d05e2841f0 100644
--- a/api/audio/echo_canceller3_config_json.cc
+++ b/modules/audio_processing/test/echo_canceller3_config_json.cc
@@ -7,7 +7,7 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/audio/echo_canceller3_config_json.h"
+#include "modules/audio_processing/test/echo_canceller3_config_json.h"
#include <stddef.h>
@@ -429,13 +429,6 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
}
}
-EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) {
- EchoCanceller3Config cfg;
- bool not_used;
- Aec3ConfigFromJsonString(json_string, &cfg, &not_used);
- return cfg;
-}
-
std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
rtc::StringBuilder ost;
ost << "{";
diff --git a/api/audio/echo_canceller3_config_json.h b/modules/audio_processing/test/echo_canceller3_config_json.h
index ecee9541c7..6637c8fbfb 100644
--- a/api/audio/echo_canceller3_config_json.h
+++ b/modules/audio_processing/test/echo_canceller3_config_json.h
@@ -8,14 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_
-#define API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_
+#ifndef MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_
+#define MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_
#include <string>
#include "absl/strings/string_view.h"
#include "api/audio/echo_canceller3_config.h"
-#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// Parses a JSON-encoded string into an Aec3 config. Fields corresponds to
@@ -23,23 +22,15 @@ namespace webrtc {
// "aec3". Produces default config values for anything that cannot be parsed
// from the string. If any error was found in the parsing, parsing_successful is
// set to false.
-RTC_EXPORT void Aec3ConfigFromJsonString(absl::string_view json_string,
+void Aec3ConfigFromJsonString(absl::string_view json_string,
EchoCanceller3Config* config,
bool* parsing_successful);
-// To be deprecated.
-// Parses a JSON-encoded string into an Aec3 config. Fields corresponds to
-// substruct names, with the addition that there must be a top-level node
-// "aec3". Returns default config values for anything that cannot be parsed from
-// the string.
-RTC_EXPORT EchoCanceller3Config
-Aec3ConfigFromJsonString(absl::string_view json_string);
-
// Encodes an Aec3 config in JSON format. Fields corresponds to substruct names,
// with the addition that the top-level node is named "aec3".
-RTC_EXPORT std::string Aec3ConfigToJsonString(
+std::string Aec3ConfigToJsonString(
const EchoCanceller3Config& config);
} // namespace webrtc
-#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_JSON_H_
+#endif // MODULES_AUDIO_PROCESSING_TEST_ECHO_CANCELLER3_CONFIG_JSON_H_
diff --git a/api/audio/test/echo_canceller3_config_json_unittest.cc b/modules/audio_processing/test/echo_canceller3_config_json_unittest.cc
index 4146dda9fe..18c7e9f110 100644
--- a/api/audio/test/echo_canceller3_config_json_unittest.cc
+++ b/modules/audio_processing/test/echo_canceller3_config_json_unittest.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/audio/echo_canceller3_config_json.h"
+#include "modules/audio_processing/test/echo_canceller3_config_json.h"
#include "api/audio/echo_canceller3_config.h"
#include "test/gtest.h"
@@ -36,8 +36,12 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
cfg.multi_channel.stereo_detection_threshold += 1.0f;
cfg.multi_channel.stereo_detection_timeout_threshold_seconds += 1;
cfg.multi_channel.stereo_detection_hysteresis_seconds += 1;
+
std::string json_string = Aec3ConfigToJsonString(cfg);
- EchoCanceller3Config cfg_transformed = Aec3ConfigFromJsonString(json_string);
+ EchoCanceller3Config cfg_transformed;
+ bool parsing_successful;
+ Aec3ConfigFromJsonString(json_string, &cfg_transformed, & parsing_successful);
+ ASSERT_TRUE(parsing_successful);
// Expect unchanged values to remain default.
EXPECT_EQ(cfg.ep_strength.default_len,
diff --git a/modules/audio_processing/test/protobuf_utils.h b/modules/audio_processing/test/protobuf_utils.h
index b9c2e819f9..eb93383f5a 100644
--- a/modules/audio_processing/test/protobuf_utils.h
+++ b/modules/audio_processing/test/protobuf_utils.h
@@ -14,12 +14,10 @@
#include <memory>
#include <sstream> // no-presubmit-check TODO(webrtc:8982)
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/protobuf_utils.h"
-RTC_PUSH_IGNORING_WUNDEF()
+// Generated at build-time by the protobuf compiler.
#include "modules/audio_processing/debug.pb.h"
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn
index fbde45c9ce..c017d39f5d 100644
--- a/modules/congestion_controller/goog_cc/BUILD.gn
+++ b/modules/congestion_controller/goog_cc/BUILD.gn
@@ -156,7 +156,6 @@ rtc_library("loss_based_bwe_v2") {
deps = [
"../../../api:array_view",
"../../../api:field_trials_view",
- "../../../api:network_state_predictor_api",
"../../../api/transport:network_control",
"../../../api/units:data_rate",
"../../../api/units:data_size",
diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
index e84d188e88..94645dcc4a 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc
@@ -73,25 +73,26 @@ bool IsNotDisabled(const FieldTrialsView* config, absl::string_view key) {
return !absl::StartsWith(config->Lookup(key), "Disabled");
}
-BandwidthLimitedCause GetBandwidthLimitedCause(
- LossBasedState loss_based_state,
- bool is_rtt_above_limit,
- BandwidthUsage bandwidth_usage,
- bool not_probe_if_delay_increased) {
- if (not_probe_if_delay_increased) {
- if (bandwidth_usage == BandwidthUsage::kBwOverusing ||
- bandwidth_usage == BandwidthUsage::kBwUnderusing) {
- return BandwidthLimitedCause::kDelayBasedLimitedDelayIncreased;
- } else if (is_rtt_above_limit) {
- return BandwidthLimitedCause::kRttBasedBackOffHighRtt;
- }
+BandwidthLimitedCause GetBandwidthLimitedCause(LossBasedState loss_based_state,
+ bool is_rtt_above_limit,
+ BandwidthUsage bandwidth_usage) {
+ if (bandwidth_usage == BandwidthUsage::kBwOverusing ||
+ bandwidth_usage == BandwidthUsage::kBwUnderusing) {
+ return BandwidthLimitedCause::kDelayBasedLimitedDelayIncreased;
+ } else if (is_rtt_above_limit) {
+ return BandwidthLimitedCause::kRttBasedBackOffHighRtt;
}
switch (loss_based_state) {
case LossBasedState::kDecreasing:
- return BandwidthLimitedCause::kLossLimitedBweDecreasing;
+ // Probes may not be sent in this state.
+ return BandwidthLimitedCause::kLossLimitedBwe;
+ case webrtc::LossBasedState::kIncreaseUsingPadding:
+ // Probes may not be sent in this state.
+ return BandwidthLimitedCause::kLossLimitedBwe;
case LossBasedState::kIncreasing:
+ // Probes may be sent in this state.
return BandwidthLimitedCause::kLossLimitedBweIncreasing;
- default:
+ case LossBasedState::kDelayBasedEstimate:
return BandwidthLimitedCause::kDelayBasedLimited;
}
}
@@ -112,8 +113,8 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config,
key_value_config_,
"WebRTC-Bwe-IgnoreProbesLowerThanNetworkStateEstimate")),
limit_probes_lower_than_throughput_estimate_(
- IsEnabled(key_value_config_,
- "WebRTC-Bwe-LimitProbesLowerThanThroughputEstimate")),
+ IsNotDisabled(key_value_config_,
+ "WebRTC-Bwe-LimitProbesLowerThanThroughputEstimate")),
rate_control_settings_(
RateControlSettings::ParseFromKeyValueConfig(key_value_config_)),
pace_at_max_of_bwe_and_lower_link_capacity_(
@@ -144,6 +145,7 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config,
last_loss_based_target_rate_(*config.constraints.starting_rate),
last_pushback_target_rate_(last_loss_based_target_rate_),
last_stable_target_rate_(last_loss_based_target_rate_),
+ last_loss_base_state_(LossBasedState::kDelayBasedEstimate),
pacing_factor_(config.stream_based_config.pacing_factor.value_or(
kDefaultPaceMultiplier)),
min_total_allocated_bitrate_(
@@ -639,6 +641,7 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged(
uint8_t fraction_loss = bandwidth_estimation_->fraction_loss();
TimeDelta round_trip_time = bandwidth_estimation_->round_trip_time();
DataRate loss_based_target_rate = bandwidth_estimation_->target_rate();
+ LossBasedState loss_based_state = bandwidth_estimation_->loss_based_state();
DataRate pushback_target_rate = loss_based_target_rate;
BWE_TEST_LOGGING_PLOT(1, "fraction_loss_%", at_time.ms(),
@@ -666,6 +669,7 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged(
stable_target_rate = std::min(stable_target_rate, pushback_target_rate);
if ((loss_based_target_rate != last_loss_based_target_rate_) ||
+ (loss_based_state != last_loss_base_state_) ||
(fraction_loss != last_estimated_fraction_loss_) ||
(round_trip_time != last_estimated_round_trip_time_) ||
(pushback_target_rate != last_pushback_target_rate_) ||
@@ -675,6 +679,7 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged(
last_estimated_fraction_loss_ = fraction_loss;
last_estimated_round_trip_time_ = round_trip_time;
last_stable_target_rate_ = stable_target_rate;
+ last_loss_base_state_ = loss_based_state;
alr_detector_->SetEstimatedBitrate(loss_based_target_rate.bps());
@@ -698,11 +703,9 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged(
auto probes = probe_controller_->SetEstimatedBitrate(
loss_based_target_rate,
- GetBandwidthLimitedCause(
- bandwidth_estimation_->loss_based_state(),
- bandwidth_estimation_->IsRttAboveLimit(),
- delay_based_bwe_->last_state(),
- probe_controller_->DontProbeIfDelayIncreased()),
+ GetBandwidthLimitedCause(bandwidth_estimation_->loss_based_state(),
+ bandwidth_estimation_->IsRttAboveLimit(),
+ delay_based_bwe_->last_state()),
at_time);
update->probe_cluster_configs.insert(update->probe_cluster_configs.end(),
probes.begin(), probes.end());
@@ -728,7 +731,10 @@ PacerConfig GoogCcNetworkController::GetPacingRates(Timestamp at_time) const {
pacing_factor_;
}
DataRate padding_rate =
- std::min(max_padding_rate_, last_pushback_target_rate_);
+ (last_loss_base_state_ == LossBasedState::kIncreaseUsingPadding)
+ ? std::max(max_padding_rate_, last_loss_based_target_rate_)
+ : max_padding_rate_;
+ padding_rate = std::min(padding_rate, last_pushback_target_rate_);
PacerConfig msg;
msg.at_time = at_time;
msg.time_window = TimeDelta::Seconds(1);
diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.h b/modules/congestion_controller/goog_cc/goog_cc_network_control.h
index 3ebcf08abf..957cedbac6 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control.h
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.h
@@ -130,6 +130,7 @@ class GoogCcNetworkController : public NetworkControllerInterface {
DataRate last_loss_based_target_rate_;
DataRate last_pushback_target_rate_;
DataRate last_stable_target_rate_;
+ LossBasedState last_loss_base_state_;
absl::optional<uint8_t> last_estimated_fraction_loss_ = 0;
TimeDelta last_estimated_round_trip_time_ = TimeDelta::PlusInfinity();
diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc
index 025ab94eca..c97d34da22 100644
--- a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc
+++ b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc
@@ -290,12 +290,15 @@ class NetworkControllerTestFixture {
GoogCcNetworkControllerFactory factory_;
};
-TEST(GoogCcNetworkControllerTest, InitializeTargetRateOnFirstProcessInterval) {
+TEST(GoogCcNetworkControllerTest,
+ InitializeTargetRateOnFirstProcessIntervalAfterNetworkAvailable) {
NetworkControllerTestFixture fixture;
std::unique_ptr<NetworkControllerInterface> controller =
fixture.CreateController();
- NetworkControlUpdate update =
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = Timestamp::Millis(123456), .network_available = true});
+ update =
controller->OnProcessInterval({.at_time = Timestamp::Millis(123456)});
EXPECT_EQ(update.target_rate->target_rate, kInitialBitrate);
@@ -312,8 +315,9 @@ TEST(GoogCcNetworkControllerTest, ReactsToChangedNetworkConditions) {
std::unique_ptr<NetworkControllerInterface> controller =
fixture.CreateController();
Timestamp current_time = Timestamp::Millis(123);
- NetworkControlUpdate update =
- controller->OnProcessInterval({.at_time = current_time});
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = current_time, .network_available = true});
+ update = controller->OnProcessInterval({.at_time = current_time});
update = controller->OnRemoteBitrateReport(
{.receive_time = current_time, .bandwidth = kInitialBitrate * 2});
@@ -337,8 +341,11 @@ TEST(GoogCcNetworkControllerTest, OnNetworkRouteChanged) {
std::unique_ptr<NetworkControllerInterface> controller =
fixture.CreateController();
Timestamp current_time = Timestamp::Millis(123);
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = current_time, .network_available = true});
DataRate new_bitrate = DataRate::BitsPerSec(200000);
- NetworkControlUpdate update = controller->OnNetworkRouteChange(
+
+ update = controller->OnNetworkRouteChange(
CreateRouteChange(current_time, new_bitrate));
EXPECT_EQ(update.target_rate->target_rate, new_bitrate);
EXPECT_EQ(update.pacer_config->data_rate(), new_bitrate * kDefaultPacingRate);
@@ -359,7 +366,11 @@ TEST(GoogCcNetworkControllerTest, ProbeOnRouteChange) {
std::unique_ptr<NetworkControllerInterface> controller =
fixture.CreateController();
Timestamp current_time = Timestamp::Millis(123);
- NetworkControlUpdate update = controller->OnNetworkRouteChange(
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = current_time, .network_available = true});
+ current_time += TimeDelta::Seconds(3);
+
+ update = controller->OnNetworkRouteChange(
CreateRouteChange(current_time, 2 * kInitialBitrate, DataRate::Zero(),
20 * kInitialBitrate));
@@ -404,6 +415,8 @@ TEST(GoogCcNetworkControllerTest, UpdatesDelayBasedEstimate) {
fixture.CreateController();
const int64_t kRunTimeMs = 6000;
Timestamp current_time = Timestamp::Millis(123);
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = current_time, .network_available = true});
// The test must run and insert packets/feedback long enough that the
// BWE computes a valid estimate. This is first done in an environment which
@@ -428,8 +441,9 @@ TEST(GoogCcNetworkControllerTest, PaceAtMaxOfLowerLinkCapacityAndBwe) {
std::unique_ptr<NetworkControllerInterface> controller =
fixture.CreateController();
Timestamp current_time = Timestamp::Millis(123);
- NetworkControlUpdate update =
- controller->OnProcessInterval({.at_time = current_time});
+ NetworkControlUpdate update = controller->OnNetworkAvailability(
+ {.at_time = current_time, .network_available = true});
+ update = controller->OnProcessInterval({.at_time = current_time});
current_time += TimeDelta::Millis(100);
NetworkStateEstimate network_estimate = {.link_capacity_lower =
10 * kInitialBitrate};
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
index b58f0f7520..445be082e0 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
@@ -21,7 +21,6 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
-#include "api/network_state_predictor.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
@@ -36,6 +35,9 @@ namespace webrtc {
namespace {
+constexpr TimeDelta kInitHoldDuration = TimeDelta::Millis(300);
+constexpr TimeDelta kMaxHoldDuration = TimeDelta::Seconds(60);
+
bool IsValid(DataRate datarate) {
return datarate.IsFinite();
}
@@ -48,10 +50,13 @@ bool IsValid(Timestamp timestamp) {
return timestamp.IsFinite();
}
+double ToKiloBytes(DataSize datasize) { return datasize.bytes() / 1000.0; }
+
struct PacketResultsSummary {
int num_packets = 0;
int num_lost_packets = 0;
DataSize total_size = DataSize::Zero();
+ DataSize lost_size = DataSize::Zero();
Timestamp first_send_time = Timestamp::PlusInfinity();
Timestamp last_send_time = Timestamp::MinusInfinity();
};
@@ -66,6 +71,7 @@ PacketResultsSummary GetPacketResultsSummary(
for (const PacketResult& packet : packet_results) {
if (!packet.IsReceived()) {
packet_results_summary.num_lost_packets++;
+ packet_results_summary.lost_size += packet.sent_packet.size;
}
packet_results_summary.total_size += packet.sent_packet.size;
packet_results_summary.first_send_time = std::min(
@@ -119,12 +125,14 @@ LossBasedBweV2::LossBasedBweV2(const FieldTrialsView* key_value_config)
return;
}
- current_estimate_.inherent_loss = config_->initial_inherent_loss_estimate;
+ current_best_estimate_.inherent_loss =
+ config_->initial_inherent_loss_estimate;
observations_.resize(config_->observation_window_size);
temporal_weights_.resize(config_->observation_window_size);
instant_upper_bound_temporal_weights_.resize(
config_->observation_window_size);
CalculateTemporalWeights();
+ last_hold_info_.duration = kInitHoldDuration;
}
bool LossBasedBweV2::IsEnabled() const {
@@ -132,51 +140,47 @@ bool LossBasedBweV2::IsEnabled() const {
}
bool LossBasedBweV2::IsReady() const {
- return IsEnabled() && IsValid(current_estimate_.loss_limited_bandwidth) &&
- num_observations_ > 0;
+ return IsEnabled() &&
+ IsValid(current_best_estimate_.loss_limited_bandwidth) &&
+ num_observations_ >= config_->min_num_observations;
}
bool LossBasedBweV2::ReadyToUseInStartPhase() const {
return IsReady() && config_->use_in_start_phase;
}
+bool LossBasedBweV2::UseInStartPhase() const {
+ return config_->use_in_start_phase;
+}
+
LossBasedBweV2::Result LossBasedBweV2::GetLossBasedResult() const {
- Result result;
- result.state = current_state_;
if (!IsReady()) {
if (!IsEnabled()) {
RTC_LOG(LS_WARNING)
<< "The estimator must be enabled before it can be used.";
} else {
- if (!IsValid(current_estimate_.loss_limited_bandwidth)) {
+ if (!IsValid(current_best_estimate_.loss_limited_bandwidth)) {
RTC_LOG(LS_WARNING)
<< "The estimator must be initialized before it can be used.";
}
- if (num_observations_ <= 0) {
+ if (num_observations_ <= config_->min_num_observations) {
RTC_LOG(LS_WARNING) << "The estimator must receive enough loss "
"statistics before it can be used.";
}
}
- result.bandwidth_estimate = IsValid(delay_based_estimate_)
- ? delay_based_estimate_
- : DataRate::PlusInfinity();
- return result;
+ return {.bandwidth_estimate = IsValid(delay_based_estimate_)
+ ? delay_based_estimate_
+ : DataRate::PlusInfinity(),
+ .state = LossBasedState::kDelayBasedEstimate};
}
- if (IsValid(delay_based_estimate_)) {
- result.bandwidth_estimate =
- std::min({current_estimate_.loss_limited_bandwidth,
- GetInstantUpperBound(), delay_based_estimate_});
- } else {
- result.bandwidth_estimate = std::min(
- current_estimate_.loss_limited_bandwidth, GetInstantUpperBound());
- }
- return result;
+ return loss_based_result_;
}
void LossBasedBweV2::SetAcknowledgedBitrate(DataRate acknowledged_bitrate) {
if (IsValid(acknowledged_bitrate)) {
acknowledged_bitrate_ = acknowledged_bitrate;
+ CalculateInstantLowerBound();
} else {
RTC_LOG(LS_WARNING) << "The acknowledged bitrate must be finite: "
<< ToString(acknowledged_bitrate);
@@ -185,7 +189,9 @@ void LossBasedBweV2::SetAcknowledgedBitrate(DataRate acknowledged_bitrate) {
void LossBasedBweV2::SetBandwidthEstimate(DataRate bandwidth_estimate) {
if (IsValid(bandwidth_estimate)) {
- current_estimate_.loss_limited_bandwidth = bandwidth_estimate;
+ current_best_estimate_.loss_limited_bandwidth = bandwidth_estimate;
+ loss_based_result_ = {.bandwidth_estimate = bandwidth_estimate,
+ .state = LossBasedState::kDelayBasedEstimate};
} else {
RTC_LOG(LS_WARNING) << "The bandwidth estimate must be finite: "
<< ToString(bandwidth_estimate);
@@ -196,6 +202,7 @@ void LossBasedBweV2::SetMinMaxBitrate(DataRate min_bitrate,
DataRate max_bitrate) {
if (IsValid(min_bitrate)) {
min_bitrate_ = min_bitrate;
+ CalculateInstantLowerBound();
} else {
RTC_LOG(LS_WARNING) << "The min bitrate must be finite: "
<< ToString(min_bitrate);
@@ -209,18 +216,9 @@ void LossBasedBweV2::SetMinMaxBitrate(DataRate min_bitrate,
}
}
-void LossBasedBweV2::SetProbeBitrate(absl::optional<DataRate> probe_bitrate) {
- if (probe_bitrate.has_value() && IsValid(probe_bitrate.value())) {
- probe_bitrate_ = probe_bitrate.value();
- last_probe_timestamp_ = last_send_time_most_recent_observation_;
- }
-}
-
void LossBasedBweV2::UpdateBandwidthEstimate(
rtc::ArrayView<const PacketResult> packet_results,
DataRate delay_based_estimate,
- BandwidthUsage delay_detector_state,
- absl::optional<DataRate> probe_bitrate,
bool in_alr) {
delay_based_estimate_ = delay_based_estimate;
if (!IsEnabled()) {
@@ -235,22 +233,22 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
return;
}
- if (!PushBackObservation(packet_results, delay_detector_state)) {
+ if (!PushBackObservation(packet_results)) {
return;
}
- SetProbeBitrate(probe_bitrate);
-
- if (!IsValid(current_estimate_.loss_limited_bandwidth)) {
+ if (!IsValid(current_best_estimate_.loss_limited_bandwidth)) {
if (!IsValid(delay_based_estimate)) {
RTC_LOG(LS_WARNING) << "The delay based estimate must be finite: "
<< ToString(delay_based_estimate);
return;
}
- current_estimate_.loss_limited_bandwidth = delay_based_estimate;
+ current_best_estimate_.loss_limited_bandwidth = delay_based_estimate;
+ loss_based_result_ = {.bandwidth_estimate = delay_based_estimate,
+ .state = LossBasedState::kDelayBasedEstimate};
}
- ChannelParameters best_candidate = current_estimate_;
+ ChannelParameters best_candidate = current_best_estimate_;
double objective_max = std::numeric_limits<double>::lowest();
for (ChannelParameters candidate : GetCandidates(in_alr)) {
NewtonsMethodUpdate(candidate);
@@ -262,7 +260,7 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
}
}
if (best_candidate.loss_limited_bandwidth <
- current_estimate_.loss_limited_bandwidth) {
+ current_best_estimate_.loss_limited_bandwidth) {
last_time_estimate_reduced_ = last_send_time_most_recent_observation_;
}
@@ -270,13 +268,13 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
// inherent loss.
if (GetAverageReportedLossRatio() > best_candidate.inherent_loss &&
config_->not_increase_if_inherent_loss_less_than_average_loss &&
- current_estimate_.loss_limited_bandwidth <
+ current_best_estimate_.loss_limited_bandwidth <
best_candidate.loss_limited_bandwidth) {
best_candidate.loss_limited_bandwidth =
- current_estimate_.loss_limited_bandwidth;
+ current_best_estimate_.loss_limited_bandwidth;
}
- if (IsBandwidthLimitedDueToLoss()) {
+ if (IsInLossLimitedState()) {
// Bound the estimate increase if:
// 1. The estimate has been increased for less than
// `delayed_increase_window` ago, and
@@ -290,63 +288,121 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
bandwidth_limit_in_current_window_;
}
- bool increasing_when_loss_limited =
- IsEstimateIncreasingWhenLossLimited(best_candidate);
- // Bound the best candidate by the acked bitrate unless there is a recent
- // probe result.
- if (increasing_when_loss_limited && !IsValid(probe_bitrate_) &&
- IsValid(acknowledged_bitrate_)) {
+ bool increasing_when_loss_limited = IsEstimateIncreasingWhenLossLimited(
+ /*old_estimate=*/current_best_estimate_.loss_limited_bandwidth,
+ /*new_estimate=*/best_candidate.loss_limited_bandwidth);
+ // Bound the best candidate by the acked bitrate.
+ if (increasing_when_loss_limited && IsValid(acknowledged_bitrate_)) {
best_candidate.loss_limited_bandwidth =
- IsValid(best_candidate.loss_limited_bandwidth)
- ? std::min(best_candidate.loss_limited_bandwidth,
- config_->bandwidth_rampup_upper_bound_factor *
- (*acknowledged_bitrate_))
- : config_->bandwidth_rampup_upper_bound_factor *
- (*acknowledged_bitrate_);
- }
- }
-
- if (IsEstimateIncreasingWhenLossLimited(best_candidate) &&
- best_candidate.loss_limited_bandwidth < delay_based_estimate_) {
- current_state_ = LossBasedState::kIncreasing;
- } else if (best_candidate.loss_limited_bandwidth < delay_based_estimate_) {
- current_state_ = LossBasedState::kDecreasing;
- } else if (best_candidate.loss_limited_bandwidth >= delay_based_estimate_) {
- current_state_ = LossBasedState::kDelayBasedEstimate;
- }
-
- // Use probe bitrate as the estimate limit when probes are requested.
- if (config_->probe_integration_enabled && IsValid(probe_bitrate_) &&
- IsRequestingProbe()) {
- if (last_probe_timestamp_ + config_->probe_expiration >=
- last_send_time_most_recent_observation_) {
- best_candidate.loss_limited_bandwidth =
- std::min(probe_bitrate_, best_candidate.loss_limited_bandwidth);
+ std::max(current_best_estimate_.loss_limited_bandwidth,
+ std::min(best_candidate.loss_limited_bandwidth,
+ config_->bandwidth_rampup_upper_bound_factor *
+ (*acknowledged_bitrate_)));
+ // Increase current estimate by at least 1kbps to make sure that the state
+ // will be switched to kIncreasing, thus padding is triggered.
+ if (loss_based_result_.state == LossBasedState::kDecreasing &&
+ best_candidate.loss_limited_bandwidth ==
+ current_best_estimate_.loss_limited_bandwidth) {
+ best_candidate.loss_limited_bandwidth =
+ current_best_estimate_.loss_limited_bandwidth +
+ DataRate::BitsPerSec(1);
+ }
}
}
- current_estimate_ = best_candidate;
+ current_best_estimate_ = best_candidate;
+ UpdateResult();
- if (IsBandwidthLimitedDueToLoss() &&
+ if (IsInLossLimitedState() &&
(recovering_after_loss_timestamp_.IsInfinite() ||
recovering_after_loss_timestamp_ + config_->delayed_increase_window <
last_send_time_most_recent_observation_)) {
bandwidth_limit_in_current_window_ =
std::max(kCongestionControllerMinBitrate,
- current_estimate_.loss_limited_bandwidth *
+ current_best_estimate_.loss_limited_bandwidth *
config_->max_increase_factor);
recovering_after_loss_timestamp_ = last_send_time_most_recent_observation_;
}
}
+void LossBasedBweV2::UpdateResult() {
+ DataRate bounded_bandwidth_estimate = DataRate::PlusInfinity();
+ if (IsValid(delay_based_estimate_)) {
+ bounded_bandwidth_estimate =
+ std::max(GetInstantLowerBound(),
+ std::min({current_best_estimate_.loss_limited_bandwidth,
+ GetInstantUpperBound(), delay_based_estimate_}));
+ } else {
+ bounded_bandwidth_estimate =
+ std::max(GetInstantLowerBound(),
+ std::min(current_best_estimate_.loss_limited_bandwidth,
+ GetInstantUpperBound()));
+ }
+
+ if (loss_based_result_.state == LossBasedState::kDecreasing &&
+ last_hold_info_.timestamp > last_send_time_most_recent_observation_ &&
+ bounded_bandwidth_estimate < delay_based_estimate_) {
+ // BWE is not allowed to increase above the HOLD rate. The purpose of
+ // HOLD is to not immediately ramp up BWE to a rate that may cause loss.
+ loss_based_result_.bandwidth_estimate =
+ std::min(last_hold_info_.rate, bounded_bandwidth_estimate);
+ return;
+ }
+
+ if (IsEstimateIncreasingWhenLossLimited(
+ /*old_estimate=*/loss_based_result_.bandwidth_estimate,
+ /*new_estimate=*/bounded_bandwidth_estimate) &&
+ CanKeepIncreasingState(bounded_bandwidth_estimate) &&
+ bounded_bandwidth_estimate < delay_based_estimate_ &&
+ bounded_bandwidth_estimate < max_bitrate_) {
+ if (config_->padding_duration > TimeDelta::Zero() &&
+ bounded_bandwidth_estimate > last_padding_info_.padding_rate) {
+ // Start a new padding duration.
+ last_padding_info_.padding_rate = bounded_bandwidth_estimate;
+ last_padding_info_.padding_timestamp =
+ last_send_time_most_recent_observation_;
+ }
+ loss_based_result_.state = config_->padding_duration > TimeDelta::Zero()
+ ? LossBasedState::kIncreaseUsingPadding
+ : LossBasedState::kIncreasing;
+ } else if (bounded_bandwidth_estimate < delay_based_estimate_ &&
+ bounded_bandwidth_estimate < max_bitrate_) {
+ if (loss_based_result_.state != LossBasedState::kDecreasing &&
+ config_->hold_duration_factor > 0) {
+ RTC_LOG(LS_INFO) << this << " "
+ << "Switch to HOLD. Bounded BWE: "
+ << bounded_bandwidth_estimate.kbps()
+ << ", duration: " << last_hold_info_.duration.ms();
+ last_hold_info_ = {
+ .timestamp = last_send_time_most_recent_observation_ +
+ last_hold_info_.duration,
+ .duration =
+ std::min(kMaxHoldDuration, last_hold_info_.duration *
+ config_->hold_duration_factor),
+ .rate = bounded_bandwidth_estimate};
+ }
+ last_padding_info_ = PaddingInfo();
+ loss_based_result_.state = LossBasedState::kDecreasing;
+ } else {
+ // Reset the HOLD info if delay based estimate works to avoid getting
+ // stuck in low bitrate.
+ last_hold_info_ = {.timestamp = Timestamp::MinusInfinity(),
+ .duration = kInitHoldDuration,
+ .rate = DataRate::PlusInfinity()};
+ last_padding_info_ = PaddingInfo();
+ loss_based_result_.state = LossBasedState::kDelayBasedEstimate;
+ }
+ loss_based_result_.bandwidth_estimate = bounded_bandwidth_estimate;
+}
+
bool LossBasedBweV2::IsEstimateIncreasingWhenLossLimited(
- const ChannelParameters& best_candidate) {
- return (current_estimate_.loss_limited_bandwidth <
- best_candidate.loss_limited_bandwidth ||
- (current_estimate_.loss_limited_bandwidth ==
- best_candidate.loss_limited_bandwidth &&
- current_state_ == LossBasedState::kIncreasing)) &&
- IsBandwidthLimitedDueToLoss();
+ DataRate old_estimate, DataRate new_estimate) {
+ return (old_estimate < new_estimate ||
+ (old_estimate == new_estimate &&
+ (loss_based_result_.state == LossBasedState::kIncreasing ||
+ loss_based_result_.state ==
+ LossBasedState::kIncreaseUsingPadding))) &&
+ IsInLossLimitedState();
}
// Returns a `LossBasedBweV2::Config` iff the `key_value_config` specifies a
@@ -384,6 +440,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
"AckedRateCandidate", true);
FieldTrialParameter<bool> append_delay_based_estimate_candidate(
"DelayBasedCandidate", true);
+ FieldTrialParameter<bool> append_upper_bound_candidate_in_alr(
+ "UpperBoundCandidateInAlr", false);
FieldTrialParameter<TimeDelta> observation_duration_lower_bound(
"ObservationDurationLowerBound", TimeDelta::Millis(250));
FieldTrialParameter<int> observation_window_size("ObservationWindowSize", 20);
@@ -399,15 +457,9 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
0.9);
FieldTrialParameter<double> bandwidth_backoff_lower_bound_factor(
"BwBackoffLowerBoundFactor", 1.0);
- FieldTrialParameter<bool> trendline_integration_enabled(
- "TrendlineIntegrationEnabled", false);
- FieldTrialParameter<int> trendline_observations_window_size(
- "TrendlineObservationsWindowSize", 20);
FieldTrialParameter<double> max_increase_factor("MaxIncreaseFactor", 1.3);
FieldTrialParameter<TimeDelta> delayed_increase_window(
"DelayedIncreaseWindow", TimeDelta::Millis(300));
- FieldTrialParameter<bool> use_acked_bitrate_only_when_overusing(
- "UseAckedBitrateOnlyWhenOverusing", false);
FieldTrialParameter<bool>
not_increase_if_inherent_loss_less_than_average_loss(
"NotIncreaseIfInherentLossLessThanAverageLoss", true);
@@ -417,13 +469,16 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
"BandwidthCapAtHighLossRate", DataRate::KilobitsPerSec(500.0));
FieldTrialParameter<double> slope_of_bwe_high_loss_func(
"SlopeOfBweHighLossFunc", 1000);
- FieldTrialParameter<bool> probe_integration_enabled("ProbeIntegrationEnabled",
- false);
- FieldTrialParameter<TimeDelta> probe_expiration("ProbeExpiration",
- TimeDelta::Seconds(10));
FieldTrialParameter<bool> not_use_acked_rate_in_alr("NotUseAckedRateInAlr",
- false);
+ true);
FieldTrialParameter<bool> use_in_start_phase("UseInStartPhase", false);
+ FieldTrialParameter<int> min_num_observations("MinNumObservations", 3);
+ FieldTrialParameter<double> lower_bound_by_acked_rate_factor(
+ "LowerBoundByAckedRateFactor", 0.0);
+ FieldTrialParameter<double> hold_duration_factor("HoldDurationFactor", 0.0);
+ FieldTrialParameter<bool> use_byte_loss_rate("UseByteLossRate", false);
+ FieldTrialParameter<TimeDelta> padding_duration("PaddingDuration",
+ TimeDelta::Zero());
if (key_value_config) {
ParseFieldTrial({&enabled,
&bandwidth_rampup_upper_bound_factor,
@@ -442,6 +497,7 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
&newton_step_size,
&append_acknowledged_rate_candidate,
&append_delay_based_estimate_candidate,
+ &append_upper_bound_candidate_in_alr,
&observation_duration_lower_bound,
&observation_window_size,
&sending_rate_smoothing_factor,
@@ -450,19 +506,19 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
&instant_upper_bound_loss_offset,
&temporal_weight_factor,
&bandwidth_backoff_lower_bound_factor,
- &trendline_integration_enabled,
- &trendline_observations_window_size,
&max_increase_factor,
&delayed_increase_window,
- &use_acked_bitrate_only_when_overusing,
&not_increase_if_inherent_loss_less_than_average_loss,
- &probe_integration_enabled,
- &probe_expiration,
&high_loss_rate_threshold,
&bandwidth_cap_at_high_loss_rate,
&slope_of_bwe_high_loss_func,
&not_use_acked_rate_in_alr,
- &use_in_start_phase},
+ &use_in_start_phase,
+ &min_num_observations,
+ &lower_bound_by_acked_rate_factor,
+ &hold_duration_factor,
+ &use_byte_loss_rate,
+ &padding_duration},
key_value_config->Lookup("WebRTC-Bwe-LossBasedBweV2"));
}
@@ -496,6 +552,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
append_acknowledged_rate_candidate.Get();
config->append_delay_based_estimate_candidate =
append_delay_based_estimate_candidate.Get();
+ config->append_upper_bound_candidate_in_alr =
+ append_upper_bound_candidate_in_alr.Get();
config->observation_duration_lower_bound =
observation_duration_lower_bound.Get();
config->observation_window_size = observation_window_size.Get();
@@ -509,23 +567,22 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
config->temporal_weight_factor = temporal_weight_factor.Get();
config->bandwidth_backoff_lower_bound_factor =
bandwidth_backoff_lower_bound_factor.Get();
- config->trendline_integration_enabled = trendline_integration_enabled.Get();
- config->trendline_observations_window_size =
- trendline_observations_window_size.Get();
config->max_increase_factor = max_increase_factor.Get();
config->delayed_increase_window = delayed_increase_window.Get();
- config->use_acked_bitrate_only_when_overusing =
- use_acked_bitrate_only_when_overusing.Get();
config->not_increase_if_inherent_loss_less_than_average_loss =
not_increase_if_inherent_loss_less_than_average_loss.Get();
config->high_loss_rate_threshold = high_loss_rate_threshold.Get();
config->bandwidth_cap_at_high_loss_rate =
bandwidth_cap_at_high_loss_rate.Get();
config->slope_of_bwe_high_loss_func = slope_of_bwe_high_loss_func.Get();
- config->probe_integration_enabled = probe_integration_enabled.Get();
- config->probe_expiration = probe_expiration.Get();
config->not_use_acked_rate_in_alr = not_use_acked_rate_in_alr.Get();
config->use_in_start_phase = use_in_start_phase.Get();
+ config->min_num_observations = min_num_observations.Get();
+ config->lower_bound_by_acked_rate_factor =
+ lower_bound_by_acked_rate_factor.Get();
+ config->hold_duration_factor = hold_duration_factor.Get();
+ config->use_byte_loss_rate = use_byte_loss_rate.Get();
+ config->padding_duration = padding_duration.Get();
return config;
}
@@ -690,11 +747,6 @@ bool LossBasedBweV2::IsConfigValid() const {
<< config_->bandwidth_backoff_lower_bound_factor;
valid = false;
}
- if (config_->trendline_observations_window_size < 1) {
- RTC_LOG(LS_WARNING) << "The trendline window size must be at least 1: "
- << config_->trendline_observations_window_size;
- valid = false;
- }
if (config_->max_increase_factor <= 0.0) {
RTC_LOG(LS_WARNING) << "The maximum increase factor must be positive: "
<< config_->max_increase_factor;
@@ -711,10 +763,27 @@ bool LossBasedBweV2::IsConfigValid() const {
<< config_->high_loss_rate_threshold;
valid = false;
}
+ if (config_->min_num_observations <= 0) {
+ RTC_LOG(LS_WARNING) << "The min number of observations must be positive: "
+ << config_->min_num_observations;
+ valid = false;
+ }
+ if (config_->lower_bound_by_acked_rate_factor < 0.0) {
+ RTC_LOG(LS_WARNING)
+ << "The estimate lower bound by acknowledged rate factor must be "
+ "non-negative: "
+ << config_->lower_bound_by_acked_rate_factor;
+ valid = false;
+ }
return valid;
}
double LossBasedBweV2::GetAverageReportedLossRatio() const {
+ return config_->use_byte_loss_rate ? GetAverageReportedByteLossRatio()
+ : GetAverageReportedPacketLossRatio();
+}
+
+double LossBasedBweV2::GetAverageReportedPacketLossRatio() const {
if (num_observations_ <= 0) {
return 0.0;
}
@@ -736,20 +805,31 @@ double LossBasedBweV2::GetAverageReportedLossRatio() const {
return num_lost_packets / num_packets;
}
-DataRate LossBasedBweV2::GetCandidateBandwidthUpperBound() const {
- DataRate candidate_bandwidth_upper_bound = max_bitrate_;
- if (IsBandwidthLimitedDueToLoss() &&
- IsValid(bandwidth_limit_in_current_window_)) {
- candidate_bandwidth_upper_bound = bandwidth_limit_in_current_window_;
+double LossBasedBweV2::GetAverageReportedByteLossRatio() const {
+ if (num_observations_ <= 0) {
+ return 0.0;
}
- if (config_->trendline_integration_enabled) {
- candidate_bandwidth_upper_bound =
- std::min(GetInstantUpperBound(), candidate_bandwidth_upper_bound);
- if (IsValid(delay_based_estimate_)) {
- candidate_bandwidth_upper_bound =
- std::min(delay_based_estimate_, candidate_bandwidth_upper_bound);
+ DataSize total_bytes = DataSize::Zero();
+ DataSize lost_bytes = DataSize::Zero();
+ for (const Observation& observation : observations_) {
+ if (!observation.IsInitialized()) {
+ continue;
}
+
+ double instant_temporal_weight =
+ instant_upper_bound_temporal_weights_[(num_observations_ - 1) -
+ observation.id];
+ total_bytes += instant_temporal_weight * observation.size;
+ lost_bytes += instant_temporal_weight * observation.lost_size;
+ }
+ return lost_bytes / total_bytes;
+}
+
+DataRate LossBasedBweV2::GetCandidateBandwidthUpperBound() const {
+ DataRate candidate_bandwidth_upper_bound = max_bitrate_;
+ if (IsInLossLimitedState() && IsValid(bandwidth_limit_in_current_window_)) {
+ candidate_bandwidth_upper_bound = bandwidth_limit_in_current_window_;
}
if (!acknowledged_bitrate_.has_value())
@@ -773,19 +853,17 @@ DataRate LossBasedBweV2::GetCandidateBandwidthUpperBound() const {
std::vector<LossBasedBweV2::ChannelParameters> LossBasedBweV2::GetCandidates(
bool in_alr) const {
std::vector<DataRate> bandwidths;
- bool can_increase_bitrate = TrendlineEsimateAllowBitrateIncrease();
for (double candidate_factor : config_->candidate_factors) {
- if (!can_increase_bitrate && candidate_factor > 1.0) {
- continue;
- }
bandwidths.push_back(candidate_factor *
- current_estimate_.loss_limited_bandwidth);
+ current_best_estimate_.loss_limited_bandwidth);
}
if (acknowledged_bitrate_.has_value() &&
- config_->append_acknowledged_rate_candidate &&
- TrendlineEsimateAllowEmergencyBackoff()) {
- if (!(config_->not_use_acked_rate_in_alr && in_alr)) {
+ config_->append_acknowledged_rate_candidate) {
+ if (!(config_->not_use_acked_rate_in_alr && in_alr) ||
+ (config_->padding_duration > TimeDelta::Zero() &&
+ last_padding_info_.padding_timestamp + config_->padding_duration >=
+ last_send_time_most_recent_observation_)) {
bandwidths.push_back(*acknowledged_bitrate_ *
config_->bandwidth_backoff_lower_bound_factor);
}
@@ -793,27 +871,26 @@ std::vector<LossBasedBweV2::ChannelParameters> LossBasedBweV2::GetCandidates(
if (IsValid(delay_based_estimate_) &&
config_->append_delay_based_estimate_candidate) {
- if (can_increase_bitrate &&
- delay_based_estimate_ > current_estimate_.loss_limited_bandwidth) {
+ if (delay_based_estimate_ > current_best_estimate_.loss_limited_bandwidth) {
bandwidths.push_back(delay_based_estimate_);
}
}
+ if (in_alr && config_->append_upper_bound_candidate_in_alr &&
+ current_best_estimate_.loss_limited_bandwidth > GetInstantUpperBound()) {
+ bandwidths.push_back(GetInstantUpperBound());
+ }
+
const DataRate candidate_bandwidth_upper_bound =
GetCandidateBandwidthUpperBound();
std::vector<ChannelParameters> candidates;
candidates.resize(bandwidths.size());
for (size_t i = 0; i < bandwidths.size(); ++i) {
- ChannelParameters candidate = current_estimate_;
- if (config_->trendline_integration_enabled) {
- candidate.loss_limited_bandwidth =
- std::min(bandwidths[i], candidate_bandwidth_upper_bound);
- } else {
- candidate.loss_limited_bandwidth = std::min(
- bandwidths[i], std::max(current_estimate_.loss_limited_bandwidth,
- candidate_bandwidth_upper_bound));
- }
+ ChannelParameters candidate = current_best_estimate_;
+ candidate.loss_limited_bandwidth = std::min(
+ bandwidths[i], std::max(current_best_estimate_.loss_limited_bandwidth,
+ candidate_bandwidth_upper_bound));
candidate.inherent_loss = GetFeasibleInherentLoss(candidate);
candidates[i] = candidate;
}
@@ -835,16 +912,29 @@ LossBasedBweV2::Derivatives LossBasedBweV2::GetDerivatives(
double temporal_weight =
temporal_weights_[(num_observations_ - 1) - observation.id];
-
- derivatives.first +=
- temporal_weight *
- ((observation.num_lost_packets / loss_probability) -
- (observation.num_received_packets / (1.0 - loss_probability)));
- derivatives.second -=
- temporal_weight *
- ((observation.num_lost_packets / std::pow(loss_probability, 2)) +
- (observation.num_received_packets /
- std::pow(1.0 - loss_probability, 2)));
+ if (config_->use_byte_loss_rate) {
+ derivatives.first +=
+ temporal_weight *
+ ((ToKiloBytes(observation.lost_size) / loss_probability) -
+ (ToKiloBytes(observation.size - observation.lost_size) /
+ (1.0 - loss_probability)));
+ derivatives.second -=
+ temporal_weight *
+ ((ToKiloBytes(observation.lost_size) /
+ std::pow(loss_probability, 2)) +
+ (ToKiloBytes(observation.size - observation.lost_size) /
+ std::pow(1.0 - loss_probability, 2)));
+ } else {
+ derivatives.first +=
+ temporal_weight *
+ ((observation.num_lost_packets / loss_probability) -
+ (observation.num_received_packets / (1.0 - loss_probability)));
+ derivatives.second -=
+ temporal_weight *
+ ((observation.num_lost_packets / std::pow(loss_probability, 2)) +
+ (observation.num_received_packets /
+ std::pow(1.0 - loss_probability, 2)));
+ }
}
if (derivatives.second >= 0.0) {
@@ -916,13 +1006,23 @@ double LossBasedBweV2::GetObjective(
double temporal_weight =
temporal_weights_[(num_observations_ - 1) - observation.id];
-
- objective +=
- temporal_weight *
- ((observation.num_lost_packets * std::log(loss_probability)) +
- (observation.num_received_packets * std::log(1.0 - loss_probability)));
- objective +=
- temporal_weight * high_bandwidth_bias * observation.num_packets;
+ if (config_->use_byte_loss_rate) {
+ objective +=
+ temporal_weight *
+ ((ToKiloBytes(observation.lost_size) * std::log(loss_probability)) +
+ (ToKiloBytes(observation.size - observation.lost_size) *
+ std::log(1.0 - loss_probability)));
+ objective +=
+ temporal_weight * high_bandwidth_bias * ToKiloBytes(observation.size);
+ } else {
+ objective +=
+ temporal_weight *
+ ((observation.num_lost_packets * std::log(loss_probability)) +
+ (observation.num_received_packets *
+ std::log(1.0 - loss_probability)));
+ objective +=
+ temporal_weight * high_bandwidth_bias * observation.num_packets;
+ }
}
return objective;
@@ -971,6 +1071,24 @@ void LossBasedBweV2::CalculateInstantUpperBound() {
cached_instant_upper_bound_ = instant_limit;
}
+DataRate LossBasedBweV2::GetInstantLowerBound() const {
+ return cached_instant_lower_bound_.value_or(DataRate::Zero());
+}
+
+void LossBasedBweV2::CalculateInstantLowerBound() {
+ DataRate instance_lower_bound = DataRate::Zero();
+ if (IsValid(acknowledged_bitrate_) &&
+ config_->lower_bound_by_acked_rate_factor > 0.0) {
+ instance_lower_bound = config_->lower_bound_by_acked_rate_factor *
+ acknowledged_bitrate_.value();
+ }
+
+ if (IsValid(min_bitrate_)) {
+ instance_lower_bound = std::max(instance_lower_bound, min_bitrate_);
+ }
+ cached_instant_lower_bound_ = instance_lower_bound;
+}
+
void LossBasedBweV2::CalculateTemporalWeights() {
for (int i = 0; i < config_->observation_window_size; ++i) {
temporal_weights_[i] = std::pow(config_->temporal_weight_factor, i);
@@ -994,47 +1112,8 @@ void LossBasedBweV2::NewtonsMethodUpdate(
}
}
-bool LossBasedBweV2::TrendlineEsimateAllowBitrateIncrease() const {
- if (!config_->trendline_integration_enabled) {
- return true;
- }
-
- for (const auto& detector_state : delay_detector_states_) {
- if (detector_state == BandwidthUsage::kBwOverusing ||
- detector_state == BandwidthUsage::kBwUnderusing) {
- return false;
- }
- }
- return true;
-}
-
-bool LossBasedBweV2::TrendlineEsimateAllowEmergencyBackoff() const {
- if (!config_->trendline_integration_enabled) {
- return true;
- }
-
- if (!config_->use_acked_bitrate_only_when_overusing) {
- return true;
- }
-
- for (const auto& detector_state : delay_detector_states_) {
- if (detector_state == BandwidthUsage::kBwOverusing) {
- return true;
- }
- }
-
- return false;
-}
-
bool LossBasedBweV2::PushBackObservation(
- rtc::ArrayView<const PacketResult> packet_results,
- BandwidthUsage delay_detector_state) {
- delay_detector_states_.push_front(delay_detector_state);
- if (static_cast<int>(delay_detector_states_.size()) >
- config_->trendline_observations_window_size) {
- delay_detector_states_.pop_back();
- }
-
+ rtc::ArrayView<const PacketResult> packet_results) {
if (packet_results.empty()) {
return false;
}
@@ -1046,6 +1125,7 @@ bool LossBasedBweV2::PushBackObservation(
partial_observation_.num_lost_packets +=
packet_results_summary.num_lost_packets;
partial_observation_.size += packet_results_summary.total_size;
+ partial_observation_.lost_size += packet_results_summary.lost_size;
// This is the first packet report we have received.
if (!IsValid(last_send_time_most_recent_observation_)) {
@@ -1058,9 +1138,7 @@ bool LossBasedBweV2::PushBackObservation(
last_send_time - last_send_time_most_recent_observation_;
// Too small to be meaningful.
if (observation_duration <= TimeDelta::Zero() ||
- (observation_duration < config_->observation_duration_lower_bound &&
- (delay_detector_state != BandwidthUsage::kBwOverusing ||
- !config_->trendline_integration_enabled))) {
+ observation_duration < config_->observation_duration_lower_bound) {
return false;
}
@@ -1073,6 +1151,8 @@ bool LossBasedBweV2::PushBackObservation(
observation.num_packets - observation.num_lost_packets;
observation.sending_rate =
GetSendingRate(partial_observation_.size / observation_duration);
+ observation.lost_size = partial_observation_.lost_size;
+ observation.size = partial_observation_.size;
observation.id = num_observations_++;
observations_[observation.id % config_->observation_window_size] =
observation;
@@ -1083,12 +1163,21 @@ bool LossBasedBweV2::PushBackObservation(
return true;
}
-bool LossBasedBweV2::IsBandwidthLimitedDueToLoss() const {
- return current_state_ != LossBasedState::kDelayBasedEstimate;
+bool LossBasedBweV2::IsInLossLimitedState() const {
+ return loss_based_result_.state != LossBasedState::kDelayBasedEstimate;
}
-bool LossBasedBweV2::IsRequestingProbe() const {
- return current_state_ == LossBasedState::kIncreasing;
+bool LossBasedBweV2::CanKeepIncreasingState(DataRate estimate) const {
+ if (config_->padding_duration == TimeDelta::Zero() ||
+ loss_based_result_.state != LossBasedState::kIncreaseUsingPadding)
+ return true;
+
+ // Keep using the kIncreaseUsingPadding if either the state has been
+ // kIncreaseUsingPadding for less than kPaddingDuration or the estimate
+ // increases.
+ return last_padding_info_.padding_timestamp + config_->padding_duration >=
+ last_send_time_most_recent_observation_ ||
+ last_padding_info_.padding_rate < estimate;
}
} // namespace webrtc
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
index cd49d05c97..228d5985f7 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h
@@ -11,13 +11,11 @@
#ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_LOSS_BASED_BWE_V2_H_
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_LOSS_BASED_BWE_V2_H_
-#include <deque>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/field_trials_view.h"
-#include "api/network_state_predictor.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
@@ -30,8 +28,12 @@ namespace webrtc {
// when network is loss limited, or equal to the delay based estimate.
enum class LossBasedState {
kIncreasing = 0,
- kDecreasing = 1,
- kDelayBasedEstimate = 2
+ // TODO(bugs.webrtc.org/12707): Remove one of the increasing states once we
+ // have decided if padding is usefull for ramping up when BWE is loss
+ // limited.
+ kIncreaseUsingPadding = 1,
+ kDecreasing = 2,
+ kDelayBasedEstimate = 3
};
class LossBasedBweV2 {
@@ -60,6 +62,9 @@ class LossBasedBweV2 {
// Returns true if loss based BWE is ready to be used in the start phase.
bool ReadyToUseInStartPhase() const;
+ // Returns true if loss based BWE can be used in the start phase.
+ bool UseInStartPhase() const;
+
// Returns `DataRate::PlusInfinity` if no BWE can be calculated.
Result GetLossBasedResult() const;
@@ -68,8 +73,6 @@ class LossBasedBweV2 {
void UpdateBandwidthEstimate(
rtc::ArrayView<const PacketResult> packet_results,
DataRate delay_based_estimate,
- BandwidthUsage delay_detector_state,
- absl::optional<DataRate> probe_bitrate,
bool in_alr);
// For unit testing only.
@@ -99,6 +102,7 @@ class LossBasedBweV2 {
double newton_step_size = 0.0;
bool append_acknowledged_rate_candidate = true;
bool append_delay_based_estimate_candidate = false;
+ bool append_upper_bound_candidate_in_alr = false;
TimeDelta observation_duration_lower_bound = TimeDelta::Zero();
int observation_window_size = 0;
double sending_rate_smoothing_factor = 0.0;
@@ -107,19 +111,19 @@ class LossBasedBweV2 {
double instant_upper_bound_loss_offset = 0.0;
double temporal_weight_factor = 0.0;
double bandwidth_backoff_lower_bound_factor = 0.0;
- bool trendline_integration_enabled = false;
- int trendline_observations_window_size = 0;
double max_increase_factor = 0.0;
TimeDelta delayed_increase_window = TimeDelta::Zero();
- bool use_acked_bitrate_only_when_overusing = false;
bool not_increase_if_inherent_loss_less_than_average_loss = false;
double high_loss_rate_threshold = 1.0;
DataRate bandwidth_cap_at_high_loss_rate = DataRate::MinusInfinity();
double slope_of_bwe_high_loss_func = 1000.0;
- bool probe_integration_enabled = false;
- TimeDelta probe_expiration = TimeDelta::Zero();
bool not_use_acked_rate_in_alr = false;
bool use_in_start_phase = false;
+ int min_num_observations = 0;
+ double lower_bound_by_acked_rate_factor = 0.0;
+ double hold_duration_factor = 0.0;
+ bool use_byte_loss_rate = false;
+ TimeDelta padding_duration = TimeDelta::Zero();
};
struct Derivatives {
@@ -134,6 +138,8 @@ class LossBasedBweV2 {
int num_lost_packets = 0;
int num_received_packets = 0;
DataRate sending_rate = DataRate::MinusInfinity();
+ DataSize size = DataSize::Zero();
+ DataSize lost_size = DataSize::Zero();
int id = -1;
};
@@ -141,6 +147,18 @@ class LossBasedBweV2 {
int num_packets = 0;
int num_lost_packets = 0;
DataSize size = DataSize::Zero();
+ DataSize lost_size = DataSize::Zero();
+ };
+
+ struct PaddingInfo {
+ DataRate padding_rate = DataRate::MinusInfinity();
+ Timestamp padding_timestamp = Timestamp::MinusInfinity();
+ };
+
+ struct HoldInfo {
+ Timestamp timestamp = Timestamp::MinusInfinity();
+ TimeDelta duration = TimeDelta::Zero();
+ DataRate rate = DataRate::PlusInfinity();
};
static absl::optional<Config> CreateConfig(
@@ -149,6 +167,8 @@ class LossBasedBweV2 {
// Returns `0.0` if not enough loss statistics have been received.
double GetAverageReportedLossRatio() const;
+ double GetAverageReportedPacketLossRatio() const;
+ double GetAverageReportedByteLossRatio() const;
std::vector<ChannelParameters> GetCandidates(bool in_alr) const;
DataRate GetCandidateBandwidthUpperBound() const;
Derivatives GetDerivatives(const ChannelParameters& channel_parameters) const;
@@ -161,50 +181,40 @@ class LossBasedBweV2 {
DataRate GetSendingRate(DataRate instantaneous_sending_rate) const;
DataRate GetInstantUpperBound() const;
void CalculateInstantUpperBound();
+ DataRate GetInstantLowerBound() const;
+ void CalculateInstantLowerBound();
void CalculateTemporalWeights();
void NewtonsMethodUpdate(ChannelParameters& channel_parameters) const;
- // Returns false if there exists a kBwOverusing or kBwUnderusing in the
- // window.
- bool TrendlineEsimateAllowBitrateIncrease() const;
-
- // Returns true if there exists an overusing state in the window.
- bool TrendlineEsimateAllowEmergencyBackoff() const;
-
// Returns false if no observation was created.
- bool PushBackObservation(rtc::ArrayView<const PacketResult> packet_results,
- BandwidthUsage delay_detector_state);
- void UpdateTrendlineEstimator(
- const std::vector<PacketResult>& packet_feedbacks,
- Timestamp at_time);
- void UpdateDelayDetector(BandwidthUsage delay_detector_state);
- bool IsEstimateIncreasingWhenLossLimited(
- const ChannelParameters& best_candidate);
- bool IsBandwidthLimitedDueToLoss() const;
- void SetProbeBitrate(absl::optional<DataRate> probe_bitrate);
- bool IsRequestingProbe() const;
+ bool PushBackObservation(rtc::ArrayView<const PacketResult> packet_results);
+ void UpdateResult();
+ bool IsEstimateIncreasingWhenLossLimited(DataRate old_estimate,
+ DataRate new_estimate);
+ bool IsInLossLimitedState() const;
+ bool CanKeepIncreasingState(DataRate estimate) const;
absl::optional<DataRate> acknowledged_bitrate_;
absl::optional<Config> config_;
- ChannelParameters current_estimate_;
+ ChannelParameters current_best_estimate_;
int num_observations_ = 0;
std::vector<Observation> observations_;
PartialObservation partial_observation_;
Timestamp last_send_time_most_recent_observation_ = Timestamp::PlusInfinity();
Timestamp last_time_estimate_reduced_ = Timestamp::MinusInfinity();
absl::optional<DataRate> cached_instant_upper_bound_;
+ absl::optional<DataRate> cached_instant_lower_bound_;
std::vector<double> instant_upper_bound_temporal_weights_;
std::vector<double> temporal_weights_;
- std::deque<BandwidthUsage> delay_detector_states_;
Timestamp recovering_after_loss_timestamp_ = Timestamp::MinusInfinity();
DataRate bandwidth_limit_in_current_window_ = DataRate::PlusInfinity();
DataRate min_bitrate_ = DataRate::KilobitsPerSec(1);
DataRate max_bitrate_ = DataRate::PlusInfinity();
- LossBasedState current_state_ = LossBasedState::kDelayBasedEstimate;
- DataRate probe_bitrate_ = DataRate::PlusInfinity();
DataRate delay_based_estimate_ = DataRate::PlusInfinity();
- Timestamp last_probe_timestamp_ = Timestamp::MinusInfinity();
+ LossBasedBweV2::Result loss_based_result_ = LossBasedBweV2::Result();
+ HoldInfo last_hold_info_ = HoldInfo();
+ PaddingInfo last_padding_info_ = PaddingInfo();
};
} // namespace webrtc
diff --git a/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc b/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
index 780bd79a51..16aefcc1d2 100644
--- a/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
+++ b/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc
@@ -13,8 +13,6 @@
#include <string>
#include <vector>
-#include "absl/types/optional.h"
-#include "api/network_state_predictor.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "api/units/data_size.h"
@@ -30,15 +28,14 @@ namespace {
using ::webrtc::test::ExplicitKeyValueConfig;
-constexpr TimeDelta kObservationDurationLowerBound = TimeDelta::Millis(200);
+constexpr TimeDelta kObservationDurationLowerBound = TimeDelta::Millis(250);
constexpr TimeDelta kDelayedIncreaseWindow = TimeDelta::Millis(300);
constexpr double kMaxIncreaseFactor = 1.5;
+constexpr int kPacketSize = 15'000;
class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
protected:
- std::string Config(bool enabled,
- bool valid,
- bool trendline_integration_enabled) {
+ std::string Config(bool enabled, bool valid) {
char buffer[1024];
rtc::SimpleStringBuilder config_string(buffer);
@@ -55,16 +52,8 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
} else {
config_string << ",BwRampupUpperBoundFactor:0.0";
}
-
- if (trendline_integration_enabled) {
- config_string << ",TrendlineIntegrationEnabled:true";
- } else {
- config_string << ",TrendlineIntegrationEnabled:false";
- }
-
config_string
<< ",CandidateFactors:1.1|1.0|0.95,HigherBwBiasFactor:0.01,"
- "DelayBasedCandidate:true,"
"InherentLossLowerBound:0.001,InherentLossUpperBoundBwBalance:"
"14kbps,"
"InherentLossUpperBoundOffset:0.9,InitialInherentLossEstimate:0.01,"
@@ -72,7 +61,8 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
"SendingRateSmoothingFactor:0.01,"
"InstantUpperBoundTemporalWeightFactor:0.97,"
"InstantUpperBoundBwBalance:90kbps,"
- "InstantUpperBoundLossOffset:0.1,TemporalWeightFactor:0.98";
+ "InstantUpperBoundLossOffset:0.1,TemporalWeightFactor:0.98,"
+ "MinNumObservations:1";
config_string.AppendFormat(
",ObservationDurationLowerBound:%dms",
@@ -86,11 +76,23 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
return config_string.str();
}
+ std::string ShortObservationConfig(std::string custom_config) {
+ char buffer[1024];
+ rtc::SimpleStringBuilder config_string(buffer);
+
+ config_string << "WebRTC-Bwe-LossBasedBweV2/"
+ "MinNumObservations:1,ObservationWindowSize:2,";
+ config_string << custom_config;
+ config_string << "/";
+
+ return config_string.str();
+ }
+
std::vector<PacketResult> CreatePacketResultsWithReceivedPackets(
Timestamp first_packet_timestamp) {
std::vector<PacketResult> enough_feedback(2);
- enough_feedback[0].sent_packet.size = DataSize::Bytes(15'000);
- enough_feedback[1].sent_packet.size = DataSize::Bytes(15'000);
+ enough_feedback[0].sent_packet.size = DataSize::Bytes(kPacketSize);
+ enough_feedback[1].sent_packet.size = DataSize::Bytes(kPacketSize);
enough_feedback[0].sent_packet.send_time = first_packet_timestamp;
enough_feedback[1].sent_packet.send_time =
first_packet_timestamp + kObservationDurationLowerBound;
@@ -101,12 +103,13 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
return enough_feedback;
}
- std::vector<PacketResult> CreatePacketResultsWith10pLossRate(
- Timestamp first_packet_timestamp) {
+ std::vector<PacketResult> CreatePacketResultsWith10pPacketLossRate(
+ Timestamp first_packet_timestamp,
+ DataSize lost_packet_size = DataSize::Bytes(kPacketSize)) {
std::vector<PacketResult> enough_feedback(10);
- enough_feedback[0].sent_packet.size = DataSize::Bytes(15'000);
+ enough_feedback[0].sent_packet.size = DataSize::Bytes(kPacketSize);
for (unsigned i = 0; i < enough_feedback.size(); ++i) {
- enough_feedback[i].sent_packet.size = DataSize::Bytes(15'000);
+ enough_feedback[i].sent_packet.size = DataSize::Bytes(kPacketSize);
enough_feedback[i].sent_packet.send_time =
first_packet_timestamp +
static_cast<int>(i) * kObservationDurationLowerBound;
@@ -115,14 +118,15 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
static_cast<int>(i + 1) * kObservationDurationLowerBound;
}
enough_feedback[9].receive_time = Timestamp::PlusInfinity();
+ enough_feedback[9].sent_packet.size = lost_packet_size;
return enough_feedback;
}
- std::vector<PacketResult> CreatePacketResultsWith50pLossRate(
+ std::vector<PacketResult> CreatePacketResultsWith50pPacketLossRate(
Timestamp first_packet_timestamp) {
std::vector<PacketResult> enough_feedback(2);
- enough_feedback[0].sent_packet.size = DataSize::Bytes(15'000);
- enough_feedback[1].sent_packet.size = DataSize::Bytes(15'000);
+ enough_feedback[0].sent_packet.size = DataSize::Bytes(kPacketSize);
+ enough_feedback[1].sent_packet.size = DataSize::Bytes(kPacketSize);
enough_feedback[0].sent_packet.send_time = first_packet_timestamp;
enough_feedback[1].sent_packet.send_time =
first_packet_timestamp + kObservationDurationLowerBound;
@@ -135,8 +139,8 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
std::vector<PacketResult> CreatePacketResultsWith100pLossRate(
Timestamp first_packet_timestamp) {
std::vector<PacketResult> enough_feedback(2);
- enough_feedback[0].sent_packet.size = DataSize::Bytes(15'000);
- enough_feedback[1].sent_packet.size = DataSize::Bytes(15'000);
+ enough_feedback[0].sent_packet.size = DataSize::Bytes(kPacketSize);
+ enough_feedback[1].sent_packet.size = DataSize::Bytes(kPacketSize);
enough_feedback[0].sent_packet.send_time = first_packet_timestamp;
enough_feedback[1].sent_packet.send_time =
first_packet_timestamp + kObservationDurationLowerBound;
@@ -146,107 +150,98 @@ class LossBasedBweV2Test : public ::testing::TestWithParam<bool> {
}
};
-TEST_P(LossBasedBweV2Test, EnabledWhenGivenValidConfigurationValues) {
+TEST_F(LossBasedBweV2Test, EnabledWhenGivenValidConfigurationValues) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
EXPECT_TRUE(loss_based_bandwidth_estimator.IsEnabled());
}
-TEST_P(LossBasedBweV2Test, DisabledWhenGivenDisabledConfiguration) {
+TEST_F(LossBasedBweV2Test, DisabledWhenGivenDisabledConfiguration) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/false, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/false, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsEnabled());
}
-TEST_P(LossBasedBweV2Test, DisabledWhenGivenNonValidConfigurationValues) {
+TEST_F(LossBasedBweV2Test, DisabledWhenGivenNonValidConfigurationValues) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/false,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/false));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsEnabled());
}
-TEST_P(LossBasedBweV2Test, DisabledWhenGivenNonPositiveCandidateFactor) {
+TEST_F(LossBasedBweV2Test, DisabledWhenGivenNonPositiveCandidateFactor) {
ExplicitKeyValueConfig key_value_config_negative_candidate_factor(
- "WebRTC-Bwe-LossBasedBweV2/Enabled:true,CandidateFactors:-1.3|1.1/");
+ "WebRTC-Bwe-LossBasedBweV2/CandidateFactors:-1.3|1.1/");
LossBasedBweV2 loss_based_bandwidth_estimator_1(
&key_value_config_negative_candidate_factor);
EXPECT_FALSE(loss_based_bandwidth_estimator_1.IsEnabled());
ExplicitKeyValueConfig key_value_config_zero_candidate_factor(
- "WebRTC-Bwe-LossBasedBweV2/Enabled:true,CandidateFactors:0.0|1.1/");
+ "WebRTC-Bwe-LossBasedBweV2/CandidateFactors:0.0|1.1/");
LossBasedBweV2 loss_based_bandwidth_estimator_2(
&key_value_config_zero_candidate_factor);
EXPECT_FALSE(loss_based_bandwidth_estimator_2.IsEnabled());
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
DisabledWhenGivenConfigurationThatDoesNotAllowGeneratingCandidates) {
ExplicitKeyValueConfig key_value_config(
"WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.0,AckedRateCandidate:false,"
+ "CandidateFactors:1.0,AckedRateCandidate:false,"
"DelayBasedCandidate:false/");
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsEnabled());
}
-TEST_P(LossBasedBweV2Test, ReturnsDelayBasedEstimateWhenDisabled) {
+TEST_F(LossBasedBweV2Test, ReturnsDelayBasedEstimateWhenDisabled) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/false, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/false, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
/*packet_results=*/{},
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(100));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
ReturnsDelayBasedEstimateWhenWhenGivenNonValidConfigurationValues) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/false,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/false));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
/*packet_results=*/{},
/*delay_based_estimate=*/DataRate::KilobitsPerSec(100),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
DataRate::KilobitsPerSec(100));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
BandwidthEstimateGivenInitializationAndThenFeedback) {
std::vector<PacketResult> enough_feedback =
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero());
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_TRUE(loss_based_bandwidth_estimator.IsReady());
@@ -254,19 +249,17 @@ TEST_P(LossBasedBweV2Test,
.bandwidth_estimate.IsFinite());
}
-TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
+TEST_F(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
std::vector<PacketResult> enough_feedback =
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero());
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
@@ -274,7 +267,7 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNoInitialization) {
.bandwidth_estimate.IsPlusInfinity());
}
-TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
+TEST_F(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
// Create packet results where the observation duration is less than the lower
// bound.
PacketResult not_enough_feedback[2];
@@ -289,8 +282,7 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
Timestamp::Zero() + kObservationDurationLowerBound;
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
@@ -302,8 +294,7 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
not_enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_FALSE(loss_based_bandwidth_estimator.IsReady());
@@ -311,7 +302,7 @@ TEST_P(LossBasedBweV2Test, NoBandwidthEstimateGivenNotEnoughFeedback) {
.bandwidth_estimate.IsPlusInfinity());
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
SetValueIsTheEstimateUntilAdditionalFeedbackHasBeenReceived) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
@@ -322,16 +313,14 @@ TEST_P(LossBasedBweV2Test,
2 * kObservationDurationLowerBound);
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_NE(
@@ -347,8 +336,7 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_NE(
@@ -356,7 +344,7 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
SetAcknowledgedBitrateOnlyAffectsTheBweWhenAdditionalFeedbackIsGiven) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
@@ -367,8 +355,7 @@ TEST_P(LossBasedBweV2Test,
2 * kObservationDurationLowerBound);
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator_1(&key_value_config);
LossBasedBweV2 loss_based_bandwidth_estimator_2(&key_value_config);
@@ -378,13 +365,11 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator_1.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_EQ(
@@ -400,13 +385,11 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator_1.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
loss_based_bandwidth_estimator_2.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_NE(
@@ -414,15 +397,14 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator_2.GetLossBasedResult().bandwidth_estimate);
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
BandwidthEstimateIsCappedToBeTcpFairGivenTooHighLossRate) {
std::vector<PacketResult> enough_feedback_no_received_packets =
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
@@ -430,7 +412,6 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_no_received_packets,
/*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
/*in_alr=*/false);
EXPECT_EQ(
@@ -438,46 +419,9 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(100));
}
-TEST_P(LossBasedBweV2Test, BandwidthEstimateNotIncreaseWhenNetworkUnderusing) {
- if (!GetParam()) {
- GTEST_SKIP() << "This test should run only if "
- "trendline_integration_enabled is enabled";
- }
- std::vector<PacketResult> enough_feedback_1 =
- CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero());
- std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- 2 * kObservationDurationLowerBound);
-
- ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
- LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
-
- loss_based_bandwidth_estimator.SetBandwidthEstimate(
- DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- EXPECT_LE(
- loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
- DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- EXPECT_LE(
- loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
- DataRate::KilobitsPerSec(600));
-}
-
// When network is normal, estimate can increase but never be higher than
// the delay based estimate.
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
BandwidthEstimateCappedByDelayBasedEstimateWhenNetworkNormal) {
// Create two packet results, network is in normal state, 100% packets are
// received, and no delay increase.
@@ -489,16 +433,14 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero() +
2 * kObservationDurationLowerBound);
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// If the delay based estimate is infinity, then loss based estimate increases
// and not bounded by delay based estimate.
@@ -507,8 +449,7 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::KilobitsPerSec(500),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// If the delay based estimate is not infinity, then loss based estimate is
// bounded by delay based estimate.
@@ -519,11 +460,11 @@ TEST_P(LossBasedBweV2Test,
// When loss based bwe receives a strong signal of overusing and an increase in
// loss rate, it should acked bitrate for emegency backoff.
-TEST_P(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
+TEST_F(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
// Create two packet results, first packet has 50% loss rate, second packet
// has 100% loss rate.
std::vector<PacketResult> enough_feedback_1 =
- CreatePacketResultsWith50pLossRate(
+ CreatePacketResultsWith50pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
std::vector<PacketResult> enough_feedback_2 =
CreatePacketResultsWith100pLossRate(
@@ -531,8 +472,7 @@ TEST_P(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
2 * kObservationDurationLowerBound);
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
@@ -542,15 +482,11 @@ TEST_P(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
// Update estimate when network is overusing, and 50% loss rate.
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwOverusing,
- /*probe_estimate=*/absl::nullopt,
/*in_alr=*/false);
// Update estimate again when network is continuously overusing, and 100%
// loss rate.
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwOverusing,
- /*probe_estimate=*/absl::nullopt,
/*in_alr=*/false);
// The estimate bitrate now is backed off based on acked bitrate.
EXPECT_LE(
@@ -560,13 +496,12 @@ TEST_P(LossBasedBweV2Test, UseAckedBitrateForEmegencyBackOff) {
// When receiving the same packet feedback, loss based bwe ignores the feedback
// and returns the current estimate.
-TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
+TEST_F(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero());
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
@@ -575,8 +510,7 @@ TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -584,8 +518,7 @@ TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
// Use the same feedback and check if the estimate is unchanged.
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -595,7 +528,7 @@ TEST_P(LossBasedBweV2Test, NoBweChangeIfObservationDurationUnchanged) {
// When receiving feedback of packets that were sent within an observation
// duration, and network is in the normal state, loss based bwe returns the
// current estimate.
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
NoBweChangeIfObservationDurationIsSmallAndNetworkNormal) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
@@ -605,23 +538,20 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound - TimeDelta::Millis(1));
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
@@ -631,7 +561,7 @@ TEST_P(LossBasedBweV2Test,
// When receiving feedback of packets that were sent within an observation
// duration, and network is in the underusing state, loss based bwe returns the
// current estimate.
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
NoBweIncreaseIfObservationDurationIsSmallAndNetworkUnderusing) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
@@ -641,72 +571,26 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound - TimeDelta::Millis(1));
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- DataRate estimate_1 =
- loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
-
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwUnderusing, /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- DataRate estimate_2 =
- loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
- EXPECT_LE(estimate_2, estimate_1);
-}
-
-// When receiving feedback of packets that were sent within an observation
-// duration, network is overusing, and trendline integration is enabled, loss
-// based bwe updates its estimate.
-TEST_P(LossBasedBweV2Test,
- UpdateEstimateIfObservationDurationIsSmallAndNetworkOverusing) {
- if (!GetParam()) {
- GTEST_SKIP() << "This test should run only if "
- "trendline_integration_enabled is enabled";
- }
- std::vector<PacketResult> enough_feedback_1 =
- CreatePacketResultsWith50pLossRate(
- /*first_packet_timestamp=*/Timestamp::Zero());
- std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWith100pLossRate(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound - TimeDelta::Millis(1));
- ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
- LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
- loss_based_bandwidth_estimator.SetBandwidthEstimate(
- DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
- DataRate::KilobitsPerSec(300));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
/*in_alr=*/false);
DataRate estimate_1 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_2, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwOverusing,
- /*probe_estimate=*/absl::nullopt,
/*in_alr=*/false);
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
- EXPECT_LT(estimate_2, estimate_1);
+ EXPECT_LE(estimate_2, estimate_1);
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
IncreaseToDelayBasedEstimateIfNoLossOrDelayIncrease) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
@@ -716,38 +600,34 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero() +
2 * kObservationDurationLowerBound);
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
delay_based_estimate);
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_2,
+ delay_based_estimate,
+ /*in_alr=*/false);
EXPECT_EQ(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
delay_based_estimate);
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
IncreaseByMaxIncreaseFactorAfterLossBasedBweBacksOff) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
- "ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "CandidateFactors:1.2|1|0.5,"
"InstantUpperBoundBwBalance:10000kbps,"
- "DelayBasedCandidate:true,MaxIncreaseFactor:1.5,BwRampupUpperBoundFactor:"
- "2.0,NotIncreaseIfInherentLossLessThanAverageLoss:false/");
+ "MaxIncreaseFactor:1.5,NotIncreaseIfInherentLossLessThanAverageLoss:"
+ "false"));
+
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
DataRate acked_rate = DataRate::KilobitsPerSec(300);
@@ -759,10 +639,9 @@ TEST_P(LossBasedBweV2Test,
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
LossBasedBweV2::Result result_at_loss =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -773,10 +652,9 @@ TEST_P(LossBasedBweV2Test,
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_2,
+ delay_based_estimate,
+ /*in_alr=*/false);
LossBasedBweV2::Result result_after_recovery =
loss_based_bandwidth_estimator.GetLossBasedResult();
@@ -784,16 +662,13 @@ TEST_P(LossBasedBweV2Test,
result_at_loss.bandwidth_estimate * 1.5);
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
LossBasedStateIsDelayBasedEstimateAfterNetworkRecovering) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:100|1|0.5,AckedRateCandidate:true,"
- "ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "CandidateFactors:100|1|0.5,"
"InstantUpperBoundBwBalance:10000kbps,"
- "DelayBasedCandidate:true,MaxIncreaseFactor:100,"
- "BwRampupUpperBoundFactor:"
- "2.0,NotIncreaseIfInherentLossLessThanAverageLoss:false/");
+ "MaxIncreaseFactor:100,"
+ "NotIncreaseIfInherentLossLessThanAverageLoss:false"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(600);
DataRate acked_rate = DataRate::KilobitsPerSec(300);
@@ -805,10 +680,9 @@ TEST_P(LossBasedBweV2Test,
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
@@ -819,10 +693,9 @@ TEST_P(LossBasedBweV2Test,
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_2,
+ delay_based_estimate,
+ /*in_alr=*/false);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
@@ -833,38 +706,30 @@ TEST_P(LossBasedBweV2Test,
kObservationDurationLowerBound * 2);
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_3,
+ delay_based_estimate,
+ /*in_alr=*/false);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
}
-TEST_P(LossBasedBweV2Test,
- LossBasedStateIsNotDelayBasedEstimateIfDelayBasedEsimtateInfinite) {
+TEST_F(LossBasedBweV2Test,
+ LossBasedStateIsNotDelayBasedEstimateIfDelayBasedEstimateInfinite) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:100|1|0.5,AckedRateCandidate:true,"
- "ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
- "InstantUpperBoundBwBalance:10000kbps,"
- "DelayBasedCandidate:true,MaxIncreaseFactor:100,"
- "BwRampupUpperBoundFactor:"
- "2.0/");
+ ShortObservationConfig("CandidateFactors:100|1|0.5,"
+ "InstantUpperBoundBwBalance:10000kbps,"
+ "MaxIncreaseFactor:100"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
- DataRate delay_based_estimate = DataRate::PlusInfinity();
- DataRate acked_rate = DataRate::KilobitsPerSec(300);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
// Create some loss to create the loss limited scenario.
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+ enough_feedback_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
@@ -877,8 +742,8 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+ enough_feedback_2,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
EXPECT_NE(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDelayBasedEstimate);
@@ -886,20 +751,16 @@ TEST_P(LossBasedBweV2Test,
// After loss based bwe backs off, the next estimate is capped by
// a factor of acked bitrate.
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
IncreaseByFactorOfAckedBitrateAfterLossBasedBweBacksOff) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,LossThresholdOfHighBandwidthPreference:0.99,"
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "LossThresholdOfHighBandwidthPreference:0.99,"
"BwRampupUpperBoundFactor:1.2,"
- "InherentLossUpperBoundOffset:0.9,ObservationDurationLowerBound:200ms/");
+ // Set InstantUpperBoundBwBalance high to disable InstantUpperBound cap.
+ "InstantUpperBoundBwBalance:10000kbps,"));
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWith100pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
- std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWith10pLossRate(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound);
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
@@ -907,35 +768,103 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(300));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ LossBasedBweV2::Result result =
+ loss_based_bandwidth_estimator.GetLossBasedResult();
+ DataRate estimate_1 = result.bandwidth_estimate;
+ ASSERT_LT(estimate_1.kbps(), 600);
- // Change the acked bitrate to make sure that the estimate is bounded by a
- // factor of acked bitrate.
- DataRate acked_bitrate = DataRate::KilobitsPerSec(50);
- loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_bitrate);
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(estimate_1 * 0.9);
+
+ int feedback_count = 1;
+ while (feedback_count < 5 && result.state != LossBasedState::kIncreasing) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ feedback_count++ * kObservationDurationLowerBound),
+ delay_based_estimate,
+ /*in_alr=*/false);
+ result = loss_based_bandwidth_estimator.GetLossBasedResult();
+ }
+ ASSERT_EQ(result.state, LossBasedState::kIncreasing);
+
+ // The estimate is capped by acked_bitrate * BwRampupUpperBoundFactor.
+ EXPECT_EQ(result.bandwidth_estimate, estimate_1 * 0.9 * 1.2);
+
+ // But if acked bitrate decreases, BWE does not decrease when there is no
+ // loss.
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(estimate_1 * 0.9);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ feedback_count++ * kObservationDurationLowerBound),
+ delay_based_estimate,
/*in_alr=*/false);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ result.bandwidth_estimate);
+}
- // The estimate is capped by acked_bitrate * BwRampupUpperBoundFactor.
- DataRate estimate_2 =
- loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
- EXPECT_EQ(estimate_2, acked_bitrate * 1.2);
+// Ensure that the state can switch to kIncrease even when the bandwidth is
+// bounded by acked bitrate.
+TEST_F(LossBasedBweV2Test, EnsureIncreaseEvenIfAckedBitrateBound) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "LossThresholdOfHighBandwidthPreference:0.99,"
+ "BwRampupUpperBoundFactor:1.2,"
+ // Set InstantUpperBoundBwBalance high to disable InstantUpperBound cap.
+ "InstantUpperBoundBwBalance:10000kbps,"));
+ std::vector<PacketResult> enough_feedback_1 =
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
+
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(600));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(300));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ LossBasedBweV2::Result result =
+ loss_based_bandwidth_estimator.GetLossBasedResult();
+ DataRate estimate_1 = result.bandwidth_estimate;
+ ASSERT_LT(estimate_1.kbps(), 600);
+
+ // Set a low acked bitrate.
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(estimate_1 / 2);
+
+ int feedback_count = 1;
+ while (feedback_count < 5 && result.state != LossBasedState::kIncreasing) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ feedback_count++ * kObservationDurationLowerBound),
+ delay_based_estimate,
+ /*in_alr=*/false);
+ result = loss_based_bandwidth_estimator.GetLossBasedResult();
+ }
+
+ ASSERT_EQ(result.state, LossBasedState::kIncreasing);
+ // The estimate increases by 1kbps.
+ EXPECT_EQ(result.bandwidth_estimate, estimate_1 + DataRate::BitsPerSec(1));
}
// After loss based bwe backs off, the estimate is bounded during the delayed
// window.
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
EstimateBitrateIsBoundedDuringDelayedWindowAfterLossBasedBweBacksOff) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero());
std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWith50pLossRate(
+ CreatePacketResultsWith50pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kDelayedIncreaseWindow - TimeDelta::Millis(2));
std::vector<PacketResult> enough_feedback_3 =
@@ -943,8 +872,7 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero() +
kDelayedIncreaseWindow - TimeDelta::Millis(1));
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
@@ -952,28 +880,25 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(300));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
// Increase the acknowledged bitrate to make sure that the estimate is not
// capped too low.
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(5000));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_2,
+ delay_based_estimate,
+ /*in_alr=*/false);
// The estimate is capped by current_estimate * kMaxIncreaseFactor because
// it recently backed off.
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_3,
+ delay_based_estimate,
+ /*in_alr=*/false);
// The latest estimate is the same as the previous estimate since the sent
// packets were sent within the DelayedIncreaseWindow.
EXPECT_EQ(
@@ -982,7 +907,7 @@ TEST_P(LossBasedBweV2Test,
}
// The estimate is not bounded after the delayed increase window.
-TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
+TEST_F(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
std::vector<PacketResult> enough_feedback_1 =
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero());
@@ -995,8 +920,7 @@ TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
/*first_packet_timestamp=*/Timestamp::Zero() +
kDelayedIncreaseWindow + TimeDelta::Millis(1));
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
@@ -1004,63 +928,55 @@ TEST_P(LossBasedBweV2Test, KeepIncreasingEstimateAfterDelayedIncreaseWindow) {
DataRate::KilobitsPerSec(600));
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(300));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_1,
+ delay_based_estimate,
+ /*in_alr=*/false);
// Increase the acknowledged bitrate to make sure that the estimate is not
// capped too low.
loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
DataRate::KilobitsPerSec(5000));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_2,
+ delay_based_estimate,
+ /*in_alr=*/false);
// The estimate is capped by current_estimate * kMaxIncreaseFactor because it
// recently backed off.
DataRate estimate_2 =
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_3,
+ delay_based_estimate,
+ /*in_alr=*/false);
// The estimate can continue increasing after the DelayedIncreaseWindow.
EXPECT_GE(
loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
estimate_2);
}
-TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,"
- "NotIncreaseIfInherentLossLessThanAverageLoss:true/");
+TEST_F(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "CandidateFactors:1.2,"
+ "NotIncreaseIfInherentLossLessThanAverageLoss:true"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
- DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(600));
std::vector<PacketResult> enough_feedback_10p_loss_1 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_10p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+ enough_feedback_10p_loss_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_10p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+ enough_feedback_10p_loss_2,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
// Do not increase the bitrate because inherent loss is less than average loss
@@ -1069,16 +985,11 @@ TEST_P(LossBasedBweV2Test, NotIncreaseIfInherentLossLessThanAverageLoss) {
DataRate::KilobitsPerSec(600));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
SelectHighBandwidthCandidateIfLossRateIsLessThanThreshold) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2|0.8,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "20,NotIncreaseIfInherentLossLessThanAverageLoss:false/");
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "LossThresholdOfHighBandwidthPreference:0.20,"
+ "NotIncreaseIfInherentLossLessThanAverageLoss:false"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
@@ -1086,20 +997,20 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
std::vector<PacketResult> enough_feedback_10p_loss_1 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// Because LossThresholdOfHighBandwidthPreference is 20%, the average loss is
@@ -1109,16 +1020,10 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
SelectLowBandwidthCandidateIfLossRateIsIsHigherThanThreshold) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2|0.8,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "05/");
+ ShortObservationConfig("LossThresholdOfHighBandwidthPreference:0.05"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
@@ -1126,20 +1031,20 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
std::vector<PacketResult> enough_feedback_10p_loss_1 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// Because LossThresholdOfHighBandwidthPreference is 5%, the average loss is
@@ -1149,126 +1054,10 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
}
-TEST_P(LossBasedBweV2Test, LimitByProbeResultWhenRecoveringFromLoss) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
- "ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
- "InstantUpperBoundBwBalance:10000kbps,DelayedIncreaseWindow:100s,"
- "DelayBasedCandidate:true,MaxIncreaseFactor:1.3,"
- "BwRampupUpperBoundFactor:2.0,ProbeIntegrationEnabled:true/");
- LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
- DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
- DataRate acked_rate = DataRate::KilobitsPerSec(300);
- loss_based_bandwidth_estimator.SetBandwidthEstimate(
- DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
-
- // Create some loss to create the loss limited scenario.
- std::vector<PacketResult> enough_feedback_1 =
- CreatePacketResultsWith100pLossRate(
- /*first_packet_timestamp=*/Timestamp::Zero());
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
-
- // Network recovers after loss
- DataRate probe_estimate = DataRate::KilobitsPerSec(300);
- std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound);
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- probe_estimate,
- /*in_alr=*/false);
-
- for (int i = 2; i < 5; ++i) {
- enough_feedback_2 = CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound * i);
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- LossBasedBweV2::Result result_after_recovery =
- loss_based_bandwidth_estimator.GetLossBasedResult();
- EXPECT_LE(result_after_recovery.bandwidth_estimate, probe_estimate);
- }
-}
-
-TEST_P(LossBasedBweV2Test, NotLimitByProbeResultWhenProbeResultIsExpired) {
- ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.2|1|0.5,AckedRateCandidate:true,"
- "ObservationWindowSize:2,ObservationDurationLowerBound:200ms,"
- "InstantUpperBoundBwBalance:10000kbps,DelayedIncreaseWindow:100s,"
- "DelayBasedCandidate:true,MaxIncreaseFactor:1.3,"
- "BwRampupUpperBoundFactor:2.0,ProbeIntegrationEnabled:true,"
- "ProbeExpiration:10s/");
- LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
- DataRate delay_based_estimate = DataRate::KilobitsPerSec(5000);
- DataRate acked_rate = DataRate::KilobitsPerSec(300);
- loss_based_bandwidth_estimator.SetBandwidthEstimate(
- DataRate::KilobitsPerSec(600));
- loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acked_rate);
-
- // Create some loss to create the loss limited scenario.
- std::vector<PacketResult> enough_feedback_1 =
- CreatePacketResultsWith100pLossRate(
- /*first_packet_timestamp=*/Timestamp::Zero());
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_1, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
-
- // Network recovers after loss
- DataRate probe_estimate = DataRate::KilobitsPerSec(300);
- std::vector<PacketResult> enough_feedback_2 =
- CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound);
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- probe_estimate,
- /*in_alr=*/false);
-
- for (int i = 2; i < 5; ++i) {
- enough_feedback_2 = CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound * i);
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_2, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
- }
-
- std::vector<PacketResult> enough_feedback_3 =
- CreatePacketResultsWithReceivedPackets(
- /*first_packet_timestamp=*/Timestamp::Zero() +
- kObservationDurationLowerBound + TimeDelta::Seconds(11));
- loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
- enough_feedback_3, delay_based_estimate, BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt,
- /*in_alr=*/false);
-
- // Probe result is expired after 10s.
- LossBasedBweV2::Result result_after_recovery =
- loss_based_bandwidth_estimator.GetLossBasedResult();
- EXPECT_GT(result_after_recovery.bandwidth_estimate, probe_estimate);
-}
-
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
StricterBoundUsingHighLossRateThresholdAt10pLossRate) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.0,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "05,HighLossRateThreshold:0.09/");
+ ShortObservationConfig("HighLossRateThreshold:0.09"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1278,20 +1067,20 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
std::vector<PacketResult> enough_feedback_10p_loss_1 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_10p_loss_2 =
- CreatePacketResultsWith10pLossRate(
+ CreatePacketResultsWith10pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_10p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// At 10% loss rate and high loss rate threshold to be 10%, cap the estimate
@@ -1301,16 +1090,10 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(400));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
StricterBoundUsingHighLossRateThresholdAt50pLossRate) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.0,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "05,HighLossRateThreshold:0.3/");
+ ShortObservationConfig("HighLossRateThreshold:0.3"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1320,20 +1103,20 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(600));
std::vector<PacketResult> enough_feedback_50p_loss_1 =
- CreatePacketResultsWith50pLossRate(
+ CreatePacketResultsWith50pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_50p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_50p_loss_2 =
- CreatePacketResultsWith50pLossRate(
+ CreatePacketResultsWith50pPacketLossRate(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_50p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// At 50% loss rate and high loss rate threshold to be 30%, cap the estimate
@@ -1343,16 +1126,10 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(10));
}
-TEST_P(LossBasedBweV2Test,
+TEST_F(LossBasedBweV2Test,
StricterBoundUsingHighLossRateThresholdAt100pLossRate) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.0,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "05,HighLossRateThreshold:0.3/");
+ ShortObservationConfig("HighLossRateThreshold:0.3"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1366,7 +1143,7 @@ TEST_P(LossBasedBweV2Test,
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_100p_loss_2 =
@@ -1375,7 +1152,7 @@ TEST_P(LossBasedBweV2Test,
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// At 100% loss rate and high loss rate threshold to be 30%, cap the estimate
@@ -1385,15 +1162,9 @@ TEST_P(LossBasedBweV2Test,
DataRate::KilobitsPerSec(10));
}
-TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
+TEST_F(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.1|1.0|0.9,AckedRateCandidate:false,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,HigherBwBiasFactor:1000,"
- "HigherLogBwBiasFactor:1000,LossThresholdOfHighBandwidthPreference:0."
- "05,HighLossRateThreshold:0.3/");
+ ShortObservationConfig("HighLossRateThreshold:0.3"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1407,7 +1178,7 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// Make sure that the estimate is set to min bitrate because of 100% loss
@@ -1423,7 +1194,7 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
kObservationDurationLowerBound);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_0p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
std::vector<PacketResult> enough_feedback_0p_loss_2 =
@@ -1432,7 +1203,7 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
kObservationDurationLowerBound * 2);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_0p_loss_2, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// The estimate increases as network recovers.
@@ -1441,10 +1212,9 @@ TEST_P(LossBasedBweV2Test, EstimateRecoversAfterHighLoss) {
DataRate::KilobitsPerSec(10));
}
-TEST_P(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
+TEST_F(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
ExplicitKeyValueConfig key_value_config(
- Config(/*enabled=*/true, /*valid=*/true,
- /*trendline_integration_enabled=*/GetParam()));
+ Config(/*enabled=*/true, /*valid=*/true));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1456,7 +1226,7 @@ TEST_P(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback, /*delay_based_estimate=*/DataRate::PlusInfinity(),
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
EXPECT_LE(
@@ -1464,13 +1234,9 @@ TEST_P(LossBasedBweV2Test, EstimateIsNotHigherThanMaxBitrate) {
DataRate::KilobitsPerSec(1000));
}
-TEST_P(LossBasedBweV2Test, NotBackOffToAckedRateInAlr) {
+TEST_F(LossBasedBweV2Test, NotBackOffToAckedRateInAlr) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.1|1.0|0.9,AckedRateCandidate:true,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,NotUseAckedRateInAlr:true/");
+ ShortObservationConfig("InstantUpperBoundBwBalance:100kbps"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1486,7 +1252,6 @@ TEST_P(LossBasedBweV2Test, NotBackOffToAckedRateInAlr) {
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
/*in_alr=*/true);
// Make sure that the estimate decreases but higher than acked rate.
@@ -1499,13 +1264,9 @@ TEST_P(LossBasedBweV2Test, NotBackOffToAckedRateInAlr) {
DataRate::KilobitsPerSec(600));
}
-TEST_P(LossBasedBweV2Test, BackOffToAckedRateIfNotInAlr) {
+TEST_F(LossBasedBweV2Test, BackOffToAckedRateIfNotInAlr) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,CandidateFactors:1.1|1.0|0.9,AckedRateCandidate:true,"
- "ObservationWindowSize:2,"
- "DelayBasedCandidate:true,InstantUpperBoundBwBalance:100kbps,"
- "ObservationDurationLowerBound:200ms,NotUseAckedRateInAlr:true/");
+ ShortObservationConfig("InstantUpperBoundBwBalance:100kbps"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetMinMaxBitrate(
/*min_bitrate=*/DataRate::KilobitsPerSec(10),
@@ -1521,7 +1282,7 @@ TEST_P(LossBasedBweV2Test, BackOffToAckedRateIfNotInAlr) {
/*first_packet_timestamp=*/Timestamp::Zero());
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback_100p_loss_1, delay_based_estimate,
- BandwidthUsage::kBwNormal, /*probe_estimate=*/absl::nullopt,
+
/*in_alr=*/false);
// Make sure that the estimate decreases but higher than acked rate.
@@ -1530,21 +1291,18 @@ TEST_P(LossBasedBweV2Test, BackOffToAckedRateIfNotInAlr) {
acked_rate);
}
-TEST_P(LossBasedBweV2Test, NotReadyToUseInStartPhase) {
+TEST_F(LossBasedBweV2Test, NotReadyToUseInStartPhase) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,UseInStartPhase:true/");
+ ShortObservationConfig("UseInStartPhase:true"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
// Make sure that the estimator is not ready to use in start phase because of
// lacking TWCC feedback.
EXPECT_FALSE(loss_based_bandwidth_estimator.ReadyToUseInStartPhase());
}
-TEST_P(LossBasedBweV2Test,
- ReadyToUseInStartPhase) {
+TEST_F(LossBasedBweV2Test, ReadyToUseInStartPhase) {
ExplicitKeyValueConfig key_value_config(
- "WebRTC-Bwe-LossBasedBweV2/"
- "Enabled:true,ObservationDurationLowerBound:200ms,UseInStartPhase:true/");
+ ShortObservationConfig("UseInStartPhase:true"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
std::vector<PacketResult> enough_feedback =
CreatePacketResultsWithReceivedPackets(
@@ -1552,14 +1310,517 @@ TEST_P(LossBasedBweV2Test,
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
enough_feedback, /*delay_based_estimate=*/DataRate::KilobitsPerSec(600),
- BandwidthUsage::kBwNormal,
- /*probe_estimate=*/absl::nullopt, /*in_alr=*/false);
+ /*in_alr=*/false);
EXPECT_TRUE(loss_based_bandwidth_estimator.ReadyToUseInStartPhase());
}
-INSTANTIATE_TEST_SUITE_P(LossBasedBweV2Tests,
- LossBasedBweV2Test,
- ::testing::Bool());
+TEST_F(LossBasedBweV2Test, BoundEstimateByAckedRate) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("LowerBoundByAckedRateFactor:1.0"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(600));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(500));
+
+ std::vector<PacketResult> enough_feedback_100p_loss_1 =
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_100p_loss_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(500));
+}
+
+TEST_F(LossBasedBweV2Test, NotBoundEstimateByAckedRate) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("LowerBoundByAckedRateFactor:0.0"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(600));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(500));
+
+ std::vector<PacketResult> enough_feedback_100p_loss_1 =
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_100p_loss_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+
+ EXPECT_LT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(500));
+}
+
+TEST_F(LossBasedBweV2Test, HasDecreaseStateBecauseOfUpperBound) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "CandidateFactors:1.0,InstantUpperBoundBwBalance:10kbps"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(500));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(500));
+
+ std::vector<PacketResult> enough_feedback_10p_loss_1 =
+ CreatePacketResultsWith10pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_10p_loss_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+
+ // Verify that the instant upper bound decreases the estimate, and state is
+ // updated to kDecreasing.
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(200));
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+}
+
+TEST_F(LossBasedBweV2Test, HasIncreaseStateBecauseOfLowerBound) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "CandidateFactors:1.0,LowerBoundByAckedRateFactor:10.0"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000000));
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(500));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(1));
+
+ // Network has a high loss to create a loss scenario.
+ std::vector<PacketResult> enough_feedback_50p_loss_1 =
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero());
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_50p_loss_1,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+
+ // Network still has a high loss, but better acked rate.
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(200));
+ std::vector<PacketResult> enough_feedback_50p_loss_2 =
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ enough_feedback_50p_loss_2,
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+
+ // Verify that the instant lower bound increases the estimate, and state is
+ // updated to kIncreasing.
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(200) * 10);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kIncreasing);
+}
+
+TEST_F(LossBasedBweV2Test,
+ EstimateIncreaseSlowlyFromInstantUpperBoundInAlrIfFieldTrial) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("UpperBoundCandidateInAlr:true"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(1000));
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(150));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/true);
+ LossBasedBweV2::Result result_after_loss =
+ loss_based_bandwidth_estimator.GetLossBasedResult();
+ ASSERT_EQ(result_after_loss.state, LossBasedState::kDecreasing);
+
+ for (int feedback_count = 1; feedback_count <= 3; ++feedback_count) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ feedback_count * kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/true);
+ }
+ // Expect less than 100% increase.
+ EXPECT_LT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ 2 * result_after_loss.bandwidth_estimate);
+}
+
+TEST_F(LossBasedBweV2Test, HasDelayBasedStateIfLossBasedBweIsMax) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(""));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetMinMaxBitrate(
+ /*min_bitrate=*/DataRate::KilobitsPerSec(10),
+ /*max_bitrate=*/DataRate::KilobitsPerSec(1000));
+
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ /*feedback = */ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::KilobitsPerSec(2000),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDelayBasedEstimate);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(1000));
+
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ /*feedback=*/CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::KilobitsPerSec(2000),
+ /*in_alr=*/false);
+ LossBasedBweV2::Result result =
+ loss_based_bandwidth_estimator.GetLossBasedResult();
+ ASSERT_EQ(result.state, LossBasedState::kDecreasing);
+ ASSERT_LT(result.bandwidth_estimate, DataRate::KilobitsPerSec(1000));
+
+ // Eventually the estimator recovers to delay based state.
+ int feedback_count = 2;
+ while (feedback_count < 5 &&
+ result.state != LossBasedState::kDelayBasedEstimate) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ /*feedback = */ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ feedback_count++ * kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::KilobitsPerSec(2000),
+ /*in_alr=*/false);
+ result = loss_based_bandwidth_estimator.GetLossBasedResult();
+ }
+ EXPECT_EQ(result.state, LossBasedState::kDelayBasedEstimate);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(1000));
+}
+
+TEST_F(LossBasedBweV2Test, IncreaseUsingPaddingStateIfFieldTrial) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("PaddingDuration:1000ms"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(2500));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kIncreaseUsingPadding);
+}
+
+TEST_F(LossBasedBweV2Test, DecreaseToAckedCandidateIfPaddingInAlr) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "PaddingDuration:1000ms,"
+ // Set InstantUpperBoundBwBalance high to disable InstantUpperBound cap.
+ "InstantUpperBoundBwBalance:10000kbps"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(1000));
+ int feedback_id = 0;
+ while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
+ LossBasedState::kDecreasing) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/true);
+ feedback_id++;
+ }
+
+ while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
+ LossBasedState::kIncreaseUsingPadding) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/true);
+ feedback_id++;
+ }
+ ASSERT_GT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(900));
+
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(
+ DataRate::KilobitsPerSec(100));
+ // Padding is sent now, create some lost packets.
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/true);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(100));
+}
+
+TEST_F(LossBasedBweV2Test, DecreaseAfterPadding) {
+ ExplicitKeyValueConfig key_value_config(ShortObservationConfig(
+ "PaddingDuration:1000ms,BwRampupUpperBoundFactor:2.0"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(2500));
+ DataRate acknowledged_bitrate = DataRate::KilobitsPerSec(51);
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acknowledged_bitrate);
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ ASSERT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ acknowledged_bitrate);
+
+ acknowledged_bitrate = DataRate::KilobitsPerSec(26);
+ loss_based_bandwidth_estimator.SetAcknowledgedBitrate(acknowledged_bitrate);
+ int feedback_id = 1;
+ while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
+ LossBasedState::kIncreaseUsingPadding) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ feedback_id++;
+ }
+
+ const Timestamp estimate_increased =
+ Timestamp::Zero() + kObservationDurationLowerBound * feedback_id;
+ // The state is kIncreaseUsingPadding for a while without changing the
+ // estimate, which is limited by 2 * acked rate.
+ while (loss_based_bandwidth_estimator.GetLossBasedResult().state ==
+ LossBasedState::kIncreaseUsingPadding) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ feedback_id++;
+ }
+
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ const Timestamp start_decreasing =
+ Timestamp::Zero() + kObservationDurationLowerBound * (feedback_id - 1);
+ EXPECT_EQ(start_decreasing - estimate_increased, TimeDelta::Seconds(1));
+}
+
+TEST_F(LossBasedBweV2Test, IncreaseEstimateIfNotHold) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("HoldDurationFactor:0"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(2500));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ DataRate estimate =
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
+
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kIncreasing);
+ EXPECT_GT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ estimate);
+}
+
+TEST_F(LossBasedBweV2Test, IncreaseEstimateAfterHoldDuration) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("HoldDurationFactor:10"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(2500));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ DataRate estimate =
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
+
+ // During the hold duration, e.g. first 300ms, the estimate cannot increase.
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ estimate);
+
+ // After the hold duration, the estimate can increase.
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * 2),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kIncreasing);
+ EXPECT_GE(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ estimate);
+
+ // Get another 50p packet loss.
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * 3),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ DataRate estimate_at_hold =
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
+
+ // In the hold duration, e.g. next 3s, the estimate cannot increase above the
+ // hold rate. Get some lost packets to get lower estimate than the HOLD rate.
+ for (int i = 4; i <= 6; ++i) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith100pLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * i),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ EXPECT_LT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ estimate_at_hold);
+ }
+
+ int feedback_id = 7;
+ while (loss_based_bandwidth_estimator.GetLossBasedResult().state !=
+ LossBasedState::kIncreasing) {
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound * feedback_id),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ if (loss_based_bandwidth_estimator.GetLossBasedResult().state ==
+ LossBasedState::kDecreasing) {
+ // In the hold duration, the estimate can not go higher than estimate at
+ // hold.
+ EXPECT_LE(loss_based_bandwidth_estimator.GetLossBasedResult()
+ .bandwidth_estimate,
+ estimate_at_hold);
+ } else if (loss_based_bandwidth_estimator.GetLossBasedResult().state ==
+ LossBasedState::kIncreasing) {
+ // After the hold duration, the estimate can increase again.
+ EXPECT_GT(loss_based_bandwidth_estimator.GetLossBasedResult()
+ .bandwidth_estimate,
+ estimate_at_hold);
+ }
+ feedback_id++;
+ }
+}
+
+TEST_F(LossBasedBweV2Test, EndHoldDurationIfDelayBasedEstimateWorks) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("HoldDurationFactor:3"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(2500));
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith50pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero()),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ DataRate estimate =
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate;
+
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWithReceivedPackets(
+ /*first_packet_timestamp=*/Timestamp::Zero() +
+ kObservationDurationLowerBound),
+ /*delay_based_estimate=*/estimate + DataRate::KilobitsPerSec(10),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDelayBasedEstimate);
+ EXPECT_EQ(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ estimate + DataRate::KilobitsPerSec(10));
+}
+
+TEST_F(LossBasedBweV2Test, UseByteLossRate) {
+ ExplicitKeyValueConfig key_value_config(
+ ShortObservationConfig("UseByteLossRate:true"));
+ LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
+ loss_based_bandwidth_estimator.SetBandwidthEstimate(
+ DataRate::KilobitsPerSec(500));
+ // Create packet feedback having 10% packet loss but more than 50% byte loss.
+ loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
+ CreatePacketResultsWith10pPacketLossRate(
+ /*first_packet_timestamp=*/Timestamp::Zero(),
+ /*lost_packet_size=*/DataSize::Bytes(kPacketSize * 20)),
+ /*delay_based_estimate=*/DataRate::PlusInfinity(),
+ /*in_alr=*/false);
+ EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
+ LossBasedState::kDecreasing);
+ // The estimate is bounded by the instant upper bound due to high loss.
+ EXPECT_LT(
+ loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate,
+ DataRate::KilobitsPerSec(150));
+}
} // namespace
} // namespace webrtc
diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc
index 6139704fb5..32b1b93c0b 100644
--- a/modules/congestion_controller/goog_cc/probe_controller.cc
+++ b/modules/congestion_controller/goog_cc/probe_controller.cc
@@ -109,35 +109,23 @@ ProbeControllerConfig::ProbeControllerConfig(
allocation_probe_max("alloc_probe_max", DataRate::PlusInfinity()),
min_probe_packets_sent("min_probe_packets_sent", 5),
min_probe_duration("min_probe_duration", TimeDelta::Millis(15)),
- limit_probe_target_rate_to_loss_bwe("limit_probe_target_rate_to_loss_bwe",
- false),
loss_limited_probe_scale("loss_limited_scale", 1.5),
skip_if_estimate_larger_than_fraction_of_max(
"skip_if_est_larger_than_fraction_of_max",
- 0.0),
- not_probe_if_delay_increased("not_probe_if_delay_increased", false) {
- ParseFieldTrial({&first_exponential_probe_scale,
- &second_exponential_probe_scale,
- &further_exponential_probe_scale,
- &further_probe_threshold,
- &alr_probing_interval,
- &alr_probe_scale,
- &probe_on_max_allocated_bitrate_change,
- &first_allocation_probe_scale,
- &second_allocation_probe_scale,
- &allocation_allow_further_probing,
- &min_probe_duration,
- &network_state_estimate_probing_interval,
- &probe_if_estimate_lower_than_network_state_estimate_ratio,
- &estimate_lower_than_network_state_estimate_probing_interval,
- &network_state_probe_scale,
- &network_state_probe_duration,
- &min_probe_packets_sent,
- &limit_probe_target_rate_to_loss_bwe,
- &loss_limited_probe_scale,
- &skip_if_estimate_larger_than_fraction_of_max,
- &not_probe_if_delay_increased},
- key_value_config->Lookup("WebRTC-Bwe-ProbingConfiguration"));
+ 0.0) {
+ ParseFieldTrial(
+ {&first_exponential_probe_scale, &second_exponential_probe_scale,
+ &further_exponential_probe_scale, &further_probe_threshold,
+ &alr_probing_interval, &alr_probe_scale,
+ &probe_on_max_allocated_bitrate_change, &first_allocation_probe_scale,
+ &second_allocation_probe_scale, &allocation_allow_further_probing,
+ &min_probe_duration, &network_state_estimate_probing_interval,
+ &probe_if_estimate_lower_than_network_state_estimate_ratio,
+ &estimate_lower_than_network_state_estimate_probing_interval,
+ &network_state_probe_scale, &network_state_probe_duration,
+ &min_probe_packets_sent, &loss_limited_probe_scale,
+ &skip_if_estimate_larger_than_fraction_of_max},
+ key_value_config->Lookup("WebRTC-Bwe-ProbingConfiguration"));
// Specialized keys overriding subsets of WebRTC-Bwe-ProbingConfiguration
ParseFieldTrial(
@@ -162,7 +150,7 @@ ProbeControllerConfig::~ProbeControllerConfig() = default;
ProbeController::ProbeController(const FieldTrialsView* key_value_config,
RtcEventLog* event_log)
- : network_available_(true),
+ : network_available_(false),
enable_periodic_alr_probing_(false),
in_rapid_recovery_experiment_(absl::StartsWith(
key_value_config->Lookup(kBweRapidRecoveryExperiment),
@@ -484,29 +472,21 @@ std::vector<ProbeClusterConfig> ProbeController::InitiateProbing(
}
DataRate estimate_capped_bitrate = DataRate::PlusInfinity();
- if (config_.limit_probe_target_rate_to_loss_bwe) {
- switch (bandwidth_limited_cause_) {
- case BandwidthLimitedCause::kLossLimitedBweDecreasing:
- // If bandwidth estimate is decreasing because of packet loss, do not
- // send probes.
- return {};
- case BandwidthLimitedCause::kLossLimitedBweIncreasing:
- estimate_capped_bitrate =
- std::min(max_probe_bitrate,
- estimated_bitrate_ * config_.loss_limited_probe_scale);
- break;
- case BandwidthLimitedCause::kDelayBasedLimited:
- break;
- default:
- break;
- }
- }
- if (config_.not_probe_if_delay_increased &&
- (bandwidth_limited_cause_ ==
- BandwidthLimitedCause::kDelayBasedLimitedDelayIncreased ||
- bandwidth_limited_cause_ ==
- BandwidthLimitedCause::kRttBasedBackOffHighRtt)) {
- return {};
+ switch (bandwidth_limited_cause_) {
+ case BandwidthLimitedCause::kRttBasedBackOffHighRtt:
+ case BandwidthLimitedCause::kDelayBasedLimitedDelayIncreased:
+ case BandwidthLimitedCause::kLossLimitedBwe:
+ RTC_LOG(LS_INFO) << "Not sending probe in bandwidth limited state.";
+ return {};
+ case BandwidthLimitedCause::kLossLimitedBweIncreasing:
+ estimate_capped_bitrate =
+ std::min(max_probe_bitrate,
+ estimated_bitrate_ * config_.loss_limited_probe_scale);
+ break;
+ case BandwidthLimitedCause::kDelayBasedLimited:
+ break;
+ default:
+ break;
}
if (config_.network_state_estimate_probing_interval->IsFinite() &&
diff --git a/modules/congestion_controller/goog_cc/probe_controller.h b/modules/congestion_controller/goog_cc/probe_controller.h
index c8653b8d69..feec81f2dc 100644
--- a/modules/congestion_controller/goog_cc/probe_controller.h
+++ b/modules/congestion_controller/goog_cc/probe_controller.h
@@ -71,14 +71,10 @@ struct ProbeControllerConfig {
FieldTrialParameter<int> min_probe_packets_sent;
// The minimum probing duration.
FieldTrialParameter<TimeDelta> min_probe_duration;
- // Periodically probe when bandwidth estimate is loss limited.
- FieldTrialParameter<bool> limit_probe_target_rate_to_loss_bwe;
FieldTrialParameter<double> loss_limited_probe_scale;
// Dont send a probe if min(estimate, network state estimate) is larger than
// this fraction of the set max bitrate.
FieldTrialParameter<double> skip_if_estimate_larger_than_fraction_of_max;
- // Do not send probes if either overusing/underusing network or high rtt.
- FieldTrialParameter<bool> not_probe_if_delay_increased;
};
// Reason that bandwidth estimate is limited. Bandwidth estimate can be limited
@@ -86,7 +82,7 @@ struct ProbeControllerConfig {
// estimate.
enum class BandwidthLimitedCause {
kLossLimitedBweIncreasing = 0,
- kLossLimitedBweDecreasing = 1,
+ kLossLimitedBwe = 1,
kDelayBasedLimited = 2,
kDelayBasedLimitedDelayIncreased = 3,
kRttBasedBackOffHighRtt = 4
@@ -142,11 +138,6 @@ class ProbeController {
ABSL_MUST_USE_RESULT std::vector<ProbeClusterConfig> Process(
Timestamp at_time);
- // Gets the value of field trial not_probe_if_delay_increased.
- bool DontProbeIfDelayIncreased() {
- return config_.not_probe_if_delay_increased;
- }
-
private:
enum class State {
// Initial state where no probing has been triggered yet.
diff --git a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
index 6c02b3e2b5..94025b30ea 100644
--- a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
+++ b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
@@ -60,20 +60,38 @@ class ProbeControllerFixture {
NiceMock<MockRtcEventLog> mock_rtc_event_log;
};
-TEST(ProbeControllerTest, InitiatesProbingAtStart) {
+TEST(ProbeControllerTest, InitiatesProbingAfterSetBitrates) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_GE(probes.size(), 2u);
}
+TEST(ProbeControllerTest, InitiatesProbingWhenNetworkAvailable) {
+ ProbeControllerFixture fixture;
+ std::unique_ptr<ProbeController> probe_controller =
+ fixture.CreateController();
+
+ std::vector<ProbeClusterConfig> probes = probe_controller->SetBitrates(
+ kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
+ EXPECT_THAT(probes, IsEmpty());
+ probes = probe_controller->OnNetworkAvailability({.network_available = true});
+ EXPECT_GE(probes.size(), 2u);
+}
+
TEST(ProbeControllerTest, SetsDefaultTargetDurationAndTargetProbeCount) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
std::vector<ProbeClusterConfig> probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
ASSERT_GE(probes.size(), 2u);
@@ -89,6 +107,9 @@ TEST(ProbeControllerTest,
"min_probe_packets_sent:2,min_probe_duration:123ms/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
std::vector<ProbeClusterConfig> probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
ASSERT_GE(probes.size(), 2u);
@@ -115,6 +136,9 @@ TEST(ProbeControllerTest, CanConfigureInitialProbeRateFactor) {
ProbeControllerFixture fixture("WebRTC-Bwe-ProbingConfiguration/p1:2,p2:3/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_EQ(probes.size(), 2u);
@@ -126,6 +150,9 @@ TEST(ProbeControllerTest, DisableSecondInitialProbeIfRateFactorZero) {
ProbeControllerFixture fixture("WebRTC-Bwe-ProbingConfiguration/p1:2,p2:0/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_EQ(probes.size(), 1u);
@@ -136,6 +163,9 @@ TEST(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
// Long enough to time out exponential probing.
@@ -155,6 +185,9 @@ TEST(ProbeControllerTest, ProbesOnMaxAllocatedBitrateIncreaseOnlyWhenInAlr) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probes = probe_controller->SetEstimatedBitrate(
@@ -186,7 +219,9 @@ TEST(ProbeControllerTest, CanDisableProbingOnMaxTotalAllocatedBitrateIncrease) {
"probe_max_allocation:false/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
-
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probes = probe_controller->SetEstimatedBitrate(
@@ -208,6 +243,9 @@ TEST(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
// Long enough to time out exponential probing.
@@ -231,6 +269,9 @@ TEST(ProbeControllerTest, TestExponentialProbing) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -252,6 +293,9 @@ TEST(ProbeControllerTest, TestExponentialProbingTimeout) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
// Advance far enough to cause a time out in waiting for probing result.
@@ -268,6 +312,9 @@ TEST(ProbeControllerTest, RequestProbeInAlr) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_GE(probes.size(), 2u);
@@ -291,6 +338,9 @@ TEST(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_EQ(probes.size(), 2u);
@@ -316,6 +366,9 @@ TEST(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_EQ(probes.size(), 2u);
@@ -339,6 +392,9 @@ TEST(ProbeControllerTest, RequestProbeWhenBweDropNotRecent) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
EXPECT_EQ(probes.size(), 2u);
@@ -361,6 +417,9 @@ TEST(ProbeControllerTest, PeriodicProbing) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -405,6 +464,9 @@ TEST(ProbeControllerTest, PeriodicProbingAfterReset) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
Timestamp alr_start_time = fixture.CurrentTime();
probe_controller->SetAlrStartTimeMs(alr_start_time.ms());
@@ -463,6 +525,9 @@ TEST(ProbeControllerTest, TestExponentialProbingOverflow) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
const DataRate kMbpsMultiplier = DataRate::KilobitsPerSec(1000);
auto probes = probe_controller->SetBitrates(kMinBitrate, 10 * kMbpsMultiplier,
100 * kMbpsMultiplier,
@@ -484,6 +549,9 @@ TEST(ProbeControllerTest, TestAllocatedBitrateCap) {
ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
const DataRate kMbpsMultiplier = DataRate::KilobitsPerSec(1000);
const DataRate kMaxBitrate = 100 * kMbpsMultiplier;
auto probes = probe_controller->SetBitrates(
@@ -529,6 +597,9 @@ TEST(ProbeControllerTest, ConfigurableProbingFieldTrial) {
"alloc_p1:2,alloc_p2,min_probe_packets_sent:2/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(kMinBitrate, kStartBitrate,
DataRate::KilobitsPerSec(5000),
@@ -563,11 +634,12 @@ TEST(ProbeControllerTest, ConfigurableProbingFieldTrial) {
}
TEST(ProbeControllerTest, LimitAlrProbeWhenLossBasedBweLimited) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "limit_probe_target_rate_to_loss_bwe:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -602,6 +674,9 @@ TEST(ProbeControllerTest, PeriodicProbeAtUpperNetworkStateEstimate) {
"WebRTC-Bwe-ProbingConfiguration/network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -627,9 +702,12 @@ TEST(ProbeControllerTest,
LimitProbeAtUpperNetworkStateEstimateIfLossBasedLimited) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -659,6 +737,9 @@ TEST(ProbeControllerTest, AlrProbesLimitedByNetworkStateEstimate) {
"WebRTC-Bwe-ProbingConfiguration/network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -687,6 +768,9 @@ TEST(ProbeControllerTest, CanSetLongerProbeDurationAfterNetworkStateEstimate) {
"network_state_interval:5s,network_state_probe_duration:100ms/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -706,11 +790,12 @@ TEST(ProbeControllerTest, CanSetLongerProbeDurationAfterNetworkStateEstimate) {
}
TEST(ProbeControllerTest, ProbeInAlrIfLossBasedIncreasing) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "limit_probe_target_rate_to_loss_bwe:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probe_controller->EnablePeriodicAlrProbing(true);
@@ -732,11 +817,12 @@ TEST(ProbeControllerTest, ProbeInAlrIfLossBasedIncreasing) {
}
TEST(ProbeControllerTest, ProbeFurtherInAlrIfLossBasedIncreasing) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "limit_probe_target_rate_to_loss_bwe:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probe_controller->EnablePeriodicAlrProbing(true);
@@ -764,16 +850,17 @@ TEST(ProbeControllerTest, ProbeFurtherInAlrIfLossBasedIncreasing) {
}
TEST(ProbeControllerTest, NotProbeWhenInAlrIfLossBasedDecreases) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probe_controller->EnablePeriodicAlrProbing(true);
probes = probe_controller->SetEstimatedBitrate(
- kStartBitrate, BandwidthLimitedCause::kLossLimitedBweDecreasing,
+ kStartBitrate, BandwidthLimitedCause::kLossLimitedBwe,
fixture.CurrentTime());
// Wait long enough to time out exponential probing.
@@ -789,11 +876,12 @@ TEST(ProbeControllerTest, NotProbeWhenInAlrIfLossBasedDecreases) {
}
TEST(ProbeControllerTest, NotProbeIfLossBasedIncreasingOutsideAlr) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "limit_probe_target_rate_to_loss_bwe:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probe_controller->EnablePeriodicAlrProbing(true);
@@ -815,9 +903,12 @@ TEST(ProbeControllerTest, NotProbeIfLossBasedIncreasingOutsideAlr) {
TEST(ProbeControllerTest, ProbeFurtherWhenLossBasedIsSameAsDelayBasedEstimate) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -855,6 +946,9 @@ TEST(ProbeControllerTest, ProbeIfEstimateLowerThanNetworkStateEstimate) {
"target_rate_to_loss_bwe:true/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -896,9 +990,12 @@ TEST(ProbeControllerTest, ProbeIfEstimateLowerThanNetworkStateEstimate) {
TEST(ProbeControllerTest, DontProbeFurtherWhenLossLimited) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -918,17 +1015,20 @@ TEST(ProbeControllerTest, DontProbeFurtherWhenLossLimited) {
EXPECT_LT(probes[0].target_data_rate, state_estimate.link_capacity_upper);
// Expect that no more probes are sent immediately if BWE is loss limited.
probes = probe_controller->SetEstimatedBitrate(
- probes[0].target_data_rate,
- BandwidthLimitedCause::kLossLimitedBweDecreasing, fixture.CurrentTime());
+ probes[0].target_data_rate, BandwidthLimitedCause::kLossLimitedBwe,
+ fixture.CurrentTime());
EXPECT_TRUE(probes.empty());
}
TEST(ProbeControllerTest, ProbeFurtherWhenDelayBasedLimited) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -958,9 +1058,12 @@ TEST(ProbeControllerTest,
ProbeFurtherIfNetworkStateEstimateIncreaseAfterProbeSent) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
ASSERT_FALSE(probes.empty());
@@ -999,6 +1102,9 @@ TEST(ProbeControllerTest, SkipAlrProbeIfEstimateLargerThanMaxProbe) {
"skip_if_est_larger_than_fraction_of_max:0.9/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -1027,6 +1133,9 @@ TEST(ProbeControllerTest,
"skip_if_est_larger_than_fraction_of_max:1.0/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -1057,6 +1166,9 @@ TEST(ProbeControllerTest, SkipNetworkStateProbeIfEstimateLargerThanMaxProbe) {
"network_state_interval:2s,skip_if_est_larger_than_fraction_of_max:0.9/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
ASSERT_FALSE(probes.empty());
@@ -1080,6 +1192,9 @@ TEST(ProbeControllerTest, SendsProbeIfNetworkStateEstimateLowerThanMaxProbe) {
"/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
ASSERT_FALSE(probes.empty());
@@ -1107,9 +1222,12 @@ TEST(ProbeControllerTest,
ProbeNotLimitedByNetworkStateEsimateIfLowerThantCurrent) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,limit_probe_target_rate_to_loss_bwe:true/");
+ "network_state_interval:5s/");
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
probe_controller->EnablePeriodicAlrProbing(true);
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -1133,11 +1251,12 @@ TEST(ProbeControllerTest,
}
TEST(ProbeControllerTest, DontProbeIfDelayIncreased) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,not_probe_if_delay_increased:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
@@ -1162,11 +1281,12 @@ TEST(ProbeControllerTest, DontProbeIfDelayIncreased) {
}
TEST(ProbeControllerTest, DontProbeIfHighRtt) {
- ProbeControllerFixture fixture(
- "WebRTC-Bwe-ProbingConfiguration/"
- "network_state_interval:5s,not_probe_if_delay_increased:true/");
+ ProbeControllerFixture fixture;
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
+ ASSERT_THAT(
+ probe_controller->OnNetworkAvailability({.network_available = true}),
+ IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
index 31024662ff..22693d67e9 100644
--- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
+++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc
@@ -203,9 +203,9 @@ TimeDelta RttBasedBackoff::CorrectedRtt() const {
RttBasedBackoff::~RttBasedBackoff() = default;
SendSideBandwidthEstimation::SendSideBandwidthEstimation(
- const FieldTrialsView* key_value_config,
- RtcEventLog* event_log)
- : rtt_backoff_(key_value_config),
+ const FieldTrialsView* key_value_config, RtcEventLog* event_log)
+ : key_value_config_(key_value_config),
+ rtt_backoff_(key_value_config),
lost_packets_since_last_loss_update_(0),
expected_packets_since_last_loss_update_(0),
current_target_(DataRate::Zero()),
@@ -234,7 +234,7 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation(
high_loss_threshold_(kDefaultHighLossThreshold),
bitrate_threshold_(kDefaultBitrateThreshold),
loss_based_bandwidth_estimator_v1_(key_value_config),
- loss_based_bandwidth_estimator_v2_(key_value_config),
+ loss_based_bandwidth_estimator_v2_(new LossBasedBweV2(key_value_config)),
loss_based_state_(LossBasedState::kDelayBasedEstimate),
disable_receiver_limit_caps_only_("Disabled") {
RTC_DCHECK(event_log);
@@ -252,7 +252,7 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation(
ParseFieldTrial({&disable_receiver_limit_caps_only_},
key_value_config->Lookup("WebRTC-Bwe-ReceiverLimitCapsOnly"));
if (LossBasedBandwidthEstimatorV2Enabled()) {
- loss_based_bandwidth_estimator_v2_.SetMinMaxBitrate(
+ loss_based_bandwidth_estimator_v2_->SetMinMaxBitrate(
min_bitrate_configured_, max_bitrate_configured_);
}
}
@@ -281,6 +281,10 @@ void SendSideBandwidthEstimation::OnRouteChange() {
uma_update_state_ = kNoUpdate;
uma_rtt_state_ = kNoUpdate;
last_rtc_event_log_ = Timestamp::MinusInfinity();
+ if (loss_based_bandwidth_estimator_v2_->UseInStartPhase()) {
+ loss_based_bandwidth_estimator_v2_.reset(
+ new LossBasedBweV2(key_value_config_));
+ }
}
void SendSideBandwidthEstimation::SetBitrates(
@@ -315,8 +319,8 @@ void SendSideBandwidthEstimation::SetMinMaxBitrate(DataRate min_bitrate,
} else {
max_bitrate_configured_ = kDefaultMaxBitrate;
}
- loss_based_bandwidth_estimator_v2_.SetMinMaxBitrate(min_bitrate_configured_,
- max_bitrate_configured_);
+ loss_based_bandwidth_estimator_v2_->SetMinMaxBitrate(min_bitrate_configured_,
+ max_bitrate_configured_);
}
int SendSideBandwidthEstimation::GetMinBitrate() const {
@@ -371,7 +375,7 @@ void SendSideBandwidthEstimation::SetAcknowledgedRate(
*acknowledged_rate, at_time);
}
if (LossBasedBandwidthEstimatorV2Enabled()) {
- loss_based_bandwidth_estimator_v2_.SetAcknowledgedBitrate(
+ loss_based_bandwidth_estimator_v2_->SetAcknowledgedBitrate(
*acknowledged_rate);
}
}
@@ -386,9 +390,8 @@ void SendSideBandwidthEstimation::UpdateLossBasedEstimator(
report.packet_feedbacks, report.feedback_time);
}
if (LossBasedBandwidthEstimatorV2Enabled()) {
- loss_based_bandwidth_estimator_v2_.UpdateBandwidthEstimate(
- report.packet_feedbacks, delay_based_limit_, delay_detector_state,
- probe_bitrate, in_alr);
+ loss_based_bandwidth_estimator_v2_->UpdateBandwidthEstimate(
+ report.packet_feedbacks, delay_based_limit_, in_alr);
UpdateEstimate(report.feedback_time);
}
}
@@ -493,7 +496,7 @@ void SendSideBandwidthEstimation::UpdateEstimate(Timestamp at_time) {
// We trust the REMB and/or delay-based estimate during the first 2 seconds if
// we haven't had any packet loss reported, to allow startup bitrate probing.
if (last_fraction_loss_ == 0 && IsInStartPhase(at_time) &&
- !loss_based_bandwidth_estimator_v2_.ReadyToUseInStartPhase()) {
+ !loss_based_bandwidth_estimator_v2_->ReadyToUseInStartPhase()) {
DataRate new_bitrate = current_target_;
// TODO(srte): We should not allow the new_bitrate to be larger than the
// receiver limit here.
@@ -535,7 +538,7 @@ void SendSideBandwidthEstimation::UpdateEstimate(Timestamp at_time) {
if (LossBasedBandwidthEstimatorV2ReadyForUse()) {
LossBasedBweV2::Result result =
- loss_based_bandwidth_estimator_v2_.GetLossBasedResult();
+ loss_based_bandwidth_estimator_v2_->GetLossBasedResult();
loss_based_state_ = result.state;
UpdateTargetBitrate(result.bandwidth_estimate, at_time);
return;
@@ -691,13 +694,13 @@ bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV1ReadyForUse()
}
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV2Enabled() const {
- return loss_based_bandwidth_estimator_v2_.IsEnabled();
+ return loss_based_bandwidth_estimator_v2_->IsEnabled();
}
bool SendSideBandwidthEstimation::LossBasedBandwidthEstimatorV2ReadyForUse()
const {
return LossBasedBandwidthEstimatorV2Enabled() &&
- loss_based_bandwidth_estimator_v2_.IsReady();
+ loss_based_bandwidth_estimator_v2_->IsReady();
}
} // namespace webrtc
diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
index 3a4efc47c7..dd4d25a236 100644
--- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
+++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h
@@ -16,6 +16,7 @@
#include <stdint.h>
#include <deque>
+#include <memory>
#include <utility>
#include <vector>
@@ -167,6 +168,7 @@ class SendSideBandwidthEstimation {
bool LossBasedBandwidthEstimatorV1ReadyForUse() const;
bool LossBasedBandwidthEstimatorV2ReadyForUse() const;
+ const FieldTrialsView* key_value_config_;
RttBasedBackoff rtt_backoff_;
LinkCapacityTracker link_capacity_;
@@ -208,7 +210,7 @@ class SendSideBandwidthEstimation {
float high_loss_threshold_;
DataRate bitrate_threshold_;
LossBasedBandwidthEstimation loss_based_bandwidth_estimator_v1_;
- LossBasedBweV2 loss_based_bandwidth_estimator_v2_;
+ std::unique_ptr<LossBasedBweV2> loss_based_bandwidth_estimator_v2_;
LossBasedState loss_based_state_;
FieldTrialFlag disable_receiver_limit_caps_only_;
};
diff --git a/modules/congestion_controller/rtp/control_handler.cc b/modules/congestion_controller/rtp/control_handler.cc
index ffa373aeba..da6451c97e 100644
--- a/modules/congestion_controller/rtp/control_handler.cc
+++ b/modules/congestion_controller/rtp/control_handler.cc
@@ -30,9 +30,7 @@ bool IsPacerEmergencyStopDisabled() {
} // namespace
CongestionControlHandler::CongestionControlHandler()
- : disable_pacer_emergency_stop_(IsPacerEmergencyStopDisabled()) {
- sequenced_checker_.Detach();
-}
+ : disable_pacer_emergency_stop_(IsPacerEmergencyStopDisabled()) {}
CongestionControlHandler::~CongestionControlHandler() {}
diff --git a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
index 4ef00e68ab..40764de7ae 100644
--- a/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
+++ b/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
@@ -82,8 +82,10 @@ void BaseCapturerPipeWire::OnScreenCastRequestResult(RequestResponse result,
<< static_cast<uint>(result);
} else if (ScreenCastPortal* screencast_portal = GetScreenCastPortal()) {
if (!screencast_portal->RestoreToken().empty()) {
+ const SourceId token_id =
+ selected_source_id_ ? selected_source_id_ : source_id_;
RestoreTokenManager::GetInstance().AddToken(
- source_id_, screencast_portal->RestoreToken());
+ token_id, screencast_portal->RestoreToken());
}
}
@@ -137,7 +139,7 @@ void BaseCapturerPipeWire::Start(Callback* callback) {
ScreenCastPortal::PersistMode::kTransient);
if (selected_source_id_) {
screencast_portal->SetRestoreToken(
- RestoreTokenManager::GetInstance().TakeToken(selected_source_id_));
+ RestoreTokenManager::GetInstance().GetToken(selected_source_id_));
}
}
diff --git a/modules/desktop_capture/linux/wayland/restore_token_manager.cc b/modules/desktop_capture/linux/wayland/restore_token_manager.cc
index 5ca9b957a9..a17d9a49bb 100644
--- a/modules/desktop_capture/linux/wayland/restore_token_manager.cc
+++ b/modules/desktop_capture/linux/wayland/restore_token_manager.cc
@@ -23,10 +23,8 @@ void RestoreTokenManager::AddToken(DesktopCapturer::SourceId id,
restore_tokens_.insert({id, token});
}
-std::string RestoreTokenManager::TakeToken(DesktopCapturer::SourceId id) {
- std::string token = restore_tokens_[id];
- // Remove the token as it cannot be used anymore
- restore_tokens_.erase(id);
+std::string RestoreTokenManager::GetToken(DesktopCapturer::SourceId id) {
+ const std::string token = restore_tokens_[id];
return token;
}
diff --git a/modules/desktop_capture/linux/wayland/restore_token_manager.h b/modules/desktop_capture/linux/wayland/restore_token_manager.h
index 174bef121f..ad4f74790f 100644
--- a/modules/desktop_capture/linux/wayland/restore_token_manager.h
+++ b/modules/desktop_capture/linux/wayland/restore_token_manager.h
@@ -27,7 +27,7 @@ class RestoreTokenManager {
static RestoreTokenManager& GetInstance();
void AddToken(DesktopCapturer::SourceId id, const std::string& token);
- std::string TakeToken(DesktopCapturer::SourceId id);
+ std::string GetToken(DesktopCapturer::SourceId id);
// Returns a source ID which does not have any token associated with it yet.
DesktopCapturer::SourceId GetUnusedId();
diff --git a/modules/desktop_capture/win/dxgi_duplicator_controller.h b/modules/desktop_capture/win/dxgi_duplicator_controller.h
index 2b1e0ab041..815986f680 100644
--- a/modules/desktop_capture/win/dxgi_duplicator_controller.h
+++ b/modules/desktop_capture/win/dxgi_duplicator_controller.h
@@ -132,7 +132,7 @@ class RTC_EXPORT DxgiDuplicatorController {
// scoped_refptr<DxgiDuplicatorController> accesses private AddRef() and
// Release() functions.
- friend class rtc::scoped_refptr<DxgiDuplicatorController>;
+ friend class webrtc::scoped_refptr<DxgiDuplicatorController>;
// A private constructor to ensure consumers to use
// DxgiDuplicatorController::Instance().
diff --git a/modules/desktop_capture/win/wgc_capture_session.cc b/modules/desktop_capture/win/wgc_capture_session.cc
index e220e4f4f8..8c74c2bf24 100644
--- a/modules/desktop_capture/win/wgc_capture_session.cc
+++ b/modules/desktop_capture/win/wgc_capture_session.cc
@@ -75,7 +75,8 @@ enum class GetFrameResult {
kGetContentSizeFailed = 9,
kResizeMappedTextureFailed = 10,
kRecreateFramePoolFailed = 11,
- kMaxValue = kRecreateFramePoolFailed
+ kFramePoolEmpty = 12,
+ kMaxValue = kFramePoolEmpty
};
void RecordStartCaptureResult(StartCaptureResult error) {
@@ -190,8 +191,8 @@ HRESULT WgcCaptureSession::StartCapture(const DesktopCaptureOptions& options) {
// By default, the WGC capture API adds a yellow border around the captured
// window or display to indicate that a capture is in progress. The section
// below is an attempt to remove this yellow border to make the capture
- // experience more inline with the DXGI capture path. The QueryInterface call
- // will silently fail on Windows versions lower than 2104 (10.0.20348.0).
+ // experience more inline with the DXGI capture path.
+ // This requires 10.0.20348.0 or later, which practically means Windows 11.
ComPtr<ABI::Windows::Graphics::Capture::IGraphicsCaptureSession3> session3;
if (SUCCEEDED(session_->QueryInterface(
ABI::Windows::Graphics::Capture::IID_IGraphicsCaptureSession3,
@@ -256,10 +257,16 @@ void WgcCaptureSession::EnsureFrame() {
<< "Unable to process a valid frame even after trying 10 times.";
}
-bool WgcCaptureSession::GetFrame(std::unique_ptr<DesktopFrame>* output_frame) {
+bool WgcCaptureSession::GetFrame(std::unique_ptr<DesktopFrame>* output_frame,
+ bool source_should_be_capturable) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
- EnsureFrame();
+ // Try to process the captured frame and wait some if needed. Avoid trying
+ // if we know that the source will not be capturable. This can happen e.g.
+ // when captured window is minimized and if EnsureFrame() was called in this
+ // state a large amount of kFrameDropped errors would be logged.
+ if (source_should_be_capturable)
+ EnsureFrame();
// Return a NULL frame and false as `result` if we still don't have a valid
// frame. This will lead to a DesktopCapturer::Result::ERROR_PERMANENT being
@@ -326,10 +333,15 @@ HRESULT WgcCaptureSession::ProcessFrame() {
}
if (!capture_frame) {
- // Avoid logging errors until at least one valid frame has been captured.
- if (queue_.current_frame()) {
- RTC_DLOG(LS_WARNING) << "Frame pool was empty => kFrameDropped.";
+ if (!queue_.current_frame()) {
+ // The frame pool was empty and so is the external queue.
+ RTC_DLOG(LS_ERROR) << "Frame pool was empty => kFrameDropped.";
RecordGetFrameResult(GetFrameResult::kFrameDropped);
+ } else {
+ // The frame pool was empty but there is still one old frame available in
+ // external the queue.
+ RTC_DLOG(LS_WARNING) << "Frame pool was empty => kFramePoolEmpty.";
+ RecordGetFrameResult(GetFrameResult::kFramePoolEmpty);
}
return E_FAIL;
}
diff --git a/modules/desktop_capture/win/wgc_capture_session.h b/modules/desktop_capture/win/wgc_capture_session.h
index 499c75ee98..d2901d9199 100644
--- a/modules/desktop_capture/win/wgc_capture_session.h
+++ b/modules/desktop_capture/win/wgc_capture_session.h
@@ -44,17 +44,20 @@ class WgcCaptureSession final {
HRESULT StartCapture(const DesktopCaptureOptions& options);
// Returns a frame from the local frame queue, if any are present.
- bool GetFrame(std::unique_ptr<DesktopFrame>* output_frame);
+ bool GetFrame(std::unique_ptr<DesktopFrame>* output_frame,
+ bool source_should_be_capturable);
bool IsCaptureStarted() const {
RTC_DCHECK_RUN_ON(&sequence_checker_);
return is_capture_started_;
}
- // We only keep 1 buffer in the internal frame pool to reduce the latency as
- // much as possible.
+ // We keep 2 buffers in the frame pool since it results in a good compromise
+ // between latency/capture-rate and the rate at which
+ // Direct3D11CaptureFramePool.TryGetNextFrame returns NULL and we have to fall
+ // back to providing a copy from our external queue instead.
// We make this public for tests.
- static constexpr int kNumBuffers = 1;
+ static constexpr int kNumBuffers = 2;
private:
// Initializes `mapped_texture_` with the properties of the `src_texture`,
diff --git a/modules/desktop_capture/win/wgc_capture_source.cc b/modules/desktop_capture/win/wgc_capture_source.cc
index 24e6129ec7..1688878cde 100644
--- a/modules/desktop_capture/win/wgc_capture_source.cc
+++ b/modules/desktop_capture/win/wgc_capture_source.cc
@@ -29,6 +29,10 @@ WgcCaptureSource::WgcCaptureSource(DesktopCapturer::SourceId source_id)
: source_id_(source_id) {}
WgcCaptureSource::~WgcCaptureSource() = default;
+bool WgcCaptureSource::ShouldBeCapturable() {
+ return true;
+}
+
bool WgcCaptureSource::IsCapturable() {
// If we can create a capture item, then we can capture it. Unfortunately,
// we can't cache this item because it may be created in a different COM
@@ -105,9 +109,14 @@ ABI::Windows::Graphics::SizeInt32 WgcWindowSource::GetSize() {
window_rect.bottom - window_rect.top};
}
+bool WgcWindowSource::ShouldBeCapturable() {
+ return IsWindowValidAndVisible(reinterpret_cast<HWND>(GetSourceId()));
+}
+
bool WgcWindowSource::IsCapturable() {
- if (!IsWindowValidAndVisible(reinterpret_cast<HWND>(GetSourceId())))
+ if (!ShouldBeCapturable()) {
return false;
+ }
return WgcCaptureSource::IsCapturable();
}
diff --git a/modules/desktop_capture/win/wgc_capture_source.h b/modules/desktop_capture/win/wgc_capture_source.h
index d1275b6168..57b105c2f8 100644
--- a/modules/desktop_capture/win/wgc_capture_source.h
+++ b/modules/desktop_capture/win/wgc_capture_source.h
@@ -33,6 +33,10 @@ class WgcCaptureSource {
virtual ~WgcCaptureSource();
virtual DesktopVector GetTopLeft() = 0;
+ // Lightweight version of IsCapturable which avoids allocating/deallocating
+ // COM objects for each call. As such may return a different value than
+ // IsCapturable.
+ virtual bool ShouldBeCapturable();
virtual bool IsCapturable();
virtual bool FocusOnSource();
virtual ABI::Windows::Graphics::SizeInt32 GetSize();
@@ -99,6 +103,7 @@ class WgcWindowSource final : public WgcCaptureSource {
DesktopVector GetTopLeft() override;
ABI::Windows::Graphics::SizeInt32 GetSize() override;
+ bool ShouldBeCapturable() override;
bool IsCapturable() override;
bool FocusOnSource() override;
diff --git a/modules/desktop_capture/win/wgc_capturer_win.cc b/modules/desktop_capture/win/wgc_capturer_win.cc
index 20d4eb938d..9c545597aa 100644
--- a/modules/desktop_capture/win/wgc_capturer_win.cc
+++ b/modules/desktop_capture/win/wgc_capturer_win.cc
@@ -323,7 +323,8 @@ void WgcCapturerWin::CaptureFrame() {
}
std::unique_ptr<DesktopFrame> frame;
- if (!capture_session->GetFrame(&frame)) {
+ if (!capture_session->GetFrame(&frame,
+ capture_source_->ShouldBeCapturable())) {
RTC_LOG(LS_ERROR) << "GetFrame failed.";
ongoing_captures_.erase(capture_source_->GetSourceId());
callback_->OnCaptureResult(DesktopCapturer::Result::ERROR_PERMANENT,
diff --git a/modules/pacing/pacing_controller.cc b/modules/pacing/pacing_controller.cc
index 74def9c538..13ff9a2a95 100644
--- a/modules/pacing/pacing_controller.cc
+++ b/modules/pacing/pacing_controller.cc
@@ -17,6 +17,8 @@
#include "absl/cleanup/cleanup.h"
#include "absl/strings/match.h"
+#include "api/units/data_size.h"
+#include "api/units/time_delta.h"
#include "modules/pacing/bitrate_prober.h"
#include "modules/pacing/interval_budget.h"
#include "rtc_base/checks.h"
@@ -162,7 +164,6 @@ void PacingController::SetProbingEnabled(bool enabled) {
void PacingController::SetPacingRates(DataRate pacing_rate,
DataRate padding_rate) {
- static constexpr DataRate kMaxRate = DataRate::KilobitsPerSec(100'000);
RTC_CHECK_GT(pacing_rate, DataRate::Zero());
RTC_CHECK_GE(padding_rate, DataRate::Zero());
if (padding_rate > pacing_rate) {
@@ -172,11 +173,12 @@ void PacingController::SetPacingRates(DataRate pacing_rate,
padding_rate = pacing_rate;
}
- if (pacing_rate > kMaxRate || padding_rate > kMaxRate) {
- RTC_LOG(LS_WARNING) << "Very high pacing rates ( > " << kMaxRate.kbps()
+ if (pacing_rate > max_rate || padding_rate > max_rate) {
+ RTC_LOG(LS_WARNING) << "Very high pacing rates ( > " << max_rate.kbps()
<< " kbps) configured: pacing = " << pacing_rate.kbps()
<< " kbps, padding = " << padding_rate.kbps()
<< " kbps.";
+ max_rate = std::max(pacing_rate, padding_rate) * 1.1;
}
pacing_rate_ = pacing_rate;
padding_rate_ = padding_rate;
@@ -343,9 +345,13 @@ Timestamp PacingController::NextSendTime() const {
// debt is allowed to grow up to one packet more than what can be sent
// during 'send_burst_period_'.
TimeDelta drain_time = media_debt_ / adjusted_media_rate_;
+ // Ensure that a burst of sent packet is not larger than kMaxBurstSize in
+ // order to not risk overfilling socket buffers at high bitrate.
+ TimeDelta send_burst_interval =
+ std::min(send_burst_interval_, kMaxBurstSize / adjusted_media_rate_);
next_send_time =
last_process_time_ +
- ((send_burst_interval_ > drain_time) ? TimeDelta::Zero() : drain_time);
+ ((send_burst_interval > drain_time) ? TimeDelta::Zero() : drain_time);
} else if (padding_rate_ > DataRate::Zero() && packet_queue_.Empty()) {
// If we _don't_ have pending packets, check how long until we have
// bandwidth for padding packets. Both media and padding debts must
diff --git a/modules/pacing/pacing_controller.h b/modules/pacing/pacing_controller.h
index 2145868a62..dd5636ccef 100644
--- a/modules/pacing/pacing_controller.h
+++ b/modules/pacing/pacing_controller.h
@@ -24,6 +24,7 @@
#include "api/function_view.h"
#include "api/transport/field_trial_based_config.h"
#include "api/transport/network_types.h"
+#include "api/units/data_size.h"
#include "modules/pacing/bitrate_prober.h"
#include "modules/pacing/interval_budget.h"
#include "modules/pacing/prioritized_packet_queue.h"
@@ -86,6 +87,11 @@ class PacingController {
// set to 1ms as this is intended to allow times be rounded down to the
// nearest millisecond.
static const TimeDelta kMaxEarlyProbeProcessing;
+ // Max total size of packets expected to be sent in a burst in order to not
+ // risk loosing packets due to too small send socket buffers. It upper limits
+ // the send burst interval.
+ // Ex: max send burst interval = 63Kb / 10Mbit/s = 50ms.
+ static constexpr DataSize kMaxBurstSize = DataSize::Bytes(63 * 1000);
PacingController(Clock* clock,
PacketSender* packet_sender,
@@ -208,7 +214,7 @@ class PacingController {
const bool ignore_transport_overhead_;
const bool fast_retransmissions_;
const bool keyframe_flushing_;
-
+ DataRate max_rate = DataRate::BitsPerSec(100'000'000);
DataSize transport_overhead_per_packet_;
TimeDelta send_burst_interval_;
diff --git a/modules/pacing/pacing_controller_unittest.cc b/modules/pacing/pacing_controller_unittest.cc
index ade71cd5f5..ba93d05bb7 100644
--- a/modules/pacing/pacing_controller_unittest.cc
+++ b/modules/pacing/pacing_controller_unittest.cc
@@ -11,17 +11,16 @@
#include "modules/pacing/pacing_controller.h"
#include <algorithm>
-#include <list>
+#include <cstddef>
#include <memory>
-#include <string>
#include <utility>
#include <vector>
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
+#include "api/units/data_size.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
-#include "modules/pacing/packet_router.h"
#include "system_wrappers/include/clock.h"
#include "test/explicit_key_value_config.h"
#include "test/gmock.h"
@@ -30,6 +29,7 @@
using ::testing::_;
using ::testing::AnyNumber;
using ::testing::Field;
+using ::testing::NiceMock;
using ::testing::Pointee;
using ::testing::Property;
using ::testing::Return;
@@ -2146,6 +2146,36 @@ TEST_F(PacingControllerTest, RespectsTargetRateWhenSendingPacketsInBursts) {
EXPECT_EQ(number_of_bursts, 4);
}
+TEST_F(PacingControllerTest,
+ MaxBurstSizeLimitedAtHighPacingRateWhenSendingPacketsInBursts) {
+ NiceMock<MockPacketSender> callback;
+ PacingController pacer(&clock_, &callback, trials_);
+ pacer.SetSendBurstInterval(TimeDelta::Millis(100));
+ pacer.SetPacingRates(DataRate::KilobitsPerSec(10'000), DataRate::Zero());
+
+ size_t sent_size_in_burst = 0;
+ EXPECT_CALL(callback, SendPacket)
+ .WillRepeatedly([&](std::unique_ptr<RtpPacketToSend> packet,
+ const PacedPacketInfo& cluster_info) {
+ sent_size_in_burst += packet->size();
+ });
+
+ // Enqueue 200 packets from a 200Kb encoded frame.
+ for (int i = 0; i < 200; ++i) {
+ pacer.EnqueuePacket(video_.BuildNextPacket(1000));
+ }
+
+ while (pacer.QueueSizePackets() > 70) {
+ pacer.ProcessPackets();
+ EXPECT_NEAR(sent_size_in_burst, PacingController::kMaxBurstSize.bytes(),
+ 1000);
+ sent_size_in_burst = 0;
+ TimeDelta time_to_next = pacer.NextSendTime() - clock_.CurrentTime();
+ EXPECT_NEAR(time_to_next.ms(), 50, 2);
+ clock_.AdvanceTime(time_to_next);
+ }
+}
+
TEST_F(PacingControllerTest, RespectsQueueTimeLimit) {
static constexpr DataSize kPacketSize = DataSize::Bytes(100);
static constexpr DataRate kNominalPacingRate = DataRate::KilobitsPerSec(200);
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 0fc9931f39..b471c2fa76 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -258,6 +258,13 @@ rtc_library("rtp_rtcp") {
"source/video_rtp_depacketizer_vp9.h",
]
+ if (rtc_use_h265) {
+ sources += [
+ "source/rtp_packetizer_h265.cc",
+ "source/rtp_packetizer_h265.h",
+ ]
+ }
+
if (rtc_enable_bwe_test_logging) {
defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=1" ]
} else {
@@ -624,6 +631,10 @@ if (rtc_include_tests) {
"source/video_rtp_depacketizer_vp8_unittest.cc",
"source/video_rtp_depacketizer_vp9_unittest.cc",
]
+ if (rtc_use_h265) {
+ sources += [ "source/rtp_packetizer_h265_unittest.cc" ]
+ }
+
deps = [
":fec_test_helper",
":frame_transformer_factory_unittest",
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_interpolator.cc b/modules/rtp_rtcp/source/absolute_capture_time_interpolator.cc
index 99fc030aca..f151084c7d 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_interpolator.cc
+++ b/modules/rtp_rtcp/source/absolute_capture_time_interpolator.cc
@@ -15,15 +15,9 @@
#include "rtc_base/checks.h"
namespace webrtc {
-namespace {
-
-constexpr Timestamp kInvalidLastReceiveTime = Timestamp::MinusInfinity();
-} // namespace
-
-constexpr TimeDelta AbsoluteCaptureTimeInterpolator::kInterpolationMaxInterval;
AbsoluteCaptureTimeInterpolator::AbsoluteCaptureTimeInterpolator(Clock* clock)
- : clock_(clock), last_receive_time_(kInvalidLastReceiveTime) {}
+ : clock_(clock) {}
uint32_t AbsoluteCaptureTimeInterpolator::GetSource(
uint32_t ssrc,
@@ -39,68 +33,59 @@ absl::optional<AbsoluteCaptureTime>
AbsoluteCaptureTimeInterpolator::OnReceivePacket(
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
+ int rtp_clock_frequency_hz,
const absl::optional<AbsoluteCaptureTime>& received_extension) {
const Timestamp receive_time = clock_->CurrentTime();
MutexLock lock(&mutex_);
- AbsoluteCaptureTime extension;
if (received_extension == absl::nullopt) {
if (!ShouldInterpolateExtension(receive_time, source, rtp_timestamp,
- rtp_clock_frequency)) {
- last_receive_time_ = kInvalidLastReceiveTime;
+ rtp_clock_frequency_hz)) {
+ last_receive_time_ = Timestamp::MinusInfinity();
return absl::nullopt;
}
- extension.absolute_capture_timestamp = InterpolateAbsoluteCaptureTimestamp(
- rtp_timestamp, rtp_clock_frequency, last_rtp_timestamp_,
- last_absolute_capture_timestamp_);
- extension.estimated_capture_clock_offset =
- last_estimated_capture_clock_offset_;
+ return AbsoluteCaptureTime{
+ .absolute_capture_timestamp = InterpolateAbsoluteCaptureTimestamp(
+ rtp_timestamp, rtp_clock_frequency_hz, last_rtp_timestamp_,
+ last_received_extension_.absolute_capture_timestamp),
+ .estimated_capture_clock_offset =
+ last_received_extension_.estimated_capture_clock_offset,
+ };
} else {
last_source_ = source;
last_rtp_timestamp_ = rtp_timestamp;
- last_rtp_clock_frequency_ = rtp_clock_frequency;
- last_absolute_capture_timestamp_ =
- received_extension->absolute_capture_timestamp;
- last_estimated_capture_clock_offset_ =
- received_extension->estimated_capture_clock_offset;
+ last_rtp_clock_frequency_hz_ = rtp_clock_frequency_hz;
+ last_received_extension_ = *received_extension;
last_receive_time_ = receive_time;
- extension = *received_extension;
+ return received_extension;
}
-
- return extension;
}
uint64_t AbsoluteCaptureTimeInterpolator::InterpolateAbsoluteCaptureTimestamp(
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
+ int rtp_clock_frequency_hz,
uint32_t last_rtp_timestamp,
uint64_t last_absolute_capture_timestamp) {
- RTC_DCHECK_GT(rtp_clock_frequency, 0);
+ RTC_DCHECK_GT(rtp_clock_frequency_hz, 0);
return last_absolute_capture_timestamp +
- static_cast<int64_t>(
- rtc::dchecked_cast<uint64_t>(rtp_timestamp - last_rtp_timestamp)
- << 32) /
- rtp_clock_frequency;
+ static_cast<int64_t>(uint64_t{rtp_timestamp - last_rtp_timestamp}
+ << 32) /
+ rtp_clock_frequency_hz;
}
bool AbsoluteCaptureTimeInterpolator::ShouldInterpolateExtension(
Timestamp receive_time,
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency) const {
- // Shouldn't if we don't have a previously received extension stored.
- if (last_receive_time_ == kInvalidLastReceiveTime) {
- return false;
- }
-
- // Shouldn't if the last received extension is too old.
- if ((receive_time - last_receive_time_) > kInterpolationMaxInterval) {
+ int rtp_clock_frequency_hz) const {
+ // Shouldn't if the last received extension is not eligible for interpolation,
+ // in particular if we don't have a previously received extension stored.
+ if (receive_time - last_receive_time_ > kInterpolationMaxInterval) {
return false;
}
@@ -110,12 +95,12 @@ bool AbsoluteCaptureTimeInterpolator::ShouldInterpolateExtension(
}
// Shouldn't if the RTP clock frequency has changed.
- if (last_rtp_clock_frequency_ != rtp_clock_frequency) {
+ if (last_rtp_clock_frequency_hz_ != rtp_clock_frequency_hz) {
return false;
}
// Shouldn't if the RTP clock frequency is invalid.
- if (rtp_clock_frequency <= 0) {
+ if (rtp_clock_frequency_hz <= 0) {
return false;
}
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_interpolator.h b/modules/rtp_rtcp/source/absolute_capture_time_interpolator.h
index f5ec820dd5..c830686359 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_interpolator.h
+++ b/modules/rtp_rtcp/source/absolute_capture_time_interpolator.h
@@ -35,8 +35,7 @@ namespace webrtc {
//
class AbsoluteCaptureTimeInterpolator {
public:
- static constexpr TimeDelta kInterpolationMaxInterval =
- TimeDelta::Millis(5000);
+ static constexpr TimeDelta kInterpolationMaxInterval = TimeDelta::Seconds(5);
explicit AbsoluteCaptureTimeInterpolator(Clock* clock);
@@ -49,7 +48,7 @@ class AbsoluteCaptureTimeInterpolator {
absl::optional<AbsoluteCaptureTime> OnReceivePacket(
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
+ int rtp_clock_frequency_hz,
const absl::optional<AbsoluteCaptureTime>& received_extension);
private:
@@ -57,29 +56,31 @@ class AbsoluteCaptureTimeInterpolator {
static uint64_t InterpolateAbsoluteCaptureTimestamp(
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
+ int rtp_clock_frequency_hz,
uint32_t last_rtp_timestamp,
uint64_t last_absolute_capture_timestamp);
bool ShouldInterpolateExtension(Timestamp receive_time,
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency) const
+ int rtp_clock_frequency_hz) const
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Clock* const clock_;
Mutex mutex_;
- Timestamp last_receive_time_ RTC_GUARDED_BY(mutex_);
+ // Time of the last received header extension eligible for interpolation,
+ // MinusInfinity() if no extension was received, or last received one is
+ // not eligible for interpolation.
+ Timestamp last_receive_time_ RTC_GUARDED_BY(mutex_) =
+ Timestamp::MinusInfinity();
uint32_t last_source_ RTC_GUARDED_BY(mutex_);
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(mutex_);
- uint32_t last_rtp_clock_frequency_ RTC_GUARDED_BY(mutex_);
- uint64_t last_absolute_capture_timestamp_ RTC_GUARDED_BY(mutex_);
- absl::optional<int64_t> last_estimated_capture_clock_offset_
- RTC_GUARDED_BY(mutex_);
-}; // AbsoluteCaptureTimeInterpolator
+ int last_rtp_clock_frequency_hz_ RTC_GUARDED_BY(mutex_);
+ AbsoluteCaptureTime last_received_extension_ RTC_GUARDED_BY(mutex_);
+};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc b/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc
index 6a312f9b43..4a48054777 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc
+++ b/modules/rtp_rtcp/source/absolute_capture_time_interpolator_unittest.cc
@@ -32,13 +32,13 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, GetSourceWithCsrcs) {
TEST(AbsoluteCaptureTimeInterpolatorTest, ReceiveExtensionReturnsExtension) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9020), absl::nullopt};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9020),
+ absl::nullopt};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
@@ -55,299 +55,291 @@ TEST(AbsoluteCaptureTimeInterpolatorTest, ReceiveExtensionReturnsExtension) {
TEST(AbsoluteCaptureTimeInterpolatorTest,
ReceiveNoExtensionReturnsNoExtension) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
- EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- absl::nullopt);
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
- EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp1,
- kRtpClockFrequency, kExtension1),
- absl::nullopt);
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
TEST(AbsoluteCaptureTimeInterpolatorTest, InterpolateLaterPacketArrivingLater) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
- absl::optional<AbsoluteCaptureTime> extension = interpolator.OnReceivePacket(
- kSource, kRtpTimestamp1, kRtpClockFrequency, kExtension1);
- EXPECT_TRUE(extension.has_value());
+ absl::optional<AbsoluteCaptureTime> extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) + 20);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) + 20);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
- extension = interpolator.OnReceivePacket(kSource, kRtpTimestamp2,
- kRtpClockFrequency, kExtension2);
- EXPECT_TRUE(extension.has_value());
+ extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) + 40);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) + 40);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
}
TEST(AbsoluteCaptureTimeInterpolatorTest,
InterpolateEarlierPacketArrivingLater) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
- absl::optional<AbsoluteCaptureTime> extension = interpolator.OnReceivePacket(
- kSource, kRtpTimestamp1, kRtpClockFrequency, kExtension1);
- EXPECT_TRUE(extension.has_value());
+ absl::optional<AbsoluteCaptureTime> extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) - 20);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) - 20);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
- extension = interpolator.OnReceivePacket(kSource, kRtpTimestamp2,
- kRtpClockFrequency, kExtension2);
- EXPECT_TRUE(extension.has_value());
+ extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) - 40);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) - 40);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
}
TEST(AbsoluteCaptureTimeInterpolatorTest,
InterpolateLaterPacketArrivingLaterWithRtpTimestampWrapAround) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
- constexpr uint32_t kRtpTimestamp0 = ~uint32_t{0} - 79;
+ constexpr int kRtpClockFrequency = 64'000;
+ constexpr uint32_t kRtpTimestamp0 = uint32_t{0} - 80;
constexpr uint32_t kRtpTimestamp1 = 1280 - 80;
constexpr uint32_t kRtpTimestamp2 = 2560 - 80;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
- absl::optional<AbsoluteCaptureTime> extension = interpolator.OnReceivePacket(
- kSource, kRtpTimestamp1, kRtpClockFrequency, kExtension1);
- EXPECT_TRUE(extension.has_value());
+ absl::optional<AbsoluteCaptureTime> extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) + 20);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) + 20);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
- extension = interpolator.OnReceivePacket(kSource, kRtpTimestamp2,
- kRtpClockFrequency, kExtension2);
- EXPECT_TRUE(extension.has_value());
+ extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) + 40);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) + 40);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
}
TEST(AbsoluteCaptureTimeInterpolatorTest,
InterpolateEarlierPacketArrivingLaterWithRtpTimestampWrapAround) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 799;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
- absl::optional<AbsoluteCaptureTime> extension = interpolator.OnReceivePacket(
- kSource, kRtpTimestamp1, kRtpClockFrequency, kExtension1);
- EXPECT_TRUE(extension.has_value());
+ absl::optional<AbsoluteCaptureTime> extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) - 20);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) - 20);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
- extension = interpolator.OnReceivePacket(kSource, kRtpTimestamp2,
- kRtpClockFrequency, kExtension2);
- EXPECT_TRUE(extension.has_value());
+ extension =
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt);
+ ASSERT_TRUE(extension.has_value());
EXPECT_EQ(UQ32x32ToInt64Ms(extension->absolute_capture_timestamp),
- UQ32x32ToInt64Ms(kExtension0->absolute_capture_timestamp) - 40);
+ UQ32x32ToInt64Ms(kExtension.absolute_capture_timestamp) - 40);
EXPECT_EQ(extension->estimated_capture_clock_offset,
- kExtension0->estimated_capture_clock_offset);
+ kExtension.estimated_capture_clock_offset);
}
TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIfTooLate) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
clock.AdvanceTime(AbsoluteCaptureTimeInterpolator::kInterpolationMaxInterval);
- EXPECT_TRUE(interpolator
- .OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1)
- .has_value());
+ EXPECT_NE(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
- clock.AdvanceTimeMilliseconds(1);
+ clock.AdvanceTime(TimeDelta::Millis(1));
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2)
- .has_value());
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIfSourceChanged) {
constexpr uint32_t kSource0 = 1337;
constexpr uint32_t kSource1 = 1338;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource0, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ kRtpClockFrequency, kExtension),
+ kExtension);
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource1, kRtpTimestamp1,
- kRtpClockFrequency, kExtension1)
- .has_value());
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource1, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
TEST(AbsoluteCaptureTimeInterpolatorTest,
SkipInterpolateIfRtpClockFrequencyChanged) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency0 = 64000;
- constexpr uint32_t kRtpClockFrequency1 = 32000;
+ constexpr int kRtpClockFrequency0 = 64'000;
+ constexpr int kRtpClockFrequency1 = 32'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency0, kExtension0),
- kExtension0);
+ kRtpClockFrequency0, kExtension),
+ kExtension);
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource, kRtpTimestamp1,
- kRtpClockFrequency1, kExtension1)
- .has_value());
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency1,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
TEST(AbsoluteCaptureTimeInterpolatorTest,
SkipInterpolateIfRtpClockFrequencyIsInvalid) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 0;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
- EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource, kRtpTimestamp0,
+ /*rtp_clock_frequency_hz=*/0, kExtension),
+ kExtension);
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1)
- .has_value());
+ EXPECT_EQ(interpolator.OnReceivePacket(kSource, kRtpTimestamp1,
+ /*rtp_clock_frequency_hz=*/0,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
TEST(AbsoluteCaptureTimeInterpolatorTest, SkipInterpolateIsSticky) {
constexpr uint32_t kSource0 = 1337;
constexpr uint32_t kSource1 = 1338;
- constexpr uint32_t kSource2 = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp1 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 = absl::nullopt;
- static const absl::optional<AbsoluteCaptureTime> kExtension2 = absl::nullopt;
+ const AbsoluteCaptureTime kExtension = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeInterpolator interpolator(&clock);
EXPECT_EQ(interpolator.OnReceivePacket(kSource0, kRtpTimestamp0,
- kRtpClockFrequency, kExtension0),
- kExtension0);
-
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource1, kRtpTimestamp1,
- kRtpClockFrequency, kExtension1)
- .has_value());
-
- EXPECT_FALSE(interpolator
- .OnReceivePacket(kSource2, kRtpTimestamp2,
- kRtpClockFrequency, kExtension2)
- .has_value());
+ kRtpClockFrequency, kExtension),
+ kExtension);
+
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource1, kRtpTimestamp1, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
+
+ EXPECT_EQ(
+ interpolator.OnReceivePacket(kSource0, kRtpTimestamp2, kRtpClockFrequency,
+ /*received_extension=*/absl::nullopt),
+ absl::nullopt);
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_sender.cc b/modules/rtp_rtcp/source/absolute_capture_time_sender.cc
index 28266769ff..09f61a0ace 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_sender.cc
+++ b/modules/rtp_rtcp/source/absolute_capture_time_sender.cc
@@ -16,14 +16,6 @@
#include "system_wrappers/include/ntp_time.h"
namespace webrtc {
-namespace {
-
-constexpr Timestamp kInvalidLastSendTime = Timestamp::MinusInfinity();
-
-} // namespace
-
-constexpr TimeDelta AbsoluteCaptureTimeSender::kInterpolationMaxInterval;
-constexpr TimeDelta AbsoluteCaptureTimeSender::kInterpolationMaxError;
static_assert(
AbsoluteCaptureTimeInterpolator::kInterpolationMaxInterval >=
@@ -31,7 +23,7 @@ static_assert(
"Receivers should be as willing to interpolate timestamps as senders.");
AbsoluteCaptureTimeSender::AbsoluteCaptureTimeSender(Clock* clock)
- : clock_(clock), last_send_time_(kInvalidLastSendTime) {}
+ : clock_(clock) {}
uint32_t AbsoluteCaptureTimeSender::GetSource(
uint32_t ssrc,
@@ -45,44 +37,48 @@ absl::optional<AbsoluteCaptureTime> AbsoluteCaptureTimeSender::OnSendPacket(
uint32_t rtp_clock_frequency,
uint64_t absolute_capture_timestamp,
absl::optional<int64_t> estimated_capture_clock_offset) {
- const Timestamp send_time = clock_->CurrentTime();
-
- MutexLock lock(&mutex_);
+ return OnSendPacket(source, rtp_timestamp, rtp_clock_frequency,
+ NtpTime(absolute_capture_timestamp),
+ estimated_capture_clock_offset, /*force=*/false);
+}
- if (!ShouldSendExtension(send_time, source, rtp_timestamp,
- rtp_clock_frequency, absolute_capture_timestamp,
- estimated_capture_clock_offset)) {
+absl::optional<AbsoluteCaptureTime> AbsoluteCaptureTimeSender::OnSendPacket(
+ uint32_t source,
+ uint32_t rtp_timestamp,
+ int rtp_clock_frequency_hz,
+ NtpTime absolute_capture_time,
+ absl::optional<int64_t> estimated_capture_clock_offset,
+ bool force) {
+ Timestamp send_time = clock_->CurrentTime();
+ if (!(force || ShouldSendExtension(
+ send_time, source, rtp_timestamp, rtp_clock_frequency_hz,
+ absolute_capture_time, estimated_capture_clock_offset))) {
return absl::nullopt;
}
last_source_ = source;
last_rtp_timestamp_ = rtp_timestamp;
- last_rtp_clock_frequency_ = rtp_clock_frequency;
- last_absolute_capture_timestamp_ = absolute_capture_timestamp;
+ last_rtp_clock_frequency_hz_ = rtp_clock_frequency_hz;
+ last_absolute_capture_time_ = absolute_capture_time;
last_estimated_capture_clock_offset_ = estimated_capture_clock_offset;
-
last_send_time_ = send_time;
- AbsoluteCaptureTime extension;
- extension.absolute_capture_timestamp = absolute_capture_timestamp;
- extension.estimated_capture_clock_offset = estimated_capture_clock_offset;
- return extension;
+ return AbsoluteCaptureTime{
+ .absolute_capture_timestamp = uint64_t{absolute_capture_time},
+ .estimated_capture_clock_offset = estimated_capture_clock_offset,
+ };
}
bool AbsoluteCaptureTimeSender::ShouldSendExtension(
Timestamp send_time,
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
- uint64_t absolute_capture_timestamp,
+ int rtp_clock_frequency_hz,
+ NtpTime absolute_capture_time,
absl::optional<int64_t> estimated_capture_clock_offset) const {
- // Should if we've never sent anything before.
- if (last_send_time_ == kInvalidLastSendTime) {
- return true;
- }
-
- // Should if the last sent extension is too old.
- if ((send_time - last_send_time_) > kInterpolationMaxInterval) {
+ // Should if the last sent extension is too old, in particular if we've never
+ // sent anything before.
+ if (send_time - last_send_time_ > kInterpolationMaxInterval) {
return true;
}
@@ -92,12 +88,12 @@ bool AbsoluteCaptureTimeSender::ShouldSendExtension(
}
// Should if the RTP clock frequency has changed.
- if (last_rtp_clock_frequency_ != rtp_clock_frequency) {
+ if (last_rtp_clock_frequency_hz_ != rtp_clock_frequency_hz) {
return true;
}
// Should if the RTP clock frequency is invalid.
- if (rtp_clock_frequency <= 0) {
+ if (rtp_clock_frequency_hz <= 0) {
return true;
}
@@ -109,8 +105,9 @@ bool AbsoluteCaptureTimeSender::ShouldSendExtension(
// Should if interpolation would introduce too much error.
const uint64_t interpolated_absolute_capture_timestamp =
AbsoluteCaptureTimeInterpolator::InterpolateAbsoluteCaptureTimestamp(
- rtp_timestamp, rtp_clock_frequency, last_rtp_timestamp_,
- last_absolute_capture_timestamp_);
+ rtp_timestamp, rtp_clock_frequency_hz, last_rtp_timestamp_,
+ uint64_t{last_absolute_capture_time_});
+ const uint64_t absolute_capture_timestamp = uint64_t{absolute_capture_time};
const int64_t interpolation_error_ms = UQ32x32ToInt64Ms(std::min(
interpolated_absolute_capture_timestamp - absolute_capture_timestamp,
absolute_capture_timestamp - interpolated_absolute_capture_timestamp));
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_sender.h b/modules/rtp_rtcp/source/absolute_capture_time_sender.h
index be5a77d5e1..a961c3bb2f 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_sender.h
+++ b/modules/rtp_rtcp/source/absolute_capture_time_sender.h
@@ -15,9 +15,8 @@
#include "api/rtp_headers.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
-#include "rtc_base/synchronization/mutex.h"
-#include "rtc_base/thread_annotations.h"
#include "system_wrappers/include/clock.h"
+#include "system_wrappers/include/ntp_time.h"
namespace webrtc {
@@ -40,8 +39,7 @@ namespace webrtc {
//
class AbsoluteCaptureTimeSender {
public:
- static constexpr TimeDelta kInterpolationMaxInterval =
- TimeDelta::Millis(1000);
+ static constexpr TimeDelta kInterpolationMaxInterval = TimeDelta::Seconds(1);
static constexpr TimeDelta kInterpolationMaxError = TimeDelta::Millis(1);
explicit AbsoluteCaptureTimeSender(Clock* clock);
@@ -50,9 +48,34 @@ class AbsoluteCaptureTimeSender {
static uint32_t GetSource(uint32_t ssrc,
rtc::ArrayView<const uint32_t> csrcs);
+ // Returns value to write into AbsoluteCaptureTime RTP header extension to be
+ // sent, or `absl::nullopt` if the header extension shouldn't be attached to
+ // the outgoing packet.
+ //
+ // - `source` - id of the capture system.
+ // - `rtp_timestamp` - capture time represented as rtp timestamp in the
+ // outgoing packet
+ // - `rtp_clock_frequency_hz` - description of the `rtp_timestamp` units -
+ // `rtp_timetamp` delta of `rtp_clock_freqnecy_hz` represents 1 second.
+ // - `absolute_capture_time` - time when a frame was captured by the capture
+ // system.
+ // - `estimated_capture_clock_offset` - estimated offset between capture
+ // system clock and local `clock` passed as the AbsoluteCaptureTimeSender
+ // construction paramter. Uses the same units as `absolute_capture_time`,
+ // i.e. delta of 2^32 represents 1 second. See AbsoluteCaptureTime type
+ // comments for more details.
+ // - `force` - when set to true, OnSendPacket is forced to return non-nullopt.
+ absl::optional<AbsoluteCaptureTime> OnSendPacket(
+ uint32_t source,
+ uint32_t rtp_timestamp,
+ int rtp_clock_frequency_hz,
+ NtpTime absolute_capture_time,
+ absl::optional<int64_t> estimated_capture_clock_offset,
+ bool force = false);
+
// Returns a header extension to be sent, or `absl::nullopt` if the header
// extension shouldn't be sent.
- absl::optional<AbsoluteCaptureTime> OnSendPacket(
+ [[deprecated]] absl::optional<AbsoluteCaptureTime> OnSendPacket(
uint32_t source,
uint32_t rtp_timestamp,
uint32_t rtp_clock_frequency,
@@ -64,24 +87,20 @@ class AbsoluteCaptureTimeSender {
Timestamp send_time,
uint32_t source,
uint32_t rtp_timestamp,
- uint32_t rtp_clock_frequency,
- uint64_t absolute_capture_timestamp,
- absl::optional<int64_t> estimated_capture_clock_offset) const
- RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+ int rtp_clock_frequency_hz,
+ NtpTime absolute_capture_time,
+ absl::optional<int64_t> estimated_capture_clock_offset) const;
Clock* const clock_;
- Mutex mutex_;
-
- Timestamp last_send_time_ RTC_GUARDED_BY(mutex_);
+ Timestamp last_send_time_ = Timestamp::MinusInfinity();
- uint32_t last_source_ RTC_GUARDED_BY(mutex_);
- uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(mutex_);
- uint32_t last_rtp_clock_frequency_ RTC_GUARDED_BY(mutex_);
- uint64_t last_absolute_capture_timestamp_ RTC_GUARDED_BY(mutex_);
- absl::optional<int64_t> last_estimated_capture_clock_offset_
- RTC_GUARDED_BY(mutex_);
-}; // AbsoluteCaptureTimeSender
+ uint32_t last_source_;
+ uint32_t last_rtp_timestamp_;
+ int last_rtp_clock_frequency_hz_;
+ NtpTime last_absolute_capture_time_;
+ absl::optional<int64_t> last_estimated_capture_clock_offset_;
+};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc b/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc
index db3fc75100..d9146e4611 100644
--- a/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/absolute_capture_time_sender_unittest.cc
@@ -19,7 +19,7 @@ namespace webrtc {
TEST(AbsoluteCaptureTimeSenderTest, GetSourceWithoutCsrcs) {
constexpr uint32_t kSsrc = 12;
- EXPECT_EQ(AbsoluteCaptureTimeSender::GetSource(kSsrc, nullptr), kSsrc);
+ EXPECT_EQ(AbsoluteCaptureTimeSender::GetSource(kSsrc, {}), kSsrc);
}
TEST(AbsoluteCaptureTimeSenderTest, GetSourceWithCsrcs) {
@@ -31,343 +31,368 @@ TEST(AbsoluteCaptureTimeSenderTest, GetSourceWithCsrcs) {
TEST(AbsoluteCaptureTimeSenderTest, InterpolateLaterPacketSentLater) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest, InterpolateEarlierPacketSentLater) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 - 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 - 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 - 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 - 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest,
InterpolateLaterPacketSentLaterWithRtpTimestampWrapAround) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
- constexpr uint32_t kRtpTimestamp0 = ~uint32_t{0} - 79;
+ constexpr int kRtpClockFrequency = 64'000;
+ constexpr uint32_t kRtpTimestamp0 = uint32_t{0} - 80;
constexpr uint32_t kRtpTimestamp1 = 1280 - 80;
constexpr uint32_t kRtpTimestamp2 = 2560 - 80;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest,
InterpolateEarlierPacketSentLaterWithRtpTimestampWrapAround) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 799;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 - 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 - 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 - 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 - 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 - 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 - 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfTooLate) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
clock.AdvanceTime(AbsoluteCaptureTimeSender::kInterpolationMaxInterval);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
- clock.AdvanceTimeMicroseconds(1);
+ clock.AdvanceTime(TimeDelta::Millis(1));
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
kExtension2);
}
TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfSourceChanged) {
constexpr uint32_t kSource0 = 1337;
constexpr uint32_t kSource1 = 1338;
- constexpr uint32_t kSource2 = 1338;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource0, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource1, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
kExtension1);
- EXPECT_EQ(sender.OnSendPacket(kSource2, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ EXPECT_EQ(sender.OnSendPacket(kSource1, kRtpTimestamp2, kRtpClockFrequency,
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
+ absl::nullopt);
+}
+
+TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateWhenForced) {
+ constexpr uint32_t kSource = 1337;
+ constexpr int kRtpClockFrequency = 64'000;
+ constexpr uint32_t kRtpTimestamp0 = 1020300000;
+ constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
+ constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
+
+ SimulatedClock clock(0);
+ AbsoluteCaptureTimeSender sender(&clock);
+
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
+ kExtension0);
+
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset,
+ /*force=*/true),
+ kExtension1);
+
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset,
+ /*force=*/false),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest, SkipInterpolateIfRtpClockFrequencyChanged) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency0 = 64000;
- constexpr uint32_t kRtpClockFrequency1 = 32000;
- constexpr uint32_t kRtpClockFrequency2 = 32000;
+ constexpr int kRtpClockFrequency0 = 64'000;
+ constexpr int kRtpClockFrequency1 = 32'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 640;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 1280;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency0,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency1,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
kExtension1);
- EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency2,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency1,
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
absl::nullopt);
}
TEST(AbsoluteCaptureTimeSenderTest,
SkipInterpolateIfRtpClockFrequencyIsInvalid) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency0 = 0;
- constexpr uint32_t kRtpClockFrequency1 = 0;
- constexpr uint32_t kRtpClockFrequency2 = 0;
- constexpr uint32_t kRtpTimestamp0 = 1020300000;
- constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0;
- constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), Int64MsToQ32x32(-350)};
+ constexpr int kRtpClockFrequency = 0;
+ constexpr uint32_t kRtpTimestamp = 1020300000;
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
- EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency0,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp, kRtpClockFrequency,
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
- EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency1,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp, kRtpClockFrequency,
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
kExtension1);
- EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency2,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp, kRtpClockFrequency,
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
kExtension2);
}
TEST(AbsoluteCaptureTimeSenderTest,
SkipInterpolateIfEstimatedCaptureClockOffsetChanged) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 20), Int64MsToQ32x32(370)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000 + 40), absl::nullopt};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {Int64MsToUQ32x32(9000 + 20),
+ Int64MsToQ32x32(370)};
+ const AbsoluteCaptureTime kExtension2 = {Int64MsToUQ32x32(9000 + 40),
+ absl::nullopt};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
kExtension1);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
kExtension2);
}
TEST(AbsoluteCaptureTimeSenderTest,
SkipInterpolateIfTooMuchInterpolationError) {
constexpr uint32_t kSource = 1337;
- constexpr uint32_t kRtpClockFrequency = 64000;
+ constexpr int kRtpClockFrequency = 64'000;
constexpr uint32_t kRtpTimestamp0 = 1020300000;
constexpr uint32_t kRtpTimestamp1 = kRtpTimestamp0 + 1280;
constexpr uint32_t kRtpTimestamp2 = kRtpTimestamp0 + 2560;
- static const absl::optional<AbsoluteCaptureTime> kExtension0 =
- AbsoluteCaptureTime{Int64MsToUQ32x32(9000), Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension1 =
- AbsoluteCaptureTime{
- Int64MsToUQ32x32(
- 9000 + 20 +
- AbsoluteCaptureTimeSender::kInterpolationMaxError.ms()),
- Int64MsToQ32x32(-350)};
- static const absl::optional<AbsoluteCaptureTime> kExtension2 =
- AbsoluteCaptureTime{
- Int64MsToUQ32x32(
- 9000 + 40 +
- AbsoluteCaptureTimeSender::kInterpolationMaxError.ms() + 1),
- Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension0 = {Int64MsToUQ32x32(9000),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension1 = {
+ Int64MsToUQ32x32(9000 + 20 +
+ AbsoluteCaptureTimeSender::kInterpolationMaxError.ms()),
+ Int64MsToQ32x32(-350)};
+ const AbsoluteCaptureTime kExtension2 = {
+ Int64MsToUQ32x32(9000 + 40 +
+ AbsoluteCaptureTimeSender::kInterpolationMaxError.ms() +
+ 1),
+ Int64MsToQ32x32(-350)};
SimulatedClock clock(0);
AbsoluteCaptureTimeSender sender(&clock);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp0, kRtpClockFrequency,
- kExtension0->absolute_capture_timestamp,
- kExtension0->estimated_capture_clock_offset),
+ NtpTime(kExtension0.absolute_capture_timestamp),
+ kExtension0.estimated_capture_clock_offset),
kExtension0);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp1, kRtpClockFrequency,
- kExtension1->absolute_capture_timestamp,
- kExtension1->estimated_capture_clock_offset),
+ NtpTime(kExtension1.absolute_capture_timestamp),
+ kExtension1.estimated_capture_clock_offset),
absl::nullopt);
EXPECT_EQ(sender.OnSendPacket(kSource, kRtpTimestamp2, kRtpClockFrequency,
- kExtension2->absolute_capture_timestamp,
- kExtension2->estimated_capture_clock_offset),
+ NtpTime(kExtension2.absolute_capture_timestamp),
+ kExtension2.estimated_capture_clock_offset),
kExtension2);
}
diff --git a/modules/rtp_rtcp/source/flexfec_header_reader_writer.cc b/modules/rtp_rtcp/source/flexfec_header_reader_writer.cc
index cfca7cb066..3e6d04d59c 100644
--- a/modules/rtp_rtcp/source/flexfec_header_reader_writer.cc
+++ b/modules/rtp_rtcp/source/flexfec_header_reader_writer.cc
@@ -138,9 +138,9 @@ bool FlexfecHeaderReader::ReadFecHeader(
mask_part0 <<= 1;
ByteWriter<uint16_t>::WriteBigEndian(&data[byte_index], mask_part0);
byte_index += kFlexfecPacketMaskSizes[0];
- if (k_bit0) {
- // The first K-bit is set, and the packet mask is thus only 2 bytes long.
- // We have finished reading the properties for current ssrc.
+ if (!k_bit0) {
+ // The first K-bit is clear, and the packet mask is thus only 2 bytes
+ // long. We have finished reading the properties for current ssrc.
fec_packet->protected_streams[i].packet_mask_size =
kFlexfecPacketMaskSizes[0];
} else {
@@ -162,8 +162,8 @@ bool FlexfecHeaderReader::ReadFecHeader(
mask_part1 <<= 2;
ByteWriter<uint32_t>::WriteBigEndian(&data[byte_index], mask_part1);
byte_index += kFlexfecPacketMaskSizes[1] - kFlexfecPacketMaskSizes[0];
- if (k_bit1) {
- // The first K-bit is clear, but the second K-bit is set. The packet
+ if (!k_bit1) {
+ // The first K-bit is set, but the second K-bit is clear. The packet
// mask is thus 6 bytes long. We have finished reading the properties
// for current ssrc.
fec_packet->protected_streams[i].packet_mask_size =
@@ -273,8 +273,9 @@ void FlexfecHeaderWriter::FinalizeFecHeader(
tmp_mask_part0 >>= 1; // Shift, thus clearing K-bit 0.
ByteWriter<uint16_t>::WriteBigEndian(write_at, tmp_mask_part0);
+ *write_at |= 0x80; // Set K-bit 0.
write_at += kFlexfecPacketMaskSizes[0];
- tmp_mask_part1 >>= 2; // Shift, thus clearing K-bit 1 and bit 15.
+ tmp_mask_part1 >>= 2; // Shift twice, thus clearing K-bit 1 and bit 15.
ByteWriter<uint32_t>::WriteBigEndian(write_at, tmp_mask_part1);
bool bit15 = (protected_stream.packet_mask[1] & 0x01) != 0;
@@ -284,9 +285,9 @@ void FlexfecHeaderWriter::FinalizeFecHeader(
bool bit46 = (protected_stream.packet_mask[5] & 0x02) != 0;
bool bit47 = (protected_stream.packet_mask[5] & 0x01) != 0;
if (!bit46 && !bit47) {
- *write_at |= 0x80; // Set K-bit 1.
write_at += kFlexfecPacketMaskSizes[1] - kFlexfecPacketMaskSizes[0];
} else {
+ *write_at |= 0x80; // Set K-bit 1.
write_at += kFlexfecPacketMaskSizes[1] - kFlexfecPacketMaskSizes[0];
// Clear all trailing bits.
memset(write_at, 0,
@@ -307,14 +308,13 @@ void FlexfecHeaderWriter::FinalizeFecHeader(
ByteWriter<uint16_t>::WriteBigEndian(write_at, tmp_mask_part0);
bool bit15 = (protected_stream.packet_mask[1] & 0x01) != 0;
if (!bit15) {
- *write_at |= 0x80; // Set K-bit 0.
write_at += kFlexfecPacketMaskSizes[0];
} else {
+ *write_at |= 0x80; // Set K-bit 0.
write_at += kFlexfecPacketMaskSizes[0];
// Clear all trailing bits.
memset(write_at, 0U,
kFlexfecPacketMaskSizes[1] - kFlexfecPacketMaskSizes[0]);
- *write_at |= 0x80; // Set K-bit 1.
*write_at |= 0x40; // Set bit 15.
write_at += kFlexfecPacketMaskSizes[1] - kFlexfecPacketMaskSizes[0];
}
diff --git a/modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc b/modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc
index 6995ba3871..f25e0d8d2a 100644
--- a/modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc
+++ b/modules/rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc
@@ -36,11 +36,12 @@ using ReceivedFecPacket = ForwardErrorCorrection::ReceivedFecPacket;
using ::testing::Each;
using ::testing::ElementsAreArray;
-constexpr uint8_t kMask0[] = {0xAB, 0xCD}; // First K bit is set.
-constexpr uint8_t kMask1[] = {0x12, 0x34, // First K bit cleared.
- 0xF6, 0x78, 0x9A, 0xBC}; // Second K bit set.
-constexpr uint8_t kMask2[] = {0x12, 0x34, // First K bit cleared.
- 0x56, 0x78, 0x9A, 0xBC, // Second K bit cleared.
+constexpr uint8_t kKBit = 1 << 7;
+constexpr uint8_t kMask0[] = {0x2B, 0xCD}; // First K bit is cleared.
+constexpr uint8_t kMask1[] = {0x92, 0x34, // First K bit set.
+ 0x76, 0x78, 0x9A, 0xBC}; // Second K bit cleared.
+constexpr uint8_t kMask2[] = {0x92, 0x34, // First K bit set.
+ 0xD6, 0x78, 0x9A, 0xBC, // Second K bit set.
0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC};
constexpr size_t kMediaPacketLength = 1234;
@@ -186,11 +187,10 @@ void VerifyWrittenAndReadHeaders(
} // namespace
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0SetSingleStream) {
- constexpr uint8_t kKBit0 = 1 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0ClearSingleStream) {
constexpr size_t kExpectedFecHeaderSize = 12;
constexpr uint16_t kSnBase = 0x0102;
- constexpr uint8_t kFlexfecPktMask[] = {kKBit0 | 0x08, 0x81};
+ constexpr uint8_t kFlexfecPktMask[] = {0x08, 0x81};
constexpr uint8_t kUlpfecPacketMask[] = {0x11, 0x02};
constexpr uint8_t kPacketData[] = {
kFlexible, kPtRecovery, kLengthRecovery[0], kLengthRecovery[1],
@@ -215,13 +215,11 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0SetSingleStream) {
VerifyReadHeaders(kExpectedFecHeaderSize, read_packet, expected);
}
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1SetSingleStream) {
- constexpr uint8_t kKBit0 = 0 << 7;
- constexpr uint8_t kKBit1 = 1 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1ClearSingleStream) {
constexpr size_t kExpectedFecHeaderSize = 16;
constexpr uint16_t kSnBase = 0x0102;
- constexpr uint8_t kFlexfecPktMask[] = {kKBit0 | 0x48, 0x81, //
- kKBit1 | 0x02, 0x11, 0x00, 0x21};
+ constexpr uint8_t kFlexfecPktMask[] = {kKBit | 0x48, 0x81, //
+ 0x02, 0x11, 0x00, 0x21};
constexpr uint8_t kUlpfecPacketMask[] = {0x91, 0x02, //
0x08, 0x44, 0x00, 0x84};
constexpr uint8_t kPacketData[] = {
@@ -250,15 +248,13 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1SetSingleStream) {
VerifyReadHeaders(kExpectedFecHeaderSize, read_packet, expected);
}
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithNoKBitsSetSingleStream) {
- constexpr uint8_t kKBit0 = 0 << 7;
- constexpr uint8_t kKBit1 = 0 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithBothKBitsSetSingleStream) {
constexpr size_t kExpectedFecHeaderSize = 24;
constexpr uint16_t kSnBase = 0x0102;
- constexpr uint8_t kFlexfecPacketMask[] = {kKBit0 | 0x48, 0x81, //
- kKBit1 | 0x02, 0x11, 0x00, 0x21, //
- 0x01, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11};
+ constexpr uint8_t kFlexfecPacketMask[] = {kKBit | 0x48, 0x81, //
+ kKBit | 0x02, 0x11, 0x00, 0x21, //
+ 0x01, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11};
constexpr uint8_t kUlpfecPacketMask[] = {0x91, 0x02, //
0x08, 0x44, 0x00, 0x84, //
0x04, 0x44, 0x44, 0x44,
@@ -309,14 +305,13 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithNoKBitsSetSingleStream) {
VerifyReadHeaders(kExpectedFecHeaderSize, read_packet, expected);
}
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0Set2Streams) {
- constexpr uint8_t kKBit0 = 1 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0Clear2Streams) {
constexpr size_t kExpectedFecHeaderSize = 16;
constexpr uint16_t kSnBase0 = 0x0102;
constexpr uint16_t kSnBase1 = 0x0304;
- constexpr uint8_t kFlexfecPktMask1[] = {kKBit0 | 0x08, 0x81};
+ constexpr uint8_t kFlexfecPktMask1[] = {0x08, 0x81};
constexpr uint8_t kUlpfecPacketMask1[] = {0x11, 0x02};
- constexpr uint8_t kFlexfecPktMask2[] = {kKBit0 | 0x04, 0x41};
+ constexpr uint8_t kFlexfecPktMask2[] = {0x04, 0x41};
constexpr uint8_t kUlpfecPacketMask2[] = {0x08, 0x82};
constexpr uint8_t kPacketData[] = {
@@ -349,18 +344,16 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0Set2Streams) {
VerifyReadHeaders(kExpectedFecHeaderSize, read_packet, expected);
}
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1Set2Streams) {
- constexpr uint8_t kKBit0 = 0 << 7;
- constexpr uint8_t kKBit1 = 1 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1Clear2Streams) {
constexpr size_t kExpectedFecHeaderSize = 24;
constexpr uint16_t kSnBase0 = 0x0102;
constexpr uint16_t kSnBase1 = 0x0304;
- constexpr uint8_t kFlexfecPktMask1[] = {kKBit0 | 0x48, 0x81, //
- kKBit1 | 0x02, 0x11, 0x00, 0x21};
+ constexpr uint8_t kFlexfecPktMask1[] = {kKBit | 0x48, 0x81, //
+ 0x02, 0x11, 0x00, 0x21};
constexpr uint8_t kUlpfecPacketMask1[] = {0x91, 0x02, //
0x08, 0x44, 0x00, 0x84};
- constexpr uint8_t kFlexfecPktMask2[] = {kKBit0 | 0x57, 0x82, //
- kKBit1 | 0x04, 0x33, 0x00, 0x51};
+ constexpr uint8_t kFlexfecPktMask2[] = {kKBit | 0x57, 0x82, //
+ 0x04, 0x33, 0x00, 0x51};
constexpr uint8_t kUlpfecPacketMask2[] = {0xAF, 0x04, //
0x10, 0xCC, 0x01, 0x44};
constexpr uint8_t kPacketData[] = {
@@ -398,24 +391,22 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1Set2Streams) {
VerifyReadHeaders(kExpectedFecHeaderSize, read_packet, expected);
}
-TEST(FlexfecHeaderReaderTest, ReadsHeaderWithNoKBitsSet2Streams) {
- constexpr uint8_t kKBit0 = 0 << 7;
- constexpr uint8_t kKBit1 = 0 << 7;
+TEST(FlexfecHeaderReaderTest, ReadsHeaderWithBothKBitsSet2Streams) {
constexpr size_t kExpectedFecHeaderSize = 40;
constexpr uint16_t kSnBase0 = 0x0102;
constexpr uint16_t kSnBase1 = 0x0304;
- constexpr uint8_t kFlexfecPktMask1[] = {kKBit0 | 0x48, 0x81, //
- kKBit1 | 0x02, 0x11, 0x00, 0x21, //
- 0x01, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11};
+ constexpr uint8_t kFlexfecPktMask1[] = {kKBit | 0x48, 0x81, //
+ kKBit | 0x02, 0x11, 0x00, 0x21, //
+ 0x01, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11};
constexpr uint8_t kUlpfecPacketMask1[] = {0x91, 0x02, //
0x08, 0x44, 0x00, 0x84, //
0x04, 0x44, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44};
- constexpr uint8_t kFlexfecPktMask2[] = {kKBit0 | 0x32, 0x84, //
- kKBit1 | 0x05, 0x23, 0x00, 0x55, //
- 0xA3, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x22, 0x35};
+ constexpr uint8_t kFlexfecPktMask2[] = {kKBit | 0x32, 0x84, //
+ kKBit | 0x05, 0x23, 0x00, 0x55, //
+ 0xA3, 0x22, 0x22, 0x22,
+ 0x22, 0x22, 0x22, 0x35};
constexpr uint8_t kUlpfecPacketMask2[] = {0x65, 0x08, //
0x14, 0x8C, 0x01, 0x56, //
0x8C, 0x88, 0x88, 0x88,
@@ -490,29 +481,27 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithNoKBitsSet2Streams) {
}
TEST(FlexfecHeaderReaderTest, ReadsHeaderWithMultipleStreamsMultipleMasks) {
- constexpr uint8_t kBit0 = 0 << 7;
- constexpr uint8_t kBit1 = 1 << 7;
constexpr size_t kExpectedFecHeaderSize = 44;
constexpr uint16_t kSnBase0 = 0x0102;
constexpr uint16_t kSnBase1 = 0x0304;
constexpr uint16_t kSnBase2 = 0x0506;
constexpr uint16_t kSnBase3 = 0x0708;
- constexpr uint8_t kFlexfecPacketMask1[] = {kBit1 | 0x29, 0x91};
+ constexpr uint8_t kFlexfecPacketMask1[] = {0x29, 0x91};
constexpr uint8_t kUlpfecPacketMask1[] = {0x53, 0x22};
- constexpr uint8_t kFlexfecPacketMask2[] = {kBit0 | 0x32, 0xA1, //
- kBit1 | 0x02, 0x11, 0x00, 0x21};
+ constexpr uint8_t kFlexfecPacketMask2[] = {kKBit | 0x32, 0xA1, //
+ 0x02, 0x11, 0x00, 0x21};
constexpr uint8_t kUlpfecPacketMask2[] = {0x65, 0x42, //
0x08, 0x44, 0x00, 0x84};
- constexpr uint8_t kFlexfecPacketMask3[] = {kBit0 | 0x48, 0x81, //
- kBit0 | 0x02, 0x11, 0x00, 0x21, //
+ constexpr uint8_t kFlexfecPacketMask3[] = {kKBit | 0x48, 0x81, //
+ kKBit | 0x02, 0x11, 0x00, 0x21, //
0x01, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11};
constexpr uint8_t kUlpfecPacketMask3[] = {0x91, 0x02, //
0x08, 0x44, 0x00, 0x84, //
0x04, 0x44, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44};
- constexpr uint8_t kFlexfecPacketMask4[] = {kBit0 | 0x32, 0x84, //
- kBit1 | 0x05, 0x23, 0x00, 0x55};
+ constexpr uint8_t kFlexfecPacketMask4[] = {kKBit | 0x32, 0x84, //
+ 0x05, 0x23, 0x00, 0x55};
constexpr uint8_t kUlpfecPacketMask4[] = {0x65, 0x08, //
0x14, 0x8C, 0x01, 0x54};
constexpr uint8_t kPacketData[] = {kFlexible,
@@ -642,7 +631,7 @@ TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit0SetShouldFail) {
EXPECT_FALSE(reader.ReadFecHeader(&read_packet));
}
-TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit1SetShouldFail) {
+TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit1ClearShouldFail) {
// Simulate short received packet.
constexpr uint8_t kPacketData[] = {
kFlexible, kPtRecovery, kLengthRecovery[0], kLengthRecovery[1],
@@ -659,7 +648,7 @@ TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit1SetShouldFail) {
EXPECT_FALSE(reader.ReadFecHeader(&read_packet));
}
-TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit1ClearedShouldFail) {
+TEST(FlexfecHeaderReaderTest, ReadShortPacketWithKBit1SetShouldFail) {
// Simulate short received packet.
constexpr uint8_t kPacketData[] = {
kFlexible, kPtRecovery, kLengthRecovery[0], kLengthRecovery[1],
@@ -698,8 +687,8 @@ TEST(FlexfecHeaderReaderTest, ReadShortPacketMultipleStreamsShouldFail) {
EXPECT_FALSE(reader.ReadFecHeader(&read_packet));
}
-TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit0SetSingleStream) {
- constexpr uint8_t kFlexfecPacketMask[] = {0x88, 0x81};
+TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit0ClearSingleStream) {
+ constexpr uint8_t kFlexfecPacketMask[] = {0x08, 0x81};
constexpr uint8_t kUlpfecPacketMask[] = {0x11, 0x02};
constexpr uint16_t kMediaStartSeqNum = 1234;
Packet written_packet = WritePacket({{.ssrc = 0x01,
@@ -714,8 +703,8 @@ TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit0SetSingleStream) {
VerifyFinalizedHeaders(written_packet, expected);
}
-TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit1SetSingleStream) {
- constexpr uint8_t kFlexfecPacketMask[] = {0x48, 0x81, 0x82, 0x11, 0x00, 0x21};
+TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit1ClearSingleStream) {
+ constexpr uint8_t kFlexfecPacketMask[] = {0xC8, 0x81, 0x02, 0x11, 0x00, 0x21};
constexpr uint8_t kUlpfecPacketMask[] = {0x91, 0x02, 0x08, 0x44, 0x00, 0x84};
constexpr uint16_t kMediaStartSeqNum = 1234;
Packet written_packet = WritePacket({{.ssrc = 0x01,
@@ -730,10 +719,10 @@ TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithKBit1SetSingleStream) {
VerifyFinalizedHeaders(written_packet, expected);
}
-TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithNoKBitsSetSingleStream) {
+TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithBothKBitsSetSingleStream) {
constexpr uint8_t kFlexfecPacketMask[] = {
- 0x11, 0x11, // K-bit 0 clear.
- 0x11, 0x11, 0x11, 0x10, // K-bit 1 clear.
+ 0x91, 0x11, // K-bit 0 set.
+ 0x91, 0x11, 0x11, 0x10, // K-bit 1 set.
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //
};
constexpr uint8_t kUlpfecPacketMask[] = {0x22, 0x22, 0x44, 0x44, 0x44, 0x41};
@@ -752,22 +741,22 @@ TEST(FlexfecHeaderWriterTest, FinalizesHeaderWithNoKBitsSetSingleStream) {
TEST(FlexfecHeaderWriterTest, FinalizesHeaderMultipleStreamsMultipleMasks) {
constexpr uint8_t kFlexfecPacketMask1[] = {
- 0x11, 0x11, // K-bit 0 clear.
- 0x11, 0x11, 0x11, 0x10, // K-bit 1 clear.
+ 0x91, 0x11, // K-bit 0 set.
+ 0x91, 0x11, 0x11, 0x10, // K-bit 1 set.
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //
};
constexpr uint8_t kUlpfecPacketMask1[] = {0x22, 0x22, 0x44, 0x44, 0x44, 0x41};
constexpr uint16_t kMediaStartSeqNum1 = 1234;
- constexpr uint8_t kFlexfecPacketMask2[] = {0x88, 0x81};
+ constexpr uint8_t kFlexfecPacketMask2[] = {0x08, 0x81};
constexpr uint8_t kUlpfecPacketMask2[] = {0x11, 0x02};
constexpr uint16_t kMediaStartSeqNum2 = 2345;
- constexpr uint8_t kFlexfecPacketMask3[] = {0x48, 0x81, 0x82,
+ constexpr uint8_t kFlexfecPacketMask3[] = {0xC8, 0x81, 0x02,
0x11, 0x00, 0x21};
constexpr uint8_t kUlpfecPacketMask3[] = {0x91, 0x02, 0x08, 0x44, 0x00, 0x84};
constexpr uint16_t kMediaStartSeqNum3 = 3456;
constexpr uint8_t kFlexfecPacketMask4[] = {
- 0x55, 0xAA, // K-bit 0 clear.
- 0x22, 0xAB, 0xCD, 0xEF, // K-bit 1 clear.
+ 0xD5, 0xAA, // K-bit 0 set.
+ 0xA2, 0xAB, 0xCD, 0xEF, // K-bit 1 set.
0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //
};
constexpr uint8_t kUlpfecPacketMask4[] = {0xAB, 0x54, 0x8A, 0xAF, 0x37, 0xBF};
diff --git a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
index 8dbfaec940..3737d66f07 100644
--- a/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
+++ b/modules/rtp_rtcp/source/remote_ntp_time_estimator_unittest.cc
@@ -44,7 +44,7 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
NtpTime ntp = remote_clock_.CurrentNtpTime();
AdvanceTime(kTestRtt / 2);
- RTC_DCHECK(estimator_.UpdateRtcpTimestamp(kTestRtt, ntp, rtcp_timestamp));
+ EXPECT_TRUE(estimator_.UpdateRtcpTimestamp(kTestRtt, ntp, rtcp_timestamp));
}
void SendRtcpSrInaccurately(TimeDelta ntp_error, TimeDelta networking_delay) {
@@ -53,7 +53,7 @@ class RemoteNtpTimeEstimatorTest : public ::testing::Test {
NtpTime ntp(static_cast<uint64_t>(remote_clock_.CurrentNtpTime()) +
ntp_error_fractions);
AdvanceTime(kTestRtt / 2 + networking_delay);
- RTC_DCHECK(estimator_.UpdateRtcpTimestamp(kTestRtt, ntp, rtcp_timestamp));
+ EXPECT_TRUE(estimator_.UpdateRtcpTimestamp(kTestRtt, ntp, rtcp_timestamp));
}
SimulatedClock local_clock_{kLocalClockInitialTime};
diff --git a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
index 4248a4d3ee..356d7a2340 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback_unittest.cc
@@ -60,11 +60,11 @@ MATCHER(IsValidFeedback, "") {
TransportFeedback Parse(rtc::ArrayView<const uint8_t> buffer) {
rtcp::CommonHeader header;
- RTC_DCHECK(header.Parse(buffer.data(), buffer.size()));
- RTC_DCHECK_EQ(header.type(), TransportFeedback::kPacketType);
- RTC_DCHECK_EQ(header.fmt(), TransportFeedback::kFeedbackMessageType);
+ EXPECT_TRUE(header.Parse(buffer.data(), buffer.size()));
+ EXPECT_EQ(header.type(), TransportFeedback::kPacketType);
+ EXPECT_EQ(header.fmt(), TransportFeedback::kFeedbackMessageType);
TransportFeedback feedback;
- RTC_DCHECK(feedback.Parse(header));
+ EXPECT_TRUE(feedback.Parse(header));
return feedback;
}
@@ -89,7 +89,7 @@ class FeedbackTester {
temp_timestamps = GenerateReceiveTimestamps(received_seq);
received_ts = temp_timestamps;
}
- RTC_DCHECK_EQ(received_seq.size(), received_ts.size());
+ ASSERT_EQ(received_seq.size(), received_ts.size());
expected_deltas_.clear();
feedback_.emplace(include_timestamps_);
@@ -150,7 +150,7 @@ class FeedbackTester {
std::vector<Timestamp> GenerateReceiveTimestamps(
rtc::ArrayView<const uint16_t> seq_nums) {
- RTC_DCHECK(!seq_nums.empty());
+ RTC_CHECK(!seq_nums.empty());
uint16_t last_seq = seq_nums[0];
Timestamp time = Timestamp::Zero();
std::vector<Timestamp> result;
diff --git a/modules/rtp_rtcp/source/rtp_format.cc b/modules/rtp_rtcp/source/rtp_format.cc
index 2c11a29bfa..c7534dee40 100644
--- a/modules/rtp_rtcp/source/rtp_format.cc
+++ b/modules/rtp_rtcp/source/rtp_format.cc
@@ -22,6 +22,9 @@
#include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
#include "rtc_base/checks.h"
+#ifdef RTC_ENABLE_H265
+#include "modules/rtp_rtcp/source/rtp_packetizer_h265.h"
+#endif
namespace webrtc {
@@ -57,7 +60,11 @@ std::unique_ptr<RtpPacketizer> RtpPacketizer::Create(
return std::make_unique<RtpPacketizerAv1>(
payload, limits, rtp_video_header.frame_type,
rtp_video_header.is_last_frame_in_picture);
- // TODO(bugs.webrtc.org/13485): Implement RtpPacketizerH265.
+#ifdef RTC_ENABLE_H265
+ case kVideoCodecH265: {
+ return std::make_unique<RtpPacketizerH265>(payload, limits);
+ }
+#endif
default: {
return std::make_unique<RtpPacketizerGeneric>(payload, limits,
rtp_video_header);
diff --git a/modules/rtp_rtcp/source/rtp_packetizer_h265.cc b/modules/rtp_rtcp/source/rtp_packetizer_h265.cc
new file mode 100644
index 0000000000..313680cc87
--- /dev/null
+++ b/modules/rtp_rtcp/source/rtp_packetizer_h265.cc
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "modules/rtp_rtcp/source/rtp_packetizer_h265.h"
+
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "common_video/h264/h264_common.h"
+#include "common_video/h265/h265_common.h"
+#include "modules/rtp_rtcp/source/byte_io.h"
+#include "rtc_base/logging.h"
+
+namespace webrtc {
+namespace {
+
+// The payload header consists of the same
+// fields (F, Type, LayerId and TID) as the NAL unit header. Refer to
+// section 4.2 in RFC 7798.
+constexpr size_t kH265PayloadHeaderSize = 2;
+// Unlike H.264, H265 NAL header is 2-bytes.
+constexpr size_t kH265NalHeaderSize = 2;
+// H265's FU is constructed of 2-byte payload header, 1-byte FU header and FU
+// payload.
+constexpr size_t kH265FuHeaderSize = 1;
+// The NALU size for H265 RTP aggregated packet indicates the size of the NAL
+// unit is 2-bytes.
+constexpr size_t kH265LengthFieldSize = 2;
+
+enum H265NalHdrMasks {
+ kH265FBit = 0x80,
+ kH265TypeMask = 0x7E,
+ kH265LayerIDHMask = 0x1,
+ kH265LayerIDLMask = 0xF8,
+ kH265TIDMask = 0x7,
+ kH265TypeMaskN = 0x81,
+ kH265TypeMaskInFuHeader = 0x3F
+};
+
+// Bit masks for FU headers.
+enum H265FuBitmasks {
+ kH265SBitMask = 0x80,
+ kH265EBitMask = 0x40,
+ kH265FuTypeBitMask = 0x3F
+};
+
+} // namespace
+
+RtpPacketizerH265::RtpPacketizerH265(rtc::ArrayView<const uint8_t> payload,
+ PayloadSizeLimits limits)
+ : limits_(limits), num_packets_left_(0) {
+ for (const auto& nalu :
+ H264::FindNaluIndices(payload.data(), payload.size())) {
+ input_fragments_.push_back(
+ payload.subview(nalu.payload_start_offset, nalu.payload_size));
+ }
+
+ if (!GeneratePackets()) {
+ // If failed to generate all the packets, discard already generated
+ // packets in case the caller would ignore return value and still try to
+ // call NextPacket().
+ num_packets_left_ = 0;
+ while (!packets_.empty()) {
+ packets_.pop();
+ }
+ }
+}
+
+RtpPacketizerH265::~RtpPacketizerH265() = default;
+
+size_t RtpPacketizerH265::NumPackets() const {
+ return num_packets_left_;
+}
+
+bool RtpPacketizerH265::GeneratePackets() {
+ for (size_t i = 0; i < input_fragments_.size();) {
+ int fragment_len = input_fragments_[i].size();
+ int single_packet_capacity = limits_.max_payload_len;
+ if (input_fragments_.size() == 1) {
+ single_packet_capacity -= limits_.single_packet_reduction_len;
+ } else if (i == 0) {
+ single_packet_capacity -= limits_.first_packet_reduction_len;
+ } else if (i + 1 == input_fragments_.size()) {
+ // Pretend that last fragment is larger instead of making last packet
+ // smaller.
+ single_packet_capacity -= limits_.last_packet_reduction_len;
+ }
+ if (fragment_len > single_packet_capacity) {
+ if (!PacketizeFu(i)) {
+ return false;
+ }
+ ++i;
+ } else {
+ i = PacketizeAp(i);
+ }
+ }
+ return true;
+}
+
+bool RtpPacketizerH265::PacketizeFu(size_t fragment_index) {
+ // Fragment payload into packets (FU).
+ // Strip out the original header and leave room for the FU header.
+ rtc::ArrayView<const uint8_t> fragment = input_fragments_[fragment_index];
+ PayloadSizeLimits limits = limits_;
+ // Refer to section 4.4.3 in RFC7798, each FU fragment will have a 2-bytes
+ // payload header and a one-byte FU header. DONL is not supported so ignore
+ // its size when calculating max_payload_len.
+ limits.max_payload_len -= kH265FuHeaderSize + kH265PayloadHeaderSize;
+
+ // Update single/first/last packet reductions unless it is single/first/last
+ // fragment.
+ if (input_fragments_.size() != 1) {
+ // if this fragment is put into a single packet, it might still be the
+ // first or the last packet in the whole sequence of packets.
+ if (fragment_index == input_fragments_.size() - 1) {
+ limits.single_packet_reduction_len = limits_.last_packet_reduction_len;
+ } else if (fragment_index == 0) {
+ limits.single_packet_reduction_len = limits_.first_packet_reduction_len;
+ } else {
+ limits.single_packet_reduction_len = 0;
+ }
+ }
+ if (fragment_index != 0) {
+ limits.first_packet_reduction_len = 0;
+ }
+ if (fragment_index != input_fragments_.size() - 1) {
+ limits.last_packet_reduction_len = 0;
+ }
+
+ // Strip out the original header.
+ size_t payload_left = fragment.size() - kH265NalHeaderSize;
+ int offset = kH265NalHeaderSize;
+
+ std::vector<int> payload_sizes = SplitAboutEqually(payload_left, limits);
+ if (payload_sizes.empty()) {
+ return false;
+ }
+
+ for (size_t i = 0; i < payload_sizes.size(); ++i) {
+ int packet_length = payload_sizes[i];
+ RTC_CHECK_GT(packet_length, 0);
+ uint16_t header = (fragment[0] << 8) | fragment[1];
+ packets_.push({.source_fragment = fragment.subview(offset, packet_length),
+ .first_fragment = (i == 0),
+ .last_fragment = (i == payload_sizes.size() - 1),
+ .aggregated = false,
+ .header = header});
+ offset += packet_length;
+ payload_left -= packet_length;
+ }
+ num_packets_left_ += payload_sizes.size();
+ RTC_CHECK_EQ(payload_left, 0);
+ return true;
+}
+
+int RtpPacketizerH265::PacketizeAp(size_t fragment_index) {
+ // Aggregate fragments into one packet.
+ size_t payload_size_left = limits_.max_payload_len;
+ if (input_fragments_.size() == 1) {
+ payload_size_left -= limits_.single_packet_reduction_len;
+ } else if (fragment_index == 0) {
+ payload_size_left -= limits_.first_packet_reduction_len;
+ }
+ int aggregated_fragments = 0;
+ size_t fragment_headers_length = 0;
+ rtc::ArrayView<const uint8_t> fragment = input_fragments_[fragment_index];
+ RTC_CHECK_GE(payload_size_left, fragment.size());
+ ++num_packets_left_;
+
+ auto payload_size_needed = [&] {
+ size_t fragment_size = fragment.size() + fragment_headers_length;
+ if (input_fragments_.size() == 1) {
+ // Single fragment, single packet, payload_size_left already adjusted
+ // with limits_.single_packet_reduction_len.
+ return fragment_size;
+ }
+ if (fragment_index == input_fragments_.size() - 1) {
+ // Last fragment, so this might be the last packet.
+ return fragment_size + limits_.last_packet_reduction_len;
+ }
+ return fragment_size;
+ };
+
+ while (payload_size_left >= payload_size_needed()) {
+ RTC_CHECK_GT(fragment.size(), 0);
+ packets_.push({.source_fragment = fragment,
+ .first_fragment = (aggregated_fragments == 0),
+ .last_fragment = false,
+ .aggregated = true,
+ .header = fragment[0]});
+ payload_size_left -= fragment.size();
+ payload_size_left -= fragment_headers_length;
+
+ fragment_headers_length = kH265LengthFieldSize;
+ // If we are going to try to aggregate more fragments into this packet
+ // we need to add the AP NALU header and a length field for the first
+ // NALU of this packet.
+ if (aggregated_fragments == 0) {
+ fragment_headers_length += kH265PayloadHeaderSize + kH265LengthFieldSize;
+ }
+ ++aggregated_fragments;
+
+ // Next fragment.
+ ++fragment_index;
+ if (fragment_index == input_fragments_.size()) {
+ break;
+ }
+ fragment = input_fragments_[fragment_index];
+ }
+ RTC_CHECK_GT(aggregated_fragments, 0);
+ packets_.back().last_fragment = true;
+ return fragment_index;
+}
+
+bool RtpPacketizerH265::NextPacket(RtpPacketToSend* rtp_packet) {
+ RTC_DCHECK(rtp_packet);
+
+ if (packets_.empty()) {
+ return false;
+ }
+
+ PacketUnit packet = packets_.front();
+
+ if (packet.first_fragment && packet.last_fragment) {
+ // Single NAL unit packet. Do not support DONL for single NAL unit packets,
+ // DONL field is not present.
+ size_t bytes_to_send = packet.source_fragment.size();
+ uint8_t* buffer = rtp_packet->AllocatePayload(bytes_to_send);
+ memcpy(buffer, packet.source_fragment.data(), bytes_to_send);
+ packets_.pop();
+ input_fragments_.pop_front();
+ } else if (packet.aggregated) {
+ NextAggregatePacket(rtp_packet);
+ } else {
+ NextFragmentPacket(rtp_packet);
+ }
+ rtp_packet->SetMarker(packets_.empty());
+ --num_packets_left_;
+ return true;
+}
+
+void RtpPacketizerH265::NextAggregatePacket(RtpPacketToSend* rtp_packet) {
+ size_t payload_capacity = rtp_packet->FreeCapacity();
+ RTC_CHECK_GE(payload_capacity, kH265PayloadHeaderSize);
+ uint8_t* buffer = rtp_packet->AllocatePayload(payload_capacity);
+ RTC_CHECK(buffer);
+ PacketUnit* packet = &packets_.front();
+ RTC_CHECK(packet->first_fragment);
+
+ /*
+ +---------------+---------------+
+ |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |F| Type | LayerId | TID |
+ +-------------+-----------------+
+ */
+ // Refer to section section 4.4.2 for aggregation packets and modify type to
+ // 48 in PayloadHdr for aggregate packet. Do not support DONL for aggregation
+ // packets, DONL field is not present.
+ uint8_t payload_hdr_h = packet->header >> 8;
+ uint8_t payload_hdr_l = packet->header & 0xFF;
+ uint8_t layer_id_h = payload_hdr_h & kH265LayerIDHMask;
+ payload_hdr_h = (payload_hdr_h & kH265TypeMaskN) |
+ (H265::NaluType::kAp << 1) | layer_id_h;
+ buffer[0] = payload_hdr_h;
+ buffer[1] = payload_hdr_l;
+
+ int index = kH265PayloadHeaderSize;
+ bool is_last_fragment = packet->last_fragment;
+ while (packet->aggregated) {
+ // Add NAL unit length field.
+ rtc::ArrayView<const uint8_t> fragment = packet->source_fragment;
+ ByteWriter<uint16_t>::WriteBigEndian(&buffer[index], fragment.size());
+ index += kH265LengthFieldSize;
+ // Add NAL unit.
+ memcpy(&buffer[index], fragment.data(), fragment.size());
+ index += fragment.size();
+ packets_.pop();
+ input_fragments_.pop_front();
+ if (is_last_fragment) {
+ break;
+ }
+ packet = &packets_.front();
+ is_last_fragment = packet->last_fragment;
+ }
+ RTC_CHECK(is_last_fragment);
+ rtp_packet->SetPayloadSize(index);
+}
+
+void RtpPacketizerH265::NextFragmentPacket(RtpPacketToSend* rtp_packet) {
+ PacketUnit* packet = &packets_.front();
+ // NAL unit fragmented over multiple packets (FU).
+ // We do not send original NALU header, so it will be replaced by the
+ // PayloadHdr of the first packet.
+ /*
+ +---------------+---------------+
+ |0|1|2|3|4|5|6|7|0|1|2|3|4|5|6|7|
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |F| Type | LayerId | TID |
+ +-------------+-----------------+
+ */
+ // Refer to section section 4.4.3 for aggregation packets and modify type to
+ // 49 in PayloadHdr for aggregate packet.
+ uint8_t payload_hdr_h =
+ packet->header >> 8; // 1-bit F, 6-bit type, 1-bit layerID highest-bit
+ uint8_t payload_hdr_l = packet->header & 0xFF;
+ uint8_t layer_id_h = payload_hdr_h & kH265LayerIDHMask;
+ uint8_t fu_header = 0;
+ /*
+ +---------------+
+ |0|1|2|3|4|5|6|7|
+ +-+-+-+-+-+-+-+-+
+ |S|E| FuType |
+ +---------------+
+ */
+ // S bit indicates the start of a fragmented NAL unit.
+ // E bit indicates the end of a fragmented NAL unit.
+ // FuType must be equal to the field type value of the fragmented NAL unit.
+ fu_header |= (packet->first_fragment ? kH265SBitMask : 0);
+ fu_header |= (packet->last_fragment ? kH265EBitMask : 0);
+ uint8_t type = (payload_hdr_h & kH265TypeMask) >> 1;
+ fu_header |= type;
+ // Now update payload_hdr_h with FU type.
+ payload_hdr_h = (payload_hdr_h & kH265TypeMaskN) |
+ (H265::NaluType::kFu << 1) | layer_id_h;
+ rtc::ArrayView<const uint8_t> fragment = packet->source_fragment;
+ uint8_t* buffer = rtp_packet->AllocatePayload(
+ kH265FuHeaderSize + kH265PayloadHeaderSize + fragment.size());
+ RTC_CHECK(buffer);
+ buffer[0] = payload_hdr_h;
+ buffer[1] = payload_hdr_l;
+ buffer[2] = fu_header;
+
+ // Do not support DONL for fragmentation units, DONL field is not present.
+ memcpy(buffer + kH265FuHeaderSize + kH265PayloadHeaderSize, fragment.data(),
+ fragment.size());
+ if (packet->last_fragment) {
+ input_fragments_.pop_front();
+ }
+ packets_.pop();
+}
+
+} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_packetizer_h265.h b/modules/rtp_rtcp/source/rtp_packetizer_h265.h
new file mode 100644
index 0000000000..95442f795c
--- /dev/null
+++ b/modules/rtp_rtcp/source/rtp_packetizer_h265.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_RTP_RTCP_SOURCE_RTP_PACKETIZER_H265_H_
+#define MODULES_RTP_RTCP_SOURCE_RTP_PACKETIZER_H265_H_
+
+#include <deque>
+#include <queue>
+#include <string>
+
+#include "api/array_view.h"
+#include "modules/rtp_rtcp/source/rtp_format.h"
+#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
+
+namespace webrtc {
+
+class RtpPacketizerH265 : public RtpPacketizer {
+ public:
+ // Initialize with payload from encoder.
+ // The payload_data must be exactly one encoded H.265 frame.
+ // For H265 we only support tx-mode SRST.
+ RtpPacketizerH265(rtc::ArrayView<const uint8_t> payload,
+ PayloadSizeLimits limits);
+
+ RtpPacketizerH265(const RtpPacketizerH265&) = delete;
+ RtpPacketizerH265& operator=(const RtpPacketizerH265&) = delete;
+
+ ~RtpPacketizerH265() override;
+
+ size_t NumPackets() const override;
+
+ // Get the next payload with H.265 payload header.
+ // Write payload and set marker bit of the `packet`.
+ // Returns true on success or false if there was no payload to packetize.
+ bool NextPacket(RtpPacketToSend* rtp_packet) override;
+
+ private:
+ struct PacketUnit {
+ rtc::ArrayView<const uint8_t> source_fragment;
+ bool first_fragment = false;
+ bool last_fragment = false;
+ bool aggregated = false;
+ uint16_t header = 0;
+ };
+ std::deque<rtc::ArrayView<const uint8_t>> input_fragments_;
+ std::queue<PacketUnit> packets_;
+
+ bool GeneratePackets();
+ bool PacketizeFu(size_t fragment_index);
+ int PacketizeAp(size_t fragment_index);
+
+ void NextAggregatePacket(RtpPacketToSend* rtp_packet);
+ void NextFragmentPacket(RtpPacketToSend* rtp_packet);
+
+ const PayloadSizeLimits limits_;
+ size_t num_packets_left_ = 0;
+};
+} // namespace webrtc
+#endif // MODULES_RTP_RTCP_SOURCE_RTP_PACKETIZER_H265_H_
diff --git a/modules/rtp_rtcp/source/rtp_packetizer_h265_unittest.cc b/modules/rtp_rtcp/source/rtp_packetizer_h265_unittest.cc
new file mode 100644
index 0000000000..cb1de334c0
--- /dev/null
+++ b/modules/rtp_rtcp/source/rtp_packetizer_h265_unittest.cc
@@ -0,0 +1,525 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "modules/rtp_rtcp/source/rtp_packetizer_h265.h"
+
+#include <vector>
+
+#include "common_video/h265/h265_common.h"
+#include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
+#include "modules/rtp_rtcp/source/byte_io.h"
+#include "test/gmock.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace {
+
+using ::testing::Each;
+using ::testing::ElementsAre;
+using ::testing::ElementsAreArray;
+using ::testing::Eq;
+using ::testing::IsEmpty;
+using ::testing::SizeIs;
+
+constexpr RtpPacketToSend::ExtensionManager* kNoExtensions = nullptr;
+constexpr size_t kMaxPayloadSize = 1200;
+constexpr size_t kLengthFieldLength = 2;
+constexpr RtpPacketizer::PayloadSizeLimits kNoLimits;
+
+constexpr size_t kNalHeaderSize = 2;
+constexpr size_t kFuHeaderSize = 3;
+
+constexpr uint8_t kNaluTypeMask = 0x7E;
+
+// Bit masks for FU headers.
+constexpr uint8_t kH265SBit = 0x80;
+constexpr uint8_t kH265EBit = 0x40;
+
+// Creates Buffer that looks like nal unit of given size.
+rtc::Buffer GenerateNalUnit(size_t size) {
+ RTC_CHECK_GT(size, 0);
+ rtc::Buffer buffer(size);
+ // Set some valid header with type TRAIL_R and temporal id
+ buffer[0] = 2;
+ buffer[1] = 2;
+ for (size_t i = 2; i < size; ++i) {
+ buffer[i] = static_cast<uint8_t>(i);
+ }
+ // Last byte shouldn't be 0, or it may be counted as part of next 4-byte start
+ // sequence.
+ buffer[size - 1] |= 0x10;
+ return buffer;
+}
+
+// Create frame consisting of nalus of given size.
+rtc::Buffer CreateFrame(std::initializer_list<size_t> nalu_sizes) {
+ static constexpr int kStartCodeSize = 3;
+ rtc::Buffer frame(absl::c_accumulate(nalu_sizes, size_t{0}) +
+ kStartCodeSize * nalu_sizes.size());
+ size_t offset = 0;
+ for (size_t nalu_size : nalu_sizes) {
+ EXPECT_GE(nalu_size, 1u);
+ // Insert nalu start code
+ frame[offset] = 0;
+ frame[offset + 1] = 0;
+ frame[offset + 2] = 1;
+ // Set some valid header.
+ frame[offset + 3] = 2;
+ // Fill payload avoiding accidental start codes
+ if (nalu_size > 1) {
+ memset(frame.data() + offset + 4, 0x3f, nalu_size - 1);
+ }
+ offset += (kStartCodeSize + nalu_size);
+ }
+ return frame;
+}
+
+// Create frame consisting of given nalus.
+rtc::Buffer CreateFrame(rtc::ArrayView<const rtc::Buffer> nalus) {
+ static constexpr int kStartCodeSize = 3;
+ int frame_size = 0;
+ for (const rtc::Buffer& nalu : nalus) {
+ frame_size += (kStartCodeSize + nalu.size());
+ }
+ rtc::Buffer frame(frame_size);
+ size_t offset = 0;
+ for (const rtc::Buffer& nalu : nalus) {
+ // Insert nalu start code
+ frame[offset] = 0;
+ frame[offset + 1] = 0;
+ frame[offset + 2] = 1;
+ // Copy the nalu unit.
+ memcpy(frame.data() + offset + 3, nalu.data(), nalu.size());
+ offset += (kStartCodeSize + nalu.size());
+ }
+ return frame;
+}
+
+std::vector<RtpPacketToSend> FetchAllPackets(RtpPacketizerH265* packetizer) {
+ std::vector<RtpPacketToSend> result;
+ size_t num_packets = packetizer->NumPackets();
+ result.reserve(num_packets);
+ RtpPacketToSend packet(kNoExtensions);
+ while (packetizer->NextPacket(&packet)) {
+ result.push_back(packet);
+ }
+ EXPECT_THAT(result, SizeIs(num_packets));
+ return result;
+}
+
+// Single nalu tests.
+TEST(RtpPacketizerH265Test, SingleNalu) {
+ const uint8_t frame[] = {0, 0, 1, H265::kIdrWRadl, 0xFF};
+
+ RtpPacketizerH265 packetizer(frame, kNoLimits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(1));
+ EXPECT_THAT(packets[0].payload(), ElementsAre(H265::kIdrWRadl, 0xFF));
+}
+
+TEST(RtpPacketizerH265Test, SingleNaluTwoPackets) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = kMaxPayloadSize;
+ rtc::Buffer nalus[] = {GenerateNalUnit(kMaxPayloadSize),
+ GenerateNalUnit(100)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(2));
+ EXPECT_THAT(packets[0].payload(), ElementsAreArray(nalus[0]));
+ EXPECT_THAT(packets[1].payload(), ElementsAreArray(nalus[1]));
+}
+
+TEST(RtpPacketizerH265Test,
+ SingleNaluFirstPacketReductionAppliesOnlyToFirstFragment) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 200;
+ limits.first_packet_reduction_len = 5;
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/195),
+ GenerateNalUnit(/*size=*/200),
+ GenerateNalUnit(/*size=*/200)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(3));
+ EXPECT_THAT(packets[0].payload(), ElementsAreArray(nalus[0]));
+ EXPECT_THAT(packets[1].payload(), ElementsAreArray(nalus[1]));
+ EXPECT_THAT(packets[2].payload(), ElementsAreArray(nalus[2]));
+}
+
+TEST(RtpPacketizerH265Test,
+ SingleNaluLastPacketReductionAppliesOnlyToLastFragment) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 200;
+ limits.last_packet_reduction_len = 5;
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/200),
+ GenerateNalUnit(/*size=*/200),
+ GenerateNalUnit(/*size=*/195)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(3));
+ EXPECT_THAT(packets[0].payload(), ElementsAreArray(nalus[0]));
+ EXPECT_THAT(packets[1].payload(), ElementsAreArray(nalus[1]));
+ EXPECT_THAT(packets[2].payload(), ElementsAreArray(nalus[2]));
+}
+
+TEST(RtpPacketizerH265Test,
+ SingleNaluFirstAndLastPacketReductionSumsForSinglePacket) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 200;
+ limits.first_packet_reduction_len = 20;
+ limits.last_packet_reduction_len = 30;
+ rtc::Buffer frame = CreateFrame({150});
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ EXPECT_THAT(packets, SizeIs(1));
+}
+
+// Aggregation tests.
+TEST(RtpPacketizerH265Test, ApRespectsNoPacketReduction) {
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/0x123)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, kNoLimits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(1));
+ auto payload = packets[0].payload();
+ int type = H265::ParseNaluType(payload[0]);
+ EXPECT_EQ(payload.size(),
+ kNalHeaderSize + 3 * kLengthFieldLength + 2 + 2 + 0x123);
+
+ EXPECT_EQ(type, H265::NaluType::kAp);
+ payload = payload.subview(kNalHeaderSize);
+ // 1st fragment.
+ EXPECT_THAT(payload.subview(0, kLengthFieldLength),
+ ElementsAre(0, 2)); // Size.
+ EXPECT_THAT(payload.subview(kLengthFieldLength, 2),
+ ElementsAreArray(nalus[0]));
+ payload = payload.subview(kLengthFieldLength + 2);
+ // 2nd fragment.
+ EXPECT_THAT(payload.subview(0, kLengthFieldLength),
+ ElementsAre(0, 2)); // Size.
+ EXPECT_THAT(payload.subview(kLengthFieldLength, 2),
+ ElementsAreArray(nalus[1]));
+ payload = payload.subview(kLengthFieldLength + 2);
+ // 3rd fragment.
+ EXPECT_THAT(payload.subview(0, kLengthFieldLength),
+ ElementsAre(0x1, 0x23)); // Size.
+ EXPECT_THAT(payload.subview(kLengthFieldLength), ElementsAreArray(nalus[2]));
+}
+
+TEST(RtpPacketizerH265Test, ApRespectsFirstPacketReduction) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1000;
+ limits.first_packet_reduction_len = 100;
+ const size_t kFirstFragmentSize =
+ limits.max_payload_len - limits.first_packet_reduction_len;
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/kFirstFragmentSize),
+ GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/2)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(2));
+ // Expect 1st packet is single nalu.
+ EXPECT_THAT(packets[0].payload(), ElementsAreArray(nalus[0]));
+ // Expect 2nd packet is aggregate of last two fragments.
+ // The size of H265 nal_unit_header is 2 bytes, according to 7.3.1.2
+ // in H265 spec. Aggregation packet type is 48, and nuh_temporal_id_plus1
+ // is 2, so the nal_unit_header should be "01100000 00000010",
+ // which is 96 and 2.
+ EXPECT_THAT(packets[1].payload(),
+ ElementsAre(96, 2, //
+ 0, 2, nalus[1][0], nalus[1][1], //
+ 0, 2, nalus[2][0], nalus[2][1]));
+}
+
+TEST(RtpPacketizerH265Test, ApRespectsLastPacketReduction) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1000;
+ limits.last_packet_reduction_len = 100;
+ const size_t kLastFragmentSize =
+ limits.max_payload_len - limits.last_packet_reduction_len;
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/kLastFragmentSize)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(2));
+ // Expect 1st packet is aggregate of 1st two fragments.
+ EXPECT_THAT(packets[0].payload(),
+ ElementsAre(96, 2, //
+ 0, 2, nalus[0][0], nalus[0][1], //
+ 0, 2, nalus[1][0], nalus[1][1]));
+ // Expect 2nd packet is single nalu.
+ EXPECT_THAT(packets[1].payload(), ElementsAreArray(nalus[2]));
+}
+
+TEST(RtpPacketizerH265Test, TooSmallForApHeaders) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1000;
+ const size_t kLastFragmentSize =
+ limits.max_payload_len - 3 * kLengthFieldLength - 4;
+ rtc::Buffer nalus[] = {GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/2),
+ GenerateNalUnit(/*size=*/kLastFragmentSize)};
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(2));
+ // Expect 1st packet is aggregate of 1st two fragments.
+ EXPECT_THAT(packets[0].payload(),
+ ElementsAre(96, 2, //
+ 0, 2, nalus[0][0], nalus[0][1], //
+ 0, 2, nalus[1][0], nalus[1][1]));
+ // Expect 2nd packet is single nalu.
+ EXPECT_THAT(packets[1].payload(), ElementsAreArray(nalus[2]));
+}
+
+TEST(RtpPacketizerH265Test, LastFragmentFitsInSingleButNotLastPacket) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1178;
+ limits.first_packet_reduction_len = 0;
+ limits.last_packet_reduction_len = 20;
+ limits.single_packet_reduction_len = 20;
+ // Actual sizes, which triggered this bug.
+ rtc::Buffer frame = CreateFrame({20, 8, 18, 1161});
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ // Last packet has to be of correct size.
+ // Incorrect implementation might miss this constraint and not split the last
+ // fragment in two packets.
+ EXPECT_LE(static_cast<int>(packets.back().payload_size()),
+ limits.max_payload_len - limits.last_packet_reduction_len);
+}
+
+// Splits frame with payload size `frame_payload_size` without fragmentation,
+// Returns sizes of the payloads excluding FU headers.
+std::vector<int> TestFu(size_t frame_payload_size,
+ const RtpPacketizer::PayloadSizeLimits& limits) {
+ rtc::Buffer nalu[] = {GenerateNalUnit(kNalHeaderSize + frame_payload_size)};
+ rtc::Buffer frame = CreateFrame(nalu);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ EXPECT_GE(packets.size(), 2u); // Single packet indicates it is not FU.
+ std::vector<uint16_t> fu_header;
+ std::vector<int> payload_sizes;
+
+ for (const RtpPacketToSend& packet : packets) {
+ auto payload = packet.payload();
+ EXPECT_GT(payload.size(), kFuHeaderSize);
+ // FU header is after the 2-bytes size PayloadHdr according to 4.4.3 in spec
+ fu_header.push_back(payload[2]);
+ payload_sizes.push_back(payload.size() - kFuHeaderSize);
+ }
+
+ EXPECT_TRUE(fu_header.front() & kH265SBit);
+ EXPECT_TRUE(fu_header.back() & kH265EBit);
+ // Clear S and E bits before testing all are duplicating same original header.
+ fu_header.front() &= ~kH265SBit;
+ fu_header.back() &= ~kH265EBit;
+ uint8_t nalu_type = (nalu[0][0] & kNaluTypeMask) >> 1;
+ EXPECT_THAT(fu_header, Each(Eq(nalu_type)));
+
+ return payload_sizes;
+}
+
+// Fragmentation tests.
+TEST(RtpPacketizerH265Test, FuOddSize) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1200;
+ EXPECT_THAT(TestFu(1200, limits), ElementsAre(600, 600));
+}
+
+TEST(RtpPacketizerH265Test, FuWithFirstPacketReduction) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1200;
+ limits.first_packet_reduction_len = 4;
+ limits.single_packet_reduction_len = 4;
+ EXPECT_THAT(TestFu(1198, limits), ElementsAre(597, 601));
+}
+
+TEST(RtpPacketizerH265Test, FuWithLastPacketReduction) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1200;
+ limits.last_packet_reduction_len = 4;
+ limits.single_packet_reduction_len = 4;
+ EXPECT_THAT(TestFu(1198, limits), ElementsAre(601, 597));
+}
+
+TEST(RtpPacketizerH265Test, FuWithSinglePacketReduction) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1199;
+ limits.single_packet_reduction_len = 200;
+ EXPECT_THAT(TestFu(1000, limits), ElementsAre(500, 500));
+}
+
+TEST(RtpPacketizerH265Test, FuEvenSize) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1200;
+ EXPECT_THAT(TestFu(1201, limits), ElementsAre(600, 601));
+}
+
+TEST(RtpPacketizerH265Test, FuRounding) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1448;
+ EXPECT_THAT(TestFu(10123, limits),
+ ElementsAre(1265, 1265, 1265, 1265, 1265, 1266, 1266, 1266));
+}
+
+TEST(RtpPacketizerH265Test, FuBig) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ limits.max_payload_len = 1200;
+ // Generate 10 full sized packets, leave room for FU headers.
+ EXPECT_THAT(
+ TestFu(10 * (1200 - kFuHeaderSize), limits),
+ ElementsAre(1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197, 1197));
+}
+
+struct PacketInfo {
+ bool first_fragment = false;
+ bool last_fragment = false;
+ bool aggregated = false;
+ int nalu_index = 0;
+ int nalu_number = 0;
+ int payload_size = 0;
+ int start_offset = 0;
+};
+
+struct MixedApFuTestParams {
+ std::vector<int> nalus;
+ int expect_packetsSize = 0;
+ std::vector<PacketInfo> expected_packets;
+};
+
+class RtpPacketizerH265ParametrizedTest
+ : public ::testing::TestWithParam<MixedApFuTestParams> {};
+
+// Fragmentation + aggregation mixed testing.
+TEST_P(RtpPacketizerH265ParametrizedTest, MixedApFu) {
+ RtpPacketizer::PayloadSizeLimits limits;
+ const MixedApFuTestParams params = GetParam();
+ limits.max_payload_len = 100;
+ std::vector<rtc::Buffer> nalus;
+ nalus.reserve(params.nalus.size());
+
+ // Generate nalus according to size specified in paramters
+ for (size_t index = 0; index < params.nalus.size(); index++) {
+ nalus.push_back(GenerateNalUnit(params.nalus[index]));
+ }
+ rtc::Buffer frame = CreateFrame(nalus);
+
+ RtpPacketizerH265 packetizer(frame, limits);
+ std::vector<RtpPacketToSend> packets = FetchAllPackets(&packetizer);
+
+ ASSERT_THAT(packets, SizeIs(params.expect_packetsSize));
+ for (int i = 0; i < params.expect_packetsSize; i++) {
+ PacketInfo expected_packet = params.expected_packets[i];
+ if (expected_packet.aggregated) {
+ int type = H265::ParseNaluType(packets[i].payload()[0]);
+ EXPECT_THAT(type, H265::NaluType::kAp);
+ auto payload = packets[i].payload().subview(kNalHeaderSize);
+ int offset = 0;
+ // Generated AP packet header and payload align
+ for (int j = expected_packet.nalu_index; j < expected_packet.nalu_number;
+ j++) {
+ EXPECT_THAT(payload.subview(0, kLengthFieldLength),
+ ElementsAre(0, nalus[j].size()));
+ EXPECT_THAT(
+ payload.subview(offset + kLengthFieldLength, nalus[j].size()),
+ ElementsAreArray(nalus[j]));
+ offset += kLengthFieldLength + nalus[j].size();
+ }
+ } else {
+ uint8_t fu_header = 0;
+ fu_header |= (expected_packet.first_fragment ? kH265SBit : 0);
+ fu_header |= (expected_packet.last_fragment ? kH265EBit : 0);
+ fu_header |= H265::NaluType::kTrailR;
+ EXPECT_THAT(packets[i].payload().subview(0, kFuHeaderSize),
+ ElementsAre(98, 2, fu_header));
+ EXPECT_THAT(
+ packets[i].payload().subview(kFuHeaderSize),
+ ElementsAreArray(nalus[expected_packet.nalu_index].data() +
+ kNalHeaderSize + expected_packet.start_offset,
+ expected_packet.payload_size));
+ }
+ }
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ RtpPacketizerH265Test,
+ RtpPacketizerH265ParametrizedTest,
+ testing::Values(
+ // FU + AP + FU.
+ // GenerateNalUnit will include 2 bytes nalu header, for FU packet split
+ // calculation, this 2-byte nalu header length should be excluded.
+ MixedApFuTestParams{.nalus = {140, 20, 20, 160},
+ .expect_packetsSize = 5,
+ .expected_packets = {{.first_fragment = true,
+ .nalu_index = 0,
+ .payload_size = 69,
+ .start_offset = 0},
+ {.last_fragment = true,
+ .nalu_index = 0,
+ .payload_size = 69,
+ .start_offset = 69},
+ {.aggregated = true,
+ .nalu_index = 1,
+ .nalu_number = 2},
+ {.first_fragment = true,
+ .nalu_index = 3,
+ .payload_size = 79,
+ .start_offset = 0},
+ {.last_fragment = true,
+ .nalu_index = 3,
+ .payload_size = 79,
+ .start_offset = 79}}},
+ // AP + FU + AP
+ MixedApFuTestParams{
+ .nalus = {20, 20, 160, 30, 30},
+ .expect_packetsSize = 4,
+ .expected_packets = {
+ {.aggregated = true, .nalu_index = 0, .nalu_number = 2},
+ {.first_fragment = true,
+ .nalu_index = 2,
+ .payload_size = 79,
+ .start_offset = 0},
+ {.last_fragment = true,
+ .nalu_index = 2,
+ .payload_size = 79,
+ .start_offset = 79},
+ {.aggregated = true, .nalu_index = 3, .nalu_number = 2}}}));
+
+} // namespace
+} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender_audio.cc b/modules/rtp_rtcp/source/rtp_sender_audio.cc
index b9ac4db30c..b826c30e07 100644
--- a/modules/rtp_rtcp/source/rtp_sender_audio.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_audio.cc
@@ -30,6 +30,7 @@
#include "modules/rtp_rtcp/source/time_util.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/ntp_time.h"
@@ -92,7 +93,7 @@ int32_t RTPSenderAudio::RegisterAudioPayload(absl::string_view payload_name,
return 0;
} else if (payload_name == "audio") {
MutexLock lock(&send_audio_mutex_);
- encoder_rtp_timestamp_frequency_ = frequency;
+ encoder_rtp_timestamp_frequency_ = rtc::dchecked_cast<int>(frequency);
return 0;
}
return 0;
@@ -154,11 +155,22 @@ bool RTPSenderAudio::SendAudio(const RtpAudioFrame& frame) {
// updates, with a value of 50 ms RECOMMENDED.
constexpr int kDtmfIntervalTimeMs = 50;
uint32_t dtmf_payload_freq = 0;
- absl::optional<uint32_t> encoder_rtp_timestamp_frequency;
+ absl::optional<AbsoluteCaptureTime> absolute_capture_time;
{
MutexLock lock(&send_audio_mutex_);
dtmf_payload_freq = dtmf_payload_freq_;
- encoder_rtp_timestamp_frequency = encoder_rtp_timestamp_frequency_;
+ if (frame.capture_time.has_value()) {
+ // Send absolute capture time periodically in order to optimize and save
+ // network traffic. Missing absolute capture times can be interpolated on
+ // the receiving end if sending intervals are small enough.
+ absolute_capture_time = absolute_capture_time_sender_.OnSendPacket(
+ rtp_sender_->SSRC(), frame.rtp_timestamp,
+ // Replace missing value with 0 (invalid frequency), this will trigger
+ // absolute capture time sending.
+ encoder_rtp_timestamp_frequency_.value_or(0),
+ clock_->ConvertTimestampToNtpTime(*frame.capture_time),
+ /*estimated_capture_clock_offset=*/0);
+ }
}
// Check if we have pending DTMFs to send
@@ -252,25 +264,10 @@ bool RTPSenderAudio::SendAudio(const RtpAudioFrame& frame) {
frame.type == AudioFrameType::kAudioFrameSpeech,
frame.audio_level_dbov.value_or(127));
- if (frame.capture_time.has_value()) {
- // Send absolute capture time periodically in order to optimize and save
- // network traffic. Missing absolute capture times can be interpolated on
- // the receiving end if sending intervals are small enough.
- auto absolute_capture_time = absolute_capture_time_sender_.OnSendPacket(
- AbsoluteCaptureTimeSender::GetSource(packet->Ssrc(), packet->Csrcs()),
- packet->Timestamp(),
- // Replace missing value with 0 (invalid frequency), this will trigger
- // absolute capture time sending.
- encoder_rtp_timestamp_frequency.value_or(0),
- static_cast<uint64_t>(
- clock_->ConvertTimestampToNtpTime(*frame.capture_time)),
- /*estimated_capture_clock_offset=*/0);
- if (absolute_capture_time) {
- // It also checks that extension was registered during SDP negotiation. If
- // not then setter won't do anything.
- packet->SetExtension<AbsoluteCaptureTimeExtension>(
- *absolute_capture_time);
- }
+ if (absolute_capture_time.has_value()) {
+ // It also checks that extension was registered during SDP negotiation. If
+ // not then setter won't do anything.
+ packet->SetExtension<AbsoluteCaptureTimeExtension>(*absolute_capture_time);
}
uint8_t* payload = packet->AllocatePayload(frame.payload.size());
diff --git a/modules/rtp_rtcp/source/rtp_sender_audio.h b/modules/rtp_rtcp/source/rtp_sender_audio.h
index b53bb02c89..662f908216 100644
--- a/modules/rtp_rtcp/source/rtp_sender_audio.h
+++ b/modules/rtp_rtcp/source/rtp_sender_audio.h
@@ -104,10 +104,11 @@ class RTPSenderAudio {
OneTimeEvent first_packet_sent_;
- absl::optional<uint32_t> encoder_rtp_timestamp_frequency_
+ absl::optional<int> encoder_rtp_timestamp_frequency_
RTC_GUARDED_BY(send_audio_mutex_);
- AbsoluteCaptureTimeSender absolute_capture_time_sender_;
+ AbsoluteCaptureTimeSender absolute_capture_time_sender_
+ RTC_GUARDED_BY(send_audio_mutex_);
};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index 4d819a80a9..ebca7aaa75 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -118,7 +118,7 @@ absl::optional<VideoPlayoutDelay> LoadVideoPlayoutDelayOverride(
// Some packets can be skipped and the stream can still be decoded. Those
// packets are less likely to be retransmitted if they are lost.
-bool PacketWillLikelyBeRequestedForRestransmitionIfLost(
+bool PacketWillLikelyBeRequestedForRestransmissionIfLost(
const RTPVideoHeader& video_header) {
return IsBaseLayer(video_header) &&
!(video_header.generic.has_value()
@@ -442,7 +442,7 @@ void RTPSenderVideo::AddRtpHeaderExtensions(const RTPVideoHeader& video_header,
first_packet &&
send_allocation_ != SendVideoLayersAllocation::kDontSend &&
(video_header.frame_type == VideoFrameType::kVideoFrameKey ||
- PacketWillLikelyBeRequestedForRestransmitionIfLost(video_header))) {
+ PacketWillLikelyBeRequestedForRestransmissionIfLost(video_header))) {
VideoLayersAllocation allocation = allocation_.value();
allocation.resolution_and_frame_rate_is_valid =
send_allocation_ == SendVideoLayersAllocation::kSendWithResolution;
@@ -548,10 +548,10 @@ bool RTPSenderVideo::SendVideo(int payload_type,
if (video_header.absolute_capture_time.has_value()) {
video_header.absolute_capture_time =
absolute_capture_time_sender_.OnSendPacket(
- AbsoluteCaptureTimeSender::GetSource(single_packet->Ssrc(),
- single_packet->Csrcs()),
+ AbsoluteCaptureTimeSender::GetSource(single_packet->Ssrc(), csrcs),
single_packet->Timestamp(), kVideoPayloadTypeFrequency,
- video_header.absolute_capture_time->absolute_capture_timestamp,
+ NtpTime(
+ video_header.absolute_capture_time->absolute_capture_timestamp),
video_header.absolute_capture_time->estimated_capture_clock_offset);
}
@@ -733,7 +733,7 @@ bool RTPSenderVideo::SendVideo(int payload_type,
}
if (video_header.frame_type == VideoFrameType::kVideoFrameKey ||
- PacketWillLikelyBeRequestedForRestransmitionIfLost(video_header)) {
+ PacketWillLikelyBeRequestedForRestransmissionIfLost(video_header)) {
// This frame will likely be delivered, no need to populate playout
// delay extensions until it changes again.
playout_delay_pending_ = false;
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.h b/modules/rtp_rtcp/source/rtp_sender_video.h
index 5459e14888..9400b436d3 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.h
+++ b/modules/rtp_rtcp/source/rtp_sender_video.h
@@ -244,7 +244,8 @@ class RTPSenderVideo : public RTPVideoFrameSenderInterface {
// Set to true if the generic descriptor should be authenticated.
const bool generic_descriptor_auth_experiment_;
- AbsoluteCaptureTimeSender absolute_capture_time_sender_;
+ AbsoluteCaptureTimeSender absolute_capture_time_sender_
+ RTC_GUARDED_BY(send_checker_);
// Tracks updates to the active decode targets and decides when active decode
// targets bitmask should be attached to the dependency descriptor.
ActiveDecodeTargetsHelper active_decode_targets_tracker_;
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
index 2281a2ae27..26152df0f0 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.cc
@@ -10,6 +10,7 @@
#include "modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h"
+#include <string>
#include <utility>
#include <vector>
@@ -17,6 +18,7 @@
#include "api/task_queue/task_queue_factory.h"
#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h"
#include "rtc_base/checks.h"
+#include "rtc_base/logging.h"
namespace webrtc {
namespace {
@@ -97,6 +99,13 @@ class TransformableVideoSenderFrame : public TransformableVideoFrameInterface {
}
Direction GetDirection() const override { return Direction::kSender; }
+ std::string GetMimeType() const override {
+ if (!codec_type_.has_value()) {
+ return "video/x-unknown";
+ }
+ std::string mime_type = "video/";
+ return mime_type + CodecTypeToPayloadString(*codec_type_);
+ }
private:
rtc::scoped_refptr<EncodedImageBufferInterface> encoded_data_;
@@ -139,6 +148,17 @@ bool RTPSenderVideoFrameTransformerDelegate::TransformFrame(
const EncodedImage& encoded_image,
RTPVideoHeader video_header,
TimeDelta expected_retransmission_time) {
+ {
+ MutexLock lock(&sender_lock_);
+ if (short_circuit_) {
+ sender_->SendVideo(payload_type, codec_type, rtp_timestamp,
+ encoded_image.CaptureTime(),
+ *encoded_image.GetEncodedData(), encoded_image.size(),
+ video_header, expected_retransmission_time,
+ /*csrcs=*/{});
+ return true;
+ }
+ }
frame_transformer_->Transform(std::make_unique<TransformableVideoSenderFrame>(
encoded_image, video_header, payload_type, codec_type, rtp_timestamp,
expected_retransmission_time, ssrc_,
@@ -161,6 +181,11 @@ void RTPSenderVideoFrameTransformerDelegate::OnTransformedFrame(
});
}
+void RTPSenderVideoFrameTransformerDelegate::StartShortCircuiting() {
+ MutexLock lock(&sender_lock_);
+ short_circuit_ = true;
+}
+
void RTPSenderVideoFrameTransformerDelegate::SendVideo(
std::unique_ptr<TransformableFrameInterface> transformed_frame) const {
RTC_DCHECK_RUN_ON(transformation_queue_.get());
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
index a333db235a..243f22ca9f 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate.h
@@ -75,6 +75,8 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) override;
+ void StartShortCircuiting() override;
+
// Delegates the call to RTPSendVideo::SendVideo on the `encoder_queue_`.
void SendVideo(std::unique_ptr<TransformableFrameInterface> frame) const
RTC_RUN_ON(transformation_queue_);
@@ -107,6 +109,7 @@ class RTPSenderVideoFrameTransformerDelegate : public TransformedFrameCallback {
// Used when the encoded frames arrives without a current task queue. This can
// happen if a hardware encoder was used.
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> transformation_queue_;
+ bool short_circuit_ RTC_GUARDED_BY(sender_lock_) = false;
};
// Method to support cloning a Sender frame from another frame
diff --git a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc
index 54cfdbadd7..ad00e6449f 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video_frame_transformer_delegate_unittest.cc
@@ -74,9 +74,15 @@ class RtpSenderVideoFrameTransformerDelegateTest : public ::testing::Test {
frame_to_transform) {
frame = std::move(frame_to_transform);
});
+ RTPVideoHeader rtp_header;
+
+ VideoFrameMetadata metadata;
+ metadata.SetCodec(VideoCodecType::kVideoCodecVP8);
+ metadata.SetRTPVideoHeaderCodecSpecifics(RTPVideoHeaderVP8());
+
delegate->TransformFrame(
/*payload_type=*/1, VideoCodecType::kVideoCodecVP8, /*rtp_timestamp=*/2,
- encoded_image, RTPVideoHeader(),
+ encoded_image, RTPVideoHeader::FromMetadata(metadata),
/*expected_retransmission_time=*/TimeDelta::PlusInfinity());
return frame;
}
@@ -135,6 +141,7 @@ TEST_F(RtpSenderVideoFrameTransformerDelegateTest,
std::unique_ptr<TransformableFrameInterface> frame =
GetTransformableFrame(delegate);
ASSERT_TRUE(frame);
+ EXPECT_STRCASEEQ("video/VP8", frame->GetMimeType().c_str());
rtc::Event event;
EXPECT_CALL(test_sender_, SendVideo).WillOnce(WithoutArgs([&] {
@@ -162,6 +169,7 @@ TEST_F(RtpSenderVideoFrameTransformerDelegateTest, CloneSenderVideoFrame) {
EXPECT_EQ(clone->IsKeyFrame(), video_frame.IsKeyFrame());
EXPECT_EQ(clone->GetPayloadType(), video_frame.GetPayloadType());
+ EXPECT_EQ(clone->GetMimeType(), video_frame.GetMimeType());
EXPECT_EQ(clone->GetSsrc(), video_frame.GetSsrc());
EXPECT_EQ(clone->GetTimestamp(), video_frame.GetTimestamp());
EXPECT_EQ(clone->Metadata(), video_frame.Metadata());
@@ -182,6 +190,7 @@ TEST_F(RtpSenderVideoFrameTransformerDelegateTest, CloneKeyFrame) {
EXPECT_EQ(clone->IsKeyFrame(), video_frame.IsKeyFrame());
EXPECT_EQ(clone->GetPayloadType(), video_frame.GetPayloadType());
+ EXPECT_EQ(clone->GetMimeType(), video_frame.GetMimeType());
EXPECT_EQ(clone->GetSsrc(), video_frame.GetSsrc());
EXPECT_EQ(clone->GetTimestamp(), video_frame.GetTimestamp());
EXPECT_EQ(clone->Metadata(), video_frame.Metadata());
@@ -280,5 +289,29 @@ TEST_F(RtpSenderVideoFrameTransformerDelegateTest, SettingRTPTimestamp) {
EXPECT_EQ(video_frame.GetTimestamp(), rtp_timestamp);
}
+TEST_F(RtpSenderVideoFrameTransformerDelegateTest,
+ ShortCircuitingSkipsTransform) {
+ auto delegate = rtc::make_ref_counted<RTPSenderVideoFrameTransformerDelegate>(
+ &test_sender_, frame_transformer_,
+ /*ssrc=*/1111, time_controller_.CreateTaskQueueFactory().get());
+ EXPECT_CALL(*frame_transformer_,
+ RegisterTransformedFrameSinkCallback(_, 1111));
+ delegate->Init();
+
+ delegate->StartShortCircuiting();
+
+ // Will not call the actual transformer.
+ EXPECT_CALL(*frame_transformer_, Transform).Times(0);
+ // Will pass the frame straight to the reciever.
+ EXPECT_CALL(test_sender_, SendVideo);
+
+ EncodedImage encoded_image;
+ encoded_image.SetEncodedData(EncodedImageBuffer::Create(1));
+ delegate->TransformFrame(
+ /*payload_type=*/1, VideoCodecType::kVideoCodecVP8, /*rtp_timestamp=*/2,
+ encoded_image, RTPVideoHeader(),
+ /*expected_retransmission_time=*/TimeDelta::PlusInfinity());
+}
+
} // namespace
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
index 1b3cb7d9ab..fbd10c4c7b 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.cc
@@ -10,12 +10,14 @@
#include "modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h"
+#include <string>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "modules/rtp_rtcp/source/rtp_descriptor_authentication.h"
#include "rtc_base/checks.h"
+#include "rtc_base/logging.h"
#include "rtc_base/thread.h"
namespace webrtc {
@@ -75,6 +77,10 @@ class TransformableVideoReceiverFrame
}
Direction GetDirection() const override { return Direction::kReceiver; }
+ std::string GetMimeType() const override {
+ std::string mime_type = "video/";
+ return mime_type + CodecTypeToPayloadString(frame_->codec_type());
+ }
const RtpVideoFrameReceiver* Receiver() { return receiver_; }
@@ -114,9 +120,14 @@ void RtpVideoStreamReceiverFrameTransformerDelegate::Reset() {
void RtpVideoStreamReceiverFrameTransformerDelegate::TransformFrame(
std::unique_ptr<RtpFrameObject> frame) {
RTC_DCHECK_RUN_ON(&network_sequence_checker_);
- frame_transformer_->Transform(
- std::make_unique<TransformableVideoReceiverFrame>(std::move(frame), ssrc_,
- receiver_));
+ if (short_circuit_) {
+ // Just pass the frame straight back.
+ receiver_->ManageFrame(std::move(frame));
+ } else {
+ frame_transformer_->Transform(
+ std::make_unique<TransformableVideoReceiverFrame>(std::move(frame),
+ ssrc_, receiver_));
+ }
}
void RtpVideoStreamReceiverFrameTransformerDelegate::OnTransformedFrame(
@@ -129,6 +140,20 @@ void RtpVideoStreamReceiverFrameTransformerDelegate::OnTransformedFrame(
});
}
+void RtpVideoStreamReceiverFrameTransformerDelegate::StartShortCircuiting() {
+ rtc::scoped_refptr<RtpVideoStreamReceiverFrameTransformerDelegate> delegate(
+ this);
+ network_thread_->PostTask([delegate = std::move(delegate)]() mutable {
+ delegate->StartShortCircuitingOnNetworkSequence();
+ });
+}
+
+void RtpVideoStreamReceiverFrameTransformerDelegate::
+ StartShortCircuitingOnNetworkSequence() {
+ RTC_DCHECK_RUN_ON(&network_sequence_checker_);
+ short_circuit_ = true;
+}
+
void RtpVideoStreamReceiverFrameTransformerDelegate::ManageFrame(
std::unique_ptr<TransformableFrameInterface> frame) {
RTC_DCHECK_RUN_ON(&network_sequence_checker_);
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
index 62a42fdddf..f08fc692dd 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate.h
@@ -55,6 +55,8 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
void OnTransformedFrame(
std::unique_ptr<TransformableFrameInterface> frame) override;
+ void StartShortCircuiting() override;
+
// Delegates the call to RtpVideoFrameReceiver::ManageFrame on the
// `network_thread_`.
void ManageFrame(std::unique_ptr<TransformableFrameInterface> frame);
@@ -63,6 +65,8 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
~RtpVideoStreamReceiverFrameTransformerDelegate() override = default;
private:
+ void StartShortCircuitingOnNetworkSequence();
+
RTC_NO_UNIQUE_ADDRESS SequenceChecker network_sequence_checker_;
RtpVideoFrameReceiver* receiver_ RTC_GUARDED_BY(network_sequence_checker_);
rtc::scoped_refptr<FrameTransformerInterface> frame_transformer_
@@ -70,6 +74,7 @@ class RtpVideoStreamReceiverFrameTransformerDelegate
rtc::Thread* const network_thread_;
const uint32_t ssrc_;
Clock* const clock_;
+ bool short_circuit_ RTC_GUARDED_BY(network_sequence_checker_) = false;
};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc
index bbc1b62b5e..cf3062610f 100644
--- a/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_video_stream_receiver_frame_transformer_delegate_unittest.cc
@@ -138,6 +138,7 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest,
ON_CALL(*mock_frame_transformer, Transform)
.WillByDefault(
[&callback](std::unique_ptr<TransformableFrameInterface> frame) {
+ EXPECT_STRCASEEQ("video/Generic", frame->GetMimeType().c_str());
callback->OnTransformedFrame(std::move(frame));
});
delegate->TransformFrame(CreateRtpFrameObject(RTPVideoHeader(), csrcs));
@@ -348,5 +349,28 @@ TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest,
rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
}
+TEST(RtpVideoStreamReceiverFrameTransformerDelegateTest,
+ ShortCircuitingSkipsTransform) {
+ rtc::AutoThread main_thread_;
+ TestRtpVideoFrameReceiver receiver;
+ auto mock_frame_transformer =
+ rtc::make_ref_counted<NiceMock<MockFrameTransformer>>();
+ SimulatedClock clock(0);
+ auto delegate =
+ rtc::make_ref_counted<RtpVideoStreamReceiverFrameTransformerDelegate>(
+ &receiver, &clock, mock_frame_transformer, rtc::Thread::Current(),
+ 1111);
+ delegate->Init();
+
+ delegate->StartShortCircuiting();
+ rtc::ThreadManager::ProcessAllMessageQueuesForTesting();
+
+ // Will not call the actual transformer.
+ EXPECT_CALL(*mock_frame_transformer, Transform).Times(0);
+ // Will pass the frame straight to the reciever.
+ EXPECT_CALL(receiver, ManageFrame);
+ delegate->TransformFrame(CreateRtpFrameObject());
+}
+
} // namespace
} // namespace webrtc
diff --git a/modules/video_capture/linux/camera_portal.cc b/modules/video_capture/linux/camera_portal.cc
index 85b9f20228..106ca1682c 100644
--- a/modules/video_capture/linux/camera_portal.cc
+++ b/modules/video_capture/linux/camera_portal.cc
@@ -15,6 +15,7 @@
#include "modules/portal/pipewire_utils.h"
#include "modules/portal/xdg_desktop_portal_utils.h"
+#include "rtc_base/synchronization/mutex.h"
namespace webrtc {
@@ -54,7 +55,9 @@ class CameraPortalPrivate {
GAsyncResult* result,
gpointer user_data);
- CameraPortal::PortalNotifier* notifier_ = nullptr;
+ webrtc::Mutex notifier_lock_;
+ CameraPortal::PortalNotifier* notifier_ RTC_GUARDED_BY(&notifier_lock_) =
+ nullptr;
GDBusConnection* connection_ = nullptr;
GDBusProxy* proxy_ = nullptr;
@@ -66,6 +69,11 @@ CameraPortalPrivate::CameraPortalPrivate(CameraPortal::PortalNotifier* notifier)
: notifier_(notifier) {}
CameraPortalPrivate::~CameraPortalPrivate() {
+ {
+ webrtc::MutexLock lock(&notifier_lock_);
+ notifier_ = nullptr;
+ }
+
if (access_request_signal_id_) {
g_dbus_connection_signal_unsubscribe(connection_,
access_request_signal_id_);
@@ -229,7 +237,11 @@ void CameraPortalPrivate::OnOpenResponse(GDBusProxy* proxy,
}
void CameraPortalPrivate::OnPortalDone(RequestResponse result, int fd) {
- notifier_->OnCameraRequestResult(result, fd);
+ webrtc::MutexLock lock(&notifier_lock_);
+ if (notifier_) {
+ notifier_->OnCameraRequestResult(result, fd);
+ notifier_ = nullptr;
+ }
}
CameraPortal::CameraPortal(PortalNotifier* notifier)
diff --git a/modules/video_capture/linux/device_info_pipewire.cc b/modules/video_capture/linux/device_info_pipewire.cc
index 1dee78f5ee..e9f7e6a869 100644
--- a/modules/video_capture/linux/device_info_pipewire.cc
+++ b/modules/video_capture/linux/device_info_pipewire.cc
@@ -20,10 +20,10 @@
#include <vector>
+#include "modules/video_capture/linux/pipewire_session.h"
#include "modules/video_capture/video_capture.h"
#include "modules/video_capture/video_capture_defines.h"
#include "modules/video_capture/video_capture_impl.h"
-#include "modules/video_capture/video_capture_options.h"
#include "rtc_base/logging.h"
namespace webrtc {
@@ -38,6 +38,8 @@ int32_t DeviceInfoPipeWire::Init() {
DeviceInfoPipeWire::~DeviceInfoPipeWire() = default;
uint32_t DeviceInfoPipeWire::NumberOfDevices() {
+ RTC_CHECK(pipewire_session_);
+
return pipewire_session_->nodes().size();
}
@@ -48,6 +50,8 @@ int32_t DeviceInfoPipeWire::GetDeviceName(uint32_t deviceNumber,
uint32_t deviceUniqueIdUTF8Length,
char* productUniqueIdUTF8,
uint32_t productUniqueIdUTF8Length) {
+ RTC_CHECK(pipewire_session_);
+
if (deviceNumber >= NumberOfDevices())
return -1;
@@ -83,6 +87,8 @@ int32_t DeviceInfoPipeWire::GetDeviceName(uint32_t deviceNumber,
int32_t DeviceInfoPipeWire::CreateCapabilityMap(
const char* deviceUniqueIdUTF8) {
+ RTC_CHECK(pipewire_session_);
+
for (auto& node : pipewire_session_->nodes()) {
if (node.unique_id().compare(deviceUniqueIdUTF8) != 0)
continue;
diff --git a/modules/video_capture/linux/device_info_pipewire.h b/modules/video_capture/linux/device_info_pipewire.h
index a006c85d1b..4da0c7a90b 100644
--- a/modules/video_capture/linux/device_info_pipewire.h
+++ b/modules/video_capture/linux/device_info_pipewire.h
@@ -14,7 +14,7 @@
#include <stdint.h>
#include "modules/video_capture/device_info_impl.h"
-#include "modules/video_capture/linux/pipewire_session.h"
+#include "modules/video_capture/video_capture_options.h"
namespace webrtc {
namespace videocapturemodule {
diff --git a/modules/video_capture/video_capture.h b/modules/video_capture/video_capture.h
index eddc31414a..48920b27c0 100644
--- a/modules/video_capture/video_capture.h
+++ b/modules/video_capture/video_capture.h
@@ -18,7 +18,7 @@
namespace webrtc {
-class VideoCaptureModule : public rtc::RefCountInterface {
+class VideoCaptureModule : public RefCountInterface {
public:
// Interface for receiving information about available camera devices.
class DeviceInfo {
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index f0bce34e3e..c75b433cd4 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -409,6 +409,7 @@ rtc_library("video_coding_utility") {
":video_codec_interface",
"../../api:array_view",
"../../api:field_trials_view",
+ "../../api:field_trials_view",
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../api/units:time_delta",
@@ -756,7 +757,6 @@ if (rtc_include_tests) {
"../../api/video_codecs:video_codecs_api",
"../../modules/utility:utility",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../sdk/android:internal_jni",
"../../sdk/android:native_api_base",
"../../sdk/android:native_api_codecs",
@@ -851,8 +851,6 @@ if (rtc_include_tests) {
"../../api:frame_generator_api",
"../../api:scoped_refptr",
"../../api:sequence_checker",
- "../../api:video_codec_stats_api",
- "../../api:video_codec_tester_api",
"../../api:videocodec_test_fixture_api",
"../../api/numerics:numerics",
"../../api/task_queue",
@@ -994,46 +992,6 @@ if (rtc_include_tests) {
]
}
- rtc_library("video_codec_tester") {
- testonly = true
- sources = [
- "codecs/test/video_codec_analyzer.cc",
- "codecs/test/video_codec_analyzer.h",
- "codecs/test/video_codec_stats_impl.cc",
- "codecs/test/video_codec_stats_impl.h",
- "codecs/test/video_codec_tester_impl.cc",
- "codecs/test/video_codec_tester_impl.h",
- ]
-
- deps = [
- ":video_coding_utility",
- "../../api:sequence_checker",
- "../../api:video_codec_stats_api",
- "../../api:video_codec_tester_api",
- "../../api/numerics:numerics",
- "../../api/task_queue:default_task_queue_factory",
- "../../api/test/metrics:metrics_logger",
- "../../api/units:data_rate",
- "../../api/units:frequency",
- "../../api/units:time_delta",
- "../../api/units:timestamp",
- "../../api/video:encoded_image",
- "../../api/video:resolution",
- "../../api/video:video_codec_constants",
- "../../api/video:video_frame",
- "../../rtc_base:checks",
- "../../rtc_base:rtc_event",
- "../../rtc_base:task_queue_for_test",
- "../../rtc_base:timeutils",
- "../../rtc_base/system:no_unique_address",
- "../../system_wrappers",
- "../../test:video_test_support",
- "//third_party/libyuv",
- ]
-
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
- }
-
rtc_test("video_codec_perf_tests") {
testonly = true
@@ -1041,28 +999,18 @@ if (rtc_include_tests) {
deps = [
":video_codec_interface",
- ":video_codec_tester",
- "../../api:create_video_codec_tester_api",
- "../../api:video_codec_tester_api",
- "../../api:videocodec_test_stats_api",
"../../api/test/metrics:global_metrics_logger_and_exporter",
"../../api/units:data_rate",
"../../api/units:frequency",
- "../../api/video:encoded_image",
"../../api/video:resolution",
- "../../api/video:video_frame",
- "../../api/video_codecs:scalability_mode",
- "../../api/video_codecs:video_codecs_api",
- "../../media:rtc_internal_video_codecs",
+ "../../api/video_codecs:builtin_video_decoder_factory",
+ "../../api/video_codecs:builtin_video_encoder_factory",
"../../rtc_base:logging",
- "../../system_wrappers:field_trial",
"../../test:fileutils",
+ "../../test:test_flags",
"../../test:test_main",
"../../test:test_support",
- "../../test:video_test_support",
- "../rtp_rtcp:rtp_rtcp_format",
- "svc:scalability_mode_util",
- "//third_party/libyuv",
+ "../../test:video_codec_tester",
]
if (is_android) {
@@ -1076,7 +1024,10 @@ if (rtc_include_tests) {
shard_timeout = 900
}
- absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/flags:flag",
+ "//third_party/abseil-cpp/absl/functional:any_invocable",
+ ]
data = [ "../../resources/FourPeople_1280x720_30.yuv" ]
}
@@ -1187,9 +1138,6 @@ if (rtc_include_tests) {
sources = [
"chain_diff_calculator_unittest.cc",
- "codecs/test/video_codec_analyzer_unittest.cc",
- "codecs/test/video_codec_stats_impl_unittest.cc",
- "codecs/test/video_codec_tester_impl_unittest.cc",
"codecs/test/videocodec_test_fixture_config_unittest.cc",
"codecs/test/videocodec_test_stats_impl_unittest.cc",
"codecs/test/videoprocessor_unittest.cc",
@@ -1244,7 +1192,6 @@ if (rtc_include_tests) {
":packet_buffer",
":simulcast_test_fixture_impl",
":video_codec_interface",
- ":video_codec_tester",
":video_codecs_test_framework",
":video_coding",
":video_coding_legacy",
@@ -1260,13 +1207,13 @@ if (rtc_include_tests) {
"../../api:array_view",
"../../api:create_simulcast_test_fixture_api",
"../../api:fec_controller_api",
+ "../../api:field_trials_view",
"../../api:mock_fec_controller_override",
"../../api:mock_video_decoder",
"../../api:mock_video_encoder",
"../../api:rtp_packet_info",
"../../api:scoped_refptr",
"../../api:simulcast_test_fixture_api",
- "../../api:video_codec_tester_api",
"../../api:videocodec_test_fixture_api",
"../../api/task_queue",
"../../api/task_queue:default_task_queue_factory",
@@ -1292,6 +1239,7 @@ if (rtc_include_tests) {
"../../common_video/generic_frame_descriptor",
"../../common_video/test:utilities",
"../../media:media_constants",
+ "../../media:rtc_internal_video_codecs",
"../../media:rtc_media_base",
"../../rtc_base:checks",
"../../rtc_base:gunit_helpers",
diff --git a/modules/video_coding/codecs/av1/av1_svc_config.cc b/modules/video_coding/codecs/av1/av1_svc_config.cc
index 30c0f307a5..09b840cb76 100644
--- a/modules/video_coding/codecs/av1/av1_svc_config.cc
+++ b/modules/video_coding/codecs/av1/av1_svc_config.cc
@@ -85,7 +85,7 @@ bool SetAv1SvcConfig(VideoCodec& video_codec,
}
}
- bool configured_for_single_spatial_layer =
+ bool requested_single_spatial_layer =
ScalabilityModeToNumSpatialLayers(*scalability_mode) == 1;
if (ScalabilityMode reduced = LimitNumSpatialLayers(
@@ -121,7 +121,7 @@ bool SetAv1SvcConfig(VideoCodec& video_codec,
spatial_layer.active = true;
}
- if (configured_for_single_spatial_layer) {
+ if (requested_single_spatial_layer) {
SpatialLayer& spatial_layer = video_codec.spatialLayers[0];
spatial_layer.minBitrate = video_codec.minBitrate;
spatial_layer.maxBitrate = video_codec.maxBitrate;
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
index 9a8d57ddba..4ff22bfe34 100644
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
+++ b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
@@ -41,6 +41,11 @@
#include "third_party/libaom/source/libaom/aom/aom_encoder.h"
#include "third_party/libaom/source/libaom/aom/aomcx.h"
+#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
+ (defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
+#define MOBILE_ARM
+#endif
+
#define SET_ENCODER_PARAM_OR_RETURN_ERROR(param_id, param_value) \
do { \
if (!SetEncoderControlParameters(param_id, param_value)) { \
@@ -413,8 +418,7 @@ int LibaomAv1Encoder::NumberOfThreads(int width,
return 2;
} else {
// Use 2 threads for low res on ARM.
-#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+#ifdef MOBILE_ARM
if (width * height >= 320 * 180 && number_of_cores > 2) {
return 2;
}
diff --git a/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index 7a9f640ce6..ee69b9befb 100644
--- a/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -565,10 +565,20 @@ int32_t H264EncoderImpl::Encode(
codec_specific.codecSpecific.H264.base_layer_sync =
tid > 0 && tid < tl0sync_limit_[i];
if (svc_controllers_[i]) {
+ if (encoded_images_[i]._frameType == VideoFrameType::kVideoFrameKey) {
+ // Reset the ScalableVideoController on key frame
+ // to reset the expected dependency structure.
+ layer_frames =
+ svc_controllers_[i]->NextFrameConfig(/* restart= */ true);
+ RTC_CHECK_EQ(layer_frames.size(), 1);
+ RTC_DCHECK_EQ(layer_frames[0].TemporalId(), 0);
+ RTC_DCHECK_EQ(layer_frames[0].IsKeyframe(), true);
+ }
+
if (layer_frames[0].TemporalId() != tid) {
RTC_LOG(LS_WARNING)
- << "Encoder produced a frame for layer S" << (i + 1) << "T"
- << tid + 1 << " that wasn't requested.";
+ << "Encoder produced a frame with temporal id " << tid
+ << ", expected " << layer_frames[0].TemporalId() << ".";
continue;
}
encoded_images_[i].SetTemporalIndex(tid);
diff --git a/modules/video_coding/codecs/test/video_codec_analyzer.cc b/modules/video_coding/codecs/test/video_codec_analyzer.cc
deleted file mode 100644
index 772c15734a..0000000000
--- a/modules/video_coding/codecs/test/video_codec_analyzer.cc
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_analyzer.h"
-
-#include <memory>
-
-#include "api/task_queue/default_task_queue_factory.h"
-#include "api/video/i420_buffer.h"
-#include "api/video/video_codec_constants.h"
-#include "api/video/video_frame.h"
-#include "rtc_base/checks.h"
-#include "rtc_base/event.h"
-#include "rtc_base/time_utils.h"
-#include "third_party/libyuv/include/libyuv/compare.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using Psnr = VideoCodecStats::Frame::Psnr;
-
-Psnr CalcPsnr(const I420BufferInterface& ref_buffer,
- const I420BufferInterface& dec_buffer) {
- RTC_CHECK_EQ(ref_buffer.width(), dec_buffer.width());
- RTC_CHECK_EQ(ref_buffer.height(), dec_buffer.height());
-
- uint64_t sse_y = libyuv::ComputeSumSquareErrorPlane(
- dec_buffer.DataY(), dec_buffer.StrideY(), ref_buffer.DataY(),
- ref_buffer.StrideY(), dec_buffer.width(), dec_buffer.height());
-
- uint64_t sse_u = libyuv::ComputeSumSquareErrorPlane(
- dec_buffer.DataU(), dec_buffer.StrideU(), ref_buffer.DataU(),
- ref_buffer.StrideU(), dec_buffer.width() / 2, dec_buffer.height() / 2);
-
- uint64_t sse_v = libyuv::ComputeSumSquareErrorPlane(
- dec_buffer.DataV(), dec_buffer.StrideV(), ref_buffer.DataV(),
- ref_buffer.StrideV(), dec_buffer.width() / 2, dec_buffer.height() / 2);
-
- int num_y_samples = dec_buffer.width() * dec_buffer.height();
- Psnr psnr;
- psnr.y = libyuv::SumSquareErrorToPsnr(sse_y, num_y_samples);
- psnr.u = libyuv::SumSquareErrorToPsnr(sse_u, num_y_samples / 4);
- psnr.v = libyuv::SumSquareErrorToPsnr(sse_v, num_y_samples / 4);
-
- return psnr;
-}
-
-} // namespace
-
-VideoCodecAnalyzer::VideoCodecAnalyzer(
- ReferenceVideoSource* reference_video_source)
- : reference_video_source_(reference_video_source), num_frames_(0) {
- sequence_checker_.Detach();
-}
-
-void VideoCodecAnalyzer::StartEncode(const VideoFrame& input_frame) {
- int64_t encode_start_us = rtc::TimeMicros();
- task_queue_.PostTask(
- [this, timestamp_rtp = input_frame.timestamp(), encode_start_us]() {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
-
- RTC_CHECK(frame_num_.find(timestamp_rtp) == frame_num_.end());
- frame_num_[timestamp_rtp] = num_frames_++;
-
- stats_.AddFrame({.frame_num = frame_num_[timestamp_rtp],
- .timestamp_rtp = timestamp_rtp,
- .encode_start = Timestamp::Micros(encode_start_us)});
- });
-}
-
-void VideoCodecAnalyzer::FinishEncode(const EncodedImage& frame) {
- int64_t encode_finished_us = rtc::TimeMicros();
-
- task_queue_.PostTask([this, timestamp_rtp = frame.RtpTimestamp(),
- spatial_idx = frame.SpatialIndex().value_or(0),
- temporal_idx = frame.TemporalIndex().value_or(0),
- width = frame._encodedWidth,
- height = frame._encodedHeight,
- frame_type = frame._frameType,
- frame_size_bytes = frame.size(), qp = frame.qp_,
- encode_finished_us]() {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
-
- if (spatial_idx > 0) {
- VideoCodecStats::Frame* base_frame =
- stats_.GetFrame(timestamp_rtp, /*spatial_idx=*/0);
-
- stats_.AddFrame({.frame_num = base_frame->frame_num,
- .timestamp_rtp = timestamp_rtp,
- .spatial_idx = spatial_idx,
- .encode_start = base_frame->encode_start});
- }
-
- VideoCodecStats::Frame* fs = stats_.GetFrame(timestamp_rtp, spatial_idx);
- fs->spatial_idx = spatial_idx;
- fs->temporal_idx = temporal_idx;
- fs->width = width;
- fs->height = height;
- fs->frame_size = DataSize::Bytes(frame_size_bytes);
- fs->qp = qp;
- fs->keyframe = frame_type == VideoFrameType::kVideoFrameKey;
- fs->encode_time = Timestamp::Micros(encode_finished_us) - fs->encode_start;
- fs->encoded = true;
- });
-}
-
-void VideoCodecAnalyzer::StartDecode(const EncodedImage& frame) {
- int64_t decode_start_us = rtc::TimeMicros();
- task_queue_.PostTask([this, timestamp_rtp = frame.RtpTimestamp(),
- spatial_idx = frame.SpatialIndex().value_or(0),
- frame_size_bytes = frame.size(), decode_start_us]() {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
-
- VideoCodecStats::Frame* fs = stats_.GetFrame(timestamp_rtp, spatial_idx);
- if (fs == nullptr) {
- if (frame_num_.find(timestamp_rtp) == frame_num_.end()) {
- frame_num_[timestamp_rtp] = num_frames_++;
- }
- stats_.AddFrame({.frame_num = frame_num_[timestamp_rtp],
- .timestamp_rtp = timestamp_rtp,
- .spatial_idx = spatial_idx,
- .frame_size = DataSize::Bytes(frame_size_bytes)});
- fs = stats_.GetFrame(timestamp_rtp, spatial_idx);
- }
-
- fs->decode_start = Timestamp::Micros(decode_start_us);
- });
-}
-
-void VideoCodecAnalyzer::FinishDecode(const VideoFrame& frame,
- int spatial_idx) {
- int64_t decode_finished_us = rtc::TimeMicros();
- task_queue_.PostTask([this, timestamp_rtp = frame.timestamp(), spatial_idx,
- width = frame.width(), height = frame.height(),
- decode_finished_us]() {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
- VideoCodecStats::Frame* fs = stats_.GetFrame(timestamp_rtp, spatial_idx);
- fs->decode_time = Timestamp::Micros(decode_finished_us) - fs->decode_start;
-
- if (!fs->encoded) {
- fs->width = width;
- fs->height = height;
- }
-
- fs->decoded = true;
- });
-
- if (reference_video_source_ != nullptr) {
- // Copy hardware-backed frame into main memory to release output buffers
- // which number may be limited in hardware decoders.
- rtc::scoped_refptr<I420BufferInterface> decoded_buffer =
- frame.video_frame_buffer()->ToI420();
-
- task_queue_.PostTask([this, decoded_buffer,
- timestamp_rtp = frame.timestamp(), spatial_idx]() {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
- VideoFrame ref_frame = reference_video_source_->GetFrame(
- timestamp_rtp, {.width = decoded_buffer->width(),
- .height = decoded_buffer->height()});
- rtc::scoped_refptr<I420BufferInterface> ref_buffer =
- ref_frame.video_frame_buffer()->ToI420();
-
- Psnr psnr = CalcPsnr(*decoded_buffer, *ref_buffer);
-
- VideoCodecStats::Frame* fs =
- this->stats_.GetFrame(timestamp_rtp, spatial_idx);
- fs->psnr = psnr;
- });
- }
-}
-
-std::unique_ptr<VideoCodecStats> VideoCodecAnalyzer::GetStats() {
- std::unique_ptr<VideoCodecStats> stats;
- rtc::Event ready;
- task_queue_.PostTask([this, &stats, &ready]() mutable {
- RTC_DCHECK_RUN_ON(&sequence_checker_);
- stats.reset(new VideoCodecStatsImpl(stats_));
- ready.Set();
- });
- ready.Wait(rtc::Event::kForever);
- return stats;
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_analyzer.h b/modules/video_coding/codecs/test/video_codec_analyzer.h
deleted file mode 100644
index 29ca8ee2ff..0000000000
--- a/modules/video_coding/codecs/test/video_codec_analyzer.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_ANALYZER_H_
-#define MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_ANALYZER_H_
-
-#include <map>
-#include <memory>
-
-#include "absl/types/optional.h"
-#include "api/sequence_checker.h"
-#include "api/test/video_codec_tester.h"
-#include "api/video/encoded_image.h"
-#include "api/video/resolution.h"
-#include "api/video/video_frame.h"
-#include "modules/video_coding/codecs/test/video_codec_stats_impl.h"
-#include "rtc_base/system/no_unique_address.h"
-#include "rtc_base/task_queue_for_test.h"
-
-namespace webrtc {
-namespace test {
-
-// Analyzer measures and collects metrics necessary for evaluation of video
-// codec quality and performance. This class is thread-safe.
-class VideoCodecAnalyzer {
- public:
- // An interface that provides reference frames for spatial quality analysis.
- class ReferenceVideoSource {
- public:
- virtual ~ReferenceVideoSource() = default;
-
- virtual VideoFrame GetFrame(uint32_t timestamp_rtp,
- Resolution resolution) = 0;
- };
-
- explicit VideoCodecAnalyzer(
- ReferenceVideoSource* reference_video_source = nullptr);
-
- void StartEncode(const VideoFrame& frame);
-
- void FinishEncode(const EncodedImage& frame);
-
- void StartDecode(const EncodedImage& frame);
-
- void FinishDecode(const VideoFrame& frame, int spatial_idx);
-
- std::unique_ptr<VideoCodecStats> GetStats();
-
- protected:
- TaskQueueForTest task_queue_;
-
- ReferenceVideoSource* const reference_video_source_;
-
- VideoCodecStatsImpl stats_ RTC_GUARDED_BY(sequence_checker_);
-
- // Map from RTP timestamp to frame number.
- std::map<uint32_t, int> frame_num_ RTC_GUARDED_BY(sequence_checker_);
-
- // Processed frames counter.
- int num_frames_ RTC_GUARDED_BY(sequence_checker_);
-
- RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_ANALYZER_H_
diff --git a/modules/video_coding/codecs/test/video_codec_analyzer_unittest.cc b/modules/video_coding/codecs/test/video_codec_analyzer_unittest.cc
deleted file mode 100644
index 03146417da..0000000000
--- a/modules/video_coding/codecs/test/video_codec_analyzer_unittest.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_analyzer.h"
-
-#include "absl/types/optional.h"
-#include "api/video/i420_buffer.h"
-#include "test/gmock.h"
-#include "test/gtest.h"
-#include "third_party/libyuv/include/libyuv/planar_functions.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using ::testing::Return;
-using ::testing::Values;
-using Psnr = VideoCodecStats::Frame::Psnr;
-
-const uint32_t kTimestamp = 3000;
-const int kSpatialIdx = 2;
-
-class MockReferenceVideoSource
- : public VideoCodecAnalyzer::ReferenceVideoSource {
- public:
- MOCK_METHOD(VideoFrame, GetFrame, (uint32_t, Resolution), (override));
-};
-
-VideoFrame CreateVideoFrame(uint32_t timestamp_rtp,
- uint8_t y = 0,
- uint8_t u = 0,
- uint8_t v = 0) {
- rtc::scoped_refptr<I420Buffer> buffer(I420Buffer::Create(2, 2));
-
- libyuv::I420Rect(buffer->MutableDataY(), buffer->StrideY(),
- buffer->MutableDataU(), buffer->StrideU(),
- buffer->MutableDataV(), buffer->StrideV(), 0, 0,
- buffer->width(), buffer->height(), y, u, v);
-
- return VideoFrame::Builder()
- .set_video_frame_buffer(buffer)
- .set_timestamp_rtp(timestamp_rtp)
- .build();
-}
-
-EncodedImage CreateEncodedImage(uint32_t timestamp_rtp, int spatial_idx = 0) {
- EncodedImage encoded_image;
- encoded_image.SetRtpTimestamp(timestamp_rtp);
- encoded_image.SetSpatialIndex(spatial_idx);
- return encoded_image;
-}
-} // namespace
-
-TEST(VideoCodecAnalyzerTest, StartEncode) {
- VideoCodecAnalyzer analyzer;
- analyzer.StartEncode(CreateVideoFrame(kTimestamp));
-
- auto fs = analyzer.GetStats()->Slice();
- EXPECT_EQ(1u, fs.size());
- EXPECT_EQ(fs[0].timestamp_rtp, kTimestamp);
-}
-
-TEST(VideoCodecAnalyzerTest, FinishEncode) {
- VideoCodecAnalyzer analyzer;
- analyzer.StartEncode(CreateVideoFrame(kTimestamp));
-
- EncodedImage encoded_frame = CreateEncodedImage(kTimestamp, kSpatialIdx);
- analyzer.FinishEncode(encoded_frame);
-
- auto fs = analyzer.GetStats()->Slice();
- EXPECT_EQ(2u, fs.size());
- EXPECT_EQ(kSpatialIdx, fs[1].spatial_idx);
-}
-
-TEST(VideoCodecAnalyzerTest, StartDecode) {
- VideoCodecAnalyzer analyzer;
- analyzer.StartDecode(CreateEncodedImage(kTimestamp, kSpatialIdx));
-
- auto fs = analyzer.GetStats()->Slice();
- EXPECT_EQ(1u, fs.size());
- EXPECT_EQ(kTimestamp, fs[0].timestamp_rtp);
-}
-
-TEST(VideoCodecAnalyzerTest, FinishDecode) {
- VideoCodecAnalyzer analyzer;
- analyzer.StartDecode(CreateEncodedImage(kTimestamp, kSpatialIdx));
- VideoFrame decoded_frame = CreateVideoFrame(kTimestamp);
- analyzer.FinishDecode(decoded_frame, kSpatialIdx);
-
- auto fs = analyzer.GetStats()->Slice();
- EXPECT_EQ(1u, fs.size());
- EXPECT_EQ(decoded_frame.width(), fs[0].width);
- EXPECT_EQ(decoded_frame.height(), fs[0].height);
-}
-
-TEST(VideoCodecAnalyzerTest, ReferenceVideoSource) {
- MockReferenceVideoSource reference_video_source;
- VideoCodecAnalyzer analyzer(&reference_video_source);
- analyzer.StartDecode(CreateEncodedImage(kTimestamp, kSpatialIdx));
-
- EXPECT_CALL(reference_video_source, GetFrame)
- .WillOnce(Return(CreateVideoFrame(kTimestamp, /*y=*/0,
- /*u=*/0, /*v=*/0)));
-
- analyzer.FinishDecode(
- CreateVideoFrame(kTimestamp, /*value_y=*/1, /*value_u=*/2, /*value_v=*/3),
- kSpatialIdx);
-
- auto fs = analyzer.GetStats()->Slice();
- EXPECT_EQ(1u, fs.size());
- EXPECT_TRUE(fs[0].psnr.has_value());
-
- const Psnr& psnr = *fs[0].psnr;
- EXPECT_NEAR(psnr.y, 48, 1);
- EXPECT_NEAR(psnr.u, 42, 1);
- EXPECT_NEAR(psnr.v, 38, 1);
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_stats_impl.cc b/modules/video_coding/codecs/test/video_codec_stats_impl.cc
deleted file mode 100644
index 9808e2a601..0000000000
--- a/modules/video_coding/codecs/test/video_codec_stats_impl.cc
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_stats_impl.h"
-
-#include <algorithm>
-
-#include "api/numerics/samples_stats_counter.h"
-#include "api/test/metrics/metrics_logger.h"
-#include "rtc_base/checks.h"
-#include "rtc_base/time_utils.h"
-
-namespace webrtc {
-namespace test {
-namespace {
-using Frame = VideoCodecStats::Frame;
-using Stream = VideoCodecStats::Stream;
-
-constexpr Frequency k90kHz = Frequency::Hertz(90000);
-
-class LeakyBucket {
- public:
- LeakyBucket() : level_bits_(0) {}
-
- // Updates bucket level and returns its current level in bits. Data is remove
- // from bucket with rate equal to target bitrate of previous frame. Bucket
- // level is tracked with floating point precision. Returned value of bucket
- // level is rounded up.
- int Update(const Frame& frame) {
- RTC_CHECK(frame.target_bitrate) << "Bitrate must be specified.";
-
- if (prev_frame_) {
- RTC_CHECK_GT(frame.timestamp_rtp, prev_frame_->timestamp_rtp)
- << "Timestamp must increase.";
- TimeDelta passed =
- (frame.timestamp_rtp - prev_frame_->timestamp_rtp) / k90kHz;
- level_bits_ -=
- prev_frame_->target_bitrate->bps() * passed.us() / 1000000.0;
- level_bits_ = std::max(level_bits_, 0.0);
- }
-
- prev_frame_ = frame;
-
- level_bits_ += frame.frame_size.bytes() * 8;
- return static_cast<int>(std::ceil(level_bits_));
- }
-
- private:
- absl::optional<Frame> prev_frame_;
- double level_bits_;
-};
-
-// Merges spatial layer frames into superframes.
-std::vector<Frame> Merge(const std::vector<Frame>& frames) {
- std::vector<Frame> superframes;
- // Map from frame timestamp to index in `superframes` vector.
- std::map<uint32_t, int> index;
-
- for (const auto& f : frames) {
- if (index.find(f.timestamp_rtp) == index.end()) {
- index[f.timestamp_rtp] = static_cast<int>(superframes.size());
- superframes.push_back(f);
- continue;
- }
-
- Frame& sf = superframes[index[f.timestamp_rtp]];
-
- sf.width = std::max(sf.width, f.width);
- sf.height = std::max(sf.height, f.height);
- sf.frame_size += f.frame_size;
- sf.keyframe |= f.keyframe;
-
- sf.encode_time = std::max(sf.encode_time, f.encode_time);
- sf.decode_time = std::max(sf.decode_time, f.decode_time);
-
- if (f.spatial_idx > sf.spatial_idx) {
- if (f.qp) {
- sf.qp = f.qp;
- }
- if (f.psnr) {
- sf.psnr = f.psnr;
- }
- }
-
- sf.spatial_idx = std::max(sf.spatial_idx, f.spatial_idx);
- sf.temporal_idx = std::max(sf.temporal_idx, f.temporal_idx);
-
- sf.encoded |= f.encoded;
- sf.decoded |= f.decoded;
- }
-
- return superframes;
-}
-
-Timestamp RtpToTime(uint32_t timestamp_rtp) {
- return Timestamp::Micros((timestamp_rtp / k90kHz).us());
-}
-
-SamplesStatsCounter::StatsSample StatsSample(double value, Timestamp time) {
- return SamplesStatsCounter::StatsSample{value, time};
-}
-
-TimeDelta CalcTotalDuration(const std::vector<Frame>& frames) {
- RTC_CHECK(!frames.empty());
- TimeDelta duration = TimeDelta::Zero();
- if (frames.size() > 1) {
- duration +=
- (frames.rbegin()->timestamp_rtp - frames.begin()->timestamp_rtp) /
- k90kHz;
- }
-
- // Add last frame duration. If target frame rate is provided, calculate frame
- // duration from it. Otherwise, assume duration of last frame is the same as
- // duration of preceding frame.
- if (frames.rbegin()->target_framerate) {
- duration += 1 / *frames.rbegin()->target_framerate;
- } else {
- RTC_CHECK_GT(frames.size(), 1u);
- duration += (frames.rbegin()->timestamp_rtp -
- std::next(frames.rbegin())->timestamp_rtp) /
- k90kHz;
- }
-
- return duration;
-}
-} // namespace
-
-std::vector<Frame> VideoCodecStatsImpl::Slice(
- absl::optional<Filter> filter) const {
- std::vector<Frame> frames;
- for (const auto& [frame_id, f] : frames_) {
- if (filter.has_value()) {
- if (filter->first_frame.has_value() &&
- f.frame_num < *filter->first_frame) {
- continue;
- }
- if (filter->last_frame.has_value() && f.frame_num > *filter->last_frame) {
- continue;
- }
- if (filter->spatial_idx.has_value() &&
- f.spatial_idx != *filter->spatial_idx) {
- continue;
- }
- if (filter->temporal_idx.has_value() &&
- f.temporal_idx > *filter->temporal_idx) {
- continue;
- }
- }
- frames.push_back(f);
- }
- return frames;
-}
-
-Stream VideoCodecStatsImpl::Aggregate(const std::vector<Frame>& frames) const {
- std::vector<Frame> superframes = Merge(frames);
- RTC_CHECK(!superframes.empty());
-
- LeakyBucket leacky_bucket;
- Stream stream;
- for (size_t i = 0; i < superframes.size(); ++i) {
- Frame& f = superframes[i];
- Timestamp time = RtpToTime(f.timestamp_rtp);
-
- if (!f.frame_size.IsZero()) {
- stream.width.AddSample(StatsSample(f.width, time));
- stream.height.AddSample(StatsSample(f.height, time));
- stream.frame_size_bytes.AddSample(
- StatsSample(f.frame_size.bytes(), time));
- stream.keyframe.AddSample(StatsSample(f.keyframe, time));
- if (f.qp) {
- stream.qp.AddSample(StatsSample(*f.qp, time));
- }
- }
-
- if (f.encoded) {
- stream.encode_time_ms.AddSample(StatsSample(f.encode_time.ms(), time));
- }
-
- if (f.decoded) {
- stream.decode_time_ms.AddSample(StatsSample(f.decode_time.ms(), time));
- }
-
- if (f.psnr) {
- stream.psnr.y.AddSample(StatsSample(f.psnr->y, time));
- stream.psnr.u.AddSample(StatsSample(f.psnr->u, time));
- stream.psnr.v.AddSample(StatsSample(f.psnr->v, time));
- }
-
- if (f.target_framerate) {
- stream.target_framerate_fps.AddSample(
- StatsSample(f.target_framerate->millihertz() / 1000.0, time));
- }
-
- if (f.target_bitrate) {
- stream.target_bitrate_kbps.AddSample(
- StatsSample(f.target_bitrate->bps() / 1000.0, time));
-
- int buffer_level_bits = leacky_bucket.Update(f);
- stream.transmission_time_ms.AddSample(
- StatsSample(buffer_level_bits * rtc::kNumMillisecsPerSec /
- f.target_bitrate->bps(),
- RtpToTime(f.timestamp_rtp)));
- }
- }
-
- TimeDelta duration = CalcTotalDuration(superframes);
- DataRate encoded_bitrate =
- DataSize::Bytes(stream.frame_size_bytes.GetSum()) / duration;
-
- int num_encoded_frames = stream.frame_size_bytes.NumSamples();
- Frequency encoded_framerate = num_encoded_frames / duration;
-
- absl::optional<double> bitrate_mismatch_pct;
- if (auto target_bitrate = superframes.begin()->target_bitrate;
- target_bitrate) {
- bitrate_mismatch_pct = 100.0 *
- (encoded_bitrate.bps() - target_bitrate->bps()) /
- target_bitrate->bps();
- }
-
- absl::optional<double> framerate_mismatch_pct;
- if (auto target_framerate = superframes.begin()->target_framerate;
- target_framerate) {
- framerate_mismatch_pct =
- 100.0 *
- (encoded_framerate.millihertz() - target_framerate->millihertz()) /
- target_framerate->millihertz();
- }
-
- for (auto& f : superframes) {
- Timestamp time = RtpToTime(f.timestamp_rtp);
- stream.encoded_bitrate_kbps.AddSample(
- StatsSample(encoded_bitrate.bps() / 1000.0, time));
-
- stream.encoded_framerate_fps.AddSample(
- StatsSample(encoded_framerate.millihertz() / 1000.0, time));
-
- if (bitrate_mismatch_pct) {
- stream.bitrate_mismatch_pct.AddSample(
- StatsSample(*bitrate_mismatch_pct, time));
- }
-
- if (framerate_mismatch_pct) {
- stream.framerate_mismatch_pct.AddSample(
- StatsSample(*framerate_mismatch_pct, time));
- }
- }
-
- return stream;
-}
-
-void VideoCodecStatsImpl::AddFrame(const Frame& frame) {
- FrameId frame_id{.timestamp_rtp = frame.timestamp_rtp,
- .spatial_idx = frame.spatial_idx};
- RTC_CHECK(frames_.find(frame_id) == frames_.end())
- << "Frame with timestamp_rtp=" << frame.timestamp_rtp
- << " and spatial_idx=" << frame.spatial_idx << " already exists";
-
- frames_[frame_id] = frame;
-}
-
-Frame* VideoCodecStatsImpl::GetFrame(uint32_t timestamp_rtp, int spatial_idx) {
- FrameId frame_id{.timestamp_rtp = timestamp_rtp, .spatial_idx = spatial_idx};
- if (frames_.find(frame_id) == frames_.end()) {
- return nullptr;
- }
- return &frames_.find(frame_id)->second;
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_stats_impl.h b/modules/video_coding/codecs/test/video_codec_stats_impl.h
deleted file mode 100644
index 77471d2ecd..0000000000
--- a/modules/video_coding/codecs/test/video_codec_stats_impl.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_STATS_IMPL_H_
-#define MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_STATS_IMPL_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "absl/types/optional.h"
-#include "api/test/video_codec_stats.h"
-
-namespace webrtc {
-namespace test {
-
-// Implementation of `VideoCodecStats`. This class is not thread-safe.
-class VideoCodecStatsImpl : public VideoCodecStats {
- public:
- std::vector<Frame> Slice(
- absl::optional<Filter> filter = absl::nullopt) const override;
-
- Stream Aggregate(const std::vector<Frame>& frames) const override;
-
- void AddFrame(const Frame& frame);
-
- // Returns raw pointers to previously added frame. If frame does not exist,
- // returns `nullptr`.
- Frame* GetFrame(uint32_t timestamp_rtp, int spatial_idx);
-
- private:
- struct FrameId {
- uint32_t timestamp_rtp;
- int spatial_idx;
-
- bool operator==(const FrameId& o) const {
- return timestamp_rtp == o.timestamp_rtp && spatial_idx == o.spatial_idx;
- }
-
- bool operator<(const FrameId& o) const {
- if (timestamp_rtp < o.timestamp_rtp)
- return true;
- if (timestamp_rtp == o.timestamp_rtp && spatial_idx < o.spatial_idx)
- return true;
- return false;
- }
- };
-
- std::map<FrameId, Frame> frames_;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_STATS_IMPL_H_
diff --git a/modules/video_coding/codecs/test/video_codec_stats_impl_unittest.cc b/modules/video_coding/codecs/test/video_codec_stats_impl_unittest.cc
deleted file mode 100644
index ce11d5abe6..0000000000
--- a/modules/video_coding/codecs/test/video_codec_stats_impl_unittest.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_stats_impl.h"
-
-#include <tuple>
-
-#include "absl/types/optional.h"
-#include "test/gmock.h"
-#include "test/gtest.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using ::testing::Return;
-using ::testing::Values;
-using Filter = VideoCodecStats::Filter;
-using Frame = VideoCodecStatsImpl::Frame;
-using Stream = VideoCodecStats::Stream;
-} // namespace
-
-TEST(VideoCodecStatsImpl, AddAndGetFrame) {
- VideoCodecStatsImpl stats;
- stats.AddFrame({.timestamp_rtp = 0, .spatial_idx = 0});
- stats.AddFrame({.timestamp_rtp = 0, .spatial_idx = 1});
- stats.AddFrame({.timestamp_rtp = 1, .spatial_idx = 0});
-
- Frame* fs = stats.GetFrame(/*timestamp_rtp=*/0, /*spatial_idx=*/0);
- ASSERT_NE(fs, nullptr);
- EXPECT_EQ(fs->timestamp_rtp, 0u);
- EXPECT_EQ(fs->spatial_idx, 0);
-
- fs = stats.GetFrame(/*timestamp_rtp=*/0, /*spatial_idx=*/1);
- ASSERT_NE(fs, nullptr);
- EXPECT_EQ(fs->timestamp_rtp, 0u);
- EXPECT_EQ(fs->spatial_idx, 1);
-
- fs = stats.GetFrame(/*timestamp_rtp=*/1, /*spatial_idx=*/0);
- ASSERT_NE(fs, nullptr);
- EXPECT_EQ(fs->timestamp_rtp, 1u);
- EXPECT_EQ(fs->spatial_idx, 0);
-
- fs = stats.GetFrame(/*timestamp_rtp=*/1, /*spatial_idx=*/1);
- EXPECT_EQ(fs, nullptr);
-}
-
-class VideoCodecStatsImplSlicingTest
- : public ::testing::TestWithParam<std::tuple<Filter, std::vector<int>>> {};
-
-TEST_P(VideoCodecStatsImplSlicingTest, Slice) {
- Filter filter = std::get<0>(GetParam());
- std::vector<int> expected_frames = std::get<1>(GetParam());
- std::vector<VideoCodecStats::Frame> frames = {
- {.frame_num = 0, .timestamp_rtp = 0, .spatial_idx = 0, .temporal_idx = 0},
- {.frame_num = 0, .timestamp_rtp = 0, .spatial_idx = 1, .temporal_idx = 0},
- {.frame_num = 1, .timestamp_rtp = 1, .spatial_idx = 0, .temporal_idx = 1},
- {.frame_num = 1,
- .timestamp_rtp = 1,
- .spatial_idx = 1,
- .temporal_idx = 1}};
-
- VideoCodecStatsImpl stats;
- stats.AddFrame(frames[0]);
- stats.AddFrame(frames[1]);
- stats.AddFrame(frames[2]);
- stats.AddFrame(frames[3]);
-
- std::vector<VideoCodecStats::Frame> slice = stats.Slice(filter);
- ASSERT_EQ(slice.size(), expected_frames.size());
- for (size_t i = 0; i < expected_frames.size(); ++i) {
- Frame& expected = frames[expected_frames[i]];
- EXPECT_EQ(slice[i].frame_num, expected.frame_num);
- EXPECT_EQ(slice[i].timestamp_rtp, expected.timestamp_rtp);
- EXPECT_EQ(slice[i].spatial_idx, expected.spatial_idx);
- EXPECT_EQ(slice[i].temporal_idx, expected.temporal_idx);
- }
-}
-
-INSTANTIATE_TEST_SUITE_P(
- All,
- VideoCodecStatsImplSlicingTest,
- ::testing::Values(
- std::make_tuple(Filter{}, std::vector<int>{0, 1, 2, 3}),
- std::make_tuple(Filter{.first_frame = 1}, std::vector<int>{2, 3}),
- std::make_tuple(Filter{.last_frame = 0}, std::vector<int>{0, 1}),
- std::make_tuple(Filter{.spatial_idx = 0}, std::vector<int>{0, 2}),
- std::make_tuple(Filter{.temporal_idx = 1},
- std::vector<int>{0, 1, 2, 3})));
-
-TEST(VideoCodecStatsImpl, AggregateBitrate) {
- std::vector<VideoCodecStats::Frame> frames = {
- {.frame_num = 0,
- .timestamp_rtp = 0,
- .frame_size = DataSize::Bytes(1000),
- .target_bitrate = DataRate::BytesPerSec(1000)},
- {.frame_num = 1,
- .timestamp_rtp = 90000,
- .frame_size = DataSize::Bytes(2000),
- .target_bitrate = DataRate::BytesPerSec(1000)}};
-
- Stream stream = VideoCodecStatsImpl().Aggregate(frames);
- EXPECT_EQ(stream.encoded_bitrate_kbps.GetAverage(), 12.0);
- EXPECT_EQ(stream.bitrate_mismatch_pct.GetAverage(), 50.0);
-}
-
-TEST(VideoCodecStatsImpl, AggregateFramerate) {
- std::vector<VideoCodecStats::Frame> frames = {
- {.frame_num = 0,
- .timestamp_rtp = 0,
- .frame_size = DataSize::Bytes(1),
- .target_framerate = Frequency::Hertz(1)},
- {.frame_num = 1,
- .timestamp_rtp = 90000,
- .frame_size = DataSize::Zero(),
- .target_framerate = Frequency::Hertz(1)}};
-
- Stream stream = VideoCodecStatsImpl().Aggregate(frames);
- EXPECT_EQ(stream.encoded_framerate_fps.GetAverage(), 0.5);
- EXPECT_EQ(stream.framerate_mismatch_pct.GetAverage(), -50.0);
-}
-
-TEST(VideoCodecStatsImpl, AggregateTransmissionTime) {
- std::vector<VideoCodecStats::Frame> frames = {
- {.frame_num = 0,
- .timestamp_rtp = 0,
- .frame_size = DataSize::Bytes(2),
- .target_bitrate = DataRate::BytesPerSec(1)},
- {.frame_num = 1,
- .timestamp_rtp = 90000,
- .frame_size = DataSize::Bytes(3),
- .target_bitrate = DataRate::BytesPerSec(1)}};
-
- Stream stream = VideoCodecStatsImpl().Aggregate(frames);
- ASSERT_EQ(stream.transmission_time_ms.NumSamples(), 2);
- ASSERT_EQ(stream.transmission_time_ms.GetSamples()[0], 2000);
- ASSERT_EQ(stream.transmission_time_ms.GetSamples()[1], 4000);
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_test.cc b/modules/video_coding/codecs/test/video_codec_test.cc
index e838a6cbfd..08961a312b 100644
--- a/modules/video_coding/codecs/test/video_codec_test.cc
+++ b/modules/video_coding/codecs/test/video_codec_test.cc
@@ -8,40 +8,34 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/video_codecs/video_codec.h"
-
-#include <cstddef>
#include <memory>
#include <string>
#include <vector>
+#include "absl/flags/flag.h"
#include "absl/functional/any_invocable.h"
-#include "api/test/create_video_codec_tester.h"
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
-#include "api/test/video_codec_tester.h"
-#include "api/test/videocodec_test_stats.h"
#include "api/units/data_rate.h"
#include "api/units/frequency.h"
-#include "api/video/encoded_image.h"
-#include "api/video/i420_buffer.h"
#include "api/video/resolution.h"
-#include "api/video/video_frame.h"
-#include "api/video_codecs/scalability_mode.h"
-#include "api/video_codecs/video_decoder.h"
-#include "api/video_codecs/video_encoder.h"
-#include "media/engine/internal_decoder_factory.h"
-#include "media/engine/internal_encoder_factory.h"
-#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "modules/video_coding/include/video_error_codes.h"
-#include "modules/video_coding/svc/scalability_mode_util.h"
+#include "api/video_codecs/builtin_video_decoder_factory.h"
+#include "api/video_codecs/builtin_video_encoder_factory.h"
#if defined(WEBRTC_ANDROID)
#include "modules/video_coding/codecs/test/android_codec_factory_helper.h"
#endif
#include "rtc_base/logging.h"
-#include "system_wrappers/include/field_trial.h"
#include "test/gtest.h"
+#include "test/test_flags.h"
#include "test/testsupport/file_utils.h"
-#include "test/testsupport/frame_reader.h"
+#include "test/video_codec_tester.h"
+
+ABSL_FLAG(bool, dump_decoder_input, false, "Dump decoder input.");
+
+ABSL_FLAG(bool, dump_decoder_output, false, "Dump decoder output.");
+
+ABSL_FLAG(bool, dump_encoder_input, false, "Dump encoder input.");
+
+ABSL_FLAG(bool, dump_encoder_output, false, "Dump encoder output.");
namespace webrtc {
namespace test {
@@ -49,6 +43,10 @@ namespace test {
namespace {
using ::testing::Combine;
using ::testing::Values;
+using VideoSourceSettings = VideoCodecTester::VideoSourceSettings;
+using EncodingSettings = VideoCodecTester::EncodingSettings;
+using VideoCodecStats = VideoCodecTester::VideoCodecStats;
+using Filter = VideoCodecStats::Filter;
using PacingMode = VideoCodecTester::PacingSettings::PacingMode;
struct VideoInfo {
@@ -57,399 +55,35 @@ struct VideoInfo {
Frequency framerate;
};
-struct LayerId {
- int spatial_idx;
- int temporal_idx;
-
- bool operator==(const LayerId& o) const {
- return spatial_idx == o.spatial_idx && temporal_idx == o.temporal_idx;
- }
-
- bool operator<(const LayerId& o) const {
- if (spatial_idx < o.spatial_idx)
- return true;
- if (spatial_idx == o.spatial_idx && temporal_idx < o.temporal_idx)
- return true;
- return false;
- }
-};
-
-struct EncodingSettings {
- ScalabilityMode scalability_mode;
- struct LayerSettings {
- Resolution resolution;
- Frequency framerate;
- DataRate bitrate;
- };
- std::map<LayerId, LayerSettings> layer_settings;
-
- bool IsSameSettings(const EncodingSettings& other) const {
- if (scalability_mode != other.scalability_mode) {
- return false;
- }
-
- for (auto [layer_id, layer] : layer_settings) {
- const auto& other_layer = other.layer_settings.at(layer_id);
- if (layer.resolution != other_layer.resolution) {
- return false;
- }
- }
-
- return true;
- }
-
- bool IsSameRate(const EncodingSettings& other) const {
- for (auto [layer_id, layer] : layer_settings) {
- const auto& other_layer = other.layer_settings.at(layer_id);
- if (layer.bitrate != other_layer.bitrate ||
- layer.framerate != other_layer.framerate) {
- return false;
- }
- }
-
- return true;
- }
-};
-
const VideoInfo kFourPeople_1280x720_30 = {
.name = "FourPeople_1280x720_30",
.resolution = {.width = 1280, .height = 720},
.framerate = Frequency::Hertz(30)};
-class TestRawVideoSource : public VideoCodecTester::RawVideoSource {
- public:
- static constexpr Frequency k90kHz = Frequency::Hertz(90000);
-
- TestRawVideoSource(VideoInfo video_info,
- const std::map<int, EncodingSettings>& frame_settings,
- int num_frames)
- : video_info_(video_info),
- frame_settings_(frame_settings),
- num_frames_(num_frames),
- frame_num_(0),
- // Start with non-zero timestamp to force using frame RTP timestamps in
- // IvfFrameWriter.
- timestamp_rtp_(90000) {
- // Ensure settings for the first frame are provided.
- RTC_CHECK_GT(frame_settings_.size(), 0u);
- RTC_CHECK_EQ(frame_settings_.begin()->first, 0);
-
- frame_reader_ = CreateYuvFrameReader(
- ResourcePath(video_info_.name, "yuv"), video_info_.resolution,
- YuvFrameReaderImpl::RepeatMode::kPingPong);
- RTC_CHECK(frame_reader_);
- }
-
- // Pulls next frame. Frame RTP timestamp is set accordingly to
- // `EncodingSettings::framerate`.
- absl::optional<VideoFrame> PullFrame() override {
- if (frame_num_ >= num_frames_) {
- return absl::nullopt; // End of stream.
- }
-
- const EncodingSettings& encoding_settings =
- std::prev(frame_settings_.upper_bound(frame_num_))->second;
-
- Resolution resolution =
- encoding_settings.layer_settings.begin()->second.resolution;
- Frequency framerate =
- encoding_settings.layer_settings.begin()->second.framerate;
-
- int pulled_frame;
- auto buffer = frame_reader_->PullFrame(
- &pulled_frame, resolution,
- {.num = static_cast<int>(framerate.millihertz()),
- .den = static_cast<int>(video_info_.framerate.millihertz())});
- RTC_CHECK(buffer) << "Cannot pull frame " << frame_num_;
-
- auto frame = VideoFrame::Builder()
- .set_video_frame_buffer(buffer)
- .set_timestamp_rtp(timestamp_rtp_)
- .set_timestamp_us((timestamp_rtp_ / k90kHz).us())
- .build();
-
- pulled_frames_[timestamp_rtp_] = pulled_frame;
- timestamp_rtp_ += k90kHz / framerate;
- ++frame_num_;
-
- return frame;
- }
-
- // Reads frame specified by `timestamp_rtp`, scales it to `resolution` and
- // returns. Frame with the given `timestamp_rtp` is expected to be pulled
- // before.
- VideoFrame GetFrame(uint32_t timestamp_rtp, Resolution resolution) override {
- RTC_CHECK(pulled_frames_.find(timestamp_rtp) != pulled_frames_.end())
- << "Frame with RTP timestamp " << timestamp_rtp
- << " was not pulled before";
- auto buffer =
- frame_reader_->ReadFrame(pulled_frames_[timestamp_rtp], resolution);
- return VideoFrame::Builder()
- .set_video_frame_buffer(buffer)
- .set_timestamp_rtp(timestamp_rtp)
- .build();
- }
-
- protected:
- VideoInfo video_info_;
- std::unique_ptr<FrameReader> frame_reader_;
- const std::map<int, EncodingSettings>& frame_settings_;
- int num_frames_;
- int frame_num_;
- uint32_t timestamp_rtp_;
- std::map<uint32_t, int> pulled_frames_;
-};
-
-class TestEncoder : public VideoCodecTester::Encoder,
- public EncodedImageCallback {
- public:
- TestEncoder(std::unique_ptr<VideoEncoder> encoder,
- const std::string codec_type,
- const std::map<int, EncodingSettings>& frame_settings)
- : encoder_(std::move(encoder)),
- codec_type_(codec_type),
- frame_settings_(frame_settings),
- frame_num_(0) {
- // Ensure settings for the first frame is provided.
- RTC_CHECK_GT(frame_settings_.size(), 0u);
- RTC_CHECK_EQ(frame_settings_.begin()->first, 0);
-
- encoder_->RegisterEncodeCompleteCallback(this);
- }
-
- void Initialize() override {
- const EncodingSettings& first_frame_settings = frame_settings_.at(0);
- Configure(first_frame_settings);
- SetRates(first_frame_settings);
- }
-
- void Encode(const VideoFrame& frame, EncodeCallback callback) override {
- {
- MutexLock lock(&mutex_);
- callbacks_[frame.timestamp()] = std::move(callback);
- }
-
- if (auto fs = frame_settings_.find(frame_num_);
- fs != frame_settings_.begin() && fs != frame_settings_.end()) {
- if (!fs->second.IsSameSettings(std::prev(fs)->second)) {
- Configure(fs->second);
- } else if (!fs->second.IsSameRate(std::prev(fs)->second)) {
- SetRates(fs->second);
- }
- }
-
- encoder_->Encode(frame, nullptr);
- ++frame_num_;
- }
-
- void Flush() override {
- // TODO(webrtc:14852): For codecs which buffer frames we need a to
- // flush them to get last frames. Add such functionality to VideoEncoder
- // API. On Android it will map directly to `MediaCodec.flush()`.
- encoder_->Release();
- }
-
- VideoEncoder* encoder() { return encoder_.get(); }
-
- protected:
- Result OnEncodedImage(const EncodedImage& encoded_image,
- const CodecSpecificInfo* codec_specific_info) override {
- MutexLock lock(&mutex_);
- auto cb = callbacks_.find(encoded_image.RtpTimestamp());
- RTC_CHECK(cb != callbacks_.end());
- cb->second(encoded_image);
-
- callbacks_.erase(callbacks_.begin(), cb);
- return Result(Result::Error::OK);
- }
-
- void Configure(const EncodingSettings& es) {
- VideoCodec vc;
- const EncodingSettings::LayerSettings& layer_settings =
- es.layer_settings.begin()->second;
- vc.width = layer_settings.resolution.width;
- vc.height = layer_settings.resolution.height;
- const DataRate& bitrate = layer_settings.bitrate;
- vc.startBitrate = bitrate.kbps();
- vc.maxBitrate = bitrate.kbps();
- vc.minBitrate = 0;
- vc.maxFramerate = static_cast<uint32_t>(layer_settings.framerate.hertz());
- vc.active = true;
- vc.qpMax = 63;
- vc.numberOfSimulcastStreams = 0;
- vc.mode = webrtc::VideoCodecMode::kRealtimeVideo;
- vc.SetFrameDropEnabled(true);
- vc.SetScalabilityMode(es.scalability_mode);
-
- vc.codecType = PayloadStringToCodecType(codec_type_);
- if (vc.codecType == kVideoCodecVP8) {
- *(vc.VP8()) = VideoEncoder::GetDefaultVp8Settings();
- } else if (vc.codecType == kVideoCodecVP9) {
- *(vc.VP9()) = VideoEncoder::GetDefaultVp9Settings();
- } else if (vc.codecType == kVideoCodecH264) {
- *(vc.H264()) = VideoEncoder::GetDefaultH264Settings();
- }
-
- VideoEncoder::Settings ves(
- VideoEncoder::Capabilities(/*loss_notification=*/false),
- /*number_of_cores=*/1,
- /*max_payload_size=*/1440);
-
- int result = encoder_->InitEncode(&vc, ves);
- ASSERT_EQ(result, WEBRTC_VIDEO_CODEC_OK);
-
- SetRates(es);
- }
-
- void SetRates(const EncodingSettings& es) {
- VideoEncoder::RateControlParameters rc;
- int num_spatial_layers =
- ScalabilityModeToNumSpatialLayers(es.scalability_mode);
- int num_temporal_layers =
- ScalabilityModeToNumSpatialLayers(es.scalability_mode);
- for (int sidx = 0; sidx < num_spatial_layers; ++sidx) {
- for (int tidx = 0; tidx < num_temporal_layers; ++tidx) {
- auto layer_settings =
- es.layer_settings.find({.spatial_idx = sidx, .temporal_idx = tidx});
- RTC_CHECK(layer_settings != es.layer_settings.end())
- << "Bitrate for layer S=" << sidx << " T=" << tidx << " is not set";
- rc.bitrate.SetBitrate(sidx, tidx, layer_settings->second.bitrate.bps());
- }
- }
-
- rc.framerate_fps =
- es.layer_settings.begin()->second.framerate.millihertz() / 1000.0;
- encoder_->SetRates(rc);
- }
-
- std::unique_ptr<VideoEncoder> encoder_;
- const std::string codec_type_;
- const std::map<int, EncodingSettings>& frame_settings_;
- int frame_num_;
- std::map<uint32_t, EncodeCallback> callbacks_ RTC_GUARDED_BY(mutex_);
- Mutex mutex_;
-};
+static constexpr Frequency k90kHz = Frequency::Hertz(90000);
-class TestDecoder : public VideoCodecTester::Decoder,
- public DecodedImageCallback {
- public:
- TestDecoder(std::unique_ptr<VideoDecoder> decoder,
- const std::string codec_type)
- : decoder_(std::move(decoder)), codec_type_(codec_type) {
- decoder_->RegisterDecodeCompleteCallback(this);
- }
-
- void Initialize() override {
- VideoDecoder::Settings ds;
- ds.set_codec_type(PayloadStringToCodecType(codec_type_));
- ds.set_number_of_cores(1);
- ds.set_max_render_resolution({1280, 720});
-
- bool result = decoder_->Configure(ds);
- ASSERT_TRUE(result);
- }
-
- void Decode(const EncodedImage& frame, DecodeCallback callback) override {
- {
- MutexLock lock(&mutex_);
- callbacks_[frame.RtpTimestamp()] = std::move(callback);
- }
-
- decoder_->Decode(frame, /*render_time_ms=*/0);
- }
-
- void Flush() override {
- // TODO(webrtc:14852): For codecs which buffer frames we need a to
- // flush them to get last frames. Add such functionality to VideoDecoder
- // API. On Android it will map directly to `MediaCodec.flush()`.
- decoder_->Release();
- }
-
- VideoDecoder* decoder() { return decoder_.get(); }
-
- protected:
- int Decoded(VideoFrame& decoded_frame) override {
- MutexLock lock(&mutex_);
- auto cb = callbacks_.find(decoded_frame.timestamp());
- RTC_CHECK(cb != callbacks_.end());
- cb->second(decoded_frame);
-
- callbacks_.erase(callbacks_.begin(), cb);
- return WEBRTC_VIDEO_CODEC_OK;
- }
-
- std::unique_ptr<VideoDecoder> decoder_;
- const std::string codec_type_;
- std::map<uint32_t, DecodeCallback> callbacks_ RTC_GUARDED_BY(mutex_);
- Mutex mutex_;
-};
-
-std::unique_ptr<TestRawVideoSource> CreateVideoSource(
- const VideoInfo& video,
- const std::map<int, EncodingSettings>& frame_settings,
- int num_frames) {
- return std::make_unique<TestRawVideoSource>(video, frame_settings,
- num_frames);
-}
-
-std::unique_ptr<TestEncoder> CreateEncoder(
- std::string type,
- std::string impl,
- const std::map<int, EncodingSettings>& frame_settings) {
- std::unique_ptr<VideoEncoderFactory> factory;
+std::unique_ptr<VideoEncoderFactory> CreateEncoderFactory(std::string impl) {
if (impl == "builtin") {
- factory = std::make_unique<InternalEncoderFactory>();
- } else if (impl == "mediacodec") {
+ return CreateBuiltinVideoEncoderFactory();
+ }
#if defined(WEBRTC_ANDROID)
- InitializeAndroidObjects();
- factory = CreateAndroidEncoderFactory();
+ InitializeAndroidObjects();
+ return CreateAndroidEncoderFactory();
+#else
+ return nullptr;
#endif
- }
- std::unique_ptr<VideoEncoder> encoder =
- factory->CreateVideoEncoder(SdpVideoFormat(type));
- if (encoder == nullptr) {
- return nullptr;
- }
- return std::make_unique<TestEncoder>(std::move(encoder), type,
- frame_settings);
}
-std::unique_ptr<TestDecoder> CreateDecoder(std::string type, std::string impl) {
- std::unique_ptr<VideoDecoderFactory> factory;
+std::unique_ptr<VideoDecoderFactory> CreateDecoderFactory(std::string impl) {
if (impl == "builtin") {
- factory = std::make_unique<InternalDecoderFactory>();
- } else if (impl == "mediacodec") {
+ return CreateBuiltinVideoDecoderFactory();
+ }
#if defined(WEBRTC_ANDROID)
- InitializeAndroidObjects();
- factory = CreateAndroidDecoderFactory();
+ InitializeAndroidObjects();
+ return CreateAndroidDecoderFactory();
+#else
+ return nullptr;
#endif
- }
- std::unique_ptr<VideoDecoder> decoder =
- factory->CreateVideoDecoder(SdpVideoFormat(type));
- if (decoder == nullptr) {
- return nullptr;
- }
- return std::make_unique<TestDecoder>(std::move(decoder), type);
-}
-
-void SetTargetRates(const std::map<int, EncodingSettings>& frame_settings,
- std::vector<VideoCodecStats::Frame>& frames) {
- for (VideoCodecStats::Frame& f : frames) {
- const EncodingSettings& encoding_settings =
- std::prev(frame_settings.upper_bound(f.frame_num))->second;
- LayerId layer_id = {.spatial_idx = f.spatial_idx,
- .temporal_idx = f.temporal_idx};
- RTC_CHECK(encoding_settings.layer_settings.find(layer_id) !=
- encoding_settings.layer_settings.end())
- << "Frame frame_num=" << f.frame_num
- << " belongs to spatial_idx=" << f.spatial_idx
- << " temporal_idx=" << f.temporal_idx
- << " but settings for this layer are not provided.";
- const EncodingSettings::LayerSettings& layer_settings =
- encoding_settings.layer_settings.at(layer_id);
- f.target_bitrate = layer_settings.bitrate;
- f.target_framerate = layer_settings.framerate;
- }
}
std::string TestOutputPath() {
@@ -467,113 +101,118 @@ std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest(
std::string codec_type,
std::string codec_impl,
const VideoInfo& video_info,
- const std::map<int, EncodingSettings>& frame_settings,
- int num_frames,
- bool save_codec_input,
- bool save_codec_output) {
- std::unique_ptr<TestRawVideoSource> video_source =
- CreateVideoSource(video_info, frame_settings, num_frames);
-
- std::unique_ptr<TestEncoder> encoder =
- CreateEncoder(codec_type, codec_impl, frame_settings);
- if (encoder == nullptr) {
+ const std::map<uint32_t, EncodingSettings>& encoding_settings) {
+ VideoSourceSettings source_settings{
+ .file_path = ResourcePath(video_info.name, "yuv"),
+ .resolution = video_info.resolution,
+ .framerate = video_info.framerate};
+
+ const SdpVideoFormat& sdp_video_format =
+ encoding_settings.begin()->second.sdp_video_format;
+
+ std::unique_ptr<VideoEncoderFactory> encoder_factory =
+ CreateEncoderFactory(codec_impl);
+ if (!encoder_factory
+ ->QueryCodecSupport(sdp_video_format,
+ /*scalability_mode=*/absl::nullopt)
+ .is_supported) {
+ RTC_LOG(LS_WARNING) << "No encoder for video format "
+ << sdp_video_format.ToString();
return nullptr;
}
- std::unique_ptr<TestDecoder> decoder = CreateDecoder(codec_type, codec_impl);
- if (decoder == nullptr) {
- // If platform decoder is not available try built-in one.
- if (codec_impl == "builtin") {
- return nullptr;
- }
-
- decoder = CreateDecoder(codec_type, "builtin");
- if (decoder == nullptr) {
+ std::unique_ptr<VideoDecoderFactory> decoder_factory =
+ CreateDecoderFactory(codec_impl);
+ if (!decoder_factory
+ ->QueryCodecSupport(sdp_video_format,
+ /*reference_scaling=*/false)
+ .is_supported) {
+ decoder_factory = CreateDecoderFactory("builtin");
+ if (!decoder_factory
+ ->QueryCodecSupport(sdp_video_format,
+ /*reference_scaling=*/false)
+ .is_supported) {
+ RTC_LOG(LS_WARNING) << "No decoder for video format "
+ << sdp_video_format.ToString();
return nullptr;
}
}
- RTC_LOG(LS_INFO) << "Encoder implementation: "
- << encoder->encoder()->GetEncoderInfo().implementation_name;
- RTC_LOG(LS_INFO) << "Decoder implementation: "
- << decoder->decoder()->GetDecoderInfo().implementation_name;
+ std::string output_path = TestOutputPath();
VideoCodecTester::EncoderSettings encoder_settings;
- encoder_settings.pacing.mode =
- encoder->encoder()->GetEncoderInfo().is_hardware_accelerated
- ? PacingMode::kRealTime
- : PacingMode::kNoPacing;
+ encoder_settings.pacing_settings.mode =
+ codec_impl == "builtin" ? PacingMode::kNoPacing : PacingMode::kRealTime;
+ if (absl::GetFlag(FLAGS_dump_encoder_input)) {
+ encoder_settings.encoder_input_base_path = output_path + "_enc_input";
+ }
+ if (absl::GetFlag(FLAGS_dump_encoder_output)) {
+ encoder_settings.encoder_output_base_path = output_path + "_enc_output";
+ }
VideoCodecTester::DecoderSettings decoder_settings;
- decoder_settings.pacing.mode =
- decoder->decoder()->GetDecoderInfo().is_hardware_accelerated
- ? PacingMode::kRealTime
- : PacingMode::kNoPacing;
-
- std::string output_path = TestOutputPath();
- if (save_codec_input) {
- encoder_settings.encoder_input_base_path = output_path + "_enc_input";
+ decoder_settings.pacing_settings.mode =
+ codec_impl == "builtin" ? PacingMode::kNoPacing : PacingMode::kRealTime;
+ if (absl::GetFlag(FLAGS_dump_decoder_input)) {
decoder_settings.decoder_input_base_path = output_path + "_dec_input";
}
- if (save_codec_output) {
- encoder_settings.encoder_output_base_path = output_path + "_enc_output";
+ if (absl::GetFlag(FLAGS_dump_decoder_output)) {
decoder_settings.decoder_output_base_path = output_path + "_dec_output";
}
- std::unique_ptr<VideoCodecTester> tester = CreateVideoCodecTester();
- return tester->RunEncodeDecodeTest(video_source.get(), encoder.get(),
- decoder.get(), encoder_settings,
- decoder_settings);
+ return VideoCodecTester::RunEncodeDecodeTest(
+ source_settings, encoder_factory.get(), decoder_factory.get(),
+ encoder_settings, decoder_settings, encoding_settings);
}
std::unique_ptr<VideoCodecStats> RunEncodeTest(
std::string codec_type,
std::string codec_impl,
const VideoInfo& video_info,
- const std::map<int, EncodingSettings>& frame_settings,
- int num_frames,
- bool save_codec_input,
- bool save_codec_output) {
- std::unique_ptr<TestRawVideoSource> video_source =
- CreateVideoSource(video_info, frame_settings, num_frames);
-
- std::unique_ptr<TestEncoder> encoder =
- CreateEncoder(codec_type, codec_impl, frame_settings);
- if (encoder == nullptr) {
+ const std::map<uint32_t, EncodingSettings>& encoding_settings) {
+ VideoSourceSettings source_settings{
+ .file_path = ResourcePath(video_info.name, "yuv"),
+ .resolution = video_info.resolution,
+ .framerate = video_info.framerate};
+
+ const SdpVideoFormat& sdp_video_format =
+ encoding_settings.begin()->second.sdp_video_format;
+
+ std::unique_ptr<VideoEncoderFactory> encoder_factory =
+ CreateEncoderFactory(codec_impl);
+ if (!encoder_factory
+ ->QueryCodecSupport(sdp_video_format,
+ /*scalability_mode=*/absl::nullopt)
+ .is_supported) {
+ RTC_LOG(LS_WARNING) << "No encoder for video format "
+ << sdp_video_format.ToString();
return nullptr;
}
- RTC_LOG(LS_INFO) << "Encoder implementation: "
- << encoder->encoder()->GetEncoderInfo().implementation_name;
-
- VideoCodecTester::EncoderSettings encoder_settings;
- encoder_settings.pacing.mode =
- encoder->encoder()->GetEncoderInfo().is_hardware_accelerated
- ? PacingMode::kRealTime
- : PacingMode::kNoPacing;
-
std::string output_path = TestOutputPath();
- if (save_codec_input) {
+ VideoCodecTester::EncoderSettings encoder_settings;
+ encoder_settings.pacing_settings.mode =
+ codec_impl == "builtin" ? PacingMode::kNoPacing : PacingMode::kRealTime;
+ if (absl::GetFlag(FLAGS_dump_encoder_input)) {
encoder_settings.encoder_input_base_path = output_path + "_enc_input";
}
- if (save_codec_output) {
+ if (absl::GetFlag(FLAGS_dump_encoder_output)) {
encoder_settings.encoder_output_base_path = output_path + "_enc_output";
}
- std::unique_ptr<VideoCodecTester> tester = CreateVideoCodecTester();
- return tester->RunEncodeTest(video_source.get(), encoder.get(),
- encoder_settings);
+ return VideoCodecTester::RunEncodeTest(source_settings, encoder_factory.get(),
+ encoder_settings, encoding_settings);
}
-class SpatialQualityTest : public ::testing::TestWithParam<
- std::tuple</*codec_type=*/std::string,
- /*codec_impl=*/std::string,
- VideoInfo,
- std::tuple</*width=*/int,
- /*height=*/int,
- /*framerate_fps=*/double,
- /*bitrate_kbps=*/int,
- /*min_psnr=*/double>>> {
+class SpatialQualityTest : public ::testing::TestWithParam<std::tuple<
+ /*codec_type=*/std::string,
+ /*codec_impl=*/std::string,
+ VideoInfo,
+ std::tuple</*width=*/int,
+ /*height=*/int,
+ /*framerate_fps=*/double,
+ /*bitrate_kbps=*/int,
+ /*expected_min_psnr=*/double>>> {
public:
static std::string TestParamsToString(
const ::testing::TestParamInfo<SpatialQualityTest::ParamType>& info) {
@@ -589,31 +228,24 @@ class SpatialQualityTest : public ::testing::TestWithParam<
TEST_P(SpatialQualityTest, SpatialQuality) {
auto [codec_type, codec_impl, video_info, coding_settings] = GetParam();
- auto [width, height, framerate_fps, bitrate_kbps, psnr] = coding_settings;
-
- std::map<int, EncodingSettings> frame_settings = {
- {0,
- {.scalability_mode = ScalabilityMode::kL1T1,
- .layer_settings = {
- {LayerId{.spatial_idx = 0, .temporal_idx = 0},
- {.resolution = {.width = width, .height = height},
- .framerate = Frequency::MilliHertz(1000 * framerate_fps),
- .bitrate = DataRate::KilobitsPerSec(bitrate_kbps)}}}}}};
-
+ auto [width, height, framerate_fps, bitrate_kbps, expected_min_psnr] =
+ coding_settings;
int duration_s = 10;
int num_frames = duration_s * framerate_fps;
- std::unique_ptr<VideoCodecStats> stats = RunEncodeDecodeTest(
- codec_type, codec_impl, video_info, frame_settings, num_frames,
- /*save_codec_input=*/false, /*save_codec_output=*/false);
+ std::map<uint32_t, EncodingSettings> frames_settings =
+ VideoCodecTester::CreateEncodingSettings(
+ codec_type, /*scalability_mode=*/"L1T1", width, height,
+ {bitrate_kbps}, framerate_fps, num_frames);
+
+ std::unique_ptr<VideoCodecStats> stats =
+ RunEncodeDecodeTest(codec_type, codec_impl, video_info, frames_settings);
VideoCodecStats::Stream stream;
if (stats != nullptr) {
- std::vector<VideoCodecStats::Frame> frames = stats->Slice();
- SetTargetRates(frame_settings, frames);
- stream = stats->Aggregate(frames);
- if (field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
- EXPECT_GE(stream.psnr.y.GetAverage(), psnr);
+ stream = stats->Aggregate(Filter{});
+ if (absl::GetFlag(FLAGS_webrtc_quick_perf_test)) {
+ EXPECT_GE(stream.psnr.y.GetAverage(), expected_min_psnr);
}
}
@@ -621,9 +253,9 @@ TEST_P(SpatialQualityTest, SpatialQuality) {
GetGlobalMetricsLogger(),
::testing::UnitTest::GetInstance()->current_test_info()->name(),
/*metadata=*/
- {{"codec_type", codec_type},
- {"codec_impl", codec_impl},
- {"video_name", video_info.name}});
+ {{"video_name", video_info.name},
+ {"codec_type", codec_type},
+ {"codec_impl", codec_impl}});
}
INSTANTIATE_TEST_SUITE_P(
@@ -670,34 +302,33 @@ TEST_P(BitrateAdaptationTest, BitrateAdaptation) {
auto [codec_type, codec_impl, video_info, bitrate_kbps] = GetParam();
int duration_s = 10; // Duration of fixed rate interval.
- int first_frame = duration_s * video_info.framerate.millihertz() / 1000;
- int num_frames = 2 * duration_s * video_info.framerate.millihertz() / 1000;
-
- std::map<int, EncodingSettings> frame_settings = {
- {0,
- {.layer_settings = {{LayerId{.spatial_idx = 0, .temporal_idx = 0},
- {.resolution = {.width = 640, .height = 360},
- .framerate = video_info.framerate,
- .bitrate = DataRate::KilobitsPerSec(
- bitrate_kbps.first)}}}}},
- {first_frame,
- {.layer_settings = {
- {LayerId{.spatial_idx = 0, .temporal_idx = 0},
- {.resolution = {.width = 640, .height = 360},
- .framerate = video_info.framerate,
- .bitrate = DataRate::KilobitsPerSec(bitrate_kbps.second)}}}}}};
-
- std::unique_ptr<VideoCodecStats> stats = RunEncodeTest(
- codec_type, codec_impl, video_info, frame_settings, num_frames,
- /*save_codec_input=*/false, /*save_codec_output=*/false);
+ int num_frames =
+ static_cast<int>(duration_s * video_info.framerate.hertz<double>());
+
+ std::map<uint32_t, EncodingSettings> encoding_settings =
+ VideoCodecTester::CreateEncodingSettings(
+ codec_type, /*scalability_mode=*/"L1T1",
+ /*width=*/640, /*height=*/360, {bitrate_kbps.first},
+ /*framerate_fps=*/30, num_frames);
+
+ uint32_t initial_timestamp_rtp =
+ encoding_settings.rbegin()->first + k90kHz / Frequency::Hertz(30);
+
+ std::map<uint32_t, EncodingSettings> encoding_settings2 =
+ VideoCodecTester::CreateEncodingSettings(
+ codec_type, /*scalability_mode=*/"L1T1",
+ /*width=*/640, /*height=*/360, {bitrate_kbps.second},
+ /*framerate_fps=*/30, num_frames, initial_timestamp_rtp);
+
+ encoding_settings.merge(encoding_settings2);
+
+ std::unique_ptr<VideoCodecStats> stats =
+ RunEncodeTest(codec_type, codec_impl, video_info, encoding_settings);
VideoCodecStats::Stream stream;
if (stats != nullptr) {
- std::vector<VideoCodecStats::Frame> frames =
- stats->Slice(VideoCodecStats::Filter{.first_frame = first_frame});
- SetTargetRates(frame_settings, frames);
- stream = stats->Aggregate(frames);
- if (field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
+ stream = stats->Aggregate({.min_timestamp_rtp = initial_timestamp_rtp});
+ if (absl::GetFlag(FLAGS_webrtc_quick_perf_test)) {
EXPECT_NEAR(stream.bitrate_mismatch_pct.GetAverage(), 0, 10);
EXPECT_NEAR(stream.framerate_mismatch_pct.GetAverage(), 0, 10);
}
@@ -748,35 +379,35 @@ TEST_P(FramerateAdaptationTest, FramerateAdaptation) {
auto [codec_type, codec_impl, video_info, framerate_fps] = GetParam();
int duration_s = 10; // Duration of fixed rate interval.
- int first_frame = static_cast<int>(duration_s * framerate_fps.first);
- int num_frames = static_cast<int>(
- duration_s * (framerate_fps.first + framerate_fps.second));
-
- std::map<int, EncodingSettings> frame_settings = {
- {0,
- {.layer_settings = {{LayerId{.spatial_idx = 0, .temporal_idx = 0},
- {.resolution = {.width = 640, .height = 360},
- .framerate = Frequency::MilliHertz(
- 1000 * framerate_fps.first),
- .bitrate = DataRate::KilobitsPerSec(512)}}}}},
- {first_frame,
- {.layer_settings = {
- {LayerId{.spatial_idx = 0, .temporal_idx = 0},
- {.resolution = {.width = 640, .height = 360},
- .framerate = Frequency::MilliHertz(1000 * framerate_fps.second),
- .bitrate = DataRate::KilobitsPerSec(512)}}}}}};
-
- std::unique_ptr<VideoCodecStats> stats = RunEncodeTest(
- codec_type, codec_impl, video_info, frame_settings, num_frames,
- /*save_codec_input=*/false, /*save_codec_output=*/false);
+
+ std::map<uint32_t, EncodingSettings> encoding_settings =
+ VideoCodecTester::CreateEncodingSettings(
+ codec_type, /*scalability_mode=*/"L1T1",
+ /*width=*/640, /*height=*/360,
+ /*layer_bitrates_kbps=*/{512}, framerate_fps.first,
+ static_cast<int>(duration_s * framerate_fps.first));
+
+ uint32_t initial_timestamp_rtp =
+ encoding_settings.rbegin()->first +
+ k90kHz / Frequency::Hertz(framerate_fps.first);
+
+ std::map<uint32_t, EncodingSettings> encoding_settings2 =
+ VideoCodecTester::CreateEncodingSettings(
+ codec_type, /*scalability_mode=*/"L1T1", /*width=*/640,
+ /*height=*/360,
+ /*layer_bitrates_kbps=*/{512}, framerate_fps.second,
+ static_cast<int>(duration_s * framerate_fps.second),
+ initial_timestamp_rtp);
+
+ encoding_settings.merge(encoding_settings2);
+
+ std::unique_ptr<VideoCodecStats> stats =
+ RunEncodeTest(codec_type, codec_impl, video_info, encoding_settings);
VideoCodecStats::Stream stream;
if (stats != nullptr) {
- std::vector<VideoCodecStats::Frame> frames =
- stats->Slice(VideoCodecStats::Filter{.first_frame = first_frame});
- SetTargetRates(frame_settings, frames);
- stream = stats->Aggregate(frames);
- if (field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
+ stream = stats->Aggregate({.min_timestamp_rtp = initial_timestamp_rtp});
+ if (absl::GetFlag(FLAGS_webrtc_quick_perf_test)) {
EXPECT_NEAR(stream.bitrate_mismatch_pct.GetAverage(), 0, 10);
EXPECT_NEAR(stream.framerate_mismatch_pct.GetAverage(), 0, 10);
}
@@ -804,7 +435,6 @@ INSTANTIATE_TEST_SUITE_P(All,
Values(kFourPeople_1280x720_30),
Values(std::pair(30, 15), std::pair(15, 30))),
FramerateAdaptationTest::TestParamsToString);
-
} // namespace test
} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_tester_impl.cc b/modules/video_coding/codecs/test/video_codec_tester_impl.cc
deleted file mode 100644
index f15b1b35f3..0000000000
--- a/modules/video_coding/codecs/test/video_codec_tester_impl.cc
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_tester_impl.h"
-
-#include <map>
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "api/task_queue/default_task_queue_factory.h"
-#include "api/units/frequency.h"
-#include "api/units/time_delta.h"
-#include "api/units/timestamp.h"
-#include "api/video/encoded_image.h"
-#include "api/video/i420_buffer.h"
-#include "api/video/video_codec_type.h"
-#include "api/video/video_frame.h"
-#include "modules/video_coding/codecs/test/video_codec_analyzer.h"
-#include "modules/video_coding/utility/ivf_file_writer.h"
-#include "rtc_base/event.h"
-#include "rtc_base/time_utils.h"
-#include "system_wrappers/include/sleep.h"
-#include "test/testsupport/video_frame_writer.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using RawVideoSource = VideoCodecTester::RawVideoSource;
-using CodedVideoSource = VideoCodecTester::CodedVideoSource;
-using Decoder = VideoCodecTester::Decoder;
-using Encoder = VideoCodecTester::Encoder;
-using EncoderSettings = VideoCodecTester::EncoderSettings;
-using DecoderSettings = VideoCodecTester::DecoderSettings;
-using PacingSettings = VideoCodecTester::PacingSettings;
-using PacingMode = PacingSettings::PacingMode;
-
-constexpr Frequency k90kHz = Frequency::Hertz(90000);
-
-// A thread-safe wrapper for video source to be shared with the quality analyzer
-// that reads reference frames from a separate thread.
-class SyncRawVideoSource : public VideoCodecAnalyzer::ReferenceVideoSource {
- public:
- explicit SyncRawVideoSource(RawVideoSource* video_source)
- : video_source_(video_source) {}
-
- absl::optional<VideoFrame> PullFrame() {
- MutexLock lock(&mutex_);
- return video_source_->PullFrame();
- }
-
- VideoFrame GetFrame(uint32_t timestamp_rtp, Resolution resolution) override {
- MutexLock lock(&mutex_);
- return video_source_->GetFrame(timestamp_rtp, resolution);
- }
-
- protected:
- RawVideoSource* const video_source_ RTC_GUARDED_BY(mutex_);
- Mutex mutex_;
-};
-
-// Pacer calculates delay necessary to keep frame encode or decode call spaced
-// from the previous calls by the pacing time. `Delay` is expected to be called
-// as close as possible to posting frame encode or decode task. This class is
-// not thread safe.
-class Pacer {
- public:
- explicit Pacer(PacingSettings settings)
- : settings_(settings), delay_(TimeDelta::Zero()) {}
- Timestamp Schedule(Timestamp timestamp) {
- Timestamp now = Timestamp::Micros(rtc::TimeMicros());
- if (settings_.mode == PacingMode::kNoPacing) {
- return now;
- }
-
- Timestamp scheduled = now;
- if (prev_scheduled_) {
- scheduled = *prev_scheduled_ + PacingTime(timestamp);
- if (scheduled < now) {
- scheduled = now;
- }
- }
-
- prev_timestamp_ = timestamp;
- prev_scheduled_ = scheduled;
- return scheduled;
- }
-
- private:
- TimeDelta PacingTime(Timestamp timestamp) {
- if (settings_.mode == PacingMode::kRealTime) {
- return timestamp - *prev_timestamp_;
- }
- RTC_CHECK_EQ(PacingMode::kConstantRate, settings_.mode);
- return 1 / settings_.constant_rate;
- }
-
- PacingSettings settings_;
- absl::optional<Timestamp> prev_timestamp_;
- absl::optional<Timestamp> prev_scheduled_;
- TimeDelta delay_;
-};
-
-// Task queue that keeps the number of queued tasks below a certain limit. If
-// the limit is reached, posting of a next task is blocked until execution of a
-// previously posted task starts. This class is not thread-safe.
-class LimitedTaskQueue {
- public:
- // The codec tester reads frames from video source in the main thread.
- // Encoding and decoding are done in separate threads. If encoding or
- // decoding is slow, the reading may go far ahead and may buffer too many
- // frames in memory. To prevent this we limit the encoding/decoding queue
- // size. When the queue is full, the main thread and, hence, reading frames
- // from video source is blocked until a previously posted encoding/decoding
- // task starts.
- static constexpr int kMaxTaskQueueSize = 3;
-
- LimitedTaskQueue() : queue_size_(0) {}
-
- void PostScheduledTask(absl::AnyInvocable<void() &&> task, Timestamp start) {
- ++queue_size_;
- task_queue_.PostTask([this, task = std::move(task), start]() mutable {
- int wait_ms = static_cast<int>(start.ms() - rtc::TimeMillis());
- if (wait_ms > 0) {
- SleepMs(wait_ms);
- }
-
- std::move(task)();
- --queue_size_;
- task_executed_.Set();
- });
-
- task_executed_.Reset();
- if (queue_size_ > kMaxTaskQueueSize) {
- task_executed_.Wait(rtc::Event::kForever);
- }
- RTC_CHECK(queue_size_ <= kMaxTaskQueueSize);
- }
-
- void WaitForPreviouslyPostedTasks() {
- task_queue_.SendTask([] {});
- }
-
- TaskQueueForTest task_queue_;
- std::atomic_int queue_size_;
- rtc::Event task_executed_;
-};
-
-class TesterY4mWriter {
- public:
- explicit TesterY4mWriter(absl::string_view base_path)
- : base_path_(base_path) {}
-
- ~TesterY4mWriter() {
- task_queue_.SendTask([] {});
- }
-
- void Write(const VideoFrame& frame, int spatial_idx) {
- task_queue_.PostTask([this, frame, spatial_idx] {
- if (y4m_writers_.find(spatial_idx) == y4m_writers_.end()) {
- std::string file_path =
- base_path_ + "_s" + std::to_string(spatial_idx) + ".y4m";
-
- Y4mVideoFrameWriterImpl* y4m_writer = new Y4mVideoFrameWriterImpl(
- file_path, frame.width(), frame.height(), /*fps=*/30);
- RTC_CHECK(y4m_writer);
-
- y4m_writers_[spatial_idx] =
- std::unique_ptr<VideoFrameWriter>(y4m_writer);
- }
-
- y4m_writers_.at(spatial_idx)->WriteFrame(frame);
- });
- }
-
- protected:
- std::string base_path_;
- std::map<int, std::unique_ptr<VideoFrameWriter>> y4m_writers_;
- TaskQueueForTest task_queue_;
-};
-
-class TesterIvfWriter {
- public:
- explicit TesterIvfWriter(absl::string_view base_path)
- : base_path_(base_path) {}
-
- ~TesterIvfWriter() {
- task_queue_.SendTask([] {});
- }
-
- void Write(const EncodedImage& encoded_frame) {
- task_queue_.PostTask([this, encoded_frame] {
- int spatial_idx = encoded_frame.SpatialIndex().value_or(0);
- if (ivf_file_writers_.find(spatial_idx) == ivf_file_writers_.end()) {
- std::string ivf_path =
- base_path_ + "_s" + std::to_string(spatial_idx) + ".ivf";
-
- FileWrapper ivf_file = FileWrapper::OpenWriteOnly(ivf_path);
- RTC_CHECK(ivf_file.is_open());
-
- std::unique_ptr<IvfFileWriter> ivf_writer =
- IvfFileWriter::Wrap(std::move(ivf_file), /*byte_limit=*/0);
- RTC_CHECK(ivf_writer);
-
- ivf_file_writers_[spatial_idx] = std::move(ivf_writer);
- }
-
- // To play: ffplay -vcodec vp8|vp9|av1|hevc|h264 filename
- ivf_file_writers_.at(spatial_idx)
- ->WriteFrame(encoded_frame, VideoCodecType::kVideoCodecGeneric);
- });
- }
-
- protected:
- std::string base_path_;
- std::map<int, std::unique_ptr<IvfFileWriter>> ivf_file_writers_;
- TaskQueueForTest task_queue_;
-};
-
-class TesterDecoder {
- public:
- TesterDecoder(Decoder* decoder,
- VideoCodecAnalyzer* analyzer,
- const DecoderSettings& settings)
- : decoder_(decoder),
- analyzer_(analyzer),
- settings_(settings),
- pacer_(settings.pacing) {
- RTC_CHECK(analyzer_) << "Analyzer must be provided";
-
- if (settings.decoder_input_base_path) {
- input_writer_ =
- std::make_unique<TesterIvfWriter>(*settings.decoder_input_base_path);
- }
-
- if (settings.decoder_output_base_path) {
- output_writer_ =
- std::make_unique<TesterY4mWriter>(*settings.decoder_output_base_path);
- }
- }
-
- void Initialize() {
- task_queue_.PostScheduledTask([this] { decoder_->Initialize(); },
- Timestamp::Zero());
- task_queue_.WaitForPreviouslyPostedTasks();
- }
-
- void Decode(const EncodedImage& input_frame) {
- Timestamp timestamp =
- Timestamp::Micros((input_frame.RtpTimestamp() / k90kHz).us());
-
- task_queue_.PostScheduledTask(
- [this, input_frame] {
- analyzer_->StartDecode(input_frame);
-
- decoder_->Decode(
- input_frame,
- [this, spatial_idx = input_frame.SpatialIndex().value_or(0)](
- const VideoFrame& output_frame) {
- analyzer_->FinishDecode(output_frame, spatial_idx);
-
- if (output_writer_) {
- output_writer_->Write(output_frame, spatial_idx);
- }
- });
-
- if (input_writer_) {
- input_writer_->Write(input_frame);
- }
- },
- pacer_.Schedule(timestamp));
- }
-
- void Flush() {
- task_queue_.PostScheduledTask([this] { decoder_->Flush(); },
- Timestamp::Zero());
- task_queue_.WaitForPreviouslyPostedTasks();
- }
-
- protected:
- Decoder* const decoder_;
- VideoCodecAnalyzer* const analyzer_;
- const DecoderSettings& settings_;
- Pacer pacer_;
- LimitedTaskQueue task_queue_;
- std::unique_ptr<TesterIvfWriter> input_writer_;
- std::unique_ptr<TesterY4mWriter> output_writer_;
-};
-
-class TesterEncoder {
- public:
- TesterEncoder(Encoder* encoder,
- TesterDecoder* decoder,
- VideoCodecAnalyzer* analyzer,
- const EncoderSettings& settings)
- : encoder_(encoder),
- decoder_(decoder),
- analyzer_(analyzer),
- settings_(settings),
- pacer_(settings.pacing) {
- RTC_CHECK(analyzer_) << "Analyzer must be provided";
- if (settings.encoder_input_base_path) {
- input_writer_ =
- std::make_unique<TesterY4mWriter>(*settings.encoder_input_base_path);
- }
-
- if (settings.encoder_output_base_path) {
- output_writer_ =
- std::make_unique<TesterIvfWriter>(*settings.encoder_output_base_path);
- }
- }
-
- void Initialize() {
- task_queue_.PostScheduledTask([this] { encoder_->Initialize(); },
- Timestamp::Zero());
- task_queue_.WaitForPreviouslyPostedTasks();
- }
-
- void Encode(const VideoFrame& input_frame) {
- Timestamp timestamp =
- Timestamp::Micros((input_frame.timestamp() / k90kHz).us());
-
- task_queue_.PostScheduledTask(
- [this, input_frame] {
- analyzer_->StartEncode(input_frame);
- encoder_->Encode(input_frame,
- [this](const EncodedImage& encoded_frame) {
- analyzer_->FinishEncode(encoded_frame);
-
- if (decoder_ != nullptr) {
- decoder_->Decode(encoded_frame);
- }
-
- if (output_writer_ != nullptr) {
- output_writer_->Write(encoded_frame);
- }
- });
-
- if (input_writer_) {
- input_writer_->Write(input_frame, /*spatial_idx=*/0);
- }
- },
- pacer_.Schedule(timestamp));
- }
-
- void Flush() {
- task_queue_.PostScheduledTask([this] { encoder_->Flush(); },
- Timestamp::Zero());
- task_queue_.WaitForPreviouslyPostedTasks();
- }
-
- protected:
- Encoder* const encoder_;
- TesterDecoder* const decoder_;
- VideoCodecAnalyzer* const analyzer_;
- const EncoderSettings& settings_;
- std::unique_ptr<TesterY4mWriter> input_writer_;
- std::unique_ptr<TesterIvfWriter> output_writer_;
- Pacer pacer_;
- LimitedTaskQueue task_queue_;
-};
-
-} // namespace
-
-std::unique_ptr<VideoCodecStats> VideoCodecTesterImpl::RunDecodeTest(
- CodedVideoSource* video_source,
- Decoder* decoder,
- const DecoderSettings& decoder_settings) {
- VideoCodecAnalyzer perf_analyzer;
- TesterDecoder tester_decoder(decoder, &perf_analyzer, decoder_settings);
-
- tester_decoder.Initialize();
-
- while (auto frame = video_source->PullFrame()) {
- tester_decoder.Decode(*frame);
- }
-
- tester_decoder.Flush();
-
- return perf_analyzer.GetStats();
-}
-
-std::unique_ptr<VideoCodecStats> VideoCodecTesterImpl::RunEncodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- const EncoderSettings& encoder_settings) {
- SyncRawVideoSource sync_source(video_source);
- VideoCodecAnalyzer perf_analyzer;
- TesterEncoder tester_encoder(encoder, /*decoder=*/nullptr, &perf_analyzer,
- encoder_settings);
-
- tester_encoder.Initialize();
-
- while (auto frame = sync_source.PullFrame()) {
- tester_encoder.Encode(*frame);
- }
-
- tester_encoder.Flush();
-
- return perf_analyzer.GetStats();
-}
-
-std::unique_ptr<VideoCodecStats> VideoCodecTesterImpl::RunEncodeDecodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- Decoder* decoder,
- const EncoderSettings& encoder_settings,
- const DecoderSettings& decoder_settings) {
- SyncRawVideoSource sync_source(video_source);
- VideoCodecAnalyzer perf_analyzer(&sync_source);
- TesterDecoder tester_decoder(decoder, &perf_analyzer, decoder_settings);
- TesterEncoder tester_encoder(encoder, &tester_decoder, &perf_analyzer,
- encoder_settings);
-
- tester_encoder.Initialize();
- tester_decoder.Initialize();
-
- while (auto frame = sync_source.PullFrame()) {
- tester_encoder.Encode(*frame);
- }
-
- tester_encoder.Flush();
- tester_decoder.Flush();
-
- return perf_analyzer.GetStats();
-}
-
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/test/video_codec_tester_impl.h b/modules/video_coding/codecs/test/video_codec_tester_impl.h
deleted file mode 100644
index 32191b5a98..0000000000
--- a/modules/video_coding/codecs/test/video_codec_tester_impl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TESTER_IMPL_H_
-#define MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TESTER_IMPL_H_
-
-#include <memory>
-
-#include "api/test/video_codec_tester.h"
-
-namespace webrtc {
-namespace test {
-
-// A stateless implementation of `VideoCodecTester`. This class is thread safe.
-class VideoCodecTesterImpl : public VideoCodecTester {
- public:
- std::unique_ptr<VideoCodecStats> RunDecodeTest(
- CodedVideoSource* video_source,
- Decoder* decoder,
- const DecoderSettings& decoder_settings) override;
-
- std::unique_ptr<VideoCodecStats> RunEncodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- const EncoderSettings& encoder_settings) override;
-
- std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest(
- RawVideoSource* video_source,
- Encoder* encoder,
- Decoder* decoder,
- const EncoderSettings& encoder_settings,
- const DecoderSettings& decoder_settings) override;
-};
-
-} // namespace test
-} // namespace webrtc
-
-#endif // MODULES_VIDEO_CODING_CODECS_TEST_VIDEO_CODEC_TESTER_IMPL_H_
diff --git a/modules/video_coding/codecs/test/video_codec_tester_impl_unittest.cc b/modules/video_coding/codecs/test/video_codec_tester_impl_unittest.cc
deleted file mode 100644
index a8c118ef20..0000000000
--- a/modules/video_coding/codecs/test/video_codec_tester_impl_unittest.cc
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/video_coding/codecs/test/video_codec_tester_impl.h"
-
-#include <memory>
-#include <tuple>
-#include <utility>
-#include <vector>
-
-#include "api/units/frequency.h"
-#include "api/units/time_delta.h"
-#include "api/video/encoded_image.h"
-#include "api/video/i420_buffer.h"
-#include "api/video/video_frame.h"
-#include "rtc_base/fake_clock.h"
-#include "rtc_base/gunit.h"
-#include "rtc_base/task_queue_for_test.h"
-#include "rtc_base/time_utils.h"
-#include "test/gmock.h"
-#include "test/gtest.h"
-
-namespace webrtc {
-namespace test {
-
-namespace {
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::InvokeWithoutArgs;
-using ::testing::Return;
-
-using Decoder = VideoCodecTester::Decoder;
-using Encoder = VideoCodecTester::Encoder;
-using CodedVideoSource = VideoCodecTester::CodedVideoSource;
-using RawVideoSource = VideoCodecTester::RawVideoSource;
-using DecoderSettings = VideoCodecTester::DecoderSettings;
-using EncoderSettings = VideoCodecTester::EncoderSettings;
-using PacingSettings = VideoCodecTester::PacingSettings;
-using PacingMode = PacingSettings::PacingMode;
-
-constexpr Frequency k90kHz = Frequency::Hertz(90000);
-
-struct PacingTestParams {
- PacingSettings pacing_settings;
- Frequency framerate;
- int num_frames;
- std::vector<int> expected_delta_ms;
-};
-
-VideoFrame CreateVideoFrame(uint32_t timestamp_rtp) {
- rtc::scoped_refptr<I420Buffer> buffer(I420Buffer::Create(2, 2));
- return VideoFrame::Builder()
- .set_video_frame_buffer(buffer)
- .set_timestamp_rtp(timestamp_rtp)
- .build();
-}
-
-EncodedImage CreateEncodedImage(uint32_t timestamp_rtp) {
- EncodedImage encoded_image;
- encoded_image.SetRtpTimestamp(timestamp_rtp);
- return encoded_image;
-}
-
-class MockRawVideoSource : public RawVideoSource {
- public:
- MockRawVideoSource(int num_frames, Frequency framerate)
- : num_frames_(num_frames), frame_num_(0), framerate_(framerate) {}
-
- absl::optional<VideoFrame> PullFrame() override {
- if (frame_num_ >= num_frames_) {
- return absl::nullopt;
- }
- uint32_t timestamp_rtp = frame_num_ * k90kHz / framerate_;
- ++frame_num_;
- return CreateVideoFrame(timestamp_rtp);
- }
-
- MOCK_METHOD(VideoFrame,
- GetFrame,
- (uint32_t timestamp_rtp, Resolution),
- (override));
-
- private:
- int num_frames_;
- int frame_num_;
- Frequency framerate_;
-};
-
-class MockCodedVideoSource : public CodedVideoSource {
- public:
- MockCodedVideoSource(int num_frames, Frequency framerate)
- : num_frames_(num_frames), frame_num_(0), framerate_(framerate) {}
-
- absl::optional<EncodedImage> PullFrame() override {
- if (frame_num_ >= num_frames_) {
- return absl::nullopt;
- }
- uint32_t timestamp_rtp = frame_num_ * k90kHz / framerate_;
- ++frame_num_;
- return CreateEncodedImage(timestamp_rtp);
- }
-
- private:
- int num_frames_;
- int frame_num_;
- Frequency framerate_;
-};
-
-class MockDecoder : public Decoder {
- public:
- MOCK_METHOD(void, Initialize, (), (override));
- MOCK_METHOD(void,
- Decode,
- (const EncodedImage& frame, DecodeCallback callback),
- (override));
- MOCK_METHOD(void, Flush, (), (override));
-};
-
-class MockEncoder : public Encoder {
- public:
- MOCK_METHOD(void, Initialize, (), (override));
- MOCK_METHOD(void,
- Encode,
- (const VideoFrame& frame, EncodeCallback callback),
- (override));
- MOCK_METHOD(void, Flush, (), (override));
-};
-
-} // namespace
-
-class VideoCodecTesterImplPacingTest
- : public ::testing::TestWithParam<PacingTestParams> {
- public:
- VideoCodecTesterImplPacingTest() : test_params_(GetParam()) {}
-
- protected:
- PacingTestParams test_params_;
-};
-
-TEST_P(VideoCodecTesterImplPacingTest, PaceEncode) {
- MockRawVideoSource video_source(test_params_.num_frames,
- test_params_.framerate);
- MockEncoder encoder;
- EncoderSettings encoder_settings;
- encoder_settings.pacing = test_params_.pacing_settings;
-
- VideoCodecTesterImpl tester;
- auto fs =
- tester.RunEncodeTest(&video_source, &encoder, encoder_settings)->Slice();
- ASSERT_EQ(static_cast<int>(fs.size()), test_params_.num_frames);
-
- for (size_t i = 1; i < fs.size(); ++i) {
- int delta_ms = (fs[i].encode_start - fs[i - 1].encode_start).ms();
- EXPECT_NEAR(delta_ms, test_params_.expected_delta_ms[i - 1], 10);
- }
-}
-
-TEST_P(VideoCodecTesterImplPacingTest, PaceDecode) {
- MockCodedVideoSource video_source(test_params_.num_frames,
- test_params_.framerate);
- MockDecoder decoder;
- DecoderSettings decoder_settings;
- decoder_settings.pacing = test_params_.pacing_settings;
-
- VideoCodecTesterImpl tester;
- auto fs =
- tester.RunDecodeTest(&video_source, &decoder, decoder_settings)->Slice();
- ASSERT_EQ(static_cast<int>(fs.size()), test_params_.num_frames);
-
- for (size_t i = 1; i < fs.size(); ++i) {
- int delta_ms = (fs[i].decode_start - fs[i - 1].decode_start).ms();
- EXPECT_NEAR(delta_ms, test_params_.expected_delta_ms[i - 1], 20);
- }
-}
-
-INSTANTIATE_TEST_SUITE_P(
- DISABLED_All,
- VideoCodecTesterImplPacingTest,
- ::testing::ValuesIn(
- {// No pacing.
- PacingTestParams({.pacing_settings = {.mode = PacingMode::kNoPacing},
- .framerate = Frequency::Hertz(10),
- .num_frames = 3,
- .expected_delta_ms = {0, 0}}),
- // Real-time pacing.
- PacingTestParams({.pacing_settings = {.mode = PacingMode::kRealTime},
- .framerate = Frequency::Hertz(10),
- .num_frames = 3,
- .expected_delta_ms = {100, 100}}),
- // Pace with specified constant rate.
- PacingTestParams(
- {.pacing_settings = {.mode = PacingMode::kConstantRate,
- .constant_rate = Frequency::Hertz(20)},
- .framerate = Frequency::Hertz(10),
- .num_frames = 3,
- .expected_delta_ms = {50, 50}})}));
-} // namespace test
-} // namespace webrtc
diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
index 1ff3f09bd1..52ef6231ea 100644
--- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
+++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
@@ -44,6 +44,11 @@
#include "third_party/libyuv/include/libyuv/scale.h"
#include "vpx/vp8cx.h"
+#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
+ (defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
+#define MOBILE_ARM
+#endif
+
namespace webrtc {
namespace {
#if defined(WEBRTC_IOS)
@@ -744,8 +749,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
}
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
-#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+#ifdef MOBILE_ARM
// On mobile platform, use a lower speed setting for lower resolutions for
// CPUs with 4 or more cores.
RTC_DCHECK_GT(number_of_cores_, 0);
@@ -850,12 +854,10 @@ int LibvpxVp8Encoder::InitAndSetControlSettings() {
// for getting the denoised frame from the encoder and using that
// when encoding lower resolution streams. Would it work with the
// multi-res encoding feature?
+#ifdef MOBILE_ARM
denoiserState denoiser_state = kDenoiserOnYOnly;
-#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
- denoiser_state = kDenoiserOnYOnly;
#else
- denoiser_state = kDenoiserOnAdaptive;
+ denoiserState denoiser_state = kDenoiserOnAdaptive;
#endif
libvpx_->codec_control(
&encoders_[0], VP8E_SET_NOISE_SENSITIVITY,
diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
index efeb28a29c..a6f570f855 100644
--- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
+++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc
@@ -886,8 +886,8 @@ TEST_P(TestVp8ImplWithMaxFrameDropTrial, EnforcesMaxFrameDropInterval) {
// Allocate a very constained amount of bitrate to increase risk of frame
// drops.
VideoBitrateAllocation bitrate_allocation;
- bitrate_allocation.SetBitrate(0, 0, 80'000);
- bitrate_allocation.SetBitrate(0, 1, 100'000);
+ bitrate_allocation.SetBitrate(0, 0, 50'000);
+ bitrate_allocation.SetBitrate(0, 1, 50'000);
encoder_->SetRates(
VideoEncoder::RateControlParameters(bitrate_allocation, 5.0));
diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
index 0b0d3d5ecf..5af709f3b2 100644
--- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
+++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc
@@ -47,6 +47,11 @@
#include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h"
+#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
+ (defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
+#define MOBILE_ARM
+#endif
+
namespace webrtc {
namespace {
@@ -201,13 +206,12 @@ vpx_svc_ref_frame_config_t Vp9References(
}
bool AllowDenoising() {
- // Do not enable the denoiser on ARM since optimization is pending.
- // Denoiser is on by default on other platforms.
-#if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \
- !defined(ANDROID)
- return true;
-#else
+#ifdef MOBILE_ARM
+ // Keep the denoiser disabled on mobile ARM devices. It increases encode time
+ // by up to 16%.
return false;
+#else
+ return true;
#endif
}
@@ -766,9 +770,8 @@ int LibvpxVp9Encoder::NumberOfThreads(int width,
} else if (width * height >= 640 * 360 && number_of_cores > 2) {
return 2;
} else {
-// Use 2 threads for low res on ARM.
-#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
- defined(WEBRTC_ANDROID)
+// Use 2 threads for low res on mobile ARM.
+#ifdef MOBILE_ARM
if (width * height >= 320 * 180 && number_of_cores > 2) {
return 2;
}
@@ -2004,7 +2007,7 @@ LibvpxVp9Encoder::PerformanceFlags
LibvpxVp9Encoder::GetDefaultPerformanceFlags() {
PerformanceFlags flags;
flags.use_per_layer_speed = true;
-#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID)
+#ifdef MOBILE_ARM
// Speed 8 on all layers for all resolutions.
flags.settings_by_resolution[0] = {.base_layer_speed = 8,
.high_layer_speed = 8,
diff --git a/modules/video_coding/codecs/vp9/svc_config.cc b/modules/video_coding/codecs/vp9/svc_config.cc
index 43def0f6f3..7af8cab3cb 100644
--- a/modules/video_coding/codecs/vp9/svc_config.cc
+++ b/modules/video_coding/codecs/vp9/svc_config.cc
@@ -172,6 +172,9 @@ std::vector<SpatialLayer> GetVp9SvcConfig(VideoCodec& codec) {
absl::optional<ScalabilityMode> scalability_mode = codec.GetScalabilityMode();
RTC_DCHECK(scalability_mode.has_value());
+ bool requested_single_spatial_layer =
+ ScalabilityModeToNumSpatialLayers(*scalability_mode) == 1;
+
// Limit number of spatial layers for given resolution.
int limited_num_spatial_layers =
GetLimitedNumSpatialLayers(codec.width, codec.height);
@@ -205,6 +208,14 @@ std::vector<SpatialLayer> GetVp9SvcConfig(VideoCodec& codec) {
spatial_layers[0].minBitrate = kMinVp9SvcBitrateKbps;
+ // Use codec bitrate limits if spatial layering is not requested.
+ if (requested_single_spatial_layer) {
+ SpatialLayer& spatial_layer = spatial_layers[0];
+ spatial_layer.minBitrate = codec.minBitrate;
+ spatial_layer.maxBitrate = codec.maxBitrate;
+ spatial_layer.targetBitrate = codec.maxBitrate;
+ }
+
return spatial_layers;
}
diff --git a/modules/video_coding/codecs/vp9/svc_config_unittest.cc b/modules/video_coding/codecs/vp9/svc_config_unittest.cc
index 762fd39287..1b1abe0f6d 100644
--- a/modules/video_coding/codecs/vp9/svc_config_unittest.cc
+++ b/modules/video_coding/codecs/vp9/svc_config_unittest.cc
@@ -265,6 +265,21 @@ TEST(SvcConfig, BitrateThresholdsWithScalabilityMode) {
}
}
+TEST(SvcConfig, CopiesMinMaxBitrateForSingleSpatialLayer) {
+ VideoCodec codec;
+ codec.codecType = kVideoCodecVP9;
+ codec.SetScalabilityMode(ScalabilityMode::kL1T3);
+ codec.width = 1280;
+ codec.height = 720;
+ codec.minBitrate = 100;
+ codec.maxBitrate = 500;
+
+ std::vector<SpatialLayer> spatial_layers = GetVp9SvcConfig(codec);
+ EXPECT_EQ(spatial_layers[0].minBitrate, 100u);
+ EXPECT_EQ(spatial_layers[0].maxBitrate, 500u);
+ EXPECT_LE(spatial_layers[0].targetBitrate, 500u);
+}
+
TEST(SvcConfig, ScreenSharing) {
std::vector<SpatialLayer> spatial_layers =
GetSvcConfig(1920, 1080, 30, 1, 3, 3, true);
diff --git a/modules/video_coding/include/video_codec_interface.h b/modules/video_coding/include/video_codec_interface.h
index c6522fcc6b..987e1b623e 100644
--- a/modules/video_coding/include/video_codec_interface.h
+++ b/modules/video_coding/include/video_codec_interface.h
@@ -50,7 +50,9 @@ struct CodecSpecificInfoVP8 {
size_t updatedBuffers[kBuffersCount];
size_t updatedBuffersCount;
};
-static_assert(std::is_pod<CodecSpecificInfoVP8>::value, "");
+static_assert(std::is_trivial_v<CodecSpecificInfoVP8> &&
+ std::is_standard_layout_v<CodecSpecificInfoVP8>,
+ "");
// Hack alert - the code assumes that thisstruct is memset when constructed.
struct CodecSpecificInfoVP9 {
@@ -79,7 +81,9 @@ struct CodecSpecificInfoVP9 {
uint8_t num_ref_pics;
uint8_t p_diff[kMaxVp9RefPics];
};
-static_assert(std::is_pod<CodecSpecificInfoVP9>::value, "");
+static_assert(std::is_trivial_v<CodecSpecificInfoVP9> &&
+ std::is_standard_layout_v<CodecSpecificInfoVP9>,
+ "");
// Hack alert - the code assumes that thisstruct is memset when constructed.
struct CodecSpecificInfoH264 {
@@ -88,14 +92,18 @@ struct CodecSpecificInfoH264 {
bool base_layer_sync;
bool idr_frame;
};
-static_assert(std::is_pod<CodecSpecificInfoH264>::value, "");
+static_assert(std::is_trivial_v<CodecSpecificInfoH264> &&
+ std::is_standard_layout_v<CodecSpecificInfoH264>,
+ "");
union CodecSpecificInfoUnion {
CodecSpecificInfoVP8 VP8;
CodecSpecificInfoVP9 VP9;
CodecSpecificInfoH264 H264;
};
-static_assert(std::is_pod<CodecSpecificInfoUnion>::value, "");
+static_assert(std::is_trivial_v<CodecSpecificInfoUnion> &&
+ std::is_standard_layout_v<CodecSpecificInfoUnion>,
+ "");
// Note: if any pointers are added to this struct or its sub-structs, it
// must be fitted with a copy-constructor. This is because it is copied
diff --git a/modules/video_coding/utility/quality_scaler.cc b/modules/video_coding/utility/quality_scaler.cc
index 9fb41a0ad7..7ecb340ea4 100644
--- a/modules/video_coding/utility/quality_scaler.cc
+++ b/modules/video_coding/utility/quality_scaler.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <utility>
+#include "api/field_trials_view.h"
#include "api/units/time_delta.h"
#include "api/video/video_adaptation_reason.h"
#include "rtc_base/checks.h"
@@ -175,37 +176,38 @@ class QualityScaler::CheckQpTask {
};
QualityScaler::QualityScaler(QualityScalerQpUsageHandlerInterface* handler,
- VideoEncoder::QpThresholds thresholds)
- : QualityScaler(handler, thresholds, kMeasureMs) {}
+ VideoEncoder::QpThresholds thresholds,
+ const FieldTrialsView& field_trials)
+ : QualityScaler(handler, thresholds, field_trials, kMeasureMs) {}
// Protected ctor, should not be called directly.
QualityScaler::QualityScaler(QualityScalerQpUsageHandlerInterface* handler,
VideoEncoder::QpThresholds thresholds,
+ const FieldTrialsView& field_trials,
int64_t default_sampling_period_ms)
: handler_(handler),
thresholds_(thresholds),
- sampling_period_ms_(QualityScalerSettings::ParseFromFieldTrials()
+ sampling_period_ms_(QualityScalerSettings(field_trials)
.SamplingPeriodMs()
.value_or(default_sampling_period_ms)),
fast_rampup_(true),
// Arbitrarily choose size based on 30 fps for 5 seconds.
- average_qp_(QualityScalerSettings::ParseFromFieldTrials()
+ average_qp_(QualityScalerSettings(field_trials)
.AverageQpWindow()
.value_or(5 * 30)),
framedrop_percent_media_opt_(5 * 30),
framedrop_percent_all_(5 * 30),
- experiment_enabled_(QualityScalingExperiment::Enabled()),
- min_frames_needed_(
- QualityScalerSettings::ParseFromFieldTrials().MinFrames().value_or(
- kMinFramesNeededToScale)),
- initial_scale_factor_(QualityScalerSettings::ParseFromFieldTrials()
+ experiment_enabled_(QualityScalingExperiment::Enabled(field_trials)),
+ min_frames_needed_(QualityScalerSettings(field_trials)
+ .MinFrames()
+ .value_or(kMinFramesNeededToScale)),
+ initial_scale_factor_(QualityScalerSettings(field_trials)
.InitialScaleFactor()
.value_or(kSamplePeriodScaleFactor)),
- scale_factor_(
- QualityScalerSettings::ParseFromFieldTrials().ScaleFactor()) {
+ scale_factor_(QualityScalerSettings(field_trials).ScaleFactor()) {
RTC_DCHECK_RUN_ON(&task_checker_);
if (experiment_enabled_) {
- config_ = QualityScalingExperiment::GetConfig();
+ config_ = QualityScalingExperiment::GetConfig(field_trials);
qp_smoother_high_.reset(new QpSmoother(config_.alpha_high));
qp_smoother_low_.reset(new QpSmoother(config_.alpha_low));
}
diff --git a/modules/video_coding/utility/quality_scaler.h b/modules/video_coding/utility/quality_scaler.h
index 93014e36a7..14623ff1f3 100644
--- a/modules/video_coding/utility/quality_scaler.h
+++ b/modules/video_coding/utility/quality_scaler.h
@@ -17,6 +17,7 @@
#include <memory>
#include "absl/types/optional.h"
+#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/sequence_checker.h"
#include "api/video_codecs/video_encoder.h"
@@ -40,7 +41,8 @@ class QualityScaler {
// This starts the quality scaler periodically checking what the average QP
// has been recently.
QualityScaler(QualityScalerQpUsageHandlerInterface* handler,
- VideoEncoder::QpThresholds thresholds);
+ VideoEncoder::QpThresholds thresholds,
+ const FieldTrialsView& field_trials);
virtual ~QualityScaler();
// Should be called each time a frame is dropped at encoding.
void ReportDroppedFrameByMediaOpt();
@@ -55,6 +57,7 @@ class QualityScaler {
protected:
QualityScaler(QualityScalerQpUsageHandlerInterface* handler,
VideoEncoder::QpThresholds thresholds,
+ const FieldTrialsView& field_trials,
int64_t sampling_period_ms);
private:
diff --git a/modules/video_coding/utility/quality_scaler_unittest.cc b/modules/video_coding/utility/quality_scaler_unittest.cc
index 50410dd25b..1142947d54 100644
--- a/modules/video_coding/utility/quality_scaler_unittest.cc
+++ b/modules/video_coding/utility/quality_scaler_unittest.cc
@@ -13,12 +13,13 @@
#include <memory>
#include <string>
+#include "api/field_trials_view.h"
#include "api/units/time_delta.h"
#include "rtc_base/checks.h"
#include "rtc_base/event.h"
#include "rtc_base/task_queue_for_test.h"
-#include "test/field_trial.h"
#include "test/gtest.h"
+#include "test/scoped_key_value_config.h"
namespace webrtc {
namespace {
@@ -53,8 +54,9 @@ class FakeQpUsageHandler : public QualityScalerQpUsageHandlerInterface {
class QualityScalerUnderTest : public QualityScaler {
public:
explicit QualityScalerUnderTest(QualityScalerQpUsageHandlerInterface* handler,
- VideoEncoder::QpThresholds thresholds)
- : QualityScaler(handler, thresholds, 5) {}
+ VideoEncoder::QpThresholds thresholds,
+ const FieldTrialsView& field_trials)
+ : QualityScaler(handler, thresholds, field_trials, 5) {}
};
class QualityScalerTest : public ::testing::Test,
@@ -74,7 +76,8 @@ class QualityScalerTest : public ::testing::Test,
handler_(std::make_unique<FakeQpUsageHandler>()) {
task_queue_.SendTask([this] {
qs_ = std::unique_ptr<QualityScaler>(new QualityScalerUnderTest(
- handler_.get(), VideoEncoder::QpThresholds(kLowQp, kHighQp)));
+ handler_.get(), VideoEncoder::QpThresholds(kLowQp, kHighQp),
+ scoped_field_trial_));
});
}
@@ -104,7 +107,7 @@ class QualityScalerTest : public ::testing::Test,
}
}
- test::ScopedFieldTrials scoped_field_trial_;
+ test::ScopedKeyValueConfig scoped_field_trial_;
TaskQueueForTest task_queue_;
std::unique_ptr<QualityScaler> qs_;
std::unique_ptr<FakeQpUsageHandler> handler_;
diff --git a/modules/video_coding/video_codec_initializer.cc b/modules/video_coding/video_codec_initializer.cc
index 79421ff3e4..6098f59fe9 100644
--- a/modules/video_coding/video_codec_initializer.cc
+++ b/modules/video_coding/video_codec_initializer.cc
@@ -236,18 +236,9 @@ VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
if (!config.spatial_layers.empty()) {
// Layering is set explicitly.
spatial_layers = config.spatial_layers;
- } else if (scalability_mode.has_value()) {
+ } else if (video_codec.GetScalabilityMode().has_value()) {
// Layering is set via scalability mode.
spatial_layers = GetVp9SvcConfig(video_codec);
- if (spatial_layers.empty())
- break;
- // Use codec bitrate limits if spatial layering is not requested.
- if (video_codec.numberOfSimulcastStreams <= 1 &&
- ScalabilityModeToNumSpatialLayers(*scalability_mode) == 1) {
- spatial_layers.back().minBitrate = video_codec.minBitrate;
- spatial_layers.back().targetBitrate = video_codec.maxBitrate;
- spatial_layers.back().maxBitrate = video_codec.maxBitrate;
- }
} else {
size_t first_active_layer = 0;
for (size_t spatial_idx = 0;
diff --git a/net/dcsctp/common/BUILD.gn b/net/dcsctp/common/BUILD.gn
index 78fa0d307e..d496c64a56 100644
--- a/net/dcsctp/common/BUILD.gn
+++ b/net/dcsctp/common/BUILD.gn
@@ -29,12 +29,6 @@ rtc_source_set("sequence_numbers") {
sources = [ "sequence_numbers.h" ]
}
-rtc_source_set("str_join") {
- deps = [ "../../../rtc_base:stringutils" ]
- sources = [ "str_join.h" ]
- absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
-}
-
if (rtc_include_tests) {
rtc_library("dcsctp_common_unittests") {
testonly = true
@@ -43,7 +37,6 @@ if (rtc_include_tests) {
deps = [
":math",
":sequence_numbers",
- ":str_join",
"../../../api:array_view",
"../../../rtc_base:checks",
"../../../rtc_base:gunit_helpers",
@@ -52,7 +45,6 @@ if (rtc_include_tests) {
sources = [
"math_test.cc",
"sequence_numbers_test.cc",
- "str_join_test.cc",
]
}
}
diff --git a/net/dcsctp/common/internal_types.h b/net/dcsctp/common/internal_types.h
index 2354b92cc4..4f3b1935a2 100644
--- a/net/dcsctp/common/internal_types.h
+++ b/net/dcsctp/common/internal_types.h
@@ -40,5 +40,10 @@ using VerificationTag = webrtc::StrongAlias<class VerificationTagTag, uint32_t>;
// Tie Tag, used as a nonce when connecting.
using TieTag = webrtc::StrongAlias<class TieTagTag, uint64_t>;
+// An ID for every outgoing message, to correlate outgoing data chunks with the
+// message it was carved from.
+using OutgoingMessageId =
+ webrtc::StrongAlias<class OutgoingMessageIdTag, uint32_t>;
+
} // namespace dcsctp
#endif // NET_DCSCTP_COMMON_INTERNAL_TYPES_H_
diff --git a/net/dcsctp/fuzzers/dcsctp_fuzzers.h b/net/dcsctp/fuzzers/dcsctp_fuzzers.h
index 90cfa35099..49aa7f0430 100644
--- a/net/dcsctp/fuzzers/dcsctp_fuzzers.h
+++ b/net/dcsctp/fuzzers/dcsctp_fuzzers.h
@@ -64,7 +64,7 @@ class FuzzerCallbacks : public DcSctpSocketCallbacks {
// The fuzzer timeouts don't implement |precision|.
return std::make_unique<FuzzerTimeout>(active_timeouts_);
}
- TimeMs TimeMillis() override { return TimeMs(42); }
+ webrtc::Timestamp Now() override { return webrtc::Timestamp::Millis(42); }
uint32_t GetRandomInt(uint32_t low, uint32_t high) override {
return kRandomValue;
}
diff --git a/net/dcsctp/packet/BUILD.gn b/net/dcsctp/packet/BUILD.gn
index 7abccc004b..a0c9d8d4df 100644
--- a/net/dcsctp/packet/BUILD.gn
+++ b/net/dcsctp/packet/BUILD.gn
@@ -72,7 +72,6 @@ rtc_library("parameter") {
"../../../rtc_base:stringutils",
"../common:internal_types",
"../common:math",
- "../common:str_join",
"../public:types",
]
sources = [
@@ -120,7 +119,6 @@ rtc_library("error_cause") {
"../../../rtc_base:stringutils",
"../common:internal_types",
"../common:math",
- "../common:str_join",
"../packet:bounded_io",
"../public:types",
]
@@ -172,7 +170,6 @@ rtc_library("chunk") {
"../../../rtc_base:logging",
"../../../rtc_base:stringutils",
"../common:math",
- "../common:str_join",
"../packet:bounded_io",
]
sources = [
diff --git a/net/dcsctp/packet/chunk/data_common.h b/net/dcsctp/packet/chunk/data_common.h
index b67efeee1e..66d67bac3d 100644
--- a/net/dcsctp/packet/chunk/data_common.h
+++ b/net/dcsctp/packet/chunk/data_common.h
@@ -48,7 +48,7 @@ class AnyDataChunk : public Chunk {
StreamID stream_id() const { return data_.stream_id; }
SSN ssn() const { return data_.ssn; }
- MID message_id() const { return data_.message_id; }
+ MID mid() const { return data_.mid; }
FSN fsn() const { return data_.fsn; }
PPID ppid() const { return data_.ppid; }
rtc::ArrayView<const uint8_t> payload() const { return data_.payload; }
@@ -59,7 +59,7 @@ class AnyDataChunk : public Chunk {
AnyDataChunk(TSN tsn,
StreamID stream_id,
SSN ssn,
- MID message_id,
+ MID mid,
FSN fsn,
PPID ppid,
std::vector<uint8_t> payload,
@@ -67,7 +67,7 @@ class AnyDataChunk : public Chunk {
: tsn_(tsn),
data_(stream_id,
ssn,
- message_id,
+ mid,
fsn,
ppid,
std::move(payload),
diff --git a/net/dcsctp/packet/chunk/forward_tsn_common.h b/net/dcsctp/packet/chunk/forward_tsn_common.h
index 37bd2aafff..b9dddd2cbf 100644
--- a/net/dcsctp/packet/chunk/forward_tsn_common.h
+++ b/net/dcsctp/packet/chunk/forward_tsn_common.h
@@ -24,12 +24,9 @@ class AnyForwardTsnChunk : public Chunk {
public:
struct SkippedStream {
SkippedStream(StreamID stream_id, SSN ssn)
- : stream_id(stream_id), ssn(ssn), unordered(false), message_id(0) {}
- SkippedStream(IsUnordered unordered, StreamID stream_id, MID message_id)
- : stream_id(stream_id),
- ssn(0),
- unordered(unordered),
- message_id(message_id) {}
+ : stream_id(stream_id), ssn(ssn), unordered(false), mid(0) {}
+ SkippedStream(IsUnordered unordered, StreamID stream_id, MID mid)
+ : stream_id(stream_id), ssn(0), unordered(unordered), mid(mid) {}
StreamID stream_id;
@@ -38,11 +35,11 @@ class AnyForwardTsnChunk : public Chunk {
// Set for I-FORWARD_TSN
IsUnordered unordered;
- MID message_id;
+ MID mid;
bool operator==(const SkippedStream& other) const {
return stream_id == other.stream_id && ssn == other.ssn &&
- unordered == other.unordered && message_id == other.message_id;
+ unordered == other.unordered && mid == other.mid;
}
};
diff --git a/net/dcsctp/packet/chunk/idata_chunk.cc b/net/dcsctp/packet/chunk/idata_chunk.cc
index 9f19c7f053..e9a777dfdc 100644
--- a/net/dcsctp/packet/chunk/idata_chunk.cc
+++ b/net/dcsctp/packet/chunk/idata_chunk.cc
@@ -54,7 +54,7 @@ absl::optional<IDataChunk> IDataChunk::Parse(
uint8_t flags = reader->Load8<1>();
TSN tsn(reader->Load32<4>());
StreamID stream_identifier(reader->Load16<8>());
- MID message_id(reader->Load32<12>());
+ MID mid(reader->Load32<12>());
uint32_t ppid_or_fsn = reader->Load32<16>();
Options options;
@@ -65,7 +65,7 @@ absl::optional<IDataChunk> IDataChunk::Parse(
options.immediate_ack =
ImmediateAckFlag((flags & (1 << kFlagsBitImmediateAck)) != 0);
- return IDataChunk(tsn, stream_identifier, message_id,
+ return IDataChunk(tsn, stream_identifier, mid,
PPID(options.is_beginning ? ppid_or_fsn : 0),
FSN(options.is_beginning ? 0 : ppid_or_fsn),
std::vector<uint8_t>(reader->variable_data().begin(),
@@ -83,7 +83,7 @@ void IDataChunk::SerializeTo(std::vector<uint8_t>& out) const {
(*options().immediate_ack ? (1 << kFlagsBitImmediateAck) : 0));
writer.Store32<4>(*tsn());
writer.Store16<8>(*stream_id());
- writer.Store32<12>(*message_id());
+ writer.Store32<12>(*mid());
writer.Store32<16>(options().is_beginning ? *ppid() : *fsn());
writer.CopyToVariableData(payload());
}
@@ -97,7 +97,7 @@ std::string IDataChunk::ToString() const {
: *options().is_end ? "last"
: "middle")
<< ", tsn=" << *tsn() << ", stream_id=" << *stream_id()
- << ", message_id=" << *message_id();
+ << ", mid=" << *mid();
if (*options().is_beginning) {
sb << ", ppid=" << *ppid();
diff --git a/net/dcsctp/packet/chunk/idata_chunk.h b/net/dcsctp/packet/chunk/idata_chunk.h
index 8cdf2a1fc4..36b7e7eaab 100644
--- a/net/dcsctp/packet/chunk/idata_chunk.h
+++ b/net/dcsctp/packet/chunk/idata_chunk.h
@@ -42,7 +42,7 @@ class IDataChunk : public AnyDataChunk, public TLVTrait<IDataChunkConfig> {
static constexpr size_t kHeaderSize = IDataChunkConfig::kHeaderSize;
IDataChunk(TSN tsn,
StreamID stream_id,
- MID message_id,
+ MID mid,
PPID ppid,
FSN fsn,
std::vector<uint8_t> payload,
@@ -50,7 +50,7 @@ class IDataChunk : public AnyDataChunk, public TLVTrait<IDataChunkConfig> {
: AnyDataChunk(tsn,
stream_id,
SSN(0),
- message_id,
+ mid,
fsn,
ppid,
std::move(payload),
diff --git a/net/dcsctp/packet/chunk/idata_chunk_test.cc b/net/dcsctp/packet/chunk/idata_chunk_test.cc
index fea492d71e..d1cc0d8f90 100644
--- a/net/dcsctp/packet/chunk/idata_chunk_test.cc
+++ b/net/dcsctp/packet/chunk/idata_chunk_test.cc
@@ -44,7 +44,7 @@ TEST(IDataChunkTest, AtBeginningFromCapture) {
ASSERT_HAS_VALUE_AND_ASSIGN(IDataChunk chunk, IDataChunk::Parse(data));
EXPECT_EQ(*chunk.tsn(), 2487901653);
EXPECT_EQ(*chunk.stream_id(), 1);
- EXPECT_EQ(*chunk.message_id(), 0u);
+ EXPECT_EQ(*chunk.mid(), 0u);
EXPECT_EQ(*chunk.ppid(), 53u);
EXPECT_EQ(*chunk.fsn(), 0u); // Not provided (so set to zero)
}
@@ -62,13 +62,13 @@ TEST(IDataChunkTest, AtBeginningSerializeAndDeserialize) {
IDataChunk::Parse(serialized));
EXPECT_EQ(*deserialized.tsn(), 123u);
EXPECT_EQ(*deserialized.stream_id(), 456u);
- EXPECT_EQ(*deserialized.message_id(), 789u);
+ EXPECT_EQ(*deserialized.mid(), 789u);
EXPECT_EQ(*deserialized.ppid(), 53u);
EXPECT_EQ(*deserialized.fsn(), 0u);
EXPECT_EQ(deserialized.ToString(),
"I-DATA, type=ordered::first, tsn=123, stream_id=456, "
- "message_id=789, ppid=53, length=1");
+ "mid=789, ppid=53, length=1");
}
TEST(IDataChunkTest, InMiddleFromCapture) {
@@ -93,7 +93,7 @@ TEST(IDataChunkTest, InMiddleFromCapture) {
ASSERT_HAS_VALUE_AND_ASSIGN(IDataChunk chunk, IDataChunk::Parse(data));
EXPECT_EQ(*chunk.tsn(), 2487901706);
EXPECT_EQ(*chunk.stream_id(), 3u);
- EXPECT_EQ(*chunk.message_id(), 1u);
+ EXPECT_EQ(*chunk.mid(), 1u);
EXPECT_EQ(*chunk.ppid(), 0u); // Not provided (so set to zero)
EXPECT_EQ(*chunk.fsn(), 8u);
}
@@ -109,14 +109,14 @@ TEST(IDataChunkTest, InMiddleSerializeAndDeserialize) {
IDataChunk::Parse(serialized));
EXPECT_EQ(*deserialized.tsn(), 123u);
EXPECT_EQ(*deserialized.stream_id(), 456u);
- EXPECT_EQ(*deserialized.message_id(), 789u);
+ EXPECT_EQ(*deserialized.mid(), 789u);
EXPECT_EQ(*deserialized.ppid(), 0u);
EXPECT_EQ(*deserialized.fsn(), 101112u);
EXPECT_THAT(deserialized.payload(), ElementsAre(1, 2, 3));
EXPECT_EQ(deserialized.ToString(),
"I-DATA, type=ordered::middle, tsn=123, stream_id=456, "
- "message_id=789, fsn=101112, length=3");
+ "mid=789, fsn=101112, length=3");
}
} // namespace
diff --git a/net/dcsctp/packet/chunk/iforward_tsn_chunk.cc b/net/dcsctp/packet/chunk/iforward_tsn_chunk.cc
index a647a8bf8a..2b8e9c917a 100644
--- a/net/dcsctp/packet/chunk/iforward_tsn_chunk.cc
+++ b/net/dcsctp/packet/chunk/iforward_tsn_chunk.cc
@@ -68,8 +68,8 @@ absl::optional<IForwardTsnChunk> IForwardTsnChunk::Parse(
StreamID stream_id(sub_reader.Load16<0>());
IsUnordered unordered(sub_reader.Load8<3>() & 0x01);
- MID message_id(sub_reader.Load32<4>());
- skipped_streams.emplace_back(unordered, stream_id, message_id);
+ MID mid(sub_reader.Load32<4>());
+ skipped_streams.emplace_back(unordered, stream_id, mid);
offset += kSkippedStreamBufferSize;
}
RTC_DCHECK(offset == reader->variable_data_size());
@@ -89,7 +89,7 @@ void IForwardTsnChunk::SerializeTo(std::vector<uint8_t>& out) const {
sub_writer.Store16<0>(*skipped[i].stream_id);
sub_writer.Store8<3>(skipped[i].unordered ? 1 : 0);
- sub_writer.Store32<4>(*skipped[i].message_id);
+ sub_writer.Store32<4>(*skipped[i].mid);
offset += kSkippedStreamBufferSize;
}
RTC_DCHECK(offset == variable_size);
diff --git a/net/dcsctp/packet/chunk/sack_chunk.cc b/net/dcsctp/packet/chunk/sack_chunk.cc
index d80e430082..179f7ea379 100644
--- a/net/dcsctp/packet/chunk/sack_chunk.cc
+++ b/net/dcsctp/packet/chunk/sack_chunk.cc
@@ -18,11 +18,11 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/bounded_byte_reader.h"
#include "net/dcsctp/packet/bounded_byte_writer.h"
#include "net/dcsctp/packet/tlv_trait.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
#include "rtc_base/strings/string_builder.h"
namespace dcsctp {
diff --git a/net/dcsctp/packet/data.h b/net/dcsctp/packet/data.h
index c1754ed59a..08174dc052 100644
--- a/net/dcsctp/packet/data.h
+++ b/net/dcsctp/packet/data.h
@@ -42,7 +42,7 @@ struct Data {
Data(StreamID stream_id,
SSN ssn,
- MID message_id,
+ MID mid,
FSN fsn,
PPID ppid,
std::vector<uint8_t> payload,
@@ -51,7 +51,7 @@ struct Data {
IsUnordered is_unordered)
: stream_id(stream_id),
ssn(ssn),
- message_id(message_id),
+ mid(mid),
fsn(fsn),
ppid(ppid),
payload(std::move(payload)),
@@ -65,8 +65,8 @@ struct Data {
// Creates a copy of this `Data` object.
Data Clone() const {
- return Data(stream_id, ssn, message_id, fsn, ppid, payload, is_beginning,
- is_end, is_unordered);
+ return Data(stream_id, ssn, mid, fsn, ppid, payload, is_beginning, is_end,
+ is_unordered);
}
// The size of this data, which translates to the size of its payload.
@@ -82,7 +82,7 @@ struct Data {
// Message Identifier (MID) per stream and ordered/unordered. Defined by
// RFC8260, and used together with options.is_unordered and stream_id to
// uniquely identify a message. Used only in I-DATA chunks (not DATA).
- MID message_id;
+ MID mid;
// Fragment Sequence Number (FSN) per stream and ordered/unordered, as above.
FSN fsn;
diff --git a/net/dcsctp/packet/error_cause/missing_mandatory_parameter_cause.cc b/net/dcsctp/packet/error_cause/missing_mandatory_parameter_cause.cc
index b89f86e43e..679439d4c2 100644
--- a/net/dcsctp/packet/error_cause/missing_mandatory_parameter_cause.cc
+++ b/net/dcsctp/packet/error_cause/missing_mandatory_parameter_cause.cc
@@ -18,11 +18,11 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/bounded_byte_reader.h"
#include "net/dcsctp/packet/bounded_byte_writer.h"
#include "net/dcsctp/packet/tlv_trait.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
#include "rtc_base/strings/string_builder.h"
namespace dcsctp {
@@ -83,7 +83,7 @@ void MissingMandatoryParameterCause::SerializeTo(
std::string MissingMandatoryParameterCause::ToString() const {
rtc::StringBuilder sb;
sb << "Missing Mandatory Parameter, missing_parameter_types="
- << StrJoin(missing_parameter_types_, ",");
+ << webrtc::StrJoin(missing_parameter_types_, ",");
return sb.Release();
}
diff --git a/net/dcsctp/packet/parameter/supported_extensions_parameter.cc b/net/dcsctp/packet/parameter/supported_extensions_parameter.cc
index 6a8fb214de..87a5bd9b52 100644
--- a/net/dcsctp/packet/parameter/supported_extensions_parameter.cc
+++ b/net/dcsctp/packet/parameter/supported_extensions_parameter.cc
@@ -16,10 +16,10 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/bounded_byte_reader.h"
#include "net/dcsctp/packet/bounded_byte_writer.h"
#include "net/dcsctp/packet/tlv_trait.h"
+#include "rtc_base/strings/str_join.h"
#include "rtc_base/strings/string_builder.h"
namespace dcsctp {
@@ -59,7 +59,7 @@ void SupportedExtensionsParameter::SerializeTo(
std::string SupportedExtensionsParameter::ToString() const {
rtc::StringBuilder sb;
- sb << "Supported Extensions (" << StrJoin(chunk_types_, ", ") << ")";
+ sb << "Supported Extensions (" << webrtc::StrJoin(chunk_types_, ", ") << ")";
return sb.Release();
}
} // namespace dcsctp
diff --git a/net/dcsctp/public/BUILD.gn b/net/dcsctp/public/BUILD.gn
index 6cb289bf5b..8af0fd88c4 100644
--- a/net/dcsctp/public/BUILD.gn
+++ b/net/dcsctp/public/BUILD.gn
@@ -11,6 +11,7 @@ import("../../../webrtc.gni")
rtc_source_set("types") {
deps = [
"../../../api:array_view",
+ "../../../api/units:time_delta",
"../../../rtc_base:strong_alias",
]
sources = [
@@ -26,6 +27,7 @@ rtc_source_set("socket") {
":types",
"../../../api:array_view",
"../../../api/task_queue:task_queue",
+ "../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:strong_alias",
]
diff --git a/net/dcsctp/public/dcsctp_socket.h b/net/dcsctp/public/dcsctp_socket.h
index 3cfb8052f8..d0a81eaeb2 100644
--- a/net/dcsctp/public/dcsctp_socket.h
+++ b/net/dcsctp/public/dcsctp_socket.h
@@ -18,6 +18,7 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/task_queue/task_queue_base.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/public/dcsctp_handover_state.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/public/dcsctp_options.h"
@@ -323,9 +324,21 @@ class DcSctpSocketCallbacks {
// Returns the current time in milliseconds (from any epoch).
//
+ // TODO(bugs.webrtc.org/15593): This method is deprecated, see `Now`.
+ //
// Note that it's NOT ALLOWED to call into this library from within this
// callback.
- virtual TimeMs TimeMillis() = 0;
+ virtual TimeMs TimeMillis() { return TimeMs(0); }
+
+ // Returns the current time (from any epoch).
+ //
+ // This callback will eventually replace `TimeMillis()`.
+ //
+ // Note that it's NOT ALLOWED to call into this library from within this
+ // callback.
+ virtual webrtc::Timestamp Now() {
+ return webrtc::Timestamp::Millis(*TimeMillis());
+ }
// Called when the library needs a random number uniformly distributed between
// `low` (inclusive) and `high` (exclusive). The random numbers used by the
diff --git a/net/dcsctp/public/types.h b/net/dcsctp/public/types.h
index 7d69875d1a..02e2ce1e5e 100644
--- a/net/dcsctp/public/types.h
+++ b/net/dcsctp/public/types.h
@@ -14,6 +14,7 @@
#include <cstdint>
#include <limits>
+#include "api/units/time_delta.h"
#include "rtc_base/strong_alias.h"
namespace dcsctp {
@@ -41,6 +42,10 @@ class DurationMs : public webrtc::StrongAlias<class DurationMsTag, int32_t> {
constexpr explicit DurationMs(const UnderlyingType& v)
: webrtc::StrongAlias<class DurationMsTag, int32_t>(v) {}
+ constexpr explicit DurationMs(webrtc::TimeDelta v)
+ : webrtc::StrongAlias<class DurationMsTag, int32_t>(
+ v.IsInfinite() ? InfiniteDuration() : DurationMs(v.ms())) {}
+
static constexpr DurationMs InfiniteDuration() {
return DurationMs(std::numeric_limits<int32_t>::max());
}
@@ -58,6 +63,11 @@ class DurationMs : public webrtc::StrongAlias<class DurationMsTag, int32_t> {
value_ *= factor;
return *this;
}
+ constexpr webrtc::TimeDelta ToTimeDelta() const {
+ return *this == DurationMs::InfiniteDuration()
+ ? webrtc::TimeDelta::PlusInfinity()
+ : webrtc::TimeDelta::Millis(value_);
+ }
};
constexpr inline DurationMs operator+(DurationMs lhs, DurationMs rhs) {
diff --git a/net/dcsctp/rx/BUILD.gn b/net/dcsctp/rx/BUILD.gn
index d66fd6ba72..15b9f60f3d 100644
--- a/net/dcsctp/rx/BUILD.gn
+++ b/net/dcsctp/rx/BUILD.gn
@@ -95,9 +95,10 @@ rtc_library("reassembly_queue") {
"../../../api:array_view",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
+ "../../../rtc_base:stringutils",
+ "../../../rtc_base/containers:flat_set",
"../common:internal_types",
"../common:sequence_numbers",
- "../common:str_join",
"../packet:chunk",
"../packet:data",
"../packet:parameter",
@@ -109,6 +110,7 @@ rtc_library("reassembly_queue") {
"reassembly_queue.h",
]
absl_deps = [
+ "//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
diff --git a/net/dcsctp/rx/data_tracker.h b/net/dcsctp/rx/data_tracker.h
index 62a12320ad..9991ee6139 100644
--- a/net/dcsctp/rx/data_tracker.h
+++ b/net/dcsctp/rx/data_tracker.h
@@ -93,6 +93,10 @@ class DataTracker {
return TSN(last_cumulative_acked_tsn_.Wrap());
}
+ bool IsLaterThanCumulativeAckedTsn(TSN tsn) const {
+ return tsn_unwrapper_.PeekUnwrap(tsn) > last_cumulative_acked_tsn_;
+ }
+
// Returns true if the received `tsn` would increase the cumulative ack TSN.
bool will_increase_cum_ack_tsn(TSN tsn) const;
diff --git a/net/dcsctp/rx/data_tracker_test.cc b/net/dcsctp/rx/data_tracker_test.cc
index 07192fda54..f4e1c64444 100644
--- a/net/dcsctp/rx/data_tracker_test.cc
+++ b/net/dcsctp/rx/data_tracker_test.cc
@@ -29,6 +29,8 @@ using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
constexpr size_t kArwnd = 10000;
constexpr TSN kInitialTSN(11);
@@ -42,8 +44,8 @@ class DataTrackerTest : public testing::Test {
}),
timer_(timer_manager_.CreateTimer(
"test/delayed_ack",
- []() { return absl::nullopt; },
- TimerOptions(DurationMs(0)))),
+ []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Zero()))),
tracker_(
std::make_unique<DataTracker>("log: ", timer_.get(), kInitialTSN)) {
}
@@ -71,7 +73,7 @@ class DataTrackerTest : public testing::Test {
tracker_->RestoreFromState(state);
}
- TimeMs now_ = TimeMs(0);
+ Timestamp now_ = Timestamp::Zero();
FakeTimeoutManager timeout_manager_;
TimerManager timer_manager_;
std::unique_ptr<Timer> timer_;
diff --git a/net/dcsctp/rx/interleaved_reassembly_streams.cc b/net/dcsctp/rx/interleaved_reassembly_streams.cc
index 8b316de676..9dc2e43a23 100644
--- a/net/dcsctp/rx/interleaved_reassembly_streams.cc
+++ b/net/dcsctp/rx/interleaved_reassembly_streams.cc
@@ -106,8 +106,8 @@ size_t InterleavedReassemblyStreams::Stream::AssembleMessage(
return payload_size;
}
-size_t InterleavedReassemblyStreams::Stream::EraseTo(MID message_id) {
- UnwrappedMID unwrapped_mid = mid_unwrapper_.Unwrap(message_id);
+size_t InterleavedReassemblyStreams::Stream::EraseTo(MID mid) {
+ UnwrappedMID unwrapped_mid = mid_unwrapper_.Unwrap(mid);
size_t removed_bytes = 0;
auto it = chunks_by_mid_.begin();
@@ -135,7 +135,7 @@ int InterleavedReassemblyStreams::Stream::Add(UnwrappedTSN tsn, Data data) {
RTC_DCHECK_EQ(*data.is_unordered, *stream_id_.unordered);
RTC_DCHECK_EQ(*data.stream_id, *stream_id_.stream_id);
int queued_bytes = data.size();
- UnwrappedMID mid = mid_unwrapper_.Unwrap(data.message_id);
+ UnwrappedMID mid = mid_unwrapper_.Unwrap(data.mid);
FSN fsn = data.fsn;
auto [unused, inserted] =
chunks_by_mid_[mid].emplace(fsn, std::make_pair(tsn, std::move(data)));
@@ -208,7 +208,7 @@ size_t InterleavedReassemblyStreams::HandleForwardTsn(
for (const auto& skipped : skipped_streams) {
removed_bytes +=
GetOrCreateStream(FullStreamId(skipped.unordered, skipped.stream_id))
- .EraseTo(skipped.message_id);
+ .EraseTo(skipped.mid);
}
return removed_bytes;
}
diff --git a/net/dcsctp/rx/interleaved_reassembly_streams.h b/net/dcsctp/rx/interleaved_reassembly_streams.h
index 605cf42b93..a6faadd302 100644
--- a/net/dcsctp/rx/interleaved_reassembly_streams.h
+++ b/net/dcsctp/rx/interleaved_reassembly_streams.h
@@ -67,7 +67,7 @@ class InterleavedReassemblyStreams : public ReassemblyStreams {
parent_(*parent),
next_mid_(mid_unwrapper_.Unwrap(next_mid)) {}
int Add(UnwrappedTSN tsn, Data data);
- size_t EraseTo(MID message_id);
+ size_t EraseTo(MID mid);
void Reset() {
mid_unwrapper_.Reset();
next_mid_ = mid_unwrapper_.Unwrap(MID(0));
diff --git a/net/dcsctp/rx/reassembly_queue.cc b/net/dcsctp/rx/reassembly_queue.cc
index b5ab087f68..ae672731c0 100644
--- a/net/dcsctp/rx/reassembly_queue.cc
+++ b/net/dcsctp/rx/reassembly_queue.cc
@@ -23,16 +23,17 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "net/dcsctp/common/sequence_numbers.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/chunk/forward_tsn_common.h"
#include "net/dcsctp/packet/data.h"
#include "net/dcsctp/packet/parameter/outgoing_ssn_reset_request_parameter.h"
#include "net/dcsctp/packet/parameter/reconfiguration_response_parameter.h"
#include "net/dcsctp/public/dcsctp_message.h"
+#include "net/dcsctp/public/types.h"
#include "net/dcsctp/rx/interleaved_reassembly_streams.h"
#include "net/dcsctp/rx/reassembly_streams.h"
#include "net/dcsctp/rx/traditional_reassembly_streams.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
namespace dcsctp {
namespace {
@@ -68,10 +69,9 @@ ReassemblyQueue::ReassemblyQueue(absl::string_view log_prefix,
use_message_interleaving)) {}
void ReassemblyQueue::Add(TSN tsn, Data data) {
- RTC_DCHECK(IsConsistent());
RTC_DLOG(LS_VERBOSE) << log_prefix_ << "added tsn=" << *tsn
- << ", stream=" << *data.stream_id << ":"
- << *data.message_id << ":" << *data.fsn << ", type="
+ << ", stream=" << *data.stream_id << ":" << *data.mid
+ << ":" << *data.fsn << ", type="
<< (data.is_beginning && data.is_end ? "complete"
: data.is_beginning ? "first"
: data.is_end ? "last"
@@ -83,21 +83,23 @@ void ReassemblyQueue::Add(TSN tsn, Data data) {
// the future, the socket is in "deferred reset processing" mode and must
// buffer chunks until it's exited.
if (deferred_reset_streams_.has_value() &&
- unwrapped_tsn >
- tsn_unwrapper_.Unwrap(
- deferred_reset_streams_->req.sender_last_assigned_tsn())) {
+ unwrapped_tsn > deferred_reset_streams_->sender_last_assigned_tsn &&
+ deferred_reset_streams_->streams.contains(data.stream_id)) {
RTC_DLOG(LS_VERBOSE)
<< log_prefix_ << "Deferring chunk with tsn=" << *tsn
- << " until cum_ack_tsn="
- << *deferred_reset_streams_->req.sender_last_assigned_tsn();
+ << ", sid=" << *data.stream_id << " until tsn="
+ << *deferred_reset_streams_->sender_last_assigned_tsn.Wrap();
// https://tools.ietf.org/html/rfc6525#section-5.2.2
// "In this mode, any data arriving with a TSN larger than the
// Sender's Last Assigned TSN for the affected stream(s) MUST be queued
// locally and held until the cumulative acknowledgment point reaches the
// Sender's Last Assigned TSN."
queued_bytes_ += data.size();
- deferred_reset_streams_->deferred_chunks.emplace_back(
- std::make_pair(tsn, std::move(data)));
+ deferred_reset_streams_->deferred_actions.push_back(
+ [this, tsn, data = std::move(data)]() mutable {
+ queued_bytes_ -= data.size();
+ Add(tsn, std::move(data));
+ });
} else {
queued_bytes_ += streams_->Add(unwrapped_tsn, std::move(data));
}
@@ -113,83 +115,51 @@ void ReassemblyQueue::Add(TSN tsn, Data data) {
RTC_DCHECK(IsConsistent());
}
-ReconfigurationResponseParameter::Result ReassemblyQueue::ResetStreams(
- const OutgoingSSNResetRequestParameter& req,
- TSN cum_tsn_ack) {
- RTC_DCHECK(IsConsistent());
- if (deferred_reset_streams_.has_value()) {
- // In deferred mode already.
- return ReconfigurationResponseParameter::Result::kInProgress;
- } else if (req.request_sequence_number() <=
- last_completed_reset_req_seq_nbr_) {
- // Already performed at some time previously.
- return ReconfigurationResponseParameter::Result::kSuccessPerformed;
- }
-
- UnwrappedTSN sla_tsn = tsn_unwrapper_.Unwrap(req.sender_last_assigned_tsn());
- UnwrappedTSN unwrapped_cum_tsn_ack = tsn_unwrapper_.Unwrap(cum_tsn_ack);
-
- // https://tools.ietf.org/html/rfc6525#section-5.2.2
- // "If the Sender's Last Assigned TSN is greater than the
- // cumulative acknowledgment point, then the endpoint MUST enter "deferred
- // reset processing"."
- if (sla_tsn > unwrapped_cum_tsn_ack) {
- RTC_DLOG(LS_VERBOSE)
- << log_prefix_
- << "Entering deferred reset processing mode until cum_tsn_ack="
- << *req.sender_last_assigned_tsn();
- deferred_reset_streams_ = absl::make_optional<DeferredResetStreams>(req);
- return ReconfigurationResponseParameter::Result::kInProgress;
- }
+void ReassemblyQueue::ResetStreamsAndLeaveDeferredReset(
+ rtc::ArrayView<const StreamID> stream_ids) {
+ RTC_DLOG(LS_VERBOSE) << log_prefix_ << "Resetting streams: ["
+ << StrJoin(stream_ids, ",",
+ [](rtc::StringBuilder& sb, StreamID sid) {
+ sb << *sid;
+ })
+ << "]";
// https://tools.ietf.org/html/rfc6525#section-5.2.2
// "... streams MUST be reset to 0 as the next expected SSN."
- streams_->ResetStreams(req.stream_ids());
- last_completed_reset_req_seq_nbr_ = req.request_sequence_number();
- RTC_DCHECK(IsConsistent());
- return ReconfigurationResponseParameter::Result::kSuccessPerformed;
-}
+ streams_->ResetStreams(stream_ids);
-bool ReassemblyQueue::MaybeResetStreamsDeferred(TSN cum_ack_tsn) {
- RTC_DCHECK(IsConsistent());
if (deferred_reset_streams_.has_value()) {
- UnwrappedTSN unwrapped_cum_ack_tsn = tsn_unwrapper_.Unwrap(cum_ack_tsn);
- UnwrappedTSN unwrapped_sla_tsn = tsn_unwrapper_.Unwrap(
- deferred_reset_streams_->req.sender_last_assigned_tsn());
- if (unwrapped_cum_ack_tsn >= unwrapped_sla_tsn) {
- RTC_DLOG(LS_VERBOSE) << log_prefix_
- << "Leaving deferred reset processing with tsn="
- << *cum_ack_tsn << ", feeding back "
- << deferred_reset_streams_->deferred_chunks.size()
- << " chunks";
- // https://tools.ietf.org/html/rfc6525#section-5.2.2
- // "... streams MUST be reset to 0 as the next expected SSN."
- streams_->ResetStreams(deferred_reset_streams_->req.stream_ids());
- std::vector<std::pair<TSN, Data>> deferred_chunks =
- std::move(deferred_reset_streams_->deferred_chunks);
- // The response will not be sent now, but as a reply to the retried
- // request, which will come as "in progress" has been sent prior.
- last_completed_reset_req_seq_nbr_ =
- deferred_reset_streams_->req.request_sequence_number();
- deferred_reset_streams_ = absl::nullopt;
-
- // https://tools.ietf.org/html/rfc6525#section-5.2.2
- // "Any queued TSNs (queued at step E2) MUST now be released and processed
- // normally."
- for (auto& [tsn, data] : deferred_chunks) {
- queued_bytes_ -= data.size();
- Add(tsn, std::move(data));
- }
-
- RTC_DCHECK(IsConsistent());
- return true;
- } else {
- RTC_DLOG(LS_VERBOSE) << "Staying in deferred reset processing. tsn="
- << *cum_ack_tsn;
+ RTC_DLOG(LS_VERBOSE) << log_prefix_
+ << "Leaving deferred reset processing, feeding back "
+ << deferred_reset_streams_->deferred_actions.size()
+ << " actions";
+ // https://tools.ietf.org/html/rfc6525#section-5.2.2
+ // "Any queued TSNs (queued at step E2) MUST now be released and processed
+ // normally."
+ auto deferred_actions =
+ std::move(deferred_reset_streams_->deferred_actions);
+ deferred_reset_streams_ = absl::nullopt;
+
+ for (auto& action : deferred_actions) {
+ action();
}
}
- return false;
+ RTC_DCHECK(IsConsistent());
+}
+
+void ReassemblyQueue::EnterDeferredReset(
+ TSN sender_last_assigned_tsn,
+ rtc::ArrayView<const StreamID> streams) {
+ if (!deferred_reset_streams_.has_value()) {
+ RTC_DLOG(LS_VERBOSE) << log_prefix_
+ << "Entering deferred reset; sender_last_assigned_tsn="
+ << *sender_last_assigned_tsn;
+ deferred_reset_streams_ = absl::make_optional<DeferredResetStreams>(
+ tsn_unwrapper_.Unwrap(sender_last_assigned_tsn),
+ webrtc::flat_set<StreamID>(streams.begin(), streams.end()));
+ }
+ RTC_DCHECK(IsConsistent());
}
std::vector<DcSctpMessage> ReassemblyQueue::FlushMessages() {
@@ -237,18 +207,32 @@ void ReassemblyQueue::MaybeMoveLastAssembledWatermarkFurther() {
}
}
-void ReassemblyQueue::Handle(const AnyForwardTsnChunk& forward_tsn) {
- RTC_DCHECK(IsConsistent());
- UnwrappedTSN tsn = tsn_unwrapper_.Unwrap(forward_tsn.new_cumulative_tsn());
+void ReassemblyQueue::HandleForwardTsn(
+ TSN new_cumulative_tsn,
+ rtc::ArrayView<const AnyForwardTsnChunk::SkippedStream> skipped_streams) {
+ UnwrappedTSN tsn = tsn_unwrapper_.Unwrap(new_cumulative_tsn);
+ if (deferred_reset_streams_.has_value() &&
+ tsn > deferred_reset_streams_->sender_last_assigned_tsn) {
+ RTC_DLOG(LS_VERBOSE) << log_prefix_ << "ForwardTSN to " << *tsn.Wrap()
+ << "- deferring.";
+ deferred_reset_streams_->deferred_actions.emplace_back(
+ [this, new_cumulative_tsn,
+ streams = std::vector<AnyForwardTsnChunk::SkippedStream>(
+ skipped_streams.begin(), skipped_streams.end())] {
+ HandleForwardTsn(new_cumulative_tsn, streams);
+ });
+ RTC_DCHECK(IsConsistent());
+ return;
+ }
+
+ RTC_DLOG(LS_VERBOSE) << log_prefix_ << "ForwardTSN to " << *tsn.Wrap()
+ << " - performing.";
last_assembled_tsn_watermark_ = std::max(last_assembled_tsn_watermark_, tsn);
delivered_tsns_.erase(delivered_tsns_.begin(),
delivered_tsns_.upper_bound(tsn));
-
MaybeMoveLastAssembledWatermarkFurther();
-
- queued_bytes_ -=
- streams_->HandleForwardTsn(tsn, forward_tsn.skipped_streams());
+ queued_bytes_ -= streams_->HandleForwardTsn(tsn, skipped_streams);
RTC_DCHECK(IsConsistent());
}
diff --git a/net/dcsctp/rx/reassembly_queue.h b/net/dcsctp/rx/reassembly_queue.h
index e1f231e2a3..761ec3556c 100644
--- a/net/dcsctp/rx/reassembly_queue.h
+++ b/net/dcsctp/rx/reassembly_queue.h
@@ -19,6 +19,7 @@
#include <utility>
#include <vector>
+#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "net/dcsctp/common/internal_types.h"
@@ -30,6 +31,7 @@
#include "net/dcsctp/public/dcsctp_handover_state.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/rx/reassembly_streams.h"
+#include "rtc_base/containers/flat_set.h"
namespace dcsctp {
@@ -88,18 +90,18 @@ class ReassemblyQueue {
// Handle a ForwardTSN chunk, when the sender has indicated that the received
// (this class) should forget about some chunks. This is used to implement
// partial reliability.
- void Handle(const AnyForwardTsnChunk& forward_tsn);
+ void HandleForwardTsn(
+ TSN new_cumulative_tsn,
+ rtc::ArrayView<const AnyForwardTsnChunk::SkippedStream> skipped_streams);
- // Given the reset stream request and the current cum_tsn_ack, might either
- // reset the streams directly (returns kSuccessPerformed), or at a later time,
- // by entering the "deferred reset processing" mode (returns kInProgress).
- ReconfigurationResponseParameter::Result ResetStreams(
- const OutgoingSSNResetRequestParameter& req,
- TSN cum_tsn_ack);
+ // Resets the provided streams and leaves deferred reset processing, if
+ // enabled.
+ void ResetStreamsAndLeaveDeferredReset(
+ rtc::ArrayView<const StreamID> stream_ids);
- // Given the current (updated) cum_tsn_ack, might leave "defererred reset
- // processing" mode and reset streams. Returns true if so.
- bool MaybeResetStreamsDeferred(TSN cum_ack_tsn);
+ // Enters deferred reset processing.
+ void EnterDeferredReset(TSN sender_last_assigned_tsn,
+ rtc::ArrayView<const StreamID> streams);
// The number of payload bytes that have been queued. Note that the actual
// memory usage is higher due to additional overhead of tracking received
@@ -126,18 +128,22 @@ class ReassemblyQueue {
void RestoreFromState(const DcSctpSocketHandoverState& state);
private:
+ struct DeferredResetStreams {
+ DeferredResetStreams(UnwrappedTSN sender_last_assigned_tsn,
+ webrtc::flat_set<StreamID> streams)
+ : sender_last_assigned_tsn(sender_last_assigned_tsn),
+ streams(std::move(streams)) {}
+
+ UnwrappedTSN sender_last_assigned_tsn;
+ webrtc::flat_set<StreamID> streams;
+ std::vector<absl::AnyInvocable<void(void)>> deferred_actions;
+ };
+
bool IsConsistent() const;
void AddReassembledMessage(rtc::ArrayView<const UnwrappedTSN> tsns,
DcSctpMessage message);
void MaybeMoveLastAssembledWatermarkFurther();
- struct DeferredResetStreams {
- explicit DeferredResetStreams(OutgoingSSNResetRequestParameter req)
- : req(std::move(req)) {}
- OutgoingSSNResetRequestParameter req;
- std::vector<std::pair<TSN, Data>> deferred_chunks;
- };
-
const absl::string_view log_prefix_;
const size_t max_size_bytes_;
const size_t watermark_bytes_;
diff --git a/net/dcsctp/rx/reassembly_queue_test.cc b/net/dcsctp/rx/reassembly_queue_test.cc
index d7b9c1d821..fd8c423a5f 100644
--- a/net/dcsctp/rx/reassembly_queue_test.cc
+++ b/net/dcsctp/rx/reassembly_queue_test.cc
@@ -34,6 +34,7 @@ namespace {
using ::testing::ElementsAre;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using SkippedStream = AnyForwardTsnChunk::SkippedStream;
// The default maximum size of the Reassembly Queue.
static constexpr size_t kBufferSize = 10000;
@@ -194,7 +195,7 @@ TEST_F(ReassemblyQueueTest, ForwardTSNRemoveUnordered) {
EXPECT_FALSE(reasm.HasMessages());
- reasm.Handle(ForwardTsnChunk(TSN(13), {}));
+ reasm.HandleForwardTsn(TSN(13), std::vector<SkippedStream>());
EXPECT_EQ(reasm.queued_bytes(), 3u);
// The second lost chunk comes, message is assembled.
@@ -217,8 +218,8 @@ TEST_F(ReassemblyQueueTest, ForwardTSNRemoveOrdered) {
EXPECT_FALSE(reasm.HasMessages());
- reasm.Handle(ForwardTsnChunk(
- TSN(13), {ForwardTsnChunk::SkippedStream(kStreamID, kSSN)}));
+ reasm.HandleForwardTsn(
+ TSN(13), std::vector<SkippedStream>({SkippedStream(kStreamID, kSSN)}));
EXPECT_EQ(reasm.queued_bytes(), 0u);
// The lost chunk comes, but too late.
@@ -241,8 +242,8 @@ TEST_F(ReassemblyQueueTest, ForwardTSNRemoveALotOrdered) {
EXPECT_FALSE(reasm.HasMessages());
- reasm.Handle(ForwardTsnChunk(
- TSN(13), {ForwardTsnChunk::SkippedStream(kStreamID, kSSN)}));
+ reasm.HandleForwardTsn(
+ TSN(13), std::vector<SkippedStream>({SkippedStream(kStreamID, kSSN)}));
EXPECT_EQ(reasm.queued_bytes(), 0u);
// The lost chunk comes, but too late.
@@ -274,46 +275,24 @@ TEST_F(ReassemblyQueueTest, NotReadyForHandoverWhenDeliveredTsnsHaveGap) {
.Add(
HandoverUnreadinessReason::kUnorderedStreamHasUnassembledChunks));
- reasm.Handle(ForwardTsnChunk(TSN(13), {}));
+ reasm.HandleForwardTsn(TSN(13), std::vector<SkippedStream>());
EXPECT_EQ(reasm.GetHandoverReadiness(), HandoverReadinessStatus());
}
TEST_F(ReassemblyQueueTest, NotReadyForHandoverWhenResetStreamIsDeferred) {
ReassemblyQueue reasm("log: ", TSN(10), kBufferSize);
- DataGeneratorOptions opts;
- opts.message_id = MID(0);
- reasm.Add(TSN(10), gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- opts.message_id = MID(1);
- reasm.Add(TSN(11), gen_.Ordered({1, 2, 3, 4}, "BE", opts));
+ reasm.Add(TSN(10), gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(0)}));
+ reasm.Add(TSN(11), gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(1)}));
EXPECT_THAT(reasm.FlushMessages(), SizeIs(2));
- reasm.ResetStreams(
- OutgoingSSNResetRequestParameter(
- ReconfigRequestSN(10), ReconfigRequestSN(3), TSN(13), {StreamID(1)}),
- TSN(11));
+ reasm.EnterDeferredReset(TSN(12), std::vector<StreamID>({StreamID(1)}));
EXPECT_EQ(reasm.GetHandoverReadiness(),
HandoverReadinessStatus().Add(
HandoverUnreadinessReason::kStreamResetDeferred));
- opts.message_id = MID(3);
- opts.ppid = PPID(3);
- reasm.Add(TSN(13), gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm.MaybeResetStreamsDeferred(TSN(11));
+ reasm.Add(TSN(12), gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(2)}));
- opts.message_id = MID(2);
- opts.ppid = PPID(2);
- reasm.Add(TSN(13), gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm.MaybeResetStreamsDeferred(TSN(15));
- EXPECT_EQ(reasm.GetHandoverReadiness(),
- HandoverReadinessStatus().Add(
- HandoverUnreadinessReason::kReassemblyQueueDeliveredTSNsGap));
-
- EXPECT_THAT(reasm.FlushMessages(), SizeIs(2));
- EXPECT_EQ(reasm.GetHandoverReadiness(),
- HandoverReadinessStatus().Add(
- HandoverUnreadinessReason::kReassemblyQueueDeliveredTSNsGap));
-
- reasm.Handle(ForwardTsnChunk(TSN(15), {}));
+ reasm.ResetStreamsAndLeaveDeferredReset(std::vector<StreamID>({StreamID(1)}));
EXPECT_EQ(reasm.GetHandoverReadiness(), HandoverReadinessStatus());
}
@@ -427,9 +406,8 @@ TEST_F(ReassemblyQueueTest, IForwardTSNRemoveALotOrdered) {
ASSERT_FALSE(reasm.HasMessages());
EXPECT_EQ(reasm.queued_bytes(), 7u);
- reasm.Handle(
- IForwardTsnChunk(TSN(13), {IForwardTsnChunk::SkippedStream(
- IsUnordered(false), kStreamID, MID(0))}));
+ reasm.HandleForwardTsn(TSN(13), std::vector<SkippedStream>({SkippedStream(
+ IsUnordered(false), kStreamID, MID(0))}));
EXPECT_EQ(reasm.queued_bytes(), 0u);
// The lost chunk comes, but too late.
diff --git a/net/dcsctp/socket/BUILD.gn b/net/dcsctp/socket/BUILD.gn
index 681ddd47e9..04f61e5b72 100644
--- a/net/dcsctp/socket/BUILD.gn
+++ b/net/dcsctp/socket/BUILD.gn
@@ -11,6 +11,7 @@ import("../../../webrtc.gni")
rtc_source_set("context") {
sources = [ "context.h" ]
deps = [
+ "../../../api/units:time_delta",
"../common:internal_types",
"../packet:sctp_packet",
"../public:socket",
@@ -23,6 +24,7 @@ rtc_library("heartbeat_handler") {
deps = [
":context",
"../../../api:array_view",
+ "../../../api/units:time_delta",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
"../packet:bounded_io",
@@ -48,11 +50,12 @@ rtc_library("stream_reset_handler") {
deps = [
":context",
"../../../api:array_view",
+ "../../../api/units:time_delta",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
+ "../../../rtc_base:stringutils",
"../../../rtc_base/containers:flat_set",
"../common:internal_types",
- "../common:str_join",
"../packet:chunk",
"../packet:parameter",
"../packet:sctp_packet",
@@ -97,6 +100,7 @@ rtc_library("transmission_control_block") {
":stream_reset_handler",
"../../../api:array_view",
"../../../api/task_queue:task_queue",
+ "../../../api/units:time_delta",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
"../../../rtc_base:stringutils",
diff --git a/net/dcsctp/socket/callback_deferrer.cc b/net/dcsctp/socket/callback_deferrer.cc
index 123526e782..0a24020167 100644
--- a/net/dcsctp/socket/callback_deferrer.cc
+++ b/net/dcsctp/socket/callback_deferrer.cc
@@ -28,7 +28,7 @@ class MessageDeliverer {
}
private:
- struct State : public rtc::RefCountInterface {
+ struct State : public webrtc::RefCountInterface {
explicit State(DcSctpMessage&& m)
: has_delivered(false), message(std::move(m)) {}
bool has_delivered;
@@ -70,6 +70,8 @@ std::unique_ptr<Timeout> CallbackDeferrer::CreateTimeout(
}
TimeMs CallbackDeferrer::TimeMillis() {
+ // This should not be called by the library - it's migrated to `Now()`.
+ RTC_DCHECK(false);
// Will not be deferred - call directly.
return underlying_.TimeMillis();
}
diff --git a/net/dcsctp/socket/callback_deferrer.h b/net/dcsctp/socket/callback_deferrer.h
index 1c35dda6cf..6659e87155 100644
--- a/net/dcsctp/socket/callback_deferrer.h
+++ b/net/dcsctp/socket/callback_deferrer.h
@@ -65,6 +65,7 @@ class CallbackDeferrer : public DcSctpSocketCallbacks {
std::unique_ptr<Timeout> CreateTimeout(
webrtc::TaskQueueBase::DelayPrecision precision) override;
TimeMs TimeMillis() override;
+ webrtc::Timestamp Now() override { return underlying_.Now(); }
uint32_t GetRandomInt(uint32_t low, uint32_t high) override;
void OnMessageReceived(DcSctpMessage message) override;
void OnError(ErrorKind error, absl::string_view message) override;
diff --git a/net/dcsctp/socket/context.h b/net/dcsctp/socket/context.h
index eca5b9e4fb..8e970e8c8e 100644
--- a/net/dcsctp/socket/context.h
+++ b/net/dcsctp/socket/context.h
@@ -13,6 +13,7 @@
#include <cstdint>
#include "absl/strings/string_view.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/packet/sctp_packet.h"
#include "net/dcsctp/public/dcsctp_socket.h"
@@ -39,11 +40,11 @@ class Context {
// Returns the socket callbacks.
virtual DcSctpSocketCallbacks& callbacks() const = 0;
- // Observes a measured RTT value, in milliseconds.
- virtual void ObserveRTT(DurationMs rtt_ms) = 0;
+ // Observes a measured RTT value.
+ virtual void ObserveRTT(webrtc::TimeDelta rtt_ms) = 0;
// Returns the current Retransmission Timeout (rto) value, in milliseconds.
- virtual DurationMs current_rto() const = 0;
+ virtual webrtc::TimeDelta current_rto() const = 0;
// Increments the transmission error counter, given a human readable reason.
virtual bool IncrementTxErrorCounter(absl::string_view reason) = 0;
diff --git a/net/dcsctp/socket/dcsctp_socket.cc b/net/dcsctp/socket/dcsctp_socket.cc
index 2e29a5a9e0..21730276d2 100644
--- a/net/dcsctp/socket/dcsctp_socket.cc
+++ b/net/dcsctp/socket/dcsctp_socket.cc
@@ -82,6 +82,8 @@
namespace dcsctp {
namespace {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
// https://tools.ietf.org/html/rfc4960#section-5.1
constexpr uint32_t kMinVerificationTag = 1;
@@ -187,19 +189,19 @@ DcSctpSocket::DcSctpSocket(absl::string_view log_prefix,
t1_init_(timer_manager_.CreateTimer(
"t1-init",
absl::bind_front(&DcSctpSocket::OnInitTimerExpiry, this),
- TimerOptions(options.t1_init_timeout,
+ TimerOptions(options.t1_init_timeout.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
options.max_init_retransmits))),
t1_cookie_(timer_manager_.CreateTimer(
"t1-cookie",
absl::bind_front(&DcSctpSocket::OnCookieTimerExpiry, this),
- TimerOptions(options.t1_cookie_timeout,
+ TimerOptions(options.t1_cookie_timeout.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
options.max_init_retransmits))),
t2_shutdown_(timer_manager_.CreateTimer(
"t2-shutdown",
absl::bind_front(&DcSctpSocket::OnShutdownTimerExpiry, this),
- TimerOptions(options.t2_shutdown_timeout,
+ TimerOptions(options.t2_shutdown_timeout.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
options.max_retransmissions))),
packet_sender_(callbacks_,
@@ -518,7 +520,7 @@ SendStatus DcSctpSocket::Send(DcSctpMessage message,
return SendStatus::kErrorResourceExhaustion;
}
- TimeMs now = callbacks_.TimeMillis();
+ Timestamp now = callbacks_.Now();
++metrics_.tx_messages_count;
send_queue_.Add(now, std::move(message), send_options);
if (tcb_ != nullptr) {
@@ -600,7 +602,7 @@ absl::optional<Metrics> DcSctpSocket::GetMetrics() const {
Metrics metrics = metrics_;
metrics.cwnd_bytes = tcb_->cwnd();
- metrics.srtt_ms = tcb_->current_srtt().value();
+ metrics.srtt_ms = tcb_->current_srtt().ms();
size_t packet_payload_size =
options_.mtu - SctpPacket::kHeaderSize - DataChunk::kHeaderSize;
metrics.unack_data_count =
@@ -768,7 +770,7 @@ void DcSctpSocket::ReceivePacket(rtc::ArrayView<const uint8_t> data) {
++metrics_.rx_packets_count;
if (packet_observer_ != nullptr) {
- packet_observer_->OnReceivedPacket(callbacks_.TimeMillis(), data);
+ packet_observer_->OnReceivedPacket(TimeMs(callbacks_.Now().ms()), data);
}
absl::optional<SctpPacket> packet = SctpPacket::Parse(data, options_);
@@ -921,7 +923,7 @@ bool DcSctpSocket::HandleUnrecognizedChunk(
return continue_processing;
}
-absl::optional<DurationMs> DcSctpSocket::OnInitTimerExpiry() {
+TimeDelta DcSctpSocket::OnInitTimerExpiry() {
RTC_DLOG(LS_VERBOSE) << log_prefix() << "Timer " << t1_init_->name()
<< " has expired: " << t1_init_->expiration_count()
<< "/" << t1_init_->options().max_restarts.value_or(-1);
@@ -933,10 +935,10 @@ absl::optional<DurationMs> DcSctpSocket::OnInitTimerExpiry() {
InternalClose(ErrorKind::kTooManyRetries, "No INIT_ACK received");
}
RTC_DCHECK(IsConsistent());
- return absl::nullopt;
+ return TimeDelta::Zero();
}
-absl::optional<DurationMs> DcSctpSocket::OnCookieTimerExpiry() {
+TimeDelta DcSctpSocket::OnCookieTimerExpiry() {
// https://tools.ietf.org/html/rfc4960#section-4
// "If the T1-cookie timer expires, the endpoint MUST retransmit COOKIE
// ECHO and restart the T1-cookie timer without changing state. This MUST
@@ -951,16 +953,16 @@ absl::optional<DurationMs> DcSctpSocket::OnCookieTimerExpiry() {
RTC_DCHECK(state_ == State::kCookieEchoed);
if (t1_cookie_->is_running()) {
- tcb_->SendBufferedPackets(callbacks_.TimeMillis());
+ tcb_->SendBufferedPackets(callbacks_.Now());
} else {
InternalClose(ErrorKind::kTooManyRetries, "No COOKIE_ACK received");
}
RTC_DCHECK(IsConsistent());
- return absl::nullopt;
+ return TimeDelta::Zero();
}
-absl::optional<DurationMs> DcSctpSocket::OnShutdownTimerExpiry() {
+TimeDelta DcSctpSocket::OnShutdownTimerExpiry() {
RTC_DLOG(LS_VERBOSE) << log_prefix() << "Timer " << t2_shutdown_->name()
<< " has expired: " << t2_shutdown_->expiration_count()
<< "/"
@@ -980,7 +982,7 @@ absl::optional<DurationMs> DcSctpSocket::OnShutdownTimerExpiry() {
InternalClose(ErrorKind::kTooManyRetries, "No SHUTDOWN_ACK received");
RTC_DCHECK(IsConsistent());
- return absl::nullopt;
+ return TimeDelta::Zero();
}
// https://tools.ietf.org/html/rfc4960#section-9.2
@@ -996,7 +998,7 @@ void DcSctpSocket::OnSentPacket(rtc::ArrayView<const uint8_t> packet,
// The packet observer is invoked even if the packet was failed to be sent, to
// indicate an attempt was made.
if (packet_observer_ != nullptr) {
- packet_observer_->OnSentPacket(callbacks_.TimeMillis(), packet);
+ packet_observer_->OnSentPacket(TimeMs(callbacks_.Now().ms()), packet);
}
if (status == SendPacketStatus::kSuccess) {
@@ -1102,7 +1104,7 @@ void DcSctpSocket::HandleDataCommon(AnyDataChunk& chunk) {
if (tcb_->data_tracker().Observe(tsn, immediate_ack)) {
tcb_->reassembly_queue().Add(tsn, std::move(data));
- MaybeResetStreamsDeferredAndDeliverMessages();
+ MaybeDeliverMessages();
}
}
@@ -1282,7 +1284,7 @@ void DcSctpSocket::HandleInitAck(
// The connection isn't fully established just yet.
tcb_->SetCookieEchoChunk(CookieEchoChunk(cookie->data()));
- tcb_->SendBufferedPackets(callbacks_.TimeMillis());
+ tcb_->SendBufferedPackets(callbacks_.Now());
t1_cookie_->Start();
}
@@ -1351,7 +1353,7 @@ void DcSctpSocket::HandleCookieEcho(
// "A COOKIE ACK chunk may be bundled with any pending DATA chunks (and/or
// SACK chunks), but the COOKIE ACK chunk MUST be the first chunk in the
// packet."
- tcb_->SendBufferedPackets(b, callbacks_.TimeMillis());
+ tcb_->SendBufferedPackets(b, callbacks_.Now());
}
bool DcSctpSocket::HandleCookieEchoWithTCB(const CommonHeader& header,
@@ -1449,16 +1451,11 @@ void DcSctpSocket::HandleCookieAck(
t1_cookie_->Stop();
tcb_->ClearCookieEchoChunk();
SetState(State::kEstablished, "COOKIE_ACK received");
- tcb_->SendBufferedPackets(callbacks_.TimeMillis());
+ tcb_->SendBufferedPackets(callbacks_.Now());
callbacks_.OnConnected();
}
-void DcSctpSocket::MaybeResetStreamsDeferredAndDeliverMessages() {
- // As new data has been received, see if paused streams can be resumed, which
- // results in even more data added to the reassembly queue.
- tcb_->reassembly_queue().MaybeResetStreamsDeferred(
- tcb_->data_tracker().last_cumulative_acked_tsn());
-
+void DcSctpSocket::MaybeDeliverMessages() {
for (auto& message : tcb_->reassembly_queue().FlushMessages()) {
++metrics_.rx_messages_count;
callbacks_.OnMessageReceived(std::move(message));
@@ -1470,7 +1467,7 @@ void DcSctpSocket::HandleSack(const CommonHeader& header,
absl::optional<SackChunk> chunk = SackChunk::Parse(descriptor.data);
if (ValidateParseSuccess(chunk) && ValidateHasTCB()) {
- TimeMs now = callbacks_.TimeMillis();
+ Timestamp now = callbacks_.Now();
SackChunk sack = ChunkValidators::Clean(*std::move(chunk));
if (tcb_->retransmission_queue().HandleSack(now, sack)) {
@@ -1559,7 +1556,7 @@ void DcSctpSocket::HandleError(const CommonHeader& header,
void DcSctpSocket::HandleReconfig(
const CommonHeader& header,
const SctpPacket::ChunkDescriptor& descriptor) {
- TimeMs now = callbacks_.TimeMillis();
+ Timestamp now = callbacks_.Now();
absl::optional<ReConfigChunk> chunk = ReConfigChunk::Parse(descriptor.data);
if (ValidateParseSuccess(chunk) && ValidateHasTCB()) {
tcb_->stream_reset_handler().HandleReConfig(*std::move(chunk));
@@ -1571,6 +1568,10 @@ void DcSctpSocket::HandleReconfig(
// If a response was processed, pending to-be-reset streams may now have
// become unpaused. Try to send more DATA chunks.
tcb_->SendBufferedPackets(now);
+
+ // If it leaves "deferred reset processing", there may be chunks to deliver
+ // that were queued while waiting for the stream to reset.
+ MaybeDeliverMessages();
}
}
@@ -1710,12 +1711,12 @@ void DcSctpSocket::HandleForwardTsnCommon(const AnyForwardTsnChunk& chunk) {
return;
}
if (tcb_->data_tracker().HandleForwardTsn(chunk.new_cumulative_tsn())) {
- tcb_->reassembly_queue().Handle(chunk);
+ tcb_->reassembly_queue().HandleForwardTsn(chunk.new_cumulative_tsn(),
+ chunk.skipped_streams());
}
- // A forward TSN - for ordered streams - may allow messages to be
- // delivered.
- MaybeResetStreamsDeferredAndDeliverMessages();
+ // A forward TSN - for ordered streams - may allow messages to be delivered.
+ MaybeDeliverMessages();
}
void DcSctpSocket::MaybeSendShutdownOrAck() {
diff --git a/net/dcsctp/socket/dcsctp_socket.h b/net/dcsctp/socket/dcsctp_socket.h
index 4f7d1787a5..deb6ee23e7 100644
--- a/net/dcsctp/socket/dcsctp_socket.h
+++ b/net/dcsctp/socket/dcsctp_socket.h
@@ -155,9 +155,9 @@ class DcSctpSocket : public DcSctpSocketInterface {
// Closes the association, because of too many retransmission errors.
void CloseConnectionBecauseOfTooManyTransmissionErrors();
// Timer expiration handlers
- absl::optional<DurationMs> OnInitTimerExpiry();
- absl::optional<DurationMs> OnCookieTimerExpiry();
- absl::optional<DurationMs> OnShutdownTimerExpiry();
+ webrtc::TimeDelta OnInitTimerExpiry();
+ webrtc::TimeDelta OnCookieTimerExpiry();
+ webrtc::TimeDelta OnShutdownTimerExpiry();
void OnSentPacket(rtc::ArrayView<const uint8_t> packet,
SendPacketStatus status);
// Sends SHUTDOWN or SHUTDOWN-ACK if the socket is shutting down and if all
@@ -180,9 +180,8 @@ class DcSctpSocket : public DcSctpSocketInterface {
// sent and prints all chunks.
void DebugPrintOutgoing(rtc::ArrayView<const uint8_t> payload);
// Called whenever data has been received, or the cumulative acknowledgment
- // TSN has moved, that may result in performing deferred stream resetting and
- // delivering messages.
- void MaybeResetStreamsDeferredAndDeliverMessages();
+ // TSN has moved, that may result in delivering messages.
+ void MaybeDeliverMessages();
// Returns true if there is a TCB, and false otherwise (and reports an error).
bool ValidateHasTCB();
diff --git a/net/dcsctp/socket/dcsctp_socket_network_test.cc b/net/dcsctp/socket/dcsctp_socket_network_test.cc
index f097bfa095..f73ecce445 100644
--- a/net/dcsctp/socket/dcsctp_socket_network_test.cc
+++ b/net/dcsctp/socket/dcsctp_socket_network_test.cc
@@ -55,6 +55,8 @@ using ::testing::AllOf;
using ::testing::Ge;
using ::testing::Le;
using ::testing::SizeIs;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
constexpr StreamID kStreamId(1);
constexpr PPID kPpid(53);
@@ -142,13 +144,13 @@ class SctpActor : public DcSctpSocketCallbacks {
emulated_socket_(emulated_socket),
timeout_factory_(
*thread_,
- [this]() { return TimeMillis(); },
+ [this]() { return TimeMs(Now().ms()); },
[this](dcsctp::TimeoutID timeout_id) {
sctp_socket_.HandleTimeout(timeout_id);
}),
random_(GetUniqueSeed()),
sctp_socket_(name, *this, nullptr, sctp_options),
- last_bandwidth_printout_(TimeMs(TimeMillis())) {
+ last_bandwidth_printout_(Now()) {
emulated_socket.SetReceiver([this](rtc::CopyOnWriteBuffer buf) {
// The receiver will be executed on the NetworkEmulation task queue, but
// the dcSCTP socket is owned by `thread_` and is not thread-safe.
@@ -157,11 +159,11 @@ class SctpActor : public DcSctpSocketCallbacks {
}
void PrintBandwidth() {
- TimeMs now = TimeMillis();
- DurationMs duration = now - last_bandwidth_printout_;
+ Timestamp now = Now();
+ TimeDelta duration = now - last_bandwidth_printout_;
double bitrate_mbps =
- static_cast<double>(received_bytes_ * 8) / *duration / 1000;
+ static_cast<double>(received_bytes_ * 8) / duration.ms() / 1000;
RTC_LOG(LS_INFO) << log_prefix()
<< rtc::StringFormat("Received %0.2f Mbps", bitrate_mbps);
@@ -185,7 +187,7 @@ class SctpActor : public DcSctpSocketCallbacks {
return timeout_factory_.CreateTimeout(precision);
}
- TimeMs TimeMillis() override { return TimeMs(rtc::TimeMillis()); }
+ Timestamp Now() override { return Timestamp::Millis(rtc::TimeMillis()); }
uint32_t GetRandomInt(uint32_t low, uint32_t high) override {
return random_.Rand(low, high);
@@ -314,7 +316,7 @@ class SctpActor : public DcSctpSocketCallbacks {
DcSctpSocket sctp_socket_;
size_t received_bytes_ = 0;
absl::optional<DcSctpMessage> last_received_message_;
- TimeMs last_bandwidth_printout_;
+ Timestamp last_bandwidth_printout_;
// Per-second received bitrates, in Mbps
std::vector<double> received_bitrate_mbps_;
webrtc::ScopedTaskSafety safety_;
diff --git a/net/dcsctp/socket/dcsctp_socket_test.cc b/net/dcsctp/socket/dcsctp_socket_test.cc
index 13202846ac..dc76b80a37 100644
--- a/net/dcsctp/socket/dcsctp_socket_test.cc
+++ b/net/dcsctp/socket/dcsctp_socket_test.cc
@@ -73,6 +73,8 @@ using ::testing::Not;
using ::testing::Property;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
constexpr SendOptions kSendOptions;
constexpr size_t kLargeMessageSize = DcSctpOptions::kMaxSafeMTUSize * 20;
@@ -269,7 +271,7 @@ void RunTimers(SocketUnderTest& s) {
}
}
-void AdvanceTime(SocketUnderTest& a, SocketUnderTest& z, DurationMs duration) {
+void AdvanceTime(SocketUnderTest& a, SocketUnderTest& z, TimeDelta duration) {
a.cb.AdvanceTime(duration);
z.cb.AdvanceTime(duration);
@@ -282,14 +284,14 @@ void AdvanceTime(SocketUnderTest& a, SocketUnderTest& z, DurationMs duration) {
void ExchangeMessagesAndAdvanceTime(
SocketUnderTest& a,
SocketUnderTest& z,
- DurationMs max_timeout = DurationMs(10000)) {
- TimeMs time_started = a.cb.TimeMillis();
- while (a.cb.TimeMillis() - time_started < max_timeout) {
+ TimeDelta max_timeout = TimeDelta::Seconds(10)) {
+ Timestamp time_started = a.cb.Now();
+ while (a.cb.Now() - time_started < max_timeout) {
ExchangeMessages(a, z);
- DurationMs time_to_next_timeout =
+ TimeDelta time_to_next_timeout =
std::min(a.cb.GetTimeToNextTimeout(), z.cb.GetTimeToNextTimeout());
- if (time_to_next_timeout == DurationMs::InfiniteDuration()) {
+ if (time_to_next_timeout.IsPlusInfinity()) {
// No more pending timer.
return;
}
@@ -535,7 +537,7 @@ TEST(DcSctpSocketTest, EstablishConnectionLostCookieAck) {
EXPECT_EQ(z.socket.state(), SocketState::kConnected);
// This will make A re-send the COOKIE_ECHO
- AdvanceTime(a, z, DurationMs(a.options.t1_cookie_timeout));
+ AdvanceTime(a, z, a.options.t1_cookie_timeout.ToTimeDelta());
// Z reads COOKIE_ECHO, produces COOKIE_ACK
z.socket.ReceivePacket(a.cb.ConsumeSentPacket());
@@ -555,7 +557,7 @@ TEST(DcSctpSocketTest, ResendInitAndEstablishConnection) {
EXPECT_THAT(a.cb.ConsumeSentPacket(),
HasChunks(ElementsAre(IsChunkType(InitChunk::kType))));
- AdvanceTime(a, z, a.options.t1_init_timeout);
+ AdvanceTime(a, z, a.options.t1_init_timeout.ToTimeDelta());
// Z reads INIT, produces INIT_ACK
z.socket.ReceivePacket(a.cb.ConsumeSentPacket());
@@ -581,7 +583,7 @@ TEST(DcSctpSocketTest, ResendingInitTooManyTimesAborts) {
HasChunks(ElementsAre(IsChunkType(InitChunk::kType))));
for (int i = 0; i < *a.options.max_init_retransmits; ++i) {
- AdvanceTime(a, z, a.options.t1_init_timeout * (1 << i));
+ AdvanceTime(a, z, a.options.t1_init_timeout.ToTimeDelta() * (1 << i));
// INIT is resent
EXPECT_THAT(a.cb.ConsumeSentPacket(),
@@ -590,8 +592,9 @@ TEST(DcSctpSocketTest, ResendingInitTooManyTimesAborts) {
// Another timeout, after the max init retransmits.
EXPECT_CALL(a.cb, OnAborted).Times(1);
- AdvanceTime(
- a, z, a.options.t1_init_timeout * (1 << *a.options.max_init_retransmits));
+ AdvanceTime(a, z,
+ a.options.t1_init_timeout.ToTimeDelta() *
+ (1 << *a.options.max_init_retransmits));
EXPECT_EQ(a.socket.state(), SocketState::kClosed);
}
@@ -611,7 +614,7 @@ TEST(DcSctpSocketTest, ResendCookieEchoAndEstablishConnection) {
EXPECT_THAT(a.cb.ConsumeSentPacket(),
HasChunks(ElementsAre(IsChunkType(CookieEchoChunk::kType))));
- AdvanceTime(a, z, a.options.t1_init_timeout);
+ AdvanceTime(a, z, a.options.t1_init_timeout.ToTimeDelta());
// Z reads COOKIE_ECHO, produces COOKIE_ACK
z.socket.ReceivePacket(a.cb.ConsumeSentPacket());
@@ -638,7 +641,7 @@ TEST(DcSctpSocketTest, ResendingCookieEchoTooManyTimesAborts) {
HasChunks(ElementsAre(IsChunkType(CookieEchoChunk::kType))));
for (int i = 0; i < *a.options.max_init_retransmits; ++i) {
- AdvanceTime(a, z, a.options.t1_cookie_timeout * (1 << i));
+ AdvanceTime(a, z, a.options.t1_cookie_timeout.ToTimeDelta() * (1 << i));
// COOKIE_ECHO is resent
EXPECT_THAT(a.cb.ConsumeSentPacket(),
@@ -647,9 +650,9 @@ TEST(DcSctpSocketTest, ResendingCookieEchoTooManyTimesAborts) {
// Another timeout, after the max init retransmits.
EXPECT_CALL(a.cb, OnAborted).Times(1);
- AdvanceTime(
- a, z,
- a.options.t1_cookie_timeout * (1 << *a.options.max_init_retransmits));
+ AdvanceTime(a, z,
+ a.options.t1_cookie_timeout.ToTimeDelta() *
+ (1 << *a.options.max_init_retransmits));
EXPECT_EQ(a.socket.state(), SocketState::kClosed);
}
@@ -680,11 +683,13 @@ TEST(DcSctpSocketTest, DoesntSendMorePacketsUntilCookieAckHasBeenReceived) {
// will be T1-COOKIE that drives retransmissions, so when the T3-RTX expires,
// nothing should be retransmitted.
ASSERT_TRUE(a.options.rto_initial < a.options.t1_cookie_timeout);
- AdvanceTime(a, z, a.options.rto_initial);
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta());
EXPECT_THAT(a.cb.ConsumeSentPacket(), IsEmpty());
// When T1-COOKIE expires, both the COOKIE-ECHO and DATA should be present.
- AdvanceTime(a, z, a.options.t1_cookie_timeout - a.options.rto_initial);
+ AdvanceTime(a, z,
+ a.options.t1_cookie_timeout.ToTimeDelta() -
+ a.options.rto_initial.ToTimeDelta());
// And this COOKIE-ECHO and DATA is also lost - never received by Z.
EXPECT_THAT(a.cb.ConsumeSentPacket(),
@@ -694,7 +699,7 @@ TEST(DcSctpSocketTest, DoesntSendMorePacketsUntilCookieAckHasBeenReceived) {
EXPECT_THAT(a.cb.ConsumeSentPacket(), IsEmpty());
// COOKIE_ECHO has exponential backoff.
- AdvanceTime(a, z, a.options.t1_cookie_timeout * 2);
+ AdvanceTime(a, z, a.options.t1_cookie_timeout.ToTimeDelta() * 2);
// Z reads COOKIE_ECHO, produces COOKIE_ACK
z.socket.ReceivePacket(a.cb.ConsumeSentPacket());
@@ -747,7 +752,7 @@ TEST(DcSctpSocketTest, ShutdownTimerExpiresTooManyTimeClosesConnection) {
EXPECT_EQ(a.socket.state(), SocketState::kShuttingDown);
for (int i = 0; i < *a.options.max_retransmissions; ++i) {
- AdvanceTime(a, z, DurationMs(a.options.rto_initial * (1 << i)));
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta() * (1 << i));
// Dropping every shutdown chunk.
EXPECT_THAT(a.cb.ConsumeSentPacket(),
@@ -757,7 +762,8 @@ TEST(DcSctpSocketTest, ShutdownTimerExpiresTooManyTimeClosesConnection) {
// The last expiry, makes it abort the connection.
EXPECT_CALL(a.cb, OnAborted).Times(1);
AdvanceTime(a, z,
- a.options.rto_initial * (1 << *a.options.max_retransmissions));
+ a.options.rto_initial.ToTimeDelta() *
+ (1 << *a.options.max_retransmissions));
EXPECT_EQ(a.socket.state(), SocketState::kClosed);
EXPECT_THAT(a.cb.ConsumeSentPacket(),
@@ -815,7 +821,7 @@ TEST_P(DcSctpSocketParametrizedTest, TimeoutResendsPacket) {
a.cb.ConsumeSentPacket();
RTC_LOG(LS_INFO) << "Advancing time";
- AdvanceTime(a, *z, a.options.rto_initial);
+ AdvanceTime(a, *z, a.options.rto_initial.ToTimeDelta());
z->socket.ReceivePacket(a.cb.ConsumeSentPacket());
@@ -886,7 +892,7 @@ TEST_P(DcSctpSocketParametrizedTest, ExpectHeartbeatToBeSent) {
EXPECT_THAT(a.cb.ConsumeSentPacket(), IsEmpty());
- AdvanceTime(a, *z, a.options.heartbeat_interval);
+ AdvanceTime(a, *z, a.options.heartbeat_interval.ToTimeDelta());
std::vector<uint8_t> packet = a.cb.ConsumeSentPacket();
// The info is a single 64-bit number.
@@ -920,7 +926,7 @@ TEST_P(DcSctpSocketParametrizedTest,
for (int i = 0; i < *a.options.max_retransmissions; ++i) {
RTC_LOG(LS_INFO) << "Letting HEARTBEAT interval timer expire - sending...";
- AdvanceTime(a, *z, time_to_next_hearbeat);
+ AdvanceTime(a, *z, time_to_next_hearbeat.ToTimeDelta());
// Dropping every heartbeat.
ASSERT_HAS_VALUE_AND_ASSIGN(
@@ -929,20 +935,20 @@ TEST_P(DcSctpSocketParametrizedTest,
EXPECT_EQ(hb_packet.descriptors()[0].type, HeartbeatRequestChunk::kType);
RTC_LOG(LS_INFO) << "Letting the heartbeat expire.";
- AdvanceTime(a, *z, DurationMs(1000));
+ AdvanceTime(a, *z, TimeDelta::Millis(1000));
time_to_next_hearbeat = a.options.heartbeat_interval - DurationMs(1000);
}
RTC_LOG(LS_INFO) << "Letting HEARTBEAT interval timer expire - sending...";
- AdvanceTime(a, *z, time_to_next_hearbeat);
+ AdvanceTime(a, *z, time_to_next_hearbeat.ToTimeDelta());
// Last heartbeat
EXPECT_THAT(a.cb.ConsumeSentPacket(), Not(IsEmpty()));
EXPECT_CALL(a.cb, OnAborted).Times(1);
// Should suffice as exceeding RTO
- AdvanceTime(a, *z, DurationMs(1000));
+ AdvanceTime(a, *z, TimeDelta::Millis(1000));
z = MaybeHandoverSocket(std::move(z));
}
@@ -959,7 +965,7 @@ TEST_P(DcSctpSocketParametrizedTest, RecoversAfterASuccessfulAck) {
// Force-close socket Z so that it doesn't interfere from now on.
z->socket.Close();
- DurationMs time_to_next_hearbeat = a.options.heartbeat_interval;
+ TimeDelta time_to_next_hearbeat = a.options.heartbeat_interval.ToTimeDelta();
for (int i = 0; i < *a.options.max_retransmissions; ++i) {
AdvanceTime(a, *z, time_to_next_hearbeat);
@@ -968,9 +974,10 @@ TEST_P(DcSctpSocketParametrizedTest, RecoversAfterASuccessfulAck) {
a.cb.ConsumeSentPacket();
RTC_LOG(LS_INFO) << "Letting the heartbeat expire.";
- AdvanceTime(a, *z, DurationMs(1000));
+ AdvanceTime(a, *z, TimeDelta::Seconds(1));
- time_to_next_hearbeat = a.options.heartbeat_interval - DurationMs(1000);
+ time_to_next_hearbeat =
+ a.options.heartbeat_interval.ToTimeDelta() - TimeDelta::Seconds(1);
}
RTC_LOG(LS_INFO) << "Getting the last heartbeat - and acking it";
@@ -990,7 +997,7 @@ TEST_P(DcSctpSocketParametrizedTest, RecoversAfterASuccessfulAck) {
// Should suffice as exceeding RTO - which will not fire.
EXPECT_CALL(a.cb, OnAborted).Times(0);
- AdvanceTime(a, *z, DurationMs(1000));
+ AdvanceTime(a, *z, TimeDelta::Seconds(1));
EXPECT_THAT(a.cb.ConsumeSentPacket(), IsEmpty());
@@ -1245,7 +1252,7 @@ TEST_P(DcSctpSocketParametrizedTest, SendMessageWithLimitedRtx) {
a.socket.ReceivePacket(z->cb.ConsumeSentPacket());
// Handle delayed SACK for third DATA
- AdvanceTime(a, *z, a.options.delayed_ack_max_timeout);
+ AdvanceTime(a, *z, a.options.delayed_ack_max_timeout.ToTimeDelta());
// Handle SACK for second DATA
a.socket.ReceivePacket(z->cb.ConsumeSentPacket());
@@ -1254,7 +1261,7 @@ TEST_P(DcSctpSocketParametrizedTest, SendMessageWithLimitedRtx) {
// in-flight and the reported gap could be due to out-of-order delivery. So
// the RetransmissionQueue will not mark it as "to be retransmitted" until
// after the t3-rtx timer has expired.
- AdvanceTime(a, *z, a.options.rto_initial);
+ AdvanceTime(a, *z, a.options.rto_initial.ToTimeDelta());
// The chunk will be marked as retransmitted, and then as abandoned, which
// will trigger a FORWARD-TSN to be sent.
@@ -1352,7 +1359,7 @@ TEST_P(DcSctpSocketParametrizedTest, SendManyFragmentedMessagesWithLimitedRtx) {
ExchangeMessages(a, *z);
// Let the RTX timer expire, and exchange FORWARD-TSN/SACKs
- AdvanceTime(a, *z, a.options.rto_initial);
+ AdvanceTime(a, *z, a.options.rto_initial.ToTimeDelta());
ExchangeMessages(a, *z);
@@ -1484,7 +1491,7 @@ TEST(DcSctpSocketTest, PassingHighWatermarkWillOnlyAcceptCumAckTsn) {
.Build());
// The receiver might have moved into delayed ack mode.
- AdvanceTime(a, z, z.options.rto_initial);
+ AdvanceTime(a, z, z.options.rto_initial.ToTimeDelta());
EXPECT_THAT(z.cb.ConsumeSentPacket(),
HasChunks(ElementsAre(IsSack(
@@ -1528,7 +1535,7 @@ TEST(DcSctpSocketTest, PassingHighWatermarkWillOnlyAcceptCumAckTsn) {
.Build());
// The receiver might have moved into delayed ack mode.
- AdvanceTime(a, z, z.options.rto_initial);
+ AdvanceTime(a, z, z.options.rto_initial.ToTimeDelta());
EXPECT_THAT(z.cb.ConsumeSentPacket(),
HasChunks(ElementsAre(IsSack(
@@ -1562,13 +1569,13 @@ TEST_P(DcSctpSocketParametrizedTest, SendsMessagesWithLowLifetime) {
z = MaybeHandoverSocket(std::move(z));
// Mock that the time always goes forward.
- TimeMs now(0);
- EXPECT_CALL(a.cb, TimeMillis).WillRepeatedly([&]() {
- now += DurationMs(3);
+ Timestamp now = Timestamp::Zero();
+ EXPECT_CALL(a.cb, Now).WillRepeatedly([&]() {
+ now += TimeDelta::Millis(3);
return now;
});
- EXPECT_CALL(z->cb, TimeMillis).WillRepeatedly([&]() {
- now += DurationMs(3);
+ EXPECT_CALL(z->cb, Now).WillRepeatedly([&]() {
+ now += TimeDelta::Millis(3);
return now;
});
@@ -1592,7 +1599,7 @@ TEST_P(DcSctpSocketParametrizedTest, SendsMessagesWithLowLifetime) {
EXPECT_FALSE(z->cb.ConsumeReceivedMessage().has_value());
// Validate that the sockets really make the time move forward.
- EXPECT_GE(*now, kIterations * 2);
+ EXPECT_GE(now.ms(), kIterations * 2);
MaybeHandoverSocketAndSendMessage(a, std::move(z));
}
@@ -1614,13 +1621,13 @@ TEST_P(DcSctpSocketParametrizedTest,
lifetime_1.lifetime = DurationMs(1);
// Mock that the time always goes forward.
- TimeMs now(0);
- EXPECT_CALL(a.cb, TimeMillis).WillRepeatedly([&]() {
- now += DurationMs(3);
+ Timestamp now = Timestamp::Zero();
+ EXPECT_CALL(a.cb, Now).WillRepeatedly([&]() {
+ now += TimeDelta::Millis(3);
return now;
});
- EXPECT_CALL(z->cb, TimeMillis).WillRepeatedly([&]() {
- now += DurationMs(3);
+ EXPECT_CALL(z->cb, Now).WillRepeatedly([&]() {
+ now += TimeDelta::Millis(3);
return now;
});
@@ -1944,7 +1951,7 @@ TEST(DcSctpSocketTest, RxAndTxPacketMetricsIncrease) {
EXPECT_EQ(z.socket.GetMetrics()->rx_messages_count, 2u);
// Delayed sack
- AdvanceTime(a, z, a.options.delayed_ack_max_timeout);
+ AdvanceTime(a, z, a.options.delayed_ack_max_timeout.ToTimeDelta());
a.socket.ReceivePacket(z.cb.ConsumeSentPacket()); // SACK
EXPECT_EQ(a.socket.GetMetrics()->unack_data_count, 0u);
@@ -1981,7 +1988,7 @@ TEST(DcSctpSocketTest, RetransmissionMetricsAreSetForNormalRetransmit) {
a.socket.Send(DcSctpMessage(StreamID(1), PPID(53), payload), kSendOptions);
a.cb.ConsumeSentPacket();
- AdvanceTime(a, z, a.options.rto_initial);
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta());
ExchangeMessages(a, z);
EXPECT_EQ(a.socket.GetMetrics()->rtx_packets_count, 1u);
@@ -2185,7 +2192,7 @@ TEST_P(DcSctpSocketParametrizedTest, CanLoseFirstOrderedMessage) {
// First DATA is lost, and retransmission timer will delete it.
a.cb.ConsumeSentPacket();
- AdvanceTime(a, *z, a.options.rto_initial);
+ AdvanceTime(a, *z, a.options.rto_initial.ToTimeDelta());
ExchangeMessages(a, *z);
// Send a second message (SID=0, SSN=1).
@@ -2574,7 +2581,7 @@ TEST(DcSctpSocketTest, LifecycleEventsAreGeneratedForAckedMessages) {
EXPECT_CALL(a.cb, OnLifecycleEnd(LifecycleId(42)));
ExchangeMessages(a, z);
// In case of delayed ack.
- AdvanceTime(a, z, a.options.delayed_ack_max_timeout);
+ AdvanceTime(a, z, a.options.delayed_ack_max_timeout.ToTimeDelta());
ExchangeMessages(a, z);
EXPECT_THAT(GetReceivedMessagePpids(z), ElementsAre(101, 102, 103));
@@ -2617,15 +2624,15 @@ TEST(DcSctpSocketTest, LifecycleEventsForFailMaxRetransmissions) {
ExchangeMessages(a, z);
// Handle delayed SACK.
- AdvanceTime(a, z, a.options.delayed_ack_max_timeout);
+ AdvanceTime(a, z, a.options.delayed_ack_max_timeout.ToTimeDelta());
ExchangeMessages(a, z);
// The chunk is now NACKed. Let the RTO expire, to discard the message.
- AdvanceTime(a, z, a.options.rto_initial);
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta());
ExchangeMessages(a, z);
// Handle delayed SACK.
- AdvanceTime(a, z, a.options.delayed_ack_max_timeout);
+ AdvanceTime(a, z, a.options.delayed_ack_max_timeout.ToTimeDelta());
ExchangeMessages(a, z);
EXPECT_THAT(GetReceivedMessagePpids(z), ElementsAre(51, 53));
@@ -2672,7 +2679,7 @@ TEST(DcSctpSocketTest, LifecycleEventsForExpiredMessageWithLifetimeLimit) {
.lifecycle_id = LifecycleId(1),
});
- AdvanceTime(a, z, DurationMs(200));
+ AdvanceTime(a, z, TimeDelta::Millis(200));
EXPECT_CALL(a.cb, OnLifecycleMessageExpired(LifecycleId(1),
/*maybe_delivered=*/false));
@@ -2769,7 +2776,7 @@ TEST(DcSctpSocketTest, ResetStreamsDeferred) {
// Z sent "in progress", which will make A buffer packets until it's sure
// that the reconfiguration has been applied. A will retry - wait for that.
- AdvanceTime(a, z, a.options.rto_initial);
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta());
auto reconfig2 = a.cb.ConsumeSentPacket();
EXPECT_THAT(reconfig2, HasChunks(ElementsAre(IsReConfig(HasParameters(
@@ -3018,7 +3025,7 @@ TEST(DcSctpSocketTest, HandlesForwardTsnOutOfOrderWithStreamResetting) {
HasChunks(ElementsAre(
IsDataChunk(AllOf(Property(&DataChunk::ssn, SSN(0)),
Property(&DataChunk::ppid, PPID(51)))))));
- AdvanceTime(a, z, a.options.rto_initial);
+ AdvanceTime(a, z, a.options.rto_initial.ToTimeDelta());
auto fwd_tsn_packet = a.cb.ConsumeSentPacket();
EXPECT_THAT(fwd_tsn_packet,
diff --git a/net/dcsctp/socket/heartbeat_handler.cc b/net/dcsctp/socket/heartbeat_handler.cc
index 902dff962f..31211e0d13 100644
--- a/net/dcsctp/socket/heartbeat_handler.cc
+++ b/net/dcsctp/socket/heartbeat_handler.cc
@@ -21,6 +21,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/packet/bounded_byte_reader.h"
#include "net/dcsctp/packet/bounded_byte_writer.h"
#include "net/dcsctp/packet/chunk/heartbeat_ack_chunk.h"
@@ -35,6 +36,8 @@
#include "rtc_base/logging.h"
namespace dcsctp {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
// This is stored (in serialized form) as HeartbeatInfoParameter sent in
// HeartbeatRequestChunk and received back in HeartbeatAckChunk. It should be
@@ -49,11 +52,11 @@ class HeartbeatInfo {
static constexpr size_t kBufferSize = sizeof(uint64_t);
static_assert(kBufferSize == 8, "Unexpected buffer size");
- explicit HeartbeatInfo(TimeMs created_at) : created_at_(created_at) {}
+ explicit HeartbeatInfo(Timestamp created_at) : created_at_(created_at) {}
std::vector<uint8_t> Serialize() {
- uint32_t high_bits = static_cast<uint32_t>(*created_at_ >> 32);
- uint32_t low_bits = static_cast<uint32_t>(*created_at_);
+ uint32_t high_bits = static_cast<uint32_t>(created_at_.ms() >> 32);
+ uint32_t low_bits = static_cast<uint32_t>(created_at_.ms());
std::vector<uint8_t> data(kBufferSize);
BoundedByteWriter<kBufferSize> writer(data);
@@ -75,13 +78,13 @@ class HeartbeatInfo {
uint32_t low_bits = reader.Load32<4>();
uint64_t created_at = static_cast<uint64_t>(high_bits) << 32 | low_bits;
- return HeartbeatInfo(TimeMs(created_at));
+ return HeartbeatInfo(Timestamp::Millis(created_at));
}
- TimeMs created_at() const { return created_at_; }
+ Timestamp created_at() const { return created_at_; }
private:
- const TimeMs created_at_;
+ const Timestamp created_at_;
};
HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
@@ -91,17 +94,18 @@ HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
: log_prefix_(log_prefix),
ctx_(context),
timer_manager_(timer_manager),
- interval_duration_(options.heartbeat_interval),
+ interval_duration_(options.heartbeat_interval.ToTimeDelta()),
interval_duration_should_include_rtt_(
options.heartbeat_interval_include_rtt),
interval_timer_(timer_manager_->CreateTimer(
"heartbeat-interval",
absl::bind_front(&HeartbeatHandler::OnIntervalTimerExpiry, this),
- TimerOptions(interval_duration_, TimerBackoffAlgorithm::kFixed))),
+ TimerOptions(interval_duration_,
+ TimerBackoffAlgorithm::kFixed))),
timeout_timer_(timer_manager_->CreateTimer(
"heartbeat-timeout",
absl::bind_front(&HeartbeatHandler::OnTimeoutTimerExpiry, this),
- TimerOptions(options.rto_initial,
+ TimerOptions(options.rto_initial.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
/*max_restarts=*/0))) {
// The interval timer must always be running as long as the association is up.
@@ -109,7 +113,7 @@ HeartbeatHandler::HeartbeatHandler(absl::string_view log_prefix,
}
void HeartbeatHandler::RestartTimer() {
- if (interval_duration_ == DurationMs(0)) {
+ if (interval_duration_.IsZero()) {
// Heartbeating has been disabled.
return;
}
@@ -117,7 +121,8 @@ void HeartbeatHandler::RestartTimer() {
if (interval_duration_should_include_rtt_) {
// The RTT should be used, but it's not easy accessible. The RTO will
// suffice.
- interval_timer_->set_duration(interval_duration_ + ctx_->current_rto());
+ interval_timer_->set_duration(
+ interval_duration_ + ctx_->current_rto());
} else {
interval_timer_->set_duration(interval_duration_);
}
@@ -153,8 +158,8 @@ void HeartbeatHandler::HandleHeartbeatAck(HeartbeatAckChunk chunk) {
return;
}
- TimeMs now = ctx_->callbacks().TimeMillis();
- if (info->created_at() > TimeMs(0) && info->created_at() <= now) {
+ Timestamp now = ctx_->callbacks().Now();
+ if (info->created_at() > Timestamp::Zero() && info->created_at() <= now) {
ctx_->ObserveRTT(now - info->created_at());
}
@@ -164,13 +169,13 @@ void HeartbeatHandler::HandleHeartbeatAck(HeartbeatAckChunk chunk) {
ctx_->ClearTxErrorCounter();
}
-absl::optional<DurationMs> HeartbeatHandler::OnIntervalTimerExpiry() {
+TimeDelta HeartbeatHandler::OnIntervalTimerExpiry() {
if (ctx_->is_connection_established()) {
- HeartbeatInfo info(ctx_->callbacks().TimeMillis());
+ HeartbeatInfo info(ctx_->callbacks().Now());
timeout_timer_->set_duration(ctx_->current_rto());
timeout_timer_->Start();
RTC_DLOG(LS_INFO) << log_prefix_ << "Sending HEARTBEAT with timeout "
- << *timeout_timer_->duration();
+ << webrtc::ToString(timeout_timer_->duration());
Parameters parameters = Parameters::Builder()
.Add(HeartbeatInfoParameter(info.Serialize()))
@@ -183,14 +188,14 @@ absl::optional<DurationMs> HeartbeatHandler::OnIntervalTimerExpiry() {
<< log_prefix_
<< "Will not send HEARTBEAT when connection not established";
}
- return absl::nullopt;
+ return TimeDelta::Zero();
}
-absl::optional<DurationMs> HeartbeatHandler::OnTimeoutTimerExpiry() {
+TimeDelta HeartbeatHandler::OnTimeoutTimerExpiry() {
// Note that the timeout timer is not restarted. It will be started again when
// the interval timer expires.
RTC_DCHECK(!timeout_timer_->is_running());
ctx_->IncrementTxErrorCounter("HEARTBEAT timeout");
- return absl::nullopt;
+ return TimeDelta::Zero();
}
} // namespace dcsctp
diff --git a/net/dcsctp/socket/heartbeat_handler.h b/net/dcsctp/socket/heartbeat_handler.h
index 318b02955b..ac58b97a64 100644
--- a/net/dcsctp/socket/heartbeat_handler.h
+++ b/net/dcsctp/socket/heartbeat_handler.h
@@ -50,14 +50,14 @@ class HeartbeatHandler {
void HandleHeartbeatAck(HeartbeatAckChunk chunk);
private:
- absl::optional<DurationMs> OnIntervalTimerExpiry();
- absl::optional<DurationMs> OnTimeoutTimerExpiry();
+ webrtc::TimeDelta OnIntervalTimerExpiry();
+ webrtc::TimeDelta OnTimeoutTimerExpiry();
const absl::string_view log_prefix_;
Context* ctx_;
TimerManager* timer_manager_;
// The time for a connection to be idle before a heartbeat is sent.
- const DurationMs interval_duration_;
+ const webrtc::TimeDelta interval_duration_;
// Adding RTT to the duration will add some jitter, which is good in
// production, but less good in unit tests, which is why it can be disabled.
const bool interval_duration_should_include_rtt_;
diff --git a/net/dcsctp/socket/heartbeat_handler_test.cc b/net/dcsctp/socket/heartbeat_handler_test.cc
index d573192440..4475527322 100644
--- a/net/dcsctp/socket/heartbeat_handler_test.cc
+++ b/net/dcsctp/socket/heartbeat_handler_test.cc
@@ -30,6 +30,7 @@ using ::testing::IsEmpty;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::SizeIs;
+using ::webrtc::TimeDelta;
constexpr DurationMs kHeartbeatInterval = DurationMs(30'000);
@@ -51,7 +52,7 @@ class HeartbeatHandlerTestBase : public testing::Test {
}),
handler_("log: ", options_, &context_, &timer_manager_) {}
- void AdvanceTime(DurationMs duration) {
+ void AdvanceTime(webrtc::TimeDelta duration) {
callbacks_.AdvanceTime(duration);
for (;;) {
absl::optional<TimeoutID> timeout_id = callbacks_.GetNextExpiredTimeout();
@@ -80,7 +81,7 @@ class DisabledHeartbeatHandlerTest : public HeartbeatHandlerTestBase {
};
TEST_F(HeartbeatHandlerTest, HasRunningHeartbeatIntervalTimer) {
- AdvanceTime(options_.heartbeat_interval);
+ AdvanceTime(options_.heartbeat_interval.ToTimeDelta());
// Validate that a heartbeat request was sent.
std::vector<uint8_t> payload = callbacks_.ConsumeSentPacket();
@@ -119,7 +120,7 @@ TEST_F(HeartbeatHandlerTest, RepliesToHeartbeatRequests) {
}
TEST_F(HeartbeatHandlerTest, SendsHeartbeatRequestsOnIdleChannel) {
- AdvanceTime(options_.heartbeat_interval);
+ AdvanceTime(options_.heartbeat_interval.ToTimeDelta());
// Grab the request, and make a response.
std::vector<uint8_t> payload = callbacks_.ConsumeSentPacket();
@@ -134,7 +135,7 @@ TEST_F(HeartbeatHandlerTest, SendsHeartbeatRequestsOnIdleChannel) {
HeartbeatAckChunk ack(std::move(req).extract_parameters());
// Respond a while later. This RTT will be measured by the handler
- constexpr DurationMs rtt(313);
+ constexpr TimeDelta rtt = TimeDelta::Millis(313);
EXPECT_CALL(context_, ObserveRTT(rtt)).Times(1);
@@ -143,7 +144,7 @@ TEST_F(HeartbeatHandlerTest, SendsHeartbeatRequestsOnIdleChannel) {
}
TEST_F(HeartbeatHandlerTest, DoesntObserveInvalidHeartbeats) {
- AdvanceTime(options_.heartbeat_interval);
+ AdvanceTime(options_.heartbeat_interval.ToTimeDelta());
// Grab the request, and make a response.
std::vector<uint8_t> payload = callbacks_.ConsumeSentPacket();
@@ -161,15 +162,15 @@ TEST_F(HeartbeatHandlerTest, DoesntObserveInvalidHeartbeats) {
// Go backwards in time - which make the HEARTBEAT-ACK have an invalid
// timestamp in it, as it will be in the future.
- callbacks_.AdvanceTime(DurationMs(-100));
+ callbacks_.AdvanceTime(TimeDelta::Millis(-100));
handler_.HandleHeartbeatAck(std::move(ack));
}
TEST_F(HeartbeatHandlerTest, IncreasesErrorIfNotAckedInTime) {
- DurationMs rto(105);
+ TimeDelta rto = TimeDelta::Millis(105);
EXPECT_CALL(context_, current_rto).WillOnce(Return(rto));
- AdvanceTime(options_.heartbeat_interval);
+ AdvanceTime(options_.heartbeat_interval.ToTimeDelta());
// Validate that a request was sent.
EXPECT_THAT(callbacks_.ConsumeSentPacket(), Not(IsEmpty()));
@@ -179,7 +180,7 @@ TEST_F(HeartbeatHandlerTest, IncreasesErrorIfNotAckedInTime) {
}
TEST_F(DisabledHeartbeatHandlerTest, IsReallyDisabled) {
- AdvanceTime(options_.heartbeat_interval);
+ AdvanceTime(options_.heartbeat_interval.ToTimeDelta());
// Validate that a request was NOT sent.
EXPECT_THAT(callbacks_.ConsumeSentPacket(), IsEmpty());
diff --git a/net/dcsctp/socket/mock_context.h b/net/dcsctp/socket/mock_context.h
index 88e71d1b35..bbd9cd17d9 100644
--- a/net/dcsctp/socket/mock_context.h
+++ b/net/dcsctp/socket/mock_context.h
@@ -40,7 +40,8 @@ class MockContext : public Context {
ON_CALL(*this, peer_initial_tsn)
.WillByDefault(testing::Return(PeerInitialTsn()));
ON_CALL(*this, callbacks).WillByDefault(testing::ReturnRef(callbacks_));
- ON_CALL(*this, current_rto).WillByDefault(testing::Return(DurationMs(123)));
+ ON_CALL(*this, current_rto)
+ .WillByDefault(testing::Return(webrtc::TimeDelta::Millis(123)));
ON_CALL(*this, Send).WillByDefault([this](SctpPacket::Builder& builder) {
callbacks_.SendPacketWithStatus(builder.Build());
});
@@ -51,8 +52,8 @@ class MockContext : public Context {
MOCK_METHOD(TSN, peer_initial_tsn, (), (const, override));
MOCK_METHOD(DcSctpSocketCallbacks&, callbacks, (), (const, override));
- MOCK_METHOD(void, ObserveRTT, (DurationMs rtt_ms), (override));
- MOCK_METHOD(DurationMs, current_rto, (), (const, override));
+ MOCK_METHOD(void, ObserveRTT, (webrtc::TimeDelta rtt), (override));
+ MOCK_METHOD(webrtc::TimeDelta, current_rto, (), (const, override));
MOCK_METHOD(bool,
IncrementTxErrorCounter,
(absl::string_view reason),
diff --git a/net/dcsctp/socket/mock_dcsctp_socket_callbacks.h b/net/dcsctp/socket/mock_dcsctp_socket_callbacks.h
index 150c1b9fa5..972e547b12 100644
--- a/net/dcsctp/socket/mock_dcsctp_socket_callbacks.h
+++ b/net/dcsctp/socket/mock_dcsctp_socket_callbacks.h
@@ -80,7 +80,7 @@ class MockDcSctpSocketCallbacks : public DcSctpSocketCallbacks {
<< log_prefix_ << "Socket abort: " << ToString(error) << "; "
<< message;
});
- ON_CALL(*this, TimeMillis).WillByDefault([this]() { return now_; });
+ ON_CALL(*this, Now).WillByDefault([this]() { return now_; });
}
MOCK_METHOD(SendPacketStatus,
@@ -94,7 +94,7 @@ class MockDcSctpSocketCallbacks : public DcSctpSocketCallbacks {
return timeout_manager_.CreateTimeout();
}
- MOCK_METHOD(TimeMs, TimeMillis, (), (override));
+ MOCK_METHOD(webrtc::Timestamp, Now, (), (override));
uint32_t GetRandomInt(uint32_t low, uint32_t high) override {
return random_.Rand(low, high);
}
@@ -159,20 +159,20 @@ class MockDcSctpSocketCallbacks : public DcSctpSocketCallbacks {
return ret;
}
- void AdvanceTime(DurationMs duration_ms) { now_ = now_ + duration_ms; }
- void SetTime(TimeMs now) { now_ = now; }
+ void AdvanceTime(webrtc::TimeDelta duration) { now_ = now_ + duration; }
+ void SetTime(webrtc::Timestamp now) { now_ = now; }
absl::optional<TimeoutID> GetNextExpiredTimeout() {
return timeout_manager_.GetNextExpiredTimeout();
}
- DurationMs GetTimeToNextTimeout() const {
+ webrtc::TimeDelta GetTimeToNextTimeout() const {
return timeout_manager_.GetTimeToNextTimeout();
}
private:
const std::string log_prefix_;
- TimeMs now_ = TimeMs(0);
+ webrtc::Timestamp now_ = webrtc::Timestamp::Zero();
webrtc::Random random_;
FakeTimeoutManager timeout_manager_;
std::deque<std::vector<uint8_t>> sent_packets_;
diff --git a/net/dcsctp/socket/stream_reset_handler.cc b/net/dcsctp/socket/stream_reset_handler.cc
index f9201eadf0..fafb9933e5 100644
--- a/net/dcsctp/socket/stream_reset_handler.cc
+++ b/net/dcsctp/socket/stream_reset_handler.cc
@@ -16,8 +16,8 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/common/internal_types.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/chunk/reconfig_chunk.h"
#include "net/dcsctp/packet/parameter/add_incoming_streams_request_parameter.h"
#include "net/dcsctp/packet/parameter/add_outgoing_streams_request_parameter.h"
@@ -35,9 +35,11 @@
#include "net/dcsctp/timer/timer.h"
#include "net/dcsctp/tx/retransmission_queue.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
namespace dcsctp {
namespace {
+using ::webrtc::TimeDelta;
using ResponseResult = ReconfigurationResponseParameter::Result;
bool DescriptorsAre(const std::vector<ParameterDescriptor>& c,
@@ -131,7 +133,7 @@ void StreamResetHandler::HandleReConfig(ReConfigChunk chunk) {
}
bool StreamResetHandler::ValidateReqSeqNbr(
- ReconfigRequestSN req_seq_nbr,
+ UnwrappedReconfigRequestSn req_seq_nbr,
std::vector<ReconfigurationResponseParameter>& responses) {
if (req_seq_nbr == last_processed_req_seq_nbr_) {
// https://www.rfc-editor.org/rfc/rfc6525.html#section-5.2.1 "If the
@@ -143,11 +145,11 @@ bool StreamResetHandler::ValidateReqSeqNbr(
<< " already processed, returning result="
<< ToString(last_processed_req_result_);
responses.push_back(ReconfigurationResponseParameter(
- req_seq_nbr, last_processed_req_result_));
+ req_seq_nbr.Wrap(), last_processed_req_result_));
return false;
}
- if (req_seq_nbr != ReconfigRequestSN(*last_processed_req_seq_nbr_ + 1)) {
+ if (req_seq_nbr != last_processed_req_seq_nbr_.next_value()) {
// Too old, too new, from wrong association etc.
// This is expected to happen when handing over a RTCPeerConnection from one
// server to another. The client will notice this and may decide to close
@@ -156,7 +158,7 @@ bool StreamResetHandler::ValidateReqSeqNbr(
RTC_DLOG(LS_VERBOSE) << log_prefix_ << "req=" << *req_seq_nbr
<< " bad seq_nbr";
responses.push_back(ReconfigurationResponseParameter(
- req_seq_nbr, ResponseResult::kErrorBadSequenceNumber));
+ req_seq_nbr.Wrap(), ResponseResult::kErrorBadSequenceNumber));
return false;
}
@@ -174,16 +176,43 @@ void StreamResetHandler::HandleResetOutgoing(
return;
}
- if (ValidateReqSeqNbr(req->request_sequence_number(), responses)) {
- RTC_DLOG(LS_VERBOSE) << log_prefix_
- << "Reset outgoing streams with req_seq_nbr="
- << *req->request_sequence_number();
-
- last_processed_req_seq_nbr_ = req->request_sequence_number();
- last_processed_req_result_ = reassembly_queue_->ResetStreams(
- *req, data_tracker_->last_cumulative_acked_tsn());
- if (last_processed_req_result_ == ResponseResult::kSuccessPerformed) {
+ UnwrappedReconfigRequestSn request_sn =
+ incoming_reconfig_request_sn_unwrapper_.Unwrap(
+ req->request_sequence_number());
+
+ if (ValidateReqSeqNbr(request_sn, responses)) {
+ last_processed_req_seq_nbr_ = request_sn;
+ if (data_tracker_->IsLaterThanCumulativeAckedTsn(
+ req->sender_last_assigned_tsn())) {
+ // https://datatracker.ietf.org/doc/html/rfc6525#section-5.2.2
+ // E2) "If the Sender's Last Assigned TSN is greater than the cumulative
+ // acknowledgment point, then the endpoint MUST enter 'deferred reset
+ // processing'."
+ reassembly_queue_->EnterDeferredReset(req->sender_last_assigned_tsn(),
+ req->stream_ids());
+ // "If the endpoint enters 'deferred reset processing', it MUST put a
+ // Re-configuration Response Parameter into a RE-CONFIG chunk indicating
+ // 'In progress' and MUST send the RE-CONFIG chunk.
+ last_processed_req_result_ = ResponseResult::kInProgress;
+ RTC_DLOG(LS_VERBOSE) << log_prefix_
+ << "Reset outgoing; Sender last_assigned="
+ << *req->sender_last_assigned_tsn()
+ << " - not yet reached -> InProgress";
+ } else {
+ // https://datatracker.ietf.org/doc/html/rfc6525#section-5.2.2
+ // E3) If no stream numbers are listed in the parameter, then all incoming
+ // streams MUST be reset to 0 as the next expected SSN. If specific stream
+ // numbers are listed, then only these specific streams MUST be reset to
+ // 0, and all other non-listed SSNs remain unchanged. E4: Any queued TSNs
+ // (queued at step E2) MUST now be released and processed normally.
+ reassembly_queue_->ResetStreamsAndLeaveDeferredReset(req->stream_ids());
ctx_->callbacks().OnIncomingStreamsReset(req->stream_ids());
+ last_processed_req_result_ = ResponseResult::kSuccessPerformed;
+
+ RTC_DLOG(LS_VERBOSE) << log_prefix_
+ << "Reset outgoing; Sender last_assigned="
+ << *req->sender_last_assigned_tsn()
+ << " - reached -> SuccessPerformed";
}
responses.push_back(ReconfigurationResponseParameter(
req->request_sequence_number(), last_processed_req_result_));
@@ -200,10 +229,15 @@ void StreamResetHandler::HandleResetIncoming(
"Failed to parse Incoming Reset command");
return;
}
- if (ValidateReqSeqNbr(req->request_sequence_number(), responses)) {
+
+ UnwrappedReconfigRequestSn request_sn =
+ incoming_reconfig_request_sn_unwrapper_.Unwrap(
+ req->request_sequence_number());
+
+ if (ValidateReqSeqNbr(request_sn, responses)) {
responses.push_back(ReconfigurationResponseParameter(
req->request_sequence_number(), ResponseResult::kSuccessNothingToDo));
- last_processed_req_seq_nbr_ = req->request_sequence_number();
+ last_processed_req_seq_nbr_ = request_sn;
}
}
@@ -315,13 +349,13 @@ void StreamResetHandler::ResetStreams(
}
}
-absl::optional<DurationMs> StreamResetHandler::OnReconfigTimerExpiry() {
+TimeDelta StreamResetHandler::OnReconfigTimerExpiry() {
if (current_request_->has_been_sent()) {
// There is an outstanding request, which timed out while waiting for a
// response.
if (!ctx_->IncrementTxErrorCounter("RECONFIG timeout")) {
// Timed out. The connection will close after processing the timers.
- return absl::nullopt;
+ return TimeDelta::Zero();
}
} else {
// There is no outstanding request, but there is a prepared one. This means
@@ -345,7 +379,8 @@ HandoverReadinessStatus StreamResetHandler::GetHandoverReadiness() const {
}
void StreamResetHandler::AddHandoverState(DcSctpSocketHandoverState& state) {
- state.rx.last_completed_reset_req_sn = last_processed_req_seq_nbr_.value();
+ state.rx.last_completed_reset_req_sn =
+ last_processed_req_seq_nbr_.Wrap().value();
state.tx.next_reset_req_sn = next_outgoing_req_seq_nbr_.value();
}
diff --git a/net/dcsctp/socket/stream_reset_handler.h b/net/dcsctp/socket/stream_reset_handler.h
index 8140903c49..77e8f3bd97 100644
--- a/net/dcsctp/socket/stream_reset_handler.h
+++ b/net/dcsctp/socket/stream_reset_handler.h
@@ -20,6 +20,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/packet/chunk/reconfig_chunk.h"
#include "net/dcsctp/packet/parameter/incoming_ssn_reset_request_parameter.h"
@@ -80,15 +81,17 @@ class StreamResetHandler {
reconfig_timer_(timer_manager->CreateTimer(
"re-config",
absl::bind_front(&StreamResetHandler::OnReconfigTimerExpiry, this),
- TimerOptions(DurationMs(0)))),
+ TimerOptions(webrtc::TimeDelta::Zero()))),
next_outgoing_req_seq_nbr_(
handover_state
? ReconfigRequestSN(handover_state->tx.next_reset_req_sn)
: ReconfigRequestSN(*ctx_->my_initial_tsn())),
last_processed_req_seq_nbr_(
- handover_state ? ReconfigRequestSN(
- handover_state->rx.last_completed_reset_req_sn)
- : ReconfigRequestSN(*ctx_->peer_initial_tsn() - 1)),
+ incoming_reconfig_request_sn_unwrapper_.Unwrap(
+ handover_state
+ ? ReconfigRequestSN(
+ handover_state->rx.last_completed_reset_req_sn)
+ : ReconfigRequestSN(*ctx_->peer_initial_tsn() - 1))),
last_processed_req_result_(
ReconfigurationResponseParameter::Result::kSuccessNothingToDo) {}
@@ -113,6 +116,7 @@ class StreamResetHandler {
void AddHandoverState(DcSctpSocketHandoverState& state);
private:
+ using UnwrappedReconfigRequestSn = UnwrappedSequenceNumber<ReconfigRequestSN>;
// Represents a stream request operation. There can only be one ongoing at
// any time, and a sent request may either succeed, fail or result in the
// receiver signaling that it can't process it right now, and then it will be
@@ -185,7 +189,7 @@ class StreamResetHandler {
// fails to validate, and returns false, it will also add a response to
// `responses`.
bool ValidateReqSeqNbr(
- ReconfigRequestSN req_seq_nbr,
+ UnwrappedReconfigRequestSn req_seq_nbr,
std::vector<ReconfigurationResponseParameter>& responses);
// Called when this socket receives an outgoing stream reset request. It might
@@ -208,13 +212,14 @@ class StreamResetHandler {
void HandleResponse(const ParameterDescriptor& descriptor);
// Expiration handler for the Reconfig timer.
- absl::optional<DurationMs> OnReconfigTimerExpiry();
+ webrtc::TimeDelta OnReconfigTimerExpiry();
const absl::string_view log_prefix_;
Context* ctx_;
DataTracker* data_tracker_;
ReassemblyQueue* reassembly_queue_;
RetransmissionQueue* retransmission_queue_;
+ UnwrappedReconfigRequestSn::Unwrapper incoming_reconfig_request_sn_unwrapper_;
const std::unique_ptr<Timer> reconfig_timer_;
// The next sequence number for outgoing stream requests.
@@ -224,7 +229,7 @@ class StreamResetHandler {
absl::optional<CurrentRequest> current_request_;
// For incoming requests - last processed request sequence number.
- ReconfigRequestSN last_processed_req_seq_nbr_;
+ UnwrappedReconfigRequestSn last_processed_req_seq_nbr_;
// The result from last processed incoming request
ReconfigurationResponseParameter::Result last_processed_req_result_;
};
diff --git a/net/dcsctp/socket/stream_reset_handler_test.cc b/net/dcsctp/socket/stream_reset_handler_test.cc
index 503cc89094..e675c9bcef 100644
--- a/net/dcsctp/socket/stream_reset_handler_test.cc
+++ b/net/dcsctp/socket/stream_reset_handler_test.cc
@@ -20,12 +20,14 @@
#include "api/task_queue/task_queue_base.h"
#include "net/dcsctp/common/handover_testing.h"
#include "net/dcsctp/common/internal_types.h"
+#include "net/dcsctp/packet/chunk/forward_tsn_common.h"
#include "net/dcsctp/packet/chunk/reconfig_chunk.h"
#include "net/dcsctp/packet/parameter/incoming_ssn_reset_request_parameter.h"
#include "net/dcsctp/packet/parameter/outgoing_ssn_reset_request_parameter.h"
#include "net/dcsctp/packet/parameter/parameter.h"
#include "net/dcsctp/packet/parameter/reconfiguration_response_parameter.h"
#include "net/dcsctp/public/dcsctp_message.h"
+#include "net/dcsctp/public/types.h"
#include "net/dcsctp/rx/data_tracker.h"
#include "net/dcsctp/rx/reassembly_queue.h"
#include "net/dcsctp/socket/mock_context.h"
@@ -42,10 +44,13 @@ namespace dcsctp {
namespace {
using ::testing::IsEmpty;
using ::testing::NiceMock;
+using ::testing::Property;
using ::testing::Return;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
using ResponseResult = ReconfigurationResponseParameter::Result;
+using SkippedStream = AnyForwardTsnChunk::SkippedStream;
constexpr TSN kMyInitialTsn = MockContext::MyInitialTsn();
constexpr ReconfigRequestSN kMyInitialReqSn = ReconfigRequestSN(*kMyInitialTsn);
@@ -53,7 +58,7 @@ constexpr TSN kPeerInitialTsn = MockContext::PeerInitialTsn();
constexpr ReconfigRequestSN kPeerInitialReqSn =
ReconfigRequestSN(*kPeerInitialTsn);
constexpr uint32_t kArwnd = 131072;
-constexpr DurationMs kRto = DurationMs(250);
+constexpr TimeDelta kRto = TimeDelta::Millis(250);
constexpr std::array<uint8_t, 4> kShortPayload = {1, 2, 3, 4};
@@ -93,12 +98,12 @@ class StreamResetHandlerTest : public testing::Test {
}),
delayed_ack_timer_(timer_manager_.CreateTimer(
"test/delayed_ack",
- []() { return absl::nullopt; },
- TimerOptions(DurationMs(0)))),
+ []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Zero()))),
t3_rtx_timer_(timer_manager_.CreateTimer(
"test/t3_rtx",
- []() { return absl::nullopt; },
- TimerOptions(DurationMs(0)))),
+ []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Zero()))),
data_tracker_(std::make_unique<DataTracker>("log: ",
delayed_ack_timer_.get(),
kPeerInitialTsn)),
@@ -111,7 +116,7 @@ class StreamResetHandlerTest : public testing::Test {
kMyInitialTsn,
kArwnd,
producer_,
- [](DurationMs rtt_ms) {},
+ [](TimeDelta rtt) {},
[]() {},
*t3_rtx_timer_,
DcSctpOptions())),
@@ -125,8 +130,8 @@ class StreamResetHandlerTest : public testing::Test {
EXPECT_CALL(ctx_, current_rto).WillRepeatedly(Return(kRto));
}
- void AdvanceTime(DurationMs duration) {
- callbacks_.AdvanceTime(kRto);
+ void AdvanceTime(TimeDelta duration) {
+ callbacks_.AdvanceTime(duration);
for (;;) {
absl::optional<TimeoutID> timeout_id = callbacks_.GetNextExpiredTimeout();
if (!timeout_id.has_value()) {
@@ -200,8 +205,8 @@ class StreamResetHandlerTest : public testing::Test {
std::make_unique<ReassemblyQueue>("log: ", kPeerInitialTsn, kArwnd);
reasm_->RestoreFromState(state);
retransmission_queue_ = std::make_unique<RetransmissionQueue>(
- "", &callbacks_, kMyInitialTsn, kArwnd, producer_,
- [](DurationMs rtt_ms) {}, []() {}, *t3_rtx_timer_, DcSctpOptions(),
+ "", &callbacks_, kMyInitialTsn, kArwnd, producer_, [](TimeDelta rtt) {},
+ []() {}, *t3_rtx_timer_, DcSctpOptions(),
/*supports_partial_reliability=*/true,
/*use_message_interleaving=*/false);
retransmission_queue_->RestoreFromState(state);
@@ -289,61 +294,187 @@ TEST_F(StreamResetHandlerTest, ResetStreamsNotDeferred) {
}
TEST_F(StreamResetHandlerTest, ResetStreamsDeferred) {
- DataGeneratorOptions opts;
- opts.message_id = MID(0);
- reasm_->Add(kPeerInitialTsn, gen_.Ordered({1, 2, 3, 4}, "BE", opts));
+ constexpr StreamID kStreamId = StreamID(1);
+ data_tracker_->Observe(TSN(10));
+ reasm_->Add(TSN(10), gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(0)}));
- opts.message_id = MID(1);
- reasm_->Add(AddTo(kPeerInitialTsn, 1),
- gen_.Ordered({1, 2, 3, 4}, "BE", opts));
+ data_tracker_->Observe(TSN(11));
+ reasm_->Add(TSN(11), gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(1)}));
- data_tracker_->Observe(kPeerInitialTsn);
- data_tracker_->Observe(AddTo(kPeerInitialTsn, 1));
- EXPECT_THAT(reasm_->FlushMessages(),
- UnorderedElementsAre(
- SctpMessageIs(StreamID(1), PPID(53), kShortPayload),
- SctpMessageIs(StreamID(1), PPID(53), kShortPayload)));
+ EXPECT_THAT(
+ reasm_->FlushMessages(),
+ UnorderedElementsAre(SctpMessageIs(kStreamId, PPID(53), kShortPayload),
+ SctpMessageIs(kStreamId, PPID(53), kShortPayload)));
Parameters::Builder builder;
builder.Add(OutgoingSSNResetRequestParameter(
- kPeerInitialReqSn, ReconfigRequestSN(3), AddTo(kPeerInitialTsn, 3),
- {StreamID(1)}));
+ ReconfigRequestSN(10), ReconfigRequestSN(3), TSN(13), {kStreamId}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kInProgress)));
- std::vector<ReconfigurationResponseParameter> responses =
- HandleAndCatchResponse(ReConfigChunk(builder.Build()));
- EXPECT_THAT(responses, SizeIs(1));
- EXPECT_EQ(responses[0].result(), ResponseResult::kInProgress);
+ data_tracker_->Observe(TSN(15));
+ reasm_->Add(TSN(15), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.mid = MID(1), .ppid = PPID(5)}));
- opts.message_id = MID(1);
- opts.ppid = PPID(5);
- reasm_->Add(AddTo(kPeerInitialTsn, 5),
- gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm_->MaybeResetStreamsDeferred(AddTo(kPeerInitialTsn, 1));
-
- opts.message_id = MID(0);
- opts.ppid = PPID(4);
- reasm_->Add(AddTo(kPeerInitialTsn, 4),
- gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm_->MaybeResetStreamsDeferred(AddTo(kPeerInitialTsn, 1));
-
- opts.message_id = MID(3);
- opts.ppid = PPID(3);
- reasm_->Add(AddTo(kPeerInitialTsn, 3),
- gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm_->MaybeResetStreamsDeferred(AddTo(kPeerInitialTsn, 1));
-
- opts.message_id = MID(2);
- opts.ppid = PPID(2);
- reasm_->Add(AddTo(kPeerInitialTsn, 2),
- gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm_->MaybeResetStreamsDeferred(AddTo(kPeerInitialTsn, 5));
+ data_tracker_->Observe(TSN(14));
+ reasm_->Add(TSN(14), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.mid = MID(0), .ppid = PPID(4)}));
+
+ data_tracker_->Observe(TSN(13));
+ reasm_->Add(TSN(13), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.mid = MID(3), .ppid = PPID(3)}));
+
+ data_tracker_->Observe(TSN(12));
+ reasm_->Add(TSN(12), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.mid = MID(2), .ppid = PPID(2)}));
+
+ builder.Add(OutgoingSSNResetRequestParameter(
+ ReconfigRequestSN(11), ReconfigRequestSN(4), TSN(13), {kStreamId}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kSuccessPerformed)));
EXPECT_THAT(
reasm_->FlushMessages(),
- UnorderedElementsAre(SctpMessageIs(StreamID(1), PPID(2), kShortPayload),
- SctpMessageIs(StreamID(1), PPID(3), kShortPayload),
- SctpMessageIs(StreamID(1), PPID(4), kShortPayload),
- SctpMessageIs(StreamID(1), PPID(5), kShortPayload)));
+ UnorderedElementsAre(SctpMessageIs(kStreamId, PPID(2), kShortPayload),
+ SctpMessageIs(kStreamId, PPID(3), kShortPayload),
+ SctpMessageIs(kStreamId, PPID(4), kShortPayload),
+ SctpMessageIs(kStreamId, PPID(5), kShortPayload)));
+}
+
+TEST_F(StreamResetHandlerTest, ResetStreamsDeferredOnlySelectedStreams) {
+ // This test verifies the receiving behavior of receiving messages on
+ // streams 1, 2 and 3, and receiving a reset request on stream 1, 2, causing
+ // deferred reset processing.
+
+ // Reset stream 1,2 with "last assigned TSN=12"
+ Parameters::Builder builder;
+ builder.Add(OutgoingSSNResetRequestParameter(ReconfigRequestSN(10),
+ ReconfigRequestSN(3), TSN(12),
+ {StreamID(1), StreamID(2)}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kInProgress)));
+
+ // TSN 10, SID 1 - before TSN 12 -> deliver
+ data_tracker_->Observe(TSN(10));
+ reasm_->Add(TSN(10), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(1),
+ .mid = MID(0),
+ .ppid = PPID(1001)}));
+
+ // TSN 11, SID 2 - before TSN 12 -> deliver
+ data_tracker_->Observe(TSN(11));
+ reasm_->Add(TSN(11), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(2),
+ .mid = MID(0),
+ .ppid = PPID(1002)}));
+
+ // TSN 12, SID 3 - at TSN 12 -> deliver
+ data_tracker_->Observe(TSN(12));
+ reasm_->Add(TSN(12), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(3),
+ .mid = MID(0),
+ .ppid = PPID(1003)}));
+
+ // TSN 13, SID 1 - after TSN 12 and SID=1 -> defer
+ data_tracker_->Observe(TSN(13));
+ reasm_->Add(TSN(13), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(1),
+ .mid = MID(0),
+ .ppid = PPID(1004)}));
+
+ // TSN 14, SID 2 - after TSN 12 and SID=2 -> defer
+ data_tracker_->Observe(TSN(14));
+ reasm_->Add(TSN(14), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(2),
+ .mid = MID(0),
+ .ppid = PPID(1005)}));
+
+ // TSN 15, SID 3 - after TSN 12, but SID 3 is not reset -> deliver
+ data_tracker_->Observe(TSN(15));
+ reasm_->Add(TSN(15), gen_.Ordered({1, 2, 3, 4}, "BE",
+ {.stream_id = StreamID(3),
+ .mid = MID(1),
+ .ppid = PPID(1006)}));
+
+ EXPECT_THAT(reasm_->FlushMessages(),
+ UnorderedElementsAre(
+ SctpMessageIs(StreamID(1), PPID(1001), kShortPayload),
+ SctpMessageIs(StreamID(2), PPID(1002), kShortPayload),
+ SctpMessageIs(StreamID(3), PPID(1003), kShortPayload),
+ SctpMessageIs(StreamID(3), PPID(1006), kShortPayload)));
+
+ builder.Add(OutgoingSSNResetRequestParameter(ReconfigRequestSN(11),
+ ReconfigRequestSN(3), TSN(13),
+ {StreamID(1), StreamID(2)}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kSuccessPerformed)));
+
+ EXPECT_THAT(reasm_->FlushMessages(),
+ UnorderedElementsAre(
+ SctpMessageIs(StreamID(1), PPID(1004), kShortPayload),
+ SctpMessageIs(StreamID(2), PPID(1005), kShortPayload)));
+}
+
+TEST_F(StreamResetHandlerTest, ResetStreamsDefersForwardTsn) {
+ // This test verifies that FORWARD-TSNs are deferred if they want to move
+ // the cumulative ack TSN point past sender's last assigned TSN.
+ static constexpr StreamID kStreamId = StreamID(42);
+
+ // Simulate sender sends:
+ // * TSN 10 (SSN=0, BE, lost),
+ // * TSN 11 (SSN=1, BE, lost),
+ // * TSN 12 (SSN=2, BE, lost)
+ // * RESET THE STREAM
+ // * TSN 13 (SSN=0, B, received)
+ // * TSN 14 (SSN=0, E, lost),
+ // * TSN 15 (SSN=1, BE, received)
+ Parameters::Builder builder;
+ builder.Add(OutgoingSSNResetRequestParameter(
+ ReconfigRequestSN(10), ReconfigRequestSN(3), TSN(12), {kStreamId}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kInProgress)));
+
+ // TSN 13, B, after TSN=12 -> defer
+ data_tracker_->Observe(TSN(13));
+ reasm_->Add(TSN(13),
+ gen_.Ordered(
+ {1, 2, 3, 4}, "B",
+ {.stream_id = kStreamId, .mid = MID(0), .ppid = PPID(1004)}));
+
+ // TSN 15, BE, after TSN=12 -> defer
+ data_tracker_->Observe(TSN(15));
+ reasm_->Add(TSN(15),
+ gen_.Ordered(
+ {1, 2, 3, 4}, "BE",
+ {.stream_id = kStreamId, .mid = MID(1), .ppid = PPID(1005)}));
+
+ // Time passes, sender decides to send FORWARD-TSN up to the RESET.
+ data_tracker_->HandleForwardTsn(TSN(12));
+ reasm_->HandleForwardTsn(
+ TSN(12), std::vector<SkippedStream>({SkippedStream(kStreamId, SSN(2))}));
+
+ // The receiver sends a SACK in response to that. The stream hasn't been
+ // reset yet, but the sender now decides that TSN=13-14 is to be skipped.
+ // As this has a TSN 14, after TSN=12 -> defer it.
+ data_tracker_->HandleForwardTsn(TSN(14));
+ reasm_->HandleForwardTsn(
+ TSN(14), std::vector<SkippedStream>({SkippedStream(kStreamId, SSN(0))}));
+
+ // Reset the stream -> deferred TSNs should be re-added.
+ builder.Add(OutgoingSSNResetRequestParameter(
+ ReconfigRequestSN(11), ReconfigRequestSN(3), TSN(12), {kStreamId}));
+ EXPECT_THAT(HandleAndCatchResponse(ReConfigChunk(builder.Build())),
+ ElementsAre(Property(&ReconfigurationResponseParameter::result,
+ ResponseResult::kSuccessPerformed)));
+
+ EXPECT_THAT(reasm_->FlushMessages(),
+ UnorderedElementsAre(
+ SctpMessageIs(kStreamId, PPID(1005), kShortPayload)));
}
TEST_F(StreamResetHandlerTest, SendOutgoingRequestDirectly) {
@@ -765,9 +896,8 @@ TEST_F(StreamResetHandlerTest, PerformCloseAfterOneFirstFailing) {
// Let the socket receive the TSN.
DataGeneratorOptions opts;
- opts.message_id = MID(0);
+ opts.mid = MID(0);
reasm_->Add(kPeerInitialTsn, gen_.Ordered({1, 2, 3, 4}, "BE", opts));
- reasm_->MaybeResetStreamsDeferred(kPeerInitialTsn);
data_tracker_->Observe(kPeerInitialTsn);
// And emulate that time has passed, and the peer retries the stream reset,
diff --git a/net/dcsctp/socket/transmission_control_block.cc b/net/dcsctp/socket/transmission_control_block.cc
index 8bb1e8b2fb..c6c8861e1f 100644
--- a/net/dcsctp/socket/transmission_control_block.cc
+++ b/net/dcsctp/socket/transmission_control_block.cc
@@ -17,6 +17,7 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/packet/chunk/data_chunk.h"
#include "net/dcsctp/packet/chunk/forward_tsn_chunk.h"
#include "net/dcsctp/packet/chunk/idata_chunk.h"
@@ -25,6 +26,7 @@
#include "net/dcsctp/packet/chunk/sack_chunk.h"
#include "net/dcsctp/packet/sctp_packet.h"
#include "net/dcsctp/public/dcsctp_options.h"
+#include "net/dcsctp/public/types.h"
#include "net/dcsctp/rx/data_tracker.h"
#include "net/dcsctp/rx/reassembly_queue.h"
#include "net/dcsctp/socket/capabilities.h"
@@ -36,6 +38,8 @@
#include "rtc_base/strings/string_builder.h"
namespace dcsctp {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
TransmissionControlBlock::TransmissionControlBlock(
TimerManager& timer_manager,
@@ -60,18 +64,20 @@ TransmissionControlBlock::TransmissionControlBlock(
t3_rtx_(timer_manager_.CreateTimer(
"t3-rtx",
absl::bind_front(&TransmissionControlBlock::OnRtxTimerExpiry, this),
- TimerOptions(options.rto_initial,
+ TimerOptions(options.rto_initial.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
/*max_restarts=*/absl::nullopt,
- options.max_timer_backoff_duration))),
+ options.max_timer_backoff_duration.has_value()
+ ? options.max_timer_backoff_duration->ToTimeDelta()
+ : TimeDelta::PlusInfinity()))),
delayed_ack_timer_(timer_manager_.CreateTimer(
"delayed-ack",
absl::bind_front(&TransmissionControlBlock::OnDelayedAckTimerExpiry,
this),
- TimerOptions(options.delayed_ack_max_timeout,
+ TimerOptions(options.delayed_ack_max_timeout.ToTimeDelta(),
TimerBackoffAlgorithm::kExponential,
/*max_restarts=*/0,
- /*max_backoff_duration=*/absl::nullopt,
+ /*max_backoff_duration=*/TimeDelta::PlusInfinity(),
webrtc::TaskQueueBase::DelayPrecision::kHigh))),
my_verification_tag_(my_verification_tag),
my_initial_tsn_(my_initial_tsn),
@@ -109,21 +115,22 @@ TransmissionControlBlock::TransmissionControlBlock(
send_queue.EnableMessageInterleaving(capabilities.message_interleaving);
}
-void TransmissionControlBlock::ObserveRTT(DurationMs rtt) {
- DurationMs prev_rto = rto_.rto();
+void TransmissionControlBlock::ObserveRTT(TimeDelta rtt) {
+ TimeDelta prev_rto = rto_.rto();
rto_.ObserveRTT(rtt);
- RTC_DLOG(LS_VERBOSE) << log_prefix_ << "new rtt=" << *rtt
- << ", srtt=" << *rto_.srtt() << ", rto=" << *rto_.rto()
- << " (" << *prev_rto << ")";
+ RTC_DLOG(LS_VERBOSE) << log_prefix_ << "new rtt=" << webrtc::ToString(rtt)
+ << ", srtt=" << webrtc::ToString(rto_.srtt())
+ << ", rto=" << webrtc::ToString(rto_.rto()) << " ("
+ << webrtc::ToString(prev_rto) << ")";
t3_rtx_->set_duration(rto_.rto());
- DurationMs delayed_ack_tmo =
- std::min(rto_.rto() * 0.5, options_.delayed_ack_max_timeout);
+ TimeDelta delayed_ack_tmo = std::min(
+ rto_.rto() * 0.5, options_.delayed_ack_max_timeout.ToTimeDelta());
delayed_ack_timer_->set_duration(delayed_ack_tmo);
}
-absl::optional<DurationMs> TransmissionControlBlock::OnRtxTimerExpiry() {
- TimeMs now = callbacks_.TimeMillis();
+TimeDelta TransmissionControlBlock::OnRtxTimerExpiry() {
+ Timestamp now = callbacks_.Now();
RTC_DLOG(LS_INFO) << log_prefix_ << "Timer " << t3_rtx_->name()
<< " has expired";
if (cookie_echo_chunk_.has_value()) {
@@ -136,13 +143,13 @@ absl::optional<DurationMs> TransmissionControlBlock::OnRtxTimerExpiry() {
SendBufferedPackets(now);
}
}
- return absl::nullopt;
+ return TimeDelta::Zero();
}
-absl::optional<DurationMs> TransmissionControlBlock::OnDelayedAckTimerExpiry() {
+TimeDelta TransmissionControlBlock::OnDelayedAckTimerExpiry() {
data_tracker_.HandleDelayedAckTimerExpiry();
MaybeSendSack();
- return absl::nullopt;
+ return TimeDelta::Zero();
}
void TransmissionControlBlock::MaybeSendSack() {
@@ -155,7 +162,7 @@ void TransmissionControlBlock::MaybeSendSack() {
}
void TransmissionControlBlock::MaybeSendForwardTsn(SctpPacket::Builder& builder,
- TimeMs now) {
+ Timestamp now) {
if (now >= limit_forward_tsn_until_ &&
retransmission_queue_.ShouldSendForwardTsn(now)) {
if (capabilities_.message_interleaving) {
@@ -170,7 +177,8 @@ void TransmissionControlBlock::MaybeSendForwardTsn(SctpPacket::Builder& builder,
// sending a duplicate FORWARD TSN."
// "Any delay applied to the sending of FORWARD TSN chunk SHOULD NOT exceed
// 200ms and MUST NOT exceed 500ms".
- limit_forward_tsn_until_ = now + std::min(DurationMs(200), rto_.srtt());
+ limit_forward_tsn_until_ =
+ now + std::min(TimeDelta::Millis(200), rto_.srtt());
}
}
@@ -202,7 +210,7 @@ void TransmissionControlBlock::MaybeSendFastRetransmit() {
}
void TransmissionControlBlock::SendBufferedPackets(SctpPacket::Builder& builder,
- TimeMs now) {
+ Timestamp now) {
for (int packet_idx = 0;
packet_idx < options_.max_burst && retransmission_queue_.can_send_data();
++packet_idx) {
diff --git a/net/dcsctp/socket/transmission_control_block.h b/net/dcsctp/socket/transmission_control_block.h
index 46a39d5a7b..f8b2445525 100644
--- a/net/dcsctp/socket/transmission_control_block.h
+++ b/net/dcsctp/socket/transmission_control_block.h
@@ -67,8 +67,8 @@ class TransmissionControlBlock : public Context {
TSN my_initial_tsn() const override { return my_initial_tsn_; }
TSN peer_initial_tsn() const override { return peer_initial_tsn_; }
DcSctpSocketCallbacks& callbacks() const override { return callbacks_; }
- void ObserveRTT(DurationMs rtt) override;
- DurationMs current_rto() const override { return rto_.rto(); }
+ void ObserveRTT(webrtc::TimeDelta rtt) override;
+ webrtc::TimeDelta current_rto() const override { return rto_.rto(); }
bool IncrementTxErrorCounter(absl::string_view reason) override {
return tx_error_counter_.Increment(reason);
}
@@ -91,7 +91,7 @@ class TransmissionControlBlock : public Context {
StreamResetHandler& stream_reset_handler() { return stream_reset_handler_; }
HeartbeatHandler& heartbeat_handler() { return heartbeat_handler_; }
size_t cwnd() const { return retransmission_queue_.cwnd(); }
- DurationMs current_srtt() const { return rto_.srtt(); }
+ webrtc::TimeDelta current_srtt() const { return rto_.srtt(); }
// Returns this socket's verification tag, set in all packet headers.
VerificationTag my_verification_tag() const { return my_verification_tag_; }
@@ -108,7 +108,7 @@ class TransmissionControlBlock : public Context {
void MaybeSendSack();
// Sends a FORWARD-TSN, if it is needed and allowed (rate-limited).
- void MaybeSendForwardTsn(SctpPacket::Builder& builder, TimeMs now);
+ void MaybeSendForwardTsn(SctpPacket::Builder& builder, webrtc::Timestamp now);
// Will be set while the socket is in kCookieEcho state. In this state, there
// can only be a single packet outstanding, and it must contain the COOKIE
@@ -129,12 +129,12 @@ class TransmissionControlBlock : public Context {
// Fills `builder` (which may already be filled with control chunks) with
// other control and data chunks, and sends packets as much as can be
// allowed by the congestion control algorithm.
- void SendBufferedPackets(SctpPacket::Builder& builder, TimeMs now);
+ void SendBufferedPackets(SctpPacket::Builder& builder, webrtc::Timestamp now);
// As above, but without passing in a builder. If `cookie_echo_chunk_` is
// present, then only one packet will be sent, with this chunk as the first
// chunk.
- void SendBufferedPackets(TimeMs now) {
+ void SendBufferedPackets(webrtc::Timestamp now) {
SctpPacket::Builder builder(peer_verification_tag_, options_);
SendBufferedPackets(builder, now);
}
@@ -149,9 +149,9 @@ class TransmissionControlBlock : public Context {
private:
// Will be called when the retransmission timer (t3-rtx) expires.
- absl::optional<DurationMs> OnRtxTimerExpiry();
+ webrtc::TimeDelta OnRtxTimerExpiry();
// Will be called when the delayed ack timer expires.
- absl::optional<DurationMs> OnDelayedAckTimerExpiry();
+ webrtc::TimeDelta OnDelayedAckTimerExpiry();
const absl::string_view log_prefix_;
const DcSctpOptions options_;
@@ -172,7 +172,7 @@ class TransmissionControlBlock : public Context {
const std::function<bool()> is_connection_established_;
PacketSender& packet_sender_;
// Rate limiting of FORWARD-TSN. Next can be sent at or after this timestamp.
- TimeMs limit_forward_tsn_until_ = TimeMs(0);
+ webrtc::Timestamp limit_forward_tsn_until_ = webrtc::Timestamp::Zero();
RetransmissionTimeout rto_;
RetransmissionErrorCounter tx_error_counter_;
diff --git a/net/dcsctp/testing/data_generator.cc b/net/dcsctp/testing/data_generator.cc
index e4f9f91384..417695c9d0 100644
--- a/net/dcsctp/testing/data_generator.cc
+++ b/net/dcsctp/testing/data_generator.cc
@@ -32,13 +32,13 @@ Data DataGenerator::Ordered(std::vector<uint8_t> payload,
} else {
fsn_ = FSN(*fsn_ + 1);
}
- MID message_id = opts.message_id.value_or(message_id_);
- Data ret = Data(opts.stream_id, SSN(static_cast<uint16_t>(*message_id)),
- message_id, fsn_, opts.ppid, std::move(payload), is_beginning,
- is_end, IsUnordered(false));
+ MID mid = opts.mid.value_or(mid_);
+ Data ret = Data(opts.stream_id, SSN(static_cast<uint16_t>(*mid)), mid, fsn_,
+ opts.ppid, std::move(payload), is_beginning, is_end,
+ IsUnordered(false));
if (is_end) {
- message_id_ = MID(*message_id + 1);
+ mid_ = MID(*mid + 1);
}
return ret;
}
@@ -54,11 +54,11 @@ Data DataGenerator::Unordered(std::vector<uint8_t> payload,
} else {
fsn_ = FSN(*fsn_ + 1);
}
- MID message_id = opts.message_id.value_or(message_id_);
- Data ret = Data(opts.stream_id, SSN(0), message_id, fsn_, kPpid,
- std::move(payload), is_beginning, is_end, IsUnordered(true));
+ MID mid = opts.mid.value_or(mid_);
+ Data ret = Data(opts.stream_id, SSN(0), mid, fsn_, kPpid, std::move(payload),
+ is_beginning, is_end, IsUnordered(true));
if (is_end) {
- message_id_ = MID(*message_id + 1);
+ mid_ = MID(*mid + 1);
}
return ret;
}
diff --git a/net/dcsctp/testing/data_generator.h b/net/dcsctp/testing/data_generator.h
index f917c740a7..52f98dd1cb 100644
--- a/net/dcsctp/testing/data_generator.h
+++ b/net/dcsctp/testing/data_generator.h
@@ -23,15 +23,14 @@ namespace dcsctp {
struct DataGeneratorOptions {
StreamID stream_id = StreamID(1);
- absl::optional<MID> message_id = absl::nullopt;
+ absl::optional<MID> mid = absl::nullopt;
PPID ppid = PPID(53);
};
// Generates Data with correct sequence numbers, and used only in unit tests.
class DataGenerator {
public:
- explicit DataGenerator(MID start_message_id = MID(0))
- : message_id_(start_message_id) {}
+ explicit DataGenerator(MID start_mid = MID(0)) : mid_(start_mid) {}
// Generates ordered "data" with the provided `payload` and flags, which can
// contain "B" for setting the "is_beginning" flag, and/or "E" for setting the
@@ -48,10 +47,10 @@ class DataGenerator {
DataGeneratorOptions opts = {});
// Resets the Message ID identifier - simulating a "stream reset".
- void ResetStream() { message_id_ = MID(0); }
+ void ResetStream() { mid_ = MID(0); }
private:
- MID message_id_;
+ MID mid_;
FSN fsn_ = FSN(0);
};
} // namespace dcsctp
diff --git a/net/dcsctp/timer/BUILD.gn b/net/dcsctp/timer/BUILD.gn
index d3be1ec872..9dbe11b3ba 100644
--- a/net/dcsctp/timer/BUILD.gn
+++ b/net/dcsctp/timer/BUILD.gn
@@ -12,6 +12,8 @@ rtc_library("timer") {
deps = [
"../../../api:array_view",
"../../../api/task_queue:task_queue",
+ "../../../api/units:time_delta",
+ "../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:strong_alias",
"../../../rtc_base/containers:flat_map",
@@ -37,6 +39,7 @@ rtc_library("task_queue_timeout") {
"../../../api/task_queue:pending_task_safety_flag",
"../../../api/task_queue:task_queue",
"../../../api/units:time_delta",
+ "../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
"../public:socket",
@@ -59,6 +62,7 @@ if (rtc_include_tests) {
"../../../api:array_view",
"../../../api/task_queue:task_queue",
"../../../api/task_queue/test:mock_task_queue_base",
+ "../../../api/units:time_delta",
"../../../rtc_base:checks",
"../../../rtc_base:gunit_helpers",
"../../../test:test_support",
diff --git a/net/dcsctp/timer/fake_timeout.h b/net/dcsctp/timer/fake_timeout.h
index 4621b2ce83..cac49287d4 100644
--- a/net/dcsctp/timer/fake_timeout.h
+++ b/net/dcsctp/timer/fake_timeout.h
@@ -19,6 +19,7 @@
#include "absl/types/optional.h"
#include "api/task_queue/task_queue_base.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/public/timeout.h"
#include "net/dcsctp/public/types.h"
#include "rtc_base/checks.h"
@@ -29,46 +30,46 @@ namespace dcsctp {
// A timeout used in tests.
class FakeTimeout : public Timeout {
public:
- FakeTimeout(std::function<TimeMs()> get_time,
+ FakeTimeout(std::function<webrtc::Timestamp()> get_time,
std::function<void(FakeTimeout*)> on_delete)
: get_time_(std::move(get_time)), on_delete_(std::move(on_delete)) {}
~FakeTimeout() override { on_delete_(this); }
void Start(DurationMs duration_ms, TimeoutID timeout_id) override {
- RTC_DCHECK(expiry_ == TimeMs::InfiniteFuture());
+ RTC_DCHECK(expiry_.IsPlusInfinity());
timeout_id_ = timeout_id;
- expiry_ = get_time_() + duration_ms;
+ expiry_ = get_time_() + duration_ms.ToTimeDelta();
}
void Stop() override {
- RTC_DCHECK(expiry_ != TimeMs::InfiniteFuture());
- expiry_ = TimeMs::InfiniteFuture();
+ RTC_DCHECK(!expiry_.IsPlusInfinity());
+ expiry_ = webrtc::Timestamp::PlusInfinity();
}
- bool EvaluateHasExpired(TimeMs now) {
+ bool EvaluateHasExpired(webrtc::Timestamp now) {
if (now >= expiry_) {
- expiry_ = TimeMs::InfiniteFuture();
+ expiry_ = webrtc::Timestamp::PlusInfinity();
return true;
}
return false;
}
TimeoutID timeout_id() const { return timeout_id_; }
- TimeMs expiry() const { return expiry_; }
+ webrtc::Timestamp expiry() const { return expiry_; }
private:
- const std::function<TimeMs()> get_time_;
+ const std::function<webrtc::Timestamp()> get_time_;
const std::function<void(FakeTimeout*)> on_delete_;
TimeoutID timeout_id_ = TimeoutID(0);
- TimeMs expiry_ = TimeMs::InfiniteFuture();
+ webrtc::Timestamp expiry_ = webrtc::Timestamp::PlusInfinity();
};
class FakeTimeoutManager {
public:
// The `get_time` function must return the current time, relative to any
// epoch.
- explicit FakeTimeoutManager(std::function<TimeMs()> get_time)
+ explicit FakeTimeoutManager(std::function<webrtc::Timestamp()> get_time)
: get_time_(std::move(get_time)) {}
std::unique_ptr<FakeTimeout> CreateTimeout() {
@@ -89,7 +90,7 @@ class FakeTimeoutManager {
// Timer::is_running_ to false before you operate on the Timer or Timeout
// again.
absl::optional<TimeoutID> GetNextExpiredTimeout() {
- TimeMs now = get_time_();
+ webrtc::Timestamp now = get_time_();
std::vector<TimeoutID> expired_timers;
for (auto& timer : timers_) {
if (timer->EvaluateHasExpired(now)) {
@@ -99,21 +100,21 @@ class FakeTimeoutManager {
return absl::nullopt;
}
- DurationMs GetTimeToNextTimeout() const {
- TimeMs next_expiry = TimeMs::InfiniteFuture();
+ webrtc::TimeDelta GetTimeToNextTimeout() const {
+ webrtc::Timestamp next_expiry = webrtc::Timestamp::PlusInfinity();
for (const FakeTimeout* timer : timers_) {
if (timer->expiry() < next_expiry) {
next_expiry = timer->expiry();
}
}
- TimeMs now = get_time_();
- return next_expiry != TimeMs::InfiniteFuture() && next_expiry >= now
+ webrtc::Timestamp now = get_time_();
+ return !next_expiry.IsPlusInfinity() && next_expiry >= now
? next_expiry - now
- : DurationMs::InfiniteDuration();
+ : webrtc::TimeDelta::PlusInfinity();
}
private:
- const std::function<TimeMs()> get_time_;
+ const std::function<webrtc::Timestamp()> get_time_;
webrtc::flat_set<FakeTimeout*> timers_;
};
diff --git a/net/dcsctp/timer/task_queue_timeout.cc b/net/dcsctp/timer/task_queue_timeout.cc
index 6c43640d39..7612f98f3a 100644
--- a/net/dcsctp/timer/task_queue_timeout.cc
+++ b/net/dcsctp/timer/task_queue_timeout.cc
@@ -14,6 +14,8 @@
#include "rtc_base/logging.h"
namespace dcsctp {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
TaskQueueTimeoutFactory::TaskQueueTimeout::TaskQueueTimeout(
TaskQueueTimeoutFactory& parent,
@@ -30,8 +32,8 @@ TaskQueueTimeoutFactory::TaskQueueTimeout::~TaskQueueTimeout() {
void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
TimeoutID timeout_id) {
RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
- RTC_DCHECK(timeout_expiration_ == TimeMs::InfiniteFuture());
- timeout_expiration_ = parent_.get_time_() + duration_ms;
+ RTC_DCHECK(timeout_expiration_.IsPlusInfinity());
+ timeout_expiration_ = parent_.Now() + duration_ms.ToTimeDelta();
timeout_id_ = timeout_id;
if (timeout_expiration_ >= posted_task_expiration_) {
@@ -43,7 +45,7 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
return;
}
- if (posted_task_expiration_ != TimeMs::InfiniteFuture()) {
+ if (!posted_task_expiration_.IsPlusInfinity()) {
RTC_DLOG(LS_VERBOSE) << "New timeout duration is less than scheduled - "
"ghosting old delayed task.";
// There is already a scheduled delayed task, but its expiration time is
@@ -63,10 +65,10 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
[timeout_id, this]() {
RTC_DLOG(LS_VERBOSE) << "Timout expired: " << timeout_id.value();
RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
- RTC_DCHECK(posted_task_expiration_ != TimeMs::InfiniteFuture());
- posted_task_expiration_ = TimeMs::InfiniteFuture();
+ RTC_DCHECK(!posted_task_expiration_.IsPlusInfinity());
+ posted_task_expiration_ = Timestamp::PlusInfinity();
- if (timeout_expiration_ == TimeMs::InfiniteFuture()) {
+ if (timeout_expiration_.IsPlusInfinity()) {
// The timeout was stopped before it expired. Very common.
} else {
// Note that the timeout might have been restarted, which updated
@@ -74,10 +76,10 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
// if it's not quite time to trigger the timeout yet, schedule a
// new delayed task with what's remaining and retry at that point
// in time.
- DurationMs remaining = timeout_expiration_ - parent_.get_time_();
- timeout_expiration_ = TimeMs::InfiniteFuture();
- if (*remaining > 0) {
- Start(remaining, timeout_id_);
+ TimeDelta remaining = timeout_expiration_ - parent_.Now();
+ timeout_expiration_ = Timestamp::PlusInfinity();
+ if (remaining > TimeDelta::Zero()) {
+ Start(DurationMs(remaining.ms()), timeout_id_);
} else {
// It has actually triggered.
RTC_DLOG(LS_VERBOSE)
@@ -93,7 +95,7 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Stop() {
// As the TaskQueue doesn't support deleting a posted task, just mark the
// timeout as not running.
RTC_DCHECK_RUN_ON(&parent_.thread_checker_);
- timeout_expiration_ = TimeMs::InfiniteFuture();
+ timeout_expiration_ = Timestamp::PlusInfinity();
}
} // namespace dcsctp
diff --git a/net/dcsctp/timer/task_queue_timeout.h b/net/dcsctp/timer/task_queue_timeout.h
index faae14464f..4b40309f83 100644
--- a/net/dcsctp/timer/task_queue_timeout.h
+++ b/net/dcsctp/timer/task_queue_timeout.h
@@ -15,6 +15,7 @@
#include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_base.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/public/timeout.h"
namespace dcsctp {
@@ -74,14 +75,17 @@ class TaskQueueTimeoutFactory {
rtc::scoped_refptr<webrtc::PendingTaskSafetyFlag> pending_task_safety_flag_;
// The time when the posted delayed task is set to expire. Will be set to
// the infinite future if there is no such task running.
- TimeMs posted_task_expiration_ = TimeMs::InfiniteFuture();
+ webrtc::Timestamp posted_task_expiration_ =
+ webrtc::Timestamp::PlusInfinity();
// The time when the timeout expires. It will be set to the infinite future
// if the timeout is not running/not started.
- TimeMs timeout_expiration_ = TimeMs::InfiniteFuture();
+ webrtc::Timestamp timeout_expiration_ = webrtc::Timestamp::PlusInfinity();
// The current timeout ID that will be reported when expired.
TimeoutID timeout_id_ = TimeoutID(0);
};
+ webrtc::Timestamp Now() { return webrtc::Timestamp::Millis(*get_time_()); }
+
RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker thread_checker_;
webrtc::TaskQueueBase& task_queue_;
const std::function<TimeMs()> get_time_;
diff --git a/net/dcsctp/timer/timer.cc b/net/dcsctp/timer/timer.cc
index bde07638a5..07c9f3d786 100644
--- a/net/dcsctp/timer/timer.cc
+++ b/net/dcsctp/timer/timer.cc
@@ -22,36 +22,37 @@
namespace dcsctp {
namespace {
+using ::webrtc::TimeDelta;
+
TimeoutID MakeTimeoutId(TimerID timer_id, TimerGeneration generation) {
return TimeoutID(static_cast<uint64_t>(*timer_id) << 32 | *generation);
}
-DurationMs GetBackoffDuration(const TimerOptions& options,
- DurationMs base_duration,
- int expiration_count) {
+TimeDelta GetBackoffDuration(const TimerOptions& options,
+ TimeDelta base_duration,
+ int expiration_count) {
switch (options.backoff_algorithm) {
case TimerBackoffAlgorithm::kFixed:
return base_duration;
case TimerBackoffAlgorithm::kExponential: {
- int32_t duration_ms = *base_duration;
+ TimeDelta duration = base_duration;
- while (expiration_count > 0 && duration_ms < *Timer::kMaxTimerDuration) {
- duration_ms *= 2;
+ while (expiration_count > 0 && duration < Timer::kMaxTimerDuration) {
+ duration = duration * 2;
--expiration_count;
- if (options.max_backoff_duration.has_value() &&
- duration_ms > **options.max_backoff_duration) {
- return *options.max_backoff_duration;
+ if (duration > options.max_backoff_duration) {
+ return options.max_backoff_duration;
}
}
- return DurationMs(std::min(duration_ms, *Timer::kMaxTimerDuration));
+ return TimeDelta(std::min(duration, Timer::kMaxTimerDuration));
}
}
}
} // namespace
-constexpr DurationMs Timer::kMaxTimerDuration;
+constexpr TimeDelta Timer::kMaxTimerDuration;
Timer::Timer(TimerID id,
absl::string_view name,
@@ -77,12 +78,12 @@ void Timer::Start() {
if (!is_running()) {
is_running_ = true;
generation_ = TimerGeneration(*generation_ + 1);
- timeout_->Start(duration_, MakeTimeoutId(id_, generation_));
+ timeout_->Start(DurationMs(duration_), MakeTimeoutId(id_, generation_));
} else {
// Timer was running - stop and restart it, to make it expire in `duration_`
// from now.
generation_ = TimerGeneration(*generation_ + 1);
- timeout_->Restart(duration_, MakeTimeoutId(id_, generation_));
+ timeout_->Restart(DurationMs(duration_), MakeTimeoutId(id_, generation_));
}
}
@@ -104,23 +105,24 @@ void Timer::Trigger(TimerGeneration generation) {
// timer. Note that it might be very quickly restarted again, if the
// `on_expired_` callback returns a new duration.
is_running_ = true;
- DurationMs duration =
+ TimeDelta duration =
GetBackoffDuration(options_, duration_, expiration_count_);
generation_ = TimerGeneration(*generation_ + 1);
- timeout_->Start(duration, MakeTimeoutId(id_, generation_));
+ timeout_->Start(DurationMs(duration), MakeTimeoutId(id_, generation_));
}
- absl::optional<DurationMs> new_duration = on_expired_();
- if (new_duration.has_value() && new_duration != duration_) {
- duration_ = new_duration.value();
+ TimeDelta new_duration = on_expired_();
+ RTC_DCHECK(new_duration != TimeDelta::PlusInfinity());
+ if (new_duration > TimeDelta::Zero() && new_duration != duration_) {
+ duration_ = new_duration;
if (is_running_) {
// Restart it with new duration.
timeout_->Stop();
- DurationMs duration =
+ TimeDelta duration =
GetBackoffDuration(options_, duration_, expiration_count_);
generation_ = TimerGeneration(*generation_ + 1);
- timeout_->Start(duration, MakeTimeoutId(id_, generation_));
+ timeout_->Start(DurationMs(duration), MakeTimeoutId(id_, generation_));
}
}
}
diff --git a/net/dcsctp/timer/timer.h b/net/dcsctp/timer/timer.h
index 31b496dc81..30b07f9bfa 100644
--- a/net/dcsctp/timer/timer.h
+++ b/net/dcsctp/timer/timer.h
@@ -22,6 +22,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/task_queue/task_queue_base.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/public/timeout.h"
#include "rtc_base/strong_alias.h"
@@ -40,28 +41,31 @@ enum class TimerBackoffAlgorithm {
};
struct TimerOptions {
- explicit TimerOptions(DurationMs duration)
+ explicit TimerOptions(webrtc::TimeDelta duration)
: TimerOptions(duration, TimerBackoffAlgorithm::kExponential) {}
- TimerOptions(DurationMs duration, TimerBackoffAlgorithm backoff_algorithm)
+ TimerOptions(webrtc::TimeDelta duration,
+ TimerBackoffAlgorithm backoff_algorithm)
: TimerOptions(duration, backoff_algorithm, absl::nullopt) {}
- TimerOptions(DurationMs duration,
+ TimerOptions(webrtc::TimeDelta duration,
TimerBackoffAlgorithm backoff_algorithm,
absl::optional<int> max_restarts)
- : TimerOptions(duration, backoff_algorithm, max_restarts, absl::nullopt) {
- }
- TimerOptions(DurationMs duration,
+ : TimerOptions(duration,
+ backoff_algorithm,
+ max_restarts,
+ webrtc::TimeDelta::PlusInfinity()) {}
+ TimerOptions(webrtc::TimeDelta duration,
TimerBackoffAlgorithm backoff_algorithm,
absl::optional<int> max_restarts,
- absl::optional<DurationMs> max_backoff_duration)
+ webrtc::TimeDelta max_backoff_duration)
: TimerOptions(duration,
backoff_algorithm,
max_restarts,
max_backoff_duration,
webrtc::TaskQueueBase::DelayPrecision::kLow) {}
- TimerOptions(DurationMs duration,
+ TimerOptions(webrtc::TimeDelta duration,
TimerBackoffAlgorithm backoff_algorithm,
absl::optional<int> max_restarts,
- absl::optional<DurationMs> max_backoff_duration,
+ webrtc::TimeDelta max_backoff_duration,
webrtc::TaskQueueBase::DelayPrecision precision)
: duration(duration),
backoff_algorithm(backoff_algorithm),
@@ -70,7 +74,7 @@ struct TimerOptions {
precision(precision) {}
// The initial timer duration. Can be overridden with `set_duration`.
- const DurationMs duration;
+ const webrtc::TimeDelta duration;
// If the duration should be increased (using exponential backoff) when it is
// restarted. If not set, the same duration will be used.
const TimerBackoffAlgorithm backoff_algorithm;
@@ -78,7 +82,7 @@ struct TimerOptions {
// or absl::nullopt if there is no limit.
const absl::optional<int> max_restarts;
// The maximum timeout value for exponential backoff.
- const absl::optional<DurationMs> max_backoff_duration;
+ const webrtc::TimeDelta max_backoff_duration;
// The precision of the webrtc::TaskQueueBase used for scheduling.
const webrtc::TaskQueueBase::DelayPrecision precision;
};
@@ -98,12 +102,14 @@ struct TimerOptions {
class Timer {
public:
// The maximum timer duration - one day.
- static constexpr DurationMs kMaxTimerDuration = DurationMs(24 * 3600 * 1000);
+ static constexpr webrtc::TimeDelta kMaxTimerDuration =
+ webrtc::TimeDelta::Seconds(24 * 3600);
- // When expired, the timer handler can optionally return a new duration which
- // will be set as `duration` and used as base duration when the timer is
- // restarted and as input to the backoff algorithm.
- using OnExpired = std::function<absl::optional<DurationMs>()>;
+ // When expired, the timer handler can optionally return a new non-zero
+ // duration which will be set as `duration` and used as base duration when the
+ // timer is restarted and as input to the backoff algorithm. If zero is
+ // returned, the current duration is used.
+ using OnExpired = std::function<webrtc::TimeDelta()>;
// TimerManager will have pointers to these instances, so they must not move.
Timer(const Timer&) = delete;
@@ -121,13 +127,13 @@ class Timer {
// Sets the base duration. The actual timer duration may be larger depending
// on the backoff algorithm.
- void set_duration(DurationMs duration) {
+ void set_duration(webrtc::TimeDelta duration) {
duration_ = std::min(duration, kMaxTimerDuration);
}
// Retrieves the base duration. The actual timer duration may be larger
// depending on the backoff algorithm.
- DurationMs duration() const { return duration_; }
+ webrtc::TimeDelta duration() const { return duration_; }
// Returns the number of times the timer has expired.
int expiration_count() const { return expiration_count_; }
@@ -165,7 +171,7 @@ class Timer {
const UnregisterHandler unregister_handler_;
const std::unique_ptr<Timeout> timeout_;
- DurationMs duration_;
+ webrtc::TimeDelta duration_;
// Increased on each start, and is matched on Trigger, to avoid races. And by
// race, meaning that a timeout - which may be evaluated/expired on a
diff --git a/net/dcsctp/timer/timer_test.cc b/net/dcsctp/timer/timer_test.cc
index 4aebe65b48..9a7c029ec5 100644
--- a/net/dcsctp/timer/timer_test.cc
+++ b/net/dcsctp/timer/timer_test.cc
@@ -13,6 +13,7 @@
#include "absl/types/optional.h"
#include "api/task_queue/task_queue_base.h"
+#include "api/units/time_delta.h"
#include "net/dcsctp/public/timeout.h"
#include "net/dcsctp/timer/fake_timeout.h"
#include "rtc_base/gunit.h"
@@ -21,6 +22,8 @@
namespace dcsctp {
namespace {
using ::testing::Return;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
class TimerTest : public testing::Test {
protected:
@@ -29,10 +32,10 @@ class TimerTest : public testing::Test {
manager_([this](webrtc::TaskQueueBase::DelayPrecision precision) {
return timeout_manager_.CreateTimeout(precision);
}) {
- ON_CALL(on_expired_, Call).WillByDefault(Return(absl::nullopt));
+ ON_CALL(on_expired_, Call).WillByDefault(Return(TimeDelta::Zero()));
}
- void AdvanceTimeAndRunTimers(DurationMs duration) {
+ void AdvanceTimeAndRunTimers(TimeDelta duration) {
now_ = now_ + duration;
for (;;) {
@@ -45,16 +48,16 @@ class TimerTest : public testing::Test {
}
}
- TimeMs now_ = TimeMs(0);
+ Timestamp now_ = Timestamp::Zero();
FakeTimeoutManager timeout_manager_;
TimerManager manager_;
- testing::MockFunction<absl::optional<DurationMs>()> on_expired_;
+ testing::MockFunction<TimeDelta()> on_expired_;
};
TEST_F(TimerTest, TimerIsInitiallyStopped) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed));
EXPECT_FALSE(t1->is_running());
}
@@ -62,50 +65,50 @@ TEST_F(TimerTest, TimerIsInitiallyStopped) {
TEST_F(TimerTest, TimerExpiresAtGivenTime) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
EXPECT_TRUE(t1->is_running());
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
}
TEST_F(TimerTest, TimerReschedulesAfterExpiredWithFixedBackoff) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
EXPECT_EQ(t1->expiration_count(), 0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Fire first time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_EQ(t1->expiration_count(), 1);
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Second time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_EQ(t1->expiration_count(), 2);
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Third time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_EQ(t1->expiration_count(), 3);
}
@@ -113,151 +116,151 @@ TEST_F(TimerTest, TimerReschedulesAfterExpiredWithFixedBackoff) {
TEST_F(TimerTest, TimerWithNoRestarts) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed,
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed,
/*max_restart=*/0));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Fire first time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_FALSE(t1->is_running());
// Second time - shouldn't fire
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(5000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(5));
EXPECT_FALSE(t1->is_running());
}
TEST_F(TimerTest, TimerWithOneRestart) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed,
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed,
/*max_restart=*/1));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Fire first time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Second time - max restart limit reached.
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_FALSE(t1->is_running());
// Third time - should not fire.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(5000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(5));
EXPECT_FALSE(t1->is_running());
}
TEST_F(TimerTest, TimerWithTwoRestart) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed,
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed,
/*max_restart=*/2));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Fire first time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Second time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_TRUE(t1->is_running());
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Third time
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_FALSE(t1->is_running());
}
TEST_F(TimerTest, TimerWithExponentialBackoff) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kExponential));
t1->Start();
// Fire first time at 5 seconds
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(5000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(5));
// Second time at 5*2^1 = 10 seconds later.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(9000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(9));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
// Third time at 5*2^2 = 20 seconds later.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(19000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(19));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
// Fourth time at 5*2^3 = 40 seconds later.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(39000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(39));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
}
TEST_F(TimerTest, StartTimerWillStopAndStart) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kExponential));
t1->Start();
- AdvanceTimeAndRunTimers(DurationMs(3000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(3));
t1->Start();
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(2000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(2));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(3000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(3));
}
TEST_F(TimerTest, ExpirationCounterWillResetIfStopped) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kExponential));
t1->Start();
// Fire first time at 5 seconds
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(5000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(5));
EXPECT_EQ(t1->expiration_count(), 1);
// Second time at 5*2^1 = 10 seconds later.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(9000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(9));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_EQ(t1->expiration_count(), 2);
t1->Start();
@@ -265,79 +268,79 @@ TEST_F(TimerTest, ExpirationCounterWillResetIfStopped) {
// Third time at 5*2^0 = 5 seconds later.
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_EQ(t1->expiration_count(), 1);
}
TEST_F(TimerTest, StopTimerWillMakeItNotExpire) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kExponential));
t1->Start();
EXPECT_TRUE(t1->is_running());
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
t1->Stop();
EXPECT_FALSE(t1->is_running());
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
}
TEST_F(TimerTest, ReturningNewDurationWhenExpired) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(5000), TimerBackoffAlgorithm::kFixed));
+ TimerOptions(TimeDelta::Seconds(5), TimerBackoffAlgorithm::kFixed));
EXPECT_CALL(on_expired_, Call).Times(0);
t1->Start();
- EXPECT_EQ(t1->duration(), DurationMs(5000));
+ EXPECT_EQ(t1->duration(), TimeDelta::Seconds(5));
- AdvanceTimeAndRunTimers(DurationMs(4000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(4));
// Fire first time
- EXPECT_CALL(on_expired_, Call).WillOnce(Return(DurationMs(2000)));
- AdvanceTimeAndRunTimers(DurationMs(1000));
- EXPECT_EQ(t1->duration(), DurationMs(2000));
+ EXPECT_CALL(on_expired_, Call).WillOnce(Return(TimeDelta::Seconds(2)));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
+ EXPECT_EQ(t1->duration(), TimeDelta::Seconds(2));
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
// Second time
- EXPECT_CALL(on_expired_, Call).WillOnce(Return(DurationMs(10000)));
- AdvanceTimeAndRunTimers(DurationMs(1000));
- EXPECT_EQ(t1->duration(), DurationMs(10000));
+ EXPECT_CALL(on_expired_, Call).WillOnce(Return(TimeDelta::Seconds(10)));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
+ EXPECT_EQ(t1->duration(), TimeDelta::Seconds(10));
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(9000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(9));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
}
TEST_F(TimerTest, TimersHaveMaximumDuration) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(1000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(1), TimerBackoffAlgorithm::kExponential));
- t1->set_duration(DurationMs(2 * *Timer::kMaxTimerDuration));
+ t1->set_duration(2 * Timer::kMaxTimerDuration);
EXPECT_EQ(t1->duration(), Timer::kMaxTimerDuration);
}
TEST_F(TimerTest, TimersHaveMaximumBackoffDuration) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(1000), TimerBackoffAlgorithm::kExponential));
+ TimerOptions(TimeDelta::Seconds(1), TimerBackoffAlgorithm::kExponential));
t1->Start();
- int max_exponent = static_cast<int>(log2(*Timer::kMaxTimerDuration / 1000));
+ int max_exponent = static_cast<int>(log2(Timer::kMaxTimerDuration.seconds()));
for (int i = 0; i < max_exponent; ++i) {
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000 * (1 << i)));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1 * (1 << i)));
}
// Reached the maximum duration.
@@ -357,77 +360,77 @@ TEST_F(TimerTest, TimersHaveMaximumBackoffDuration) {
TEST_F(TimerTest, TimerCanBeStartedFromWithinExpirationHandler) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(1000), TimerBackoffAlgorithm::kFixed));
+ TimerOptions(TimeDelta::Seconds(1), TimerBackoffAlgorithm::kFixed));
t1->Start();
// Start a timer, but don't return any new duration in callback.
EXPECT_CALL(on_expired_, Call).WillOnce([&]() {
EXPECT_TRUE(t1->is_running());
- t1->set_duration(DurationMs(5000));
+ t1->set_duration(TimeDelta::Seconds(5));
t1->Start();
- return absl::nullopt;
+ return TimeDelta::Zero();
});
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(4999));
// Start a timer, and return any new duration in callback.
EXPECT_CALL(on_expired_, Call).WillOnce([&]() {
EXPECT_TRUE(t1->is_running());
- t1->set_duration(DurationMs(5000));
+ t1->set_duration(TimeDelta::Seconds(5));
t1->Start();
- return absl::make_optional(DurationMs(8000));
+ return TimeDelta::Seconds(8);
});
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(7999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(7999));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
}
TEST_F(TimerTest, DurationStaysWithinMaxTimerBackOffDuration) {
std::unique_ptr<Timer> t1 = manager_.CreateTimer(
"t1", on_expired_.AsStdFunction(),
- TimerOptions(DurationMs(1000), TimerBackoffAlgorithm::kExponential,
- /*max_restarts=*/absl::nullopt, DurationMs(5000)));
+ TimerOptions(TimeDelta::Seconds(1), TimerBackoffAlgorithm::kExponential,
+ /*max_restarts=*/absl::nullopt, TimeDelta::Seconds(5)));
t1->Start();
// Initial timeout, 1000 ms
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1000));
+ AdvanceTimeAndRunTimers(TimeDelta::Seconds(1));
// Exponential backoff -> 2000 ms
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(1999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1999));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
// Exponential backoff -> 4000 ms
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(3999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(3999));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
// Limited backoff -> 5000ms
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(4999));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
// ... where it plateaus
EXPECT_CALL(on_expired_, Call).Times(0);
- AdvanceTimeAndRunTimers(DurationMs(4999));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(4999));
EXPECT_CALL(on_expired_, Call).Times(1);
- AdvanceTimeAndRunTimers(DurationMs(1));
+ AdvanceTimeAndRunTimers(TimeDelta::Millis(1));
}
TEST(TimerManagerTest, TimerManagerPassesPrecisionToCreateTimeoutMethod) {
- FakeTimeoutManager timeout_manager([&]() { return TimeMs(0); });
+ FakeTimeoutManager timeout_manager([&]() { return Timestamp::Zero(); });
absl::optional<webrtc::TaskQueueBase::DelayPrecision> create_timer_precison;
TimerManager manager([&](webrtc::TaskQueueBase::DelayPrecision precision) {
create_timer_precison = precision;
@@ -435,22 +438,22 @@ TEST(TimerManagerTest, TimerManagerPassesPrecisionToCreateTimeoutMethod) {
});
// Default TimerOptions.
manager.CreateTimer(
- "test_timer", []() { return absl::optional<DurationMs>(); },
- TimerOptions(DurationMs(123)));
+ "test_timer", []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Millis(123)));
EXPECT_EQ(create_timer_precison, webrtc::TaskQueueBase::DelayPrecision::kLow);
// High precision TimerOptions.
manager.CreateTimer(
- "test_timer", []() { return absl::optional<DurationMs>(); },
- TimerOptions(DurationMs(123), TimerBackoffAlgorithm::kExponential,
- absl::nullopt, absl::nullopt,
+ "test_timer", []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Millis(123), TimerBackoffAlgorithm::kExponential,
+ absl::nullopt, TimeDelta::PlusInfinity(),
webrtc::TaskQueueBase::DelayPrecision::kHigh));
EXPECT_EQ(create_timer_precison,
webrtc::TaskQueueBase::DelayPrecision::kHigh);
// Low precision TimerOptions.
manager.CreateTimer(
- "test_timer", []() { return absl::optional<DurationMs>(); },
- TimerOptions(DurationMs(123), TimerBackoffAlgorithm::kExponential,
- absl::nullopt, absl::nullopt,
+ "test_timer", []() { return TimeDelta::Zero(); },
+ TimerOptions(TimeDelta::Millis(123), TimerBackoffAlgorithm::kExponential,
+ absl::nullopt, TimeDelta::PlusInfinity(),
webrtc::TaskQueueBase::DelayPrecision::kLow));
EXPECT_EQ(create_timer_precison, webrtc::TaskQueueBase::DelayPrecision::kLow);
}
diff --git a/net/dcsctp/tx/BUILD.gn b/net/dcsctp/tx/BUILD.gn
index 5219317d97..d1fd8ab3d5 100644
--- a/net/dcsctp/tx/BUILD.gn
+++ b/net/dcsctp/tx/BUILD.gn
@@ -11,6 +11,7 @@ import("../../../webrtc.gni")
rtc_source_set("send_queue") {
deps = [
"../../../api:array_view",
+ "../../../api/units:timestamp",
"../common:internal_types",
"../packet:chunk",
"../packet:data",
@@ -28,8 +29,9 @@ rtc_library("rr_send_queue") {
"../../../api:array_view",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
+ "../../../rtc_base:stringutils",
"../../../rtc_base/containers:flat_map",
- "../common:str_join",
+ "../common:internal_types",
"../packet:data",
"../public:socket",
"../public:types",
@@ -52,9 +54,9 @@ rtc_library("stream_scheduler") {
"../../../api:array_view",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
+ "../../../rtc_base:stringutils",
"../../../rtc_base:strong_alias",
"../../../rtc_base/containers:flat_set",
- "../common:str_join",
"../packet:chunk",
"../packet:data",
"../packet:sctp_packet",
@@ -88,6 +90,7 @@ rtc_library("retransmission_error_counter") {
rtc_library("retransmission_timeout") {
deps = [
+ "../../../api/units:time_delta",
"../../../rtc_base:checks",
"../public:types",
]
@@ -102,12 +105,15 @@ rtc_library("outstanding_data") {
":retransmission_timeout",
":send_queue",
"../../../api:array_view",
+ "../../../api/units:time_delta",
+ "../../../api/units:timestamp",
"../../../rtc_base:checks",
"../../../rtc_base:logging",
+ "../../../rtc_base:stringutils",
"../../../rtc_base/containers:flat_set",
+ "../common:internal_types",
"../common:math",
"../common:sequence_numbers",
- "../common:str_join",
"../packet:chunk",
"../packet:data",
"../public:socket",
@@ -136,7 +142,6 @@ rtc_library("retransmission_queue") {
"../../../rtc_base:stringutils",
"../common:math",
"../common:sequence_numbers",
- "../common:str_join",
"../packet:chunk",
"../packet:data",
"../public:socket",
@@ -160,6 +165,7 @@ if (rtc_include_tests) {
deps = [
":send_queue",
"../../../api:array_view",
+ "../../../api/units:timestamp",
"../../../test:test_support",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
@@ -184,6 +190,7 @@ if (rtc_include_tests) {
"../../../rtc_base:gunit_helpers",
"../../../test:test_support",
"../common:handover_testing",
+ "../common:internal_types",
"../common:math",
"../common:sequence_numbers",
"../packet:chunk",
diff --git a/net/dcsctp/tx/mock_send_queue.h b/net/dcsctp/tx/mock_send_queue.h
index 0c8f5d141d..3511403eab 100644
--- a/net/dcsctp/tx/mock_send_queue.h
+++ b/net/dcsctp/tx/mock_send_queue.h
@@ -15,6 +15,7 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/tx/send_queue.h"
#include "test/gmock.h"
@@ -23,18 +24,19 @@ namespace dcsctp {
class MockSendQueue : public SendQueue {
public:
MockSendQueue() {
- ON_CALL(*this, Produce).WillByDefault([](TimeMs now, size_t max_size) {
- return absl::nullopt;
- });
+ ON_CALL(*this, Produce)
+ .WillByDefault([](webrtc::Timestamp now, size_t max_size) {
+ return absl::nullopt;
+ });
}
MOCK_METHOD(absl::optional<SendQueue::DataToSend>,
Produce,
- (TimeMs now, size_t max_size),
+ (webrtc::Timestamp now, size_t max_size),
(override));
MOCK_METHOD(bool,
Discard,
- (IsUnordered unordered, StreamID stream_id, MID message_id),
+ (StreamID stream_id, OutgoingMessageId message_id),
(override));
MOCK_METHOD(void, PrepareResetStream, (StreamID stream_id), (override));
MOCK_METHOD(bool, HasStreamsReadyToBeReset, (), (const, override));
diff --git a/net/dcsctp/tx/outstanding_data.cc b/net/dcsctp/tx/outstanding_data.cc
index c65c195432..30d83870e3 100644
--- a/net/dcsctp/tx/outstanding_data.cc
+++ b/net/dcsctp/tx/outstanding_data.cc
@@ -14,12 +14,15 @@
#include <utility>
#include <vector>
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/common/math.h"
#include "net/dcsctp/common/sequence_numbers.h"
#include "net/dcsctp/public/types.h"
#include "rtc_base/logging.h"
namespace dcsctp {
+using ::webrtc::Timestamp;
// The number of times a packet must be NACKed before it's retransmitted.
// See https://tools.ietf.org/html/rfc4960#section-7.2.4
@@ -63,10 +66,12 @@ void OutstandingData::Item::MarkAsRetransmitted() {
}
void OutstandingData::Item::Abandon() {
+ RTC_DCHECK(!expires_at_.IsPlusInfinity() ||
+ max_retransmissions_ != MaxRetransmits::NoLimit());
lifecycle_ = Lifecycle::kAbandoned;
}
-bool OutstandingData::Item::has_expired(TimeMs now) const {
+bool OutstandingData::Item::has_expired(Timestamp now) const {
return expires_at_ <= now;
}
@@ -252,6 +257,7 @@ bool OutstandingData::NackItem(UnwrappedTSN tsn,
RTC_DLOG(LS_VERBOSE) << *tsn.Wrap() << " marked for retransmission";
break;
case Item::NackAction::kAbandon:
+ RTC_DLOG(LS_VERBOSE) << *tsn.Wrap() << " Nacked, resulted in abandoning";
AbandonAllFor(item);
break;
}
@@ -260,8 +266,7 @@ bool OutstandingData::NackItem(UnwrappedTSN tsn,
void OutstandingData::AbandonAllFor(const Item& item) {
// Erase all remaining chunks from the producer, if any.
- if (discard_from_send_queue_(item.data().is_unordered, item.data().stream_id,
- item.data().message_id)) {
+ if (discard_from_send_queue_(item.data().stream_id, item.message_id())) {
// There were remaining chunks to be produced for this message. Since the
// receiver may have already received all chunks (up till now) for this
// message, we can't just FORWARD-TSN to the last fragment in this
@@ -272,17 +277,17 @@ void OutstandingData::AbandonAllFor(const Item& item) {
// TSN in the sent FORWARD-TSN.
UnwrappedTSN tsn = next_tsn_;
next_tsn_.Increment();
- Data message_end(item.data().stream_id, item.data().ssn,
- item.data().message_id, item.data().fsn, item.data().ppid,
- std::vector<uint8_t>(), Data::IsBeginning(false),
- Data::IsEnd(true), item.data().is_unordered);
+ Data message_end(item.data().stream_id, item.data().ssn, item.data().mid,
+ item.data().fsn, item.data().ppid, std::vector<uint8_t>(),
+ Data::IsBeginning(false), Data::IsEnd(true),
+ item.data().is_unordered);
Item& added_item =
outstanding_data_
.emplace(std::piecewise_construct, std::forward_as_tuple(tsn),
- std::forward_as_tuple(std::move(message_end), TimeMs(0),
- MaxRetransmits::NoLimit(),
- TimeMs::InfiniteFuture(),
- LifecycleId::NotSet()))
+ std::forward_as_tuple(
+ item.message_id(), std::move(message_end),
+ Timestamp::Zero(), MaxRetransmits(0),
+ Timestamp::PlusInfinity(), LifecycleId::NotSet()))
.first->second;
// The added chunk shouldn't be included in `outstanding_bytes`, so set it
// as acked.
@@ -294,8 +299,7 @@ void OutstandingData::AbandonAllFor(const Item& item) {
for (auto& [tsn, other] : outstanding_data_) {
if (!other.is_abandoned() &&
other.data().stream_id == item.data().stream_id &&
- other.data().is_unordered == item.data().is_unordered &&
- other.data().message_id == item.data().message_id) {
+ other.message_id() == item.message_id()) {
RTC_DLOG(LS_VERBOSE) << "Marking chunk " << *tsn.Wrap()
<< " as abandoned";
if (other.should_be_retransmitted()) {
@@ -369,7 +373,7 @@ std::vector<std::pair<TSN, Data>> OutstandingData::GetChunksToBeRetransmitted(
return ExtractChunksThatCanFit(to_be_retransmitted_, max_size);
}
-void OutstandingData::ExpireOutstandingChunks(TimeMs now) {
+void OutstandingData::ExpireOutstandingChunks(Timestamp now) {
for (const auto& [tsn, item] : outstanding_data_) {
// Chunks that are nacked can be expired. Care should be taken not to expire
// unacked (in-flight) chunks as they might have been received, but the SACK
@@ -378,7 +382,7 @@ void OutstandingData::ExpireOutstandingChunks(TimeMs now) {
// Already abandoned.
} else if (item.is_nacked() && item.has_expired(now)) {
RTC_DLOG(LS_VERBOSE) << "Marking nacked chunk " << *tsn.Wrap()
- << " and message " << *item.data().message_id
+ << " and message " << *item.data().mid
<< " as expired";
AbandonAllFor(item);
} else {
@@ -395,10 +399,11 @@ UnwrappedTSN OutstandingData::highest_outstanding_tsn() const {
}
absl::optional<UnwrappedTSN> OutstandingData::Insert(
+ OutgoingMessageId message_id,
const Data& data,
- TimeMs time_sent,
+ Timestamp time_sent,
MaxRetransmits max_retransmissions,
- TimeMs expires_at,
+ Timestamp expires_at,
LifecycleId lifecycle_id) {
UnwrappedTSN tsn = next_tsn_;
next_tsn_.Increment();
@@ -409,9 +414,9 @@ absl::optional<UnwrappedTSN> OutstandingData::Insert(
++outstanding_items_;
auto it = outstanding_data_
.emplace(std::piecewise_construct, std::forward_as_tuple(tsn),
- std::forward_as_tuple(data.Clone(), time_sent,
- max_retransmissions, expires_at,
- lifecycle_id))
+ std::forward_as_tuple(message_id, data.Clone(),
+ time_sent, max_retransmissions,
+ expires_at, lifecycle_id))
.first;
if (it->second.has_expired(time_sent)) {
@@ -419,7 +424,7 @@ absl::optional<UnwrappedTSN> OutstandingData::Insert(
// queue.
RTC_DLOG(LS_VERBOSE) << "Marking freshly produced chunk "
<< *it->first.Wrap() << " and message "
- << *it->second.data().message_id << " as expired";
+ << *it->second.data().mid << " as expired";
AbandonAllFor(it->second);
RTC_DCHECK(IsConsistent());
return absl::nullopt;
@@ -439,8 +444,8 @@ void OutstandingData::NackAll() {
RTC_DCHECK(IsConsistent());
}
-absl::optional<DurationMs> OutstandingData::MeasureRTT(TimeMs now,
- UnwrappedTSN tsn) const {
+webrtc::TimeDelta OutstandingData::MeasureRTT(Timestamp now,
+ UnwrappedTSN tsn) const {
auto it = outstanding_data_.find(tsn);
if (it != outstanding_data_.end() && !it->second.has_been_retransmitted()) {
// https://tools.ietf.org/html/rfc4960#section-6.3.1
@@ -450,7 +455,7 @@ absl::optional<DurationMs> OutstandingData::MeasureRTT(TimeMs now,
// later instance)"
return now - it->second.time_sent();
}
- return absl::nullopt;
+ return webrtc::TimeDelta::PlusInfinity();
}
std::vector<std::pair<TSN, OutstandingData::State>>
@@ -522,15 +527,15 @@ IForwardTsnChunk OutstandingData::CreateIForwardTsn() const {
std::pair<IsUnordered, StreamID> stream_id =
std::make_pair(item.data().is_unordered, item.data().stream_id);
- if (item.data().message_id > skipped_per_stream[stream_id]) {
- skipped_per_stream[stream_id] = item.data().message_id;
+ if (item.data().mid > skipped_per_stream[stream_id]) {
+ skipped_per_stream[stream_id] = item.data().mid;
}
}
std::vector<IForwardTsnChunk::SkippedStream> skipped_streams;
skipped_streams.reserve(skipped_per_stream.size());
- for (const auto& [stream, message_id] : skipped_per_stream) {
- skipped_streams.emplace_back(stream.first, stream.second, message_id);
+ for (const auto& [stream, mid] : skipped_per_stream) {
+ skipped_streams.emplace_back(stream.first, stream.second, mid);
}
return IForwardTsnChunk(new_cumulative_ack.Wrap(),
diff --git a/net/dcsctp/tx/outstanding_data.h b/net/dcsctp/tx/outstanding_data.h
index 0bca1c6fe4..3cad8069c1 100644
--- a/net/dcsctp/tx/outstanding_data.h
+++ b/net/dcsctp/tx/outstanding_data.h
@@ -16,6 +16,8 @@
#include <vector>
#include "absl/types/optional.h"
+#include "api/units/timestamp.h"
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/common/sequence_numbers.h"
#include "net/dcsctp/packet/chunk/forward_tsn_chunk.h"
#include "net/dcsctp/packet/chunk/iforward_tsn_chunk.h"
@@ -75,7 +77,7 @@ class OutstandingData {
size_t data_chunk_header_size,
UnwrappedTSN next_tsn,
UnwrappedTSN last_cumulative_tsn_ack,
- std::function<bool(IsUnordered, StreamID, MID)> discard_from_send_queue)
+ std::function<bool(StreamID, OutgoingMessageId)> discard_from_send_queue)
: data_chunk_header_size_(data_chunk_header_size),
next_tsn_(next_tsn),
last_cumulative_tsn_ack_(last_cumulative_tsn_ack),
@@ -104,7 +106,7 @@ class OutstandingData {
// Given the current time `now_ms`, expire and abandon outstanding (sent at
// least once) chunks that have a limited lifetime.
- void ExpireOutstandingChunks(TimeMs now);
+ void ExpireOutstandingChunks(webrtc::Timestamp now);
bool empty() const { return outstanding_data_.empty(); }
@@ -128,10 +130,11 @@ class OutstandingData {
// parameters. Returns the TSN if the item was actually added and scheduled to
// be sent, and absl::nullopt if it shouldn't be sent.
absl::optional<UnwrappedTSN> Insert(
+ OutgoingMessageId message_id,
const Data& data,
- TimeMs time_sent,
+ webrtc::Timestamp time_sent,
MaxRetransmits max_retransmissions = MaxRetransmits::NoLimit(),
- TimeMs expires_at = TimeMs::InfiniteFuture(),
+ webrtc::Timestamp expires_at = webrtc::Timestamp::PlusInfinity(),
LifecycleId lifecycle_id = LifecycleId::NotSet());
// Nacks all outstanding data.
@@ -145,8 +148,8 @@ class OutstandingData {
// Given the current time and a TSN, it returns the measured RTT between when
// the chunk was sent and now. It takes into acccount Karn's algorithm, so if
- // the chunk has ever been retransmitted, it will return absl::nullopt.
- absl::optional<DurationMs> MeasureRTT(TimeMs now, UnwrappedTSN tsn) const;
+ // the chunk has ever been retransmitted, it will return `PlusInfinity()`.
+ webrtc::TimeDelta MeasureRTT(webrtc::Timestamp now, UnwrappedTSN tsn) const;
// Returns the internal state of all queued chunks. This is only used in
// unit-tests.
@@ -175,12 +178,14 @@ class OutstandingData {
kAbandon,
};
- Item(Data data,
- TimeMs time_sent,
+ Item(OutgoingMessageId message_id,
+ Data data,
+ webrtc::Timestamp time_sent,
MaxRetransmits max_retransmissions,
- TimeMs expires_at,
+ webrtc::Timestamp expires_at,
LifecycleId lifecycle_id)
- : time_sent_(time_sent),
+ : message_id_(message_id),
+ time_sent_(time_sent),
max_retransmissions_(max_retransmissions),
expires_at_(expires_at),
lifecycle_id_(lifecycle_id),
@@ -189,7 +194,9 @@ class OutstandingData {
Item(const Item&) = delete;
Item& operator=(const Item&) = delete;
- TimeMs time_sent() const { return time_sent_; }
+ OutgoingMessageId message_id() const { return message_id_; }
+
+ webrtc::Timestamp time_sent() const { return time_sent_; }
const Data& data() const { return data_; }
@@ -223,7 +230,7 @@ class OutstandingData {
// Given the current time, and the current state of this DATA chunk, it will
// indicate if it has expired (SCTP Partial Reliability Extension).
- bool has_expired(TimeMs now) const;
+ bool has_expired(webrtc::Timestamp now) const;
LifecycleId lifecycle_id() const { return lifecycle_id_; }
@@ -249,8 +256,10 @@ class OutstandingData {
// NOTE: This data structure has been optimized for size, by ordering fields
// to avoid unnecessary padding.
+ const OutgoingMessageId message_id_;
+
// When the packet was sent, and placed in this queue.
- const TimeMs time_sent_;
+ const webrtc::Timestamp time_sent_;
// If the message was sent with a maximum number of retransmissions, this is
// set to that number. The value zero (0) means that it will never be
// retransmitted.
@@ -270,7 +279,7 @@ class OutstandingData {
// At this exact millisecond, the item is considered expired. If the message
// is not to be expired, this is set to the infinite future.
- const TimeMs expires_at_;
+ const webrtc::Timestamp expires_at_;
// An optional lifecycle id, which may only be set for the last fragment.
const LifecycleId lifecycle_id_;
@@ -338,7 +347,7 @@ class OutstandingData {
// The last cumulative TSN ack number.
UnwrappedTSN last_cumulative_tsn_ack_;
// Callback when to discard items from the send queue.
- std::function<bool(IsUnordered, StreamID, MID)> discard_from_send_queue_;
+ std::function<bool(StreamID, OutgoingMessageId)> discard_from_send_queue_;
std::map<UnwrappedTSN, Item> outstanding_data_;
// The number of bytes that are in-flight (sent but not yet acked or nacked).
diff --git a/net/dcsctp/tx/outstanding_data_test.cc b/net/dcsctp/tx/outstanding_data_test.cc
index 3bb82fd3e6..33fc51acf1 100644
--- a/net/dcsctp/tx/outstanding_data_test.cc
+++ b/net/dcsctp/tx/outstanding_data_test.cc
@@ -12,10 +12,12 @@
#include <vector>
#include "absl/types/optional.h"
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/common/math.h"
#include "net/dcsctp/common/sequence_numbers.h"
#include "net/dcsctp/packet/chunk/data_chunk.h"
#include "net/dcsctp/packet/chunk/forward_tsn_chunk.h"
+#include "net/dcsctp/public/dcsctp_socket.h"
#include "net/dcsctp/public/types.h"
#include "net/dcsctp/testing/data_generator.h"
#include "net/dcsctp/testing/testing_macros.h"
@@ -35,8 +37,11 @@ using ::testing::Property;
using ::testing::Return;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
-constexpr TimeMs kNow(42);
+constexpr Timestamp kNow = Timestamp::Millis(42);
+constexpr OutgoingMessageId kMessageId = OutgoingMessageId(17);
class OutstandingDataTest : public testing::Test {
protected:
@@ -49,7 +54,7 @@ class OutstandingDataTest : public testing::Test {
UnwrappedTSN::Unwrapper unwrapper_;
DataGenerator gen_;
- StrictMock<MockFunction<bool(IsUnordered, StreamID, MID)>> on_discard_;
+ StrictMock<MockFunction<bool(StreamID, OutgoingMessageId)>> on_discard_;
OutstandingData buf_;
};
@@ -67,8 +72,8 @@ TEST_F(OutstandingDataTest, HasInitialState) {
}
TEST_F(OutstandingDataTest, InsertChunk) {
- ASSERT_HAS_VALUE_AND_ASSIGN(UnwrappedTSN tsn,
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow));
+ ASSERT_HAS_VALUE_AND_ASSIGN(
+ UnwrappedTSN tsn, buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow));
EXPECT_EQ(tsn.Wrap(), TSN(10));
@@ -84,7 +89,7 @@ TEST_F(OutstandingDataTest, InsertChunk) {
}
TEST_F(OutstandingDataTest, AcksSingleChunk) {
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow);
OutstandingData::AckInfo ack =
buf_.HandleSack(unwrapper_.Unwrap(TSN(10)), {}, false);
@@ -103,7 +108,7 @@ TEST_F(OutstandingDataTest, AcksSingleChunk) {
}
TEST_F(OutstandingDataTest, AcksPreviousChunkDoesntUpdate) {
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow);
buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), {}, false);
EXPECT_EQ(buf_.outstanding_bytes(), DataChunk::kHeaderSize + RoundUpTo4(1));
@@ -118,8 +123,8 @@ TEST_F(OutstandingDataTest, AcksPreviousChunkDoesntUpdate) {
}
TEST_F(OutstandingDataTest, AcksAndNacksWithGapAckBlocks) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow);
std::vector<SackChunk::GapAckBlock> gab = {SackChunk::GapAckBlock(2, 2)};
OutstandingData::AckInfo ack =
@@ -141,8 +146,8 @@ TEST_F(OutstandingDataTest, AcksAndNacksWithGapAckBlocks) {
}
TEST_F(OutstandingDataTest, NacksThreeTimesWithSameTsnDoesntRetransmit) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow);
std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(2, 2)};
EXPECT_FALSE(
@@ -164,10 +169,10 @@ TEST_F(OutstandingDataTest, NacksThreeTimesWithSameTsnDoesntRetransmit) {
}
TEST_F(OutstandingDataTest, NacksThreeTimesResultsInRetransmission) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow);
std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(2, 2)};
EXPECT_FALSE(
@@ -202,10 +207,10 @@ TEST_F(OutstandingDataTest, NacksThreeTimesResultsInRetransmission) {
TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoning) {
static constexpr MaxRetransmits kMaxRetransmissions(0);
- buf_.Insert(gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow, kMaxRetransmissions);
std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(2, 2)};
EXPECT_FALSE(
@@ -217,7 +222,7 @@ TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoning) {
buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab2, false).has_packet_loss);
EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
std::vector<SackChunk::GapAckBlock> gab3 = {SackChunk::GapAckBlock(2, 4)};
OutstandingData::AckInfo ack =
@@ -238,10 +243,10 @@ TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoning) {
TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoningWithPlaceholder) {
static constexpr MaxRetransmits kMaxRetransmissions(0);
- buf_.Insert(gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(2, 2)};
EXPECT_FALSE(
@@ -253,7 +258,7 @@ TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoningWithPlaceholder) {
buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab2, false).has_packet_loss);
EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(true));
std::vector<SackChunk::GapAckBlock> gab3 = {SackChunk::GapAckBlock(2, 4)};
OutstandingData::AckInfo ack =
@@ -274,17 +279,19 @@ TEST_F(OutstandingDataTest, NacksThreeTimesResultsInAbandoningWithPlaceholder) {
}
TEST_F(OutstandingDataTest, ExpiresChunkBeforeItIsInserted) {
- static constexpr TimeMs kExpiresAt = kNow + DurationMs(1);
- EXPECT_TRUE(buf_.Insert(gen_.Ordered({1}, "B"), kNow,
+ static constexpr Timestamp kExpiresAt = kNow + TimeDelta::Millis(1);
+ EXPECT_TRUE(buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow,
MaxRetransmits::NoLimit(), kExpiresAt)
.has_value());
- EXPECT_TRUE(buf_.Insert(gen_.Ordered({1}, ""), kNow + DurationMs(0),
+ EXPECT_TRUE(buf_.Insert(kMessageId, gen_.Ordered({1}, ""),
+ kNow + TimeDelta::Millis(0),
MaxRetransmits::NoLimit(), kExpiresAt)
.has_value());
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
- EXPECT_FALSE(buf_.Insert(gen_.Ordered({1}, "E"), kNow + DurationMs(1),
+ EXPECT_FALSE(buf_.Insert(kMessageId, gen_.Ordered({1}, "E"),
+ kNow + TimeDelta::Millis(1),
MaxRetransmits::NoLimit(), kExpiresAt)
.has_value());
@@ -301,11 +308,11 @@ TEST_F(OutstandingDataTest, ExpiresChunkBeforeItIsInserted) {
TEST_F(OutstandingDataTest, CanGenerateForwardTsn) {
static constexpr MaxRetransmits kMaxRetransmissions(0);
- buf_.Insert(gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, kMaxRetransmissions);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow, kMaxRetransmissions);
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
buf_.NackAll();
@@ -322,14 +329,14 @@ TEST_F(OutstandingDataTest, CanGenerateForwardTsn) {
}
TEST_F(OutstandingDataTest, AckWithGapBlocksFromRFC4960Section334) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, ""), kNow);
- buf_.Insert(gen_.Ordered({1}, "E"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow);
EXPECT_THAT(buf_.GetChunkStatesForTesting(),
testing::ElementsAre(Pair(TSN(9), State::kAcked), //
@@ -356,16 +363,15 @@ TEST_F(OutstandingDataTest, AckWithGapBlocksFromRFC4960Section334) {
}
TEST_F(OutstandingDataTest, MeasureRTT) {
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow);
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow + DurationMs(1));
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow + DurationMs(2));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow);
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow + TimeDelta::Millis(1));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "BE"), kNow + TimeDelta::Millis(2));
- static constexpr DurationMs kDuration(123);
- ASSERT_HAS_VALUE_AND_ASSIGN(
- DurationMs duration,
- buf_.MeasureRTT(kNow + kDuration, unwrapper_.Unwrap(TSN(11))));
+ static constexpr TimeDelta kDuration = TimeDelta::Millis(123);
+ TimeDelta duration =
+ buf_.MeasureRTT(kNow + kDuration, unwrapper_.Unwrap(TSN(11)));
- EXPECT_EQ(duration, kDuration - DurationMs(1));
+ EXPECT_EQ(duration, kDuration - TimeDelta::Millis(1));
}
TEST_F(OutstandingDataTest, MustRetransmitBeforeGettingNackedAgain) {
@@ -375,7 +381,8 @@ TEST_F(OutstandingDataTest, MustRetransmitBeforeGettingNackedAgain) {
static constexpr MaxRetransmits kOneRetransmission(1);
for (int tsn = 10; tsn <= 20; ++tsn) {
- buf_.Insert(gen_.Ordered({1}, tsn == 10 ? "B"
+ buf_.Insert(kMessageId,
+ gen_.Ordered({1}, tsn == 10 ? "B"
: tsn == 20 ? "E"
: ""),
kNow, kOneRetransmission);
@@ -434,7 +441,7 @@ TEST_F(OutstandingDataTest, MustRetransmitBeforeGettingNackedAgain) {
buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab8, false).has_packet_loss);
EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
std::vector<SackChunk::GapAckBlock> gab9 = {SackChunk::GapAckBlock(2, 10)};
@@ -445,54 +452,16 @@ TEST_F(OutstandingDataTest, MustRetransmitBeforeGettingNackedAgain) {
EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
}
-TEST_F(OutstandingDataTest, CanAbandonChunksMarkedForFastRetransmit) {
- // This test is a bit convoluted, and can't really happen with a well behaving
- // client, but this was found by fuzzers. This test will verify that a message
- // that was both marked as "to be fast retransmitted" and "abandoned" at the
- // same time doesn't cause any consistency issues.
-
- // Add chunks 10-14, but chunk 11 has zero retransmissions. When chunk 10 and
- // 11 are NACKed three times, chunk 10 will be marked for retransmission, but
- // chunk 11 will be abandoned, which also abandons chunk 10, as it's part of
- // the same message.
- buf_.Insert(gen_.Ordered({1}, "B"), kNow); // 10
- buf_.Insert(gen_.Ordered({1}, ""), kNow, MaxRetransmits(0)); // 11
- buf_.Insert(gen_.Ordered({1}, ""), kNow); // 12
- buf_.Insert(gen_.Ordered({1}, ""), kNow); // 13
- buf_.Insert(gen_.Ordered({1}, "E"), kNow); // 14
-
- // ACK 9, 12
- std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(3, 3)};
- EXPECT_FALSE(
- buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab1, false).has_packet_loss);
- EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
-
- // ACK 9, 12, 13
- std::vector<SackChunk::GapAckBlock> gab2 = {SackChunk::GapAckBlock(3, 4)};
- EXPECT_FALSE(
- buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab2, false).has_packet_loss);
- EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
-
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
- .WillOnce(Return(false));
-
- // ACK 9, 12, 13, 14
- std::vector<SackChunk::GapAckBlock> gab3 = {SackChunk::GapAckBlock(3, 5)};
- OutstandingData::AckInfo ack =
- buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab3, false);
- EXPECT_TRUE(ack.has_packet_loss);
- EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
- EXPECT_THAT(buf_.GetChunksToBeFastRetransmitted(1000), IsEmpty());
- EXPECT_THAT(buf_.GetChunksToBeRetransmitted(1000), IsEmpty());
-}
-
TEST_F(OutstandingDataTest, LifecyleReturnsAckedItemsInAckInfo) {
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow, MaxRetransmits::NoLimit(),
- TimeMs::InfiniteFuture(), LifecycleId(42));
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow, MaxRetransmits::NoLimit(),
- TimeMs::InfiniteFuture(), LifecycleId(43));
- buf_.Insert(gen_.Ordered({1}, "BE"), kNow, MaxRetransmits::NoLimit(),
- TimeMs::InfiniteFuture(), LifecycleId(44));
+ buf_.Insert(OutgoingMessageId(1), gen_.Ordered({1}, "BE"), kNow,
+ MaxRetransmits::NoLimit(), Timestamp::PlusInfinity(),
+ LifecycleId(42));
+ buf_.Insert(OutgoingMessageId(2), gen_.Ordered({1}, "BE"), kNow,
+ MaxRetransmits::NoLimit(), Timestamp::PlusInfinity(),
+ LifecycleId(43));
+ buf_.Insert(OutgoingMessageId(3), gen_.Ordered({1}, "BE"), kNow,
+ MaxRetransmits::NoLimit(), Timestamp::PlusInfinity(),
+ LifecycleId(44));
OutstandingData::AckInfo ack1 =
buf_.HandleSack(unwrapper_.Unwrap(TSN(11)), {}, false);
@@ -507,11 +476,11 @@ TEST_F(OutstandingDataTest, LifecyleReturnsAckedItemsInAckInfo) {
}
TEST_F(OutstandingDataTest, LifecycleReturnsAbandonedNackedThreeTimes) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, "E"), kNow, MaxRetransmits(0),
- TimeMs::InfiniteFuture(), LifecycleId(42));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow, MaxRetransmits(0),
+ Timestamp::PlusInfinity(), LifecycleId(42));
std::vector<SackChunk::GapAckBlock> gab1 = {SackChunk::GapAckBlock(2, 2)};
EXPECT_FALSE(
@@ -524,7 +493,7 @@ TEST_F(OutstandingDataTest, LifecycleReturnsAbandonedNackedThreeTimes) {
EXPECT_FALSE(buf_.has_data_to_be_retransmitted());
std::vector<SackChunk::GapAckBlock> gab3 = {SackChunk::GapAckBlock(2, 4)};
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
OutstandingData::AckInfo ack1 =
buf_.HandleSack(unwrapper_.Unwrap(TSN(9)), gab3, false);
@@ -543,11 +512,11 @@ TEST_F(OutstandingDataTest, LifecycleReturnsAbandonedNackedThreeTimes) {
}
TEST_F(OutstandingDataTest, LifecycleReturnsAbandonedAfterT3rtxExpired) {
- buf_.Insert(gen_.Ordered({1}, "B"), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, "E"), kNow, MaxRetransmits(0),
- TimeMs::InfiniteFuture(), LifecycleId(42));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "B"), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, ""), kNow, MaxRetransmits(0));
+ buf_.Insert(kMessageId, gen_.Ordered({1}, "E"), kNow, MaxRetransmits(0),
+ Timestamp::PlusInfinity(), LifecycleId(42));
EXPECT_THAT(buf_.GetChunkStatesForTesting(),
testing::ElementsAre(Pair(TSN(9), State::kAcked), //
@@ -569,7 +538,7 @@ TEST_F(OutstandingDataTest, LifecycleReturnsAbandonedAfterT3rtxExpired) {
Pair(TSN(13), State::kAcked)));
// T3-rtx triggered.
- EXPECT_CALL(on_discard_, Call(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(on_discard_, Call(StreamID(1), kMessageId))
.WillOnce(Return(false));
buf_.NackAll();
@@ -609,24 +578,31 @@ TEST_F(OutstandingDataTest, GeneratesForwardTsnUntilNextStreamResetTsn) {
constexpr DataGeneratorOptions kStream1 = {.stream_id = StreamID(1)};
constexpr DataGeneratorOptions kStream2 = {.stream_id = StreamID(2)};
constexpr DataGeneratorOptions kStream3 = {.stream_id = StreamID(3)};
+ constexpr MaxRetransmits kNoRtx = MaxRetransmits(0);
EXPECT_CALL(on_discard_, Call).WillRepeatedly(Return(false));
// TSN 10-12
- buf_.Insert(gen_.Ordered({1}, "BE", kStream1), kNow);
- buf_.Insert(gen_.Ordered({1}, "BE", kStream1), kNow);
- buf_.Insert(gen_.Ordered({1}, "BE", kStream1), kNow, MaxRetransmits(0));
+ buf_.Insert(OutgoingMessageId(0), gen_.Ordered({1}, "BE", kStream1), kNow,
+ kNoRtx);
+ buf_.Insert(OutgoingMessageId(1), gen_.Ordered({1}, "BE", kStream1), kNow,
+ kNoRtx);
+ buf_.Insert(OutgoingMessageId(2), gen_.Ordered({1}, "BE", kStream1), kNow,
+ kNoRtx);
buf_.BeginResetStreams();
// TSN 13, 14
- buf_.Insert(gen_.Ordered({1}, "BE", kStream2), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, "BE", kStream2), kNow, MaxRetransmits(0));
+ buf_.Insert(OutgoingMessageId(3), gen_.Ordered({1}, "BE", kStream2), kNow,
+ kNoRtx);
+ buf_.Insert(OutgoingMessageId(4), gen_.Ordered({1}, "BE", kStream2), kNow,
+ kNoRtx);
buf_.BeginResetStreams();
// TSN 15, 16
- buf_.Insert(gen_.Ordered({1}, "BE", kStream3), kNow, MaxRetransmits(0));
- buf_.Insert(gen_.Ordered({1}, "BE", kStream3), kNow);
+ buf_.Insert(OutgoingMessageId(5), gen_.Ordered({1}, "BE", kStream3), kNow,
+ kNoRtx);
+ buf_.Insert(OutgoingMessageId(6), gen_.Ordered({1}, "BE", kStream3), kNow);
EXPECT_FALSE(buf_.ShouldSendForwardTsn());
diff --git a/net/dcsctp/tx/retransmission_queue.cc b/net/dcsctp/tx/retransmission_queue.cc
index 4cc0b64074..cd1cc14b4f 100644
--- a/net/dcsctp/tx/retransmission_queue.cc
+++ b/net/dcsctp/tx/retransmission_queue.cc
@@ -25,7 +25,6 @@
#include "api/array_view.h"
#include "net/dcsctp/common/math.h"
#include "net/dcsctp/common/sequence_numbers.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/chunk/data_chunk.h"
#include "net/dcsctp/packet/chunk/forward_tsn_chunk.h"
#include "net/dcsctp/packet/chunk/forward_tsn_common.h"
@@ -40,10 +39,13 @@
#include "net/dcsctp/tx/send_queue.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
#include "rtc_base/strings/string_builder.h"
namespace dcsctp {
namespace {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
// Allow sending only slightly less than an MTU, to account for headers.
constexpr float kMinBytesRequiredToSendFactor = 0.9;
@@ -55,7 +57,7 @@ RetransmissionQueue::RetransmissionQueue(
TSN my_initial_tsn,
size_t a_rwnd,
SendQueue& send_queue,
- std::function<void(DurationMs rtt)> on_new_rtt,
+ std::function<void(TimeDelta rtt)> on_new_rtt,
std::function<void()> on_clear_retransmission_counter,
Timer& t3_rtx,
const DcSctpOptions& options,
@@ -86,8 +88,8 @@ RetransmissionQueue::RetransmissionQueue(
data_chunk_header_size_,
tsn_unwrapper_.Unwrap(my_initial_tsn),
tsn_unwrapper_.Unwrap(TSN(*my_initial_tsn - 1)),
- [this](IsUnordered unordered, StreamID stream_id, MID message_id) {
- return send_queue_.Discard(unordered, stream_id, message_id);
+ [this](StreamID stream_id, OutgoingMessageId message_id) {
+ return send_queue_.Discard(stream_id, message_id);
}) {}
bool RetransmissionQueue::IsConsistent() const {
@@ -257,7 +259,7 @@ bool RetransmissionQueue::IsSackValid(const SackChunk& sack) const {
return true;
}
-bool RetransmissionQueue::HandleSack(TimeMs now, const SackChunk& sack) {
+bool RetransmissionQueue::HandleSack(Timestamp now, const SackChunk& sack) {
if (!IsSackValid(sack)) {
return false;
}
@@ -335,7 +337,7 @@ bool RetransmissionQueue::HandleSack(TimeMs now, const SackChunk& sack) {
return true;
}
-void RetransmissionQueue::UpdateRTT(TimeMs now,
+void RetransmissionQueue::UpdateRTT(Timestamp now,
UnwrappedTSN cumulative_tsn_ack) {
// RTT updating is flawed in SCTP, as explained in e.g. Pedersen J, Griwodz C,
// Halvorsen P (2006) Considerations of SCTP retransmission delays for thin
@@ -345,11 +347,10 @@ void RetransmissionQueue::UpdateRTT(TimeMs now,
// TODO(boivie): Consider occasionally sending DATA chunks with I-bit set and
// use only those packets for measurement.
- absl::optional<DurationMs> rtt =
- outstanding_data_.MeasureRTT(now, cumulative_tsn_ack);
+ TimeDelta rtt = outstanding_data_.MeasureRTT(now, cumulative_tsn_ack);
- if (rtt.has_value()) {
- on_new_rtt_(*rtt);
+ if (rtt.IsFinite()) {
+ on_new_rtt_(rtt);
}
}
@@ -449,7 +450,7 @@ RetransmissionQueue::GetChunksForFastRetransmit(size_t bytes_in_packet) {
}
std::vector<std::pair<TSN, Data>> RetransmissionQueue::GetChunksToSend(
- TimeMs now,
+ Timestamp now,
size_t bytes_remaining_in_packet) {
// Chunks are always padded to even divisible by four.
RTC_DCHECK(IsDivisibleBy4(bytes_remaining_in_packet));
@@ -491,10 +492,11 @@ std::vector<std::pair<TSN, Data>> RetransmissionQueue::GetChunksToSend(
rwnd_ -= chunk_size;
absl::optional<UnwrappedTSN> tsn = outstanding_data_.Insert(
- chunk_opt->data, now,
+ chunk_opt->message_id, chunk_opt->data, now,
partial_reliability_ ? chunk_opt->max_retransmissions
: MaxRetransmits::NoLimit(),
- partial_reliability_ ? chunk_opt->expires_at : TimeMs::InfiniteFuture(),
+ partial_reliability_ ? chunk_opt->expires_at
+ : Timestamp::PlusInfinity(),
chunk_opt->lifecycle_id);
if (tsn.has_value()) {
@@ -539,7 +541,7 @@ bool RetransmissionQueue::can_send_data() const {
max_bytes_to_send() >= min_bytes_required_to_send_;
}
-bool RetransmissionQueue::ShouldSendForwardTsn(TimeMs now) {
+bool RetransmissionQueue::ShouldSendForwardTsn(Timestamp now) {
if (!partial_reliability_) {
return false;
}
diff --git a/net/dcsctp/tx/retransmission_queue.h b/net/dcsctp/tx/retransmission_queue.h
index b44db2a9a0..690aeeef91 100644
--- a/net/dcsctp/tx/retransmission_queue.h
+++ b/net/dcsctp/tx/retransmission_queue.h
@@ -60,7 +60,7 @@ class RetransmissionQueue {
TSN my_initial_tsn,
size_t a_rwnd,
SendQueue& send_queue,
- std::function<void(DurationMs rtt)> on_new_rtt,
+ std::function<void(webrtc::TimeDelta rtt)> on_new_rtt,
std::function<void()> on_clear_retransmission_counter,
Timer& t3_rtx,
const DcSctpOptions& options,
@@ -69,7 +69,7 @@ class RetransmissionQueue {
// Handles a received SACK. Returns true if the `sack` was processed and
// false if it was discarded due to received out-of-order and not relevant.
- bool HandleSack(TimeMs now, const SackChunk& sack);
+ bool HandleSack(webrtc::Timestamp now, const SackChunk& sack);
// Handles an expired retransmission timer.
void HandleT3RtxTimerExpiry();
@@ -90,7 +90,7 @@ class RetransmissionQueue {
// called prior to this method, to abandon expired chunks, as this method will
// not expire any chunks.
std::vector<std::pair<TSN, Data>> GetChunksToSend(
- TimeMs now,
+ webrtc::Timestamp now,
size_t bytes_remaining_in_packet);
// Returns the internal state of all queued chunks. This is only used in
@@ -136,7 +136,7 @@ class RetransmissionQueue {
// Given the current time `now`, it will evaluate if there are chunks that
// have expired and that need to be discarded. It returns true if a
// FORWARD-TSN should be sent.
- bool ShouldSendForwardTsn(TimeMs now);
+ bool ShouldSendForwardTsn(webrtc::Timestamp now);
// Creates a FORWARD-TSN chunk.
ForwardTsnChunk CreateForwardTsn() const {
@@ -185,7 +185,7 @@ class RetransmissionQueue {
// When a SACK chunk is received, this method will be called which _may_ call
// into the `RetransmissionTimeout` to update the RTO.
- void UpdateRTT(TimeMs now, UnwrappedTSN cumulative_tsn_ack);
+ void UpdateRTT(webrtc::Timestamp now, UnwrappedTSN cumulative_tsn_ack);
// If the congestion control is in "fast recovery mode", this may be exited
// now.
@@ -230,7 +230,7 @@ class RetransmissionQueue {
// The size of the data chunk (DATA/I-DATA) header that is used.
const size_t data_chunk_header_size_;
// Called when a new RTT measurement has been done
- const std::function<void(DurationMs rtt)> on_new_rtt_;
+ const std::function<void(webrtc::TimeDelta rtt)> on_new_rtt_;
// Called when a SACK has been seen that cleared the retransmission counter.
const std::function<void()> on_clear_retransmission_counter_;
// The retransmission counter.
diff --git a/net/dcsctp/tx/retransmission_queue_test.cc b/net/dcsctp/tx/retransmission_queue_test.cc
index e62c030bfa..3b4a2323c3 100644
--- a/net/dcsctp/tx/retransmission_queue_test.cc
+++ b/net/dcsctp/tx/retransmission_queue_test.cc
@@ -20,6 +20,7 @@
#include "api/array_view.h"
#include "api/task_queue/task_queue_base.h"
#include "net/dcsctp/common/handover_testing.h"
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/common/math.h"
#include "net/dcsctp/packet/chunk/data_chunk.h"
#include "net/dcsctp/packet/chunk/forward_tsn_chunk.h"
@@ -44,15 +45,19 @@ using ::testing::MockFunction;
using State = ::dcsctp::RetransmissionQueue::State;
using ::testing::_;
using ::testing::ElementsAre;
+using ::testing::Field;
using ::testing::IsEmpty;
using ::testing::NiceMock;
using ::testing::Pair;
using ::testing::Return;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
constexpr uint32_t kArwnd = 100000;
constexpr uint32_t kMaxMtu = 1191;
+constexpr OutgoingMessageId kMessageId = OutgoingMessageId(42);
DcSctpOptions MakeOptions() {
DcSctpOptions options;
@@ -71,12 +76,14 @@ class RetransmissionQueueTest : public testing::Test {
}),
timer_(timer_manager_.CreateTimer(
"test/t3_rtx",
- []() { return absl::nullopt; },
- TimerOptions(options_.rto_initial))) {}
-
- std::function<SendQueue::DataToSend(TimeMs, size_t)> CreateChunk() {
- return [this](TimeMs now, size_t max_size) {
- return SendQueue::DataToSend(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ []() { return TimeDelta::Zero(); },
+ TimerOptions(options_.rto_initial.ToTimeDelta()))) {}
+
+ std::function<SendQueue::DataToSend(Timestamp, size_t)> CreateChunk(
+ OutgoingMessageId message_id) {
+ return [this, message_id](Timestamp now, size_t max_size) {
+ return SendQueue::DataToSend(message_id,
+ gen_.Ordered({1, 2, 3, 4}, "BE"));
};
}
@@ -122,10 +129,10 @@ class RetransmissionQueueTest : public testing::Test {
MockDcSctpSocketCallbacks callbacks_;
DcSctpOptions options_;
DataGenerator gen_;
- TimeMs now_ = TimeMs(0);
+ Timestamp now_ = Timestamp::Zero();
FakeTimeoutManager timeout_manager_;
TimerManager timer_manager_;
- NiceMock<MockFunction<void(DurationMs rtt_ms)>> on_rtt_;
+ NiceMock<MockFunction<void(TimeDelta rtt_ms)>> on_rtt_;
NiceMock<MockFunction<void()>> on_clear_retransmission_counter_;
NiceMock<MockSendQueue> producer_;
std::unique_ptr<Timer> timer_;
@@ -140,8 +147,8 @@ TEST_F(RetransmissionQueueTest, InitialAckedPrevTsn) {
TEST_F(RetransmissionQueueTest, SendOneChunk) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(10)));
@@ -153,8 +160,8 @@ TEST_F(RetransmissionQueueTest, SendOneChunk) {
TEST_F(RetransmissionQueueTest, SendOneChunkAndAck) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(10)));
@@ -167,10 +174,10 @@ TEST_F(RetransmissionQueueTest, SendOneChunkAndAck) {
TEST_F(RetransmissionQueueTest, SendThreeChunksAndAckTwo) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12)));
@@ -185,15 +192,15 @@ TEST_F(RetransmissionQueueTest, SendThreeChunksAndAckTwo) {
TEST_F(RetransmissionQueueTest, AckWithGapBlocksFromRFC4960Section334) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12), TSN(13), TSN(14),
@@ -216,15 +223,15 @@ TEST_F(RetransmissionQueueTest, AckWithGapBlocksFromRFC4960Section334) {
TEST_F(RetransmissionQueueTest, ResendPacketsWhenNackedThreeTimes) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12), TSN(13), TSN(14),
@@ -235,8 +242,8 @@ TEST_F(RetransmissionQueueTest, ResendPacketsWhenNackedThreeTimes) {
// Send 18
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(8)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(18)));
// Ack 12, 14-15, 17-18
@@ -256,8 +263,8 @@ TEST_F(RetransmissionQueueTest, ResendPacketsWhenNackedThreeTimes) {
// Send 19
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(9)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(19)));
// Ack 12, 14-15, 17-19
@@ -268,8 +275,8 @@ TEST_F(RetransmissionQueueTest, ResendPacketsWhenNackedThreeTimes) {
// Send 20
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(10)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(20)));
// Ack 12, 14-15, 17-20
@@ -313,19 +320,19 @@ TEST_F(RetransmissionQueueTest, RestartsT3RtxOnRetransmitFirstOutstandingTSN) {
// TSN, it will also restart T3-RTX.
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
- static constexpr TimeMs kStartTime(100000);
+ static constexpr Timestamp kStartTime = Timestamp::Seconds(100);
now_ = kStartTime;
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12)));
// Ack 10, 12, after 100ms.
- now_ += DurationMs(100);
+ now_ += TimeDelta::Millis(100);
queue.HandleSack(
now_, SackChunk(TSN(10), kArwnd, {SackChunk::GapAckBlock(2, 2)}, {}));
@@ -336,23 +343,23 @@ TEST_F(RetransmissionQueueTest, RestartsT3RtxOnRetransmitFirstOutstandingTSN) {
// Send 13
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(13)));
// Ack 10, 12-13, after 100ms.
- now_ += DurationMs(100);
+ now_ += TimeDelta::Millis(100);
queue.HandleSack(
now_, SackChunk(TSN(10), kArwnd, {SackChunk::GapAckBlock(2, 3)}, {}));
// Send 14
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), testing::ElementsAre(TSN(14)));
// Ack 10, 12-14, after 100 ms.
- now_ += DurationMs(100);
+ now_ += TimeDelta::Millis(100);
queue.HandleSack(
now_, SackChunk(TSN(10), kArwnd, {SackChunk::GapAckBlock(2, 4)}, {}));
@@ -378,11 +385,11 @@ TEST_F(RetransmissionQueueTest, RestartsT3RtxOnRetransmitFirstOutstandingTSN) {
// Verify that the timer was really restarted when fast-retransmitting. The
// timeout is `options_.rto_initial`, so advance the time just before that.
- now_ += options_.rto_initial - DurationMs(1);
+ now_ += options_.rto_initial.ToTimeDelta() - TimeDelta::Millis(1);
EXPECT_FALSE(timeout_manager_.GetNextExpiredTimeout().has_value());
// And ensure it really is running.
- now_ += DurationMs(1);
+ now_ += TimeDelta::Millis(1);
ASSERT_HAS_VALUE_AND_ASSIGN(TimeoutID timeout,
timeout_manager_.GetNextExpiredTimeout());
// An expired timeout has to be handled (asserts validate this).
@@ -392,13 +399,15 @@ TEST_F(RetransmissionQueueTest, RestartsT3RtxOnRetransmitFirstOutstandingTSN) {
TEST_F(RetransmissionQueueTest, CanOnlyProduceTwoPacketsButWantsToSendThree) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered({1, 2, 3, 4}, "BE"));
})
- .WillOnce([this](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(1),
+ gen_.Ordered({1, 2, 3, 4}, "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 1000);
@@ -413,10 +422,11 @@ TEST_F(RetransmissionQueueTest, CanOnlyProduceTwoPacketsButWantsToSendThree) {
TEST_F(RetransmissionQueueTest, RetransmitsOnT3Expiry) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered({1, 2, 3, 4}, "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -451,12 +461,12 @@ TEST_F(RetransmissionQueueTest, LimitedRetransmissionOnlyWithRfc3758Support) {
RetransmissionQueue queue =
CreateQueue(/*supports_partial_reliability=*/false);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "BE"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -473,20 +483,19 @@ TEST_F(RetransmissionQueueTest, LimitedRetransmissionOnlyWithRfc3758Support) {
ElementsAre(Pair(TSN(9), State::kAcked), //
Pair(TSN(10), State::kToBeRetransmitted)));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(0);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(0);
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
} // namespace dcsctp
TEST_F(RetransmissionQueueTest, LimitsRetransmissionsAsUdp) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "BE"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -497,8 +506,7 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsAsUdp) {
Pair(TSN(10), State::kInFlight)));
// Will force chunks to be retransmitted
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(1);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(1);
queue.HandleT3RtxTimerExpiry();
@@ -523,12 +531,12 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsAsUdp) {
TEST_F(RetransmissionQueueTest, LimitsRetransmissionsToThreeSends) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "BE"));
dts.max_retransmissions = MaxRetransmits(3);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -538,8 +546,7 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsToThreeSends) {
ElementsAre(Pair(TSN(9), State::kAcked), //
Pair(TSN(10), State::kInFlight)));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(0);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(0);
// Retransmission 1
queue.HandleT3RtxTimerExpiry();
@@ -557,8 +564,7 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsToThreeSends) {
EXPECT_THAT(queue.GetChunksToSend(now_, 1000), SizeIs(1));
// Retransmission 4 - not allowed.
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(1);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(1);
queue.HandleT3RtxTimerExpiry();
EXPECT_TRUE(queue.ShouldSendForwardTsn(now_));
EXPECT_THAT(queue.GetChunksToSend(now_, 1000), IsEmpty());
@@ -578,10 +584,11 @@ TEST_F(RetransmissionQueueTest, RetransmitsWhenSendBufferIsFullT3Expiry) {
std::vector<uint8_t> payload(1000);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, "BE"));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 1500);
@@ -614,22 +621,23 @@ TEST_F(RetransmissionQueueTest, RetransmitsWhenSendBufferIsFullT3Expiry) {
TEST_F(RetransmissionQueueTest, ProducesValidForwardTsn) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "B"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({5, 6, 7, 8}, ""));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({5, 6, 7, 8}, ""));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({9, 10, 11, 12}, ""));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId,
+ gen_.Ordered({9, 10, 11, 12}, ""));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
// Send and ack first chunk (TSN 10)
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -645,7 +653,7 @@ TEST_F(RetransmissionQueueTest, ProducesValidForwardTsn) {
// Chunk 10 is acked, but the remaining are lost
queue.HandleSack(now_, SackChunk(TSN(10), kArwnd, {}, {}));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId))
.WillOnce(Return(true));
queue.HandleT3RtxTimerExpiry();
@@ -669,22 +677,23 @@ TEST_F(RetransmissionQueueTest, ProducesValidForwardTsn) {
TEST_F(RetransmissionQueueTest, ProducesValidForwardTsnWhenFullySent) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "B"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({5, 6, 7, 8}, ""));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({5, 6, 7, 8}, ""));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({9, 10, 11, 12}, "E"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId,
+ gen_.Ordered({9, 10, 11, 12}, "E"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
// Send and ack first chunk (TSN 10)
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -700,7 +709,7 @@ TEST_F(RetransmissionQueueTest, ProducesValidForwardTsnWhenFullySent) {
// Chunk 10 is acked, but the remaining are lost
queue.HandleSack(now_, SackChunk(TSN(10), kArwnd, {}, {}));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId))
.WillOnce(Return(false));
queue.HandleT3RtxTimerExpiry();
@@ -722,35 +731,39 @@ TEST_F(RetransmissionQueueTest, ProducesValidForwardTsnWhenFullySent) {
TEST_F(RetransmissionQueueTest, ProducesValidIForwardTsn) {
RetransmissionQueue queue = CreateQueue(/*use_message_interleaving=*/true);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
+ .WillOnce([this](Timestamp, size_t) {
DataGeneratorOptions opts;
opts.stream_id = StreamID(1);
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B", opts));
+ SendQueue::DataToSend dts(OutgoingMessageId(42),
+ gen_.Ordered({1, 2, 3, 4}, "B", opts));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
+ .WillOnce([this](Timestamp, size_t) {
DataGeneratorOptions opts;
opts.stream_id = StreamID(2);
- SendQueue::DataToSend dts(gen_.Unordered({1, 2, 3, 4}, "B", opts));
+ SendQueue::DataToSend dts(OutgoingMessageId(43),
+ gen_.Unordered({1, 2, 3, 4}, "B", opts));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
+ .WillOnce([this](Timestamp, size_t) {
DataGeneratorOptions opts;
opts.stream_id = StreamID(3);
- SendQueue::DataToSend dts(gen_.Ordered({9, 10, 11, 12}, "B", opts));
+ SendQueue::DataToSend dts(OutgoingMessageId(44),
+ gen_.Ordered({9, 10, 11, 12}, "B", opts));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
+ .WillOnce([this](Timestamp, size_t) {
DataGeneratorOptions opts;
opts.stream_id = StreamID(4);
- SendQueue::DataToSend dts(gen_.Ordered({13, 14, 15, 16}, "B", opts));
+ SendQueue::DataToSend dts(OutgoingMessageId(45),
+ gen_.Ordered({13, 14, 15, 16}, "B", opts));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 1000);
@@ -773,11 +786,11 @@ TEST_F(RetransmissionQueueTest, ProducesValidIForwardTsn) {
Pair(TSN(12), State::kNacked), //
Pair(TSN(13), State::kAcked)));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(1), OutgoingMessageId(42)))
.WillOnce(Return(true));
- EXPECT_CALL(producer_, Discard(IsUnordered(true), StreamID(2), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(2), OutgoingMessageId(43)))
.WillOnce(Return(true));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(3), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(3), OutgoingMessageId(44)))
.WillOnce(Return(true));
queue.HandleT3RtxTimerExpiry();
@@ -839,20 +852,21 @@ TEST_F(RetransmissionQueueTest, ProducesValidIForwardTsn) {
TEST_F(RetransmissionQueueTest, MeasureRTT) {
RetransmissionQueue queue = CreateQueue(/*use_message_interleaving=*/true);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(OutgoingMessageId(0),
+ gen_.Ordered({1, 2, 3, 4}, "B"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 1000);
EXPECT_THAT(chunks_to_send, ElementsAre(Pair(TSN(10), _)));
- now_ = now_ + DurationMs(123);
+ now_ = now_ + TimeDelta::Millis(123);
- EXPECT_CALL(on_rtt_, Call(DurationMs(123))).Times(1);
+ EXPECT_CALL(on_rtt_, Call(TimeDelta::Millis(123))).Times(1);
queue.HandleSack(now_, SackChunk(TSN(10), kArwnd, {}, {}));
}
@@ -868,15 +882,15 @@ TEST_F(RetransmissionQueueTest, ValidateCumTsnAckOnInflightData) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12), TSN(13), TSN(14),
@@ -898,15 +912,15 @@ TEST_F(RetransmissionQueueTest, ValidateCumTsnAckOnInflightData) {
TEST_F(RetransmissionQueueTest, HandleGapAckBlocksMatchingNoInflightData) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12), TSN(13), TSN(14),
@@ -945,15 +959,15 @@ TEST_F(RetransmissionQueueTest, HandleInvalidGapAckBlocks) {
TEST_F(RetransmissionQueueTest, GapAckBlocksDoNotMoveCumTsnAck) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue),
testing::ElementsAre(TSN(10), TSN(11), TSN(12), TSN(13), TSN(14),
@@ -983,17 +997,19 @@ TEST_F(RetransmissionQueueTest, StaysWithinAvailableSize) {
// See SctpPacketTest::ReturnsCorrectSpaceAvailableToStayWithinMTU for the
// magic numbers in this test.
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t size) {
+ .WillOnce([this](Timestamp, size_t size) {
EXPECT_EQ(size, 1176 - DataChunk::kHeaderSize);
std::vector<uint8_t> payload(183);
- return SendQueue::DataToSend(gen_.Ordered(payload, "BE"));
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, "BE"));
})
- .WillOnce([this](TimeMs, size_t size) {
+ .WillOnce([this](Timestamp, size_t size) {
EXPECT_EQ(size, 976 - DataChunk::kHeaderSize);
std::vector<uint8_t> payload(957);
- return SendQueue::DataToSend(gen_.Ordered(payload, "BE"));
+ return SendQueue::DataToSend(OutgoingMessageId(1),
+ gen_.Ordered(payload, "BE"));
});
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -1004,22 +1020,23 @@ TEST_F(RetransmissionQueueTest, StaysWithinAvailableSize) {
TEST_F(RetransmissionQueueTest, AccountsNackedAbandonedChunksAsNotOutstanding) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "B"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({5, 6, 7, 8}, ""));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({5, 6, 7, 8}, ""));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({9, 10, 11, 12}, ""));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId,
+ gen_.Ordered({9, 10, 11, 12}, ""));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
// Send and ack first chunk (TSN 10)
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -1035,8 +1052,7 @@ TEST_F(RetransmissionQueueTest, AccountsNackedAbandonedChunksAsNotOutstanding) {
EXPECT_EQ(queue.outstanding_items(), 3u);
// Mark the message as lost.
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(1);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(1);
queue.HandleT3RtxTimerExpiry();
EXPECT_TRUE(queue.ShouldSendForwardTsn(now_));
@@ -1067,28 +1083,30 @@ TEST_F(RetransmissionQueueTest, ExpireFromSendQueueWhenPartiallySent) {
RetransmissionQueue queue = CreateQueue();
DataGeneratorOptions options;
options.stream_id = StreamID(17);
- options.message_id = MID(42);
- TimeMs test_start = now_;
+ options.mid = MID(42);
+ Timestamp test_start = now_;
EXPECT_CALL(producer_, Produce)
- .WillOnce([&](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "B", options));
- dts.expires_at = TimeMs(test_start + DurationMs(10));
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId,
+ gen_.Ordered({1, 2, 3, 4}, "B", options));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
return dts;
})
- .WillOnce([&](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({5, 6, 7, 8}, "", options));
- dts.expires_at = TimeMs(test_start + DurationMs(10));
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId,
+ gen_.Ordered({5, 6, 7, 8}, "", options));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
return dts;
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 24);
EXPECT_THAT(chunks_to_send, ElementsAre(Pair(TSN(10), _)));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(17), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(17), kMessageId))
.WillOnce(Return(true));
- now_ += DurationMs(100);
+ now_ += TimeDelta::Millis(100);
EXPECT_THAT(queue.GetChunksToSend(now_, 24), IsEmpty());
@@ -1100,18 +1118,75 @@ TEST_F(RetransmissionQueueTest, ExpireFromSendQueueWhenPartiallySent) {
Pair(TSN(12), State::kAbandoned))); // Placeholder end
}
+TEST_F(RetransmissionQueueTest, ExpireCorrectMessageFromSendQueue) {
+ RetransmissionQueue queue = CreateQueue();
+ Timestamp test_start = now_;
+ EXPECT_CALL(producer_, Produce)
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(
+ OutgoingMessageId(42),
+ gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(0)}));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
+ return dts;
+ })
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(
+ OutgoingMessageId(43),
+ gen_.Ordered({1, 2, 3, 4}, "BE", {.mid = MID(1)}));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
+ return dts;
+ })
+ // Stream reset - MID reset to zero again.
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(
+ OutgoingMessageId(44),
+ gen_.Ordered({1, 2, 3, 4}, "B", {.mid = MID(0)}));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
+ return dts;
+ })
+ .WillOnce([&](Timestamp, size_t) {
+ SendQueue::DataToSend dts(
+ OutgoingMessageId(44),
+ gen_.Ordered({5, 6, 7, 8}, "", {.mid = MID(0)}));
+ dts.expires_at = Timestamp(test_start + TimeDelta::Millis(10));
+ return dts;
+ })
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
+ EXPECT_CALL(producer_, Discard(StreamID(1), OutgoingMessageId(44)))
+ .WillOnce(Return(true));
+
+ EXPECT_THAT(queue.GetChunksToSend(now_, 24),
+ ElementsAre(Pair(TSN(10), Field(&Data::mid, MID(0)))));
+ EXPECT_THAT(queue.GetChunksToSend(now_, 24),
+ ElementsAre(Pair(TSN(11), Field(&Data::mid, MID(1)))));
+ EXPECT_THAT(queue.GetChunksToSend(now_, 24),
+ ElementsAre(Pair(TSN(12), Field(&Data::mid, MID(0)))));
+
+ now_ += TimeDelta::Millis(100);
+ EXPECT_THAT(queue.GetChunksToSend(now_, 24), IsEmpty());
+
+ EXPECT_THAT(
+ queue.GetChunkStatesForTesting(),
+ ElementsAre(Pair(TSN(9), State::kAcked), // Initial TSN
+ Pair(TSN(10), State::kInFlight), // OutgoingMessageId=42, BE
+ Pair(TSN(11), State::kInFlight), // OutgoingMessageId=43, BE
+ Pair(TSN(12), State::kAbandoned), // OutgoingMessageId=44, B
+ Pair(TSN(13), State::kAbandoned), // Produced and expired
+ Pair(TSN(14), State::kAbandoned))); // Placeholder end
+}
+
TEST_F(RetransmissionQueueTest, LimitsRetransmissionsOnlyWhenNackedThreeTimes) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "BE"));
dts.max_retransmissions = MaxRetransmits(0);
return dts;
})
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
@@ -1128,8 +1203,7 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsOnlyWhenNackedThreeTimes) {
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(0);
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId)).Times(0);
queue.HandleSack(
now_, SackChunk(TSN(9), kArwnd, {SackChunk::GapAckBlock(2, 2)}, {}));
@@ -1155,7 +1229,7 @@ TEST_F(RetransmissionQueueTest, LimitsRetransmissionsOnlyWhenNackedThreeTimes) {
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId))
.WillOnce(Return(false));
queue.HandleSack(
now_, SackChunk(TSN(9), kArwnd, {SackChunk::GapAckBlock(2, 4)}, {}));
@@ -1174,21 +1248,21 @@ TEST_F(RetransmissionQueueTest, AbandonsRtxLimit2WhenNackedNineTimes) {
// This is a fairly long test.
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce([this](TimeMs, size_t) {
- SendQueue::DataToSend dts(gen_.Ordered({1, 2, 3, 4}, "BE"));
+ .WillOnce([this](Timestamp, size_t) {
+ SendQueue::DataToSend dts(kMessageId, gen_.Ordered({1, 2, 3, 4}, "BE"));
dts.max_retransmissions = MaxRetransmits(2);
return dts;
})
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillOnce(CreateChunk(OutgoingMessageId(8)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
@@ -1213,8 +1287,7 @@ TEST_F(RetransmissionQueueTest, AbandonsRtxLimit2WhenNackedNineTimes) {
Pair(TSN(18), State::kInFlight), //
Pair(TSN(19), State::kInFlight)));
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
- .Times(0);
+ EXPECT_CALL(producer_, Discard(StreamID(1), OutgoingMessageId(8))).Times(0);
// Ack TSN [11 to 13] - three nacks for TSN(10), which will retransmit it.
for (int tsn = 11; tsn <= 13; ++tsn) {
@@ -1284,7 +1357,7 @@ TEST_F(RetransmissionQueueTest, AbandonsRtxLimit2WhenNackedNineTimes) {
EXPECT_FALSE(queue.ShouldSendForwardTsn(now_));
// Ack TSN 19 - three more nacks for TSN 10, no more retransmissions.
- EXPECT_CALL(producer_, Discard(IsUnordered(false), StreamID(1), MID(42)))
+ EXPECT_CALL(producer_, Discard(StreamID(1), kMessageId))
.WillOnce(Return(false));
queue.HandleSack(
now_, SackChunk(TSN(9), kArwnd, {SackChunk::GapAckBlock(2, 10)}, {}));
@@ -1315,10 +1388,11 @@ TEST_F(RetransmissionQueueTest, CwndRecoversWhenAcking) {
std::vector<uint8_t> payload(1000);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, "BE"));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
std::vector<std::pair<TSN, Data>> chunks_to_send =
queue.GetChunksToSend(now_, 1500);
@@ -1342,11 +1416,12 @@ TEST_F(RetransmissionQueueTest, OnlySendsLargePacketsOnLargeCongestionWindow) {
// Fill the congestion window almost - leaving 500 bytes.
size_t chunk_size = intial_cwnd - 500;
EXPECT_CALL(producer_, Produce)
- .WillOnce([chunk_size, this](TimeMs, size_t) {
+ .WillOnce([chunk_size, this](Timestamp, size_t) {
return SendQueue::DataToSend(
+ OutgoingMessageId(0),
gen_.Ordered(std::vector<uint8_t>(chunk_size), "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_TRUE(queue.can_send_data());
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -1374,11 +1449,12 @@ TEST_F(RetransmissionQueueTest, AllowsSmallFragmentsOnSmallCongestionWindow) {
// Fill the congestion window almost - leaving 500 bytes.
size_t chunk_size = intial_cwnd - 500;
EXPECT_CALL(producer_, Produce)
- .WillOnce([chunk_size, this](TimeMs, size_t) {
+ .WillOnce([chunk_size, this](Timestamp, size_t) {
return SendQueue::DataToSend(
+ OutgoingMessageId(0),
gen_.Ordered(std::vector<uint8_t>(chunk_size), "BE"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_TRUE(queue.can_send_data());
std::vector<std::pair<TSN, Data>> chunks_to_send =
@@ -1392,8 +1468,8 @@ TEST_F(RetransmissionQueueTest, AllowsSmallFragmentsOnSmallCongestionWindow) {
TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenHasNoOutstandingData) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(1));
EXPECT_EQ(
@@ -1408,15 +1484,15 @@ TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenHasNoOutstandingData) {
TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenNothingToRetransmit) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(8));
EXPECT_EQ(
queue.GetHandoverReadiness(),
@@ -1428,8 +1504,8 @@ TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenNothingToRetransmit) {
// Send 18
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(8)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(1));
// Ack 12, 14-15, 17-18
@@ -1440,8 +1516,8 @@ TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenNothingToRetransmit) {
// Send 19
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(9)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(1));
// Ack 12, 14-15, 17-19
@@ -1452,8 +1528,8 @@ TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenNothingToRetransmit) {
// Send 20
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(10)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(1));
// Ack 12, 14-15, 17-20
@@ -1487,9 +1563,9 @@ TEST_F(RetransmissionQueueTest, ReadyForHandoverWhenNothingToRetransmit) {
TEST_F(RetransmissionQueueTest, HandoverTest) {
RetransmissionQueue queue = CreateQueue();
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(0)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(queue), SizeIs(2));
queue.HandleSack(now_, SackChunk(TSN(11), kArwnd, {}, {}));
@@ -1497,10 +1573,10 @@ TEST_F(RetransmissionQueueTest, HandoverTest) {
CreateQueueByHandover(queue);
EXPECT_CALL(producer_, Produce)
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillOnce(CreateChunk())
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillOnce(CreateChunk(OutgoingMessageId(2)))
+ .WillOnce(CreateChunk(OutgoingMessageId(3)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4)))
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
EXPECT_THAT(GetSentPacketTSNs(*handedover_queue),
testing::ElementsAre(TSN(12), TSN(13), TSN(14)));
@@ -1518,22 +1594,27 @@ TEST_F(RetransmissionQueueTest, CanAlwaysSendOnePacket) {
std::vector<uint8_t> payload(mtu - 100);
EXPECT_CALL(producer_, Produce)
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, "B"));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, "B"));
})
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, ""));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, ""));
})
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, ""));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, ""));
})
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, ""));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, ""));
})
- .WillOnce([this, payload](TimeMs, size_t) {
- return SendQueue::DataToSend(gen_.Ordered(payload, "E"));
+ .WillOnce([this, payload](Timestamp, size_t) {
+ return SendQueue::DataToSend(OutgoingMessageId(0),
+ gen_.Ordered(payload, "E"));
})
- .WillRepeatedly([](TimeMs, size_t) { return absl::nullopt; });
+ .WillRepeatedly([](Timestamp, size_t) { return absl::nullopt; });
// Produce all chunks and put them in the retransmission queue.
std::vector<std::pair<TSN, Data>> chunks_to_send =
diff --git a/net/dcsctp/tx/retransmission_timeout.cc b/net/dcsctp/tx/retransmission_timeout.cc
index 7d8fb9761c..8af77041a5 100644
--- a/net/dcsctp/tx/retransmission_timeout.cc
+++ b/net/dcsctp/tx/retransmission_timeout.cc
@@ -12,28 +12,29 @@
#include <algorithm>
#include <cstdint>
+#include "api/units/time_delta.h"
#include "net/dcsctp/public/dcsctp_options.h"
namespace dcsctp {
RetransmissionTimeout::RetransmissionTimeout(const DcSctpOptions& options)
- : min_rto_(*options.rto_min),
- max_rto_(*options.rto_max),
- max_rtt_(*options.rtt_max),
+ : min_rto_(options.rto_min.ToTimeDelta()),
+ max_rto_(options.rto_max.ToTimeDelta()),
+ max_rtt_(options.rtt_max.ToTimeDelta()),
min_rtt_variance_(*options.min_rtt_variance),
scaled_srtt_(*options.rto_initial << kRttShift),
rto_(*options.rto_initial) {}
-void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) {
- const int32_t rtt = *measured_rtt;
-
+void RetransmissionTimeout::ObserveRTT(webrtc::TimeDelta measured_rtt) {
// Unrealistic values will be skipped. If a wrongly measured (or otherwise
// corrupt) value was processed, it could change the state in a way that would
// take a very long time to recover.
- if (rtt < 0 || rtt > max_rtt_) {
+ if (measured_rtt < webrtc::TimeDelta::Zero() || measured_rtt > max_rtt_) {
return;
}
+ const int64_t rtt = measured_rtt.ms();
+
// From https://tools.ietf.org/html/rfc4960#section-6.3.1, but avoiding
// floating point math by implementing algorithm from "V. Jacobson: Congestion
// avoidance and control", but adapted for SCTP.
@@ -42,7 +43,7 @@ void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) {
scaled_rtt_var_ = (rtt / 2) << kRttVarShift;
first_measurement_ = false;
} else {
- int32_t rtt_diff = rtt - (scaled_srtt_ >> kRttShift);
+ int64_t rtt_diff = rtt - (scaled_srtt_ >> kRttShift);
scaled_srtt_ += rtt_diff;
if (rtt_diff < 0) {
rtt_diff = -rtt_diff;
@@ -58,6 +59,6 @@ void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) {
rto_ = (scaled_srtt_ >> kRttShift) + scaled_rtt_var_;
// Clamp RTO between min and max.
- rto_ = std::min(std::max(rto_, min_rto_), max_rto_);
+ rto_ = std::min(std::max(rto_, min_rto_.ms()), max_rto_.ms());
}
} // namespace dcsctp
diff --git a/net/dcsctp/tx/retransmission_timeout.h b/net/dcsctp/tx/retransmission_timeout.h
index 01530cb3b5..b4b0fd7fef 100644
--- a/net/dcsctp/tx/retransmission_timeout.h
+++ b/net/dcsctp/tx/retransmission_timeout.h
@@ -32,27 +32,29 @@ class RetransmissionTimeout {
explicit RetransmissionTimeout(const DcSctpOptions& options);
// To be called when a RTT has been measured, to update the RTO value.
- void ObserveRTT(DurationMs measured_rtt);
+ void ObserveRTT(webrtc::TimeDelta measured_rtt);
// Returns the Retransmission Timeout (RTO) value, in milliseconds.
- DurationMs rto() const { return DurationMs(rto_); }
+ webrtc::TimeDelta rto() const { return webrtc::TimeDelta::Millis(rto_); }
// Returns the smoothed RTT value, in milliseconds.
- DurationMs srtt() const { return DurationMs(scaled_srtt_ >> kRttShift); }
+ webrtc::TimeDelta srtt() const {
+ return webrtc::TimeDelta::Millis(scaled_srtt_ >> kRttShift);
+ }
private:
- const int32_t min_rto_;
- const int32_t max_rto_;
- const int32_t max_rtt_;
- const int32_t min_rtt_variance_;
+ const webrtc::TimeDelta min_rto_;
+ const webrtc::TimeDelta max_rto_;
+ const webrtc::TimeDelta max_rtt_;
+ const int64_t min_rtt_variance_;
// If this is the first measurement
bool first_measurement_ = true;
// Smoothed Round-Trip Time, shifted by kRttShift
- int32_t scaled_srtt_;
+ int64_t scaled_srtt_;
// Round-Trip Time Variation, shifted by kRttVarShift
- int32_t scaled_rtt_var_ = 0;
+ int64_t scaled_rtt_var_ = 0;
// Retransmission Timeout
- int32_t rto_;
+ int64_t rto_;
};
} // namespace dcsctp
diff --git a/net/dcsctp/tx/retransmission_timeout_test.cc b/net/dcsctp/tx/retransmission_timeout_test.cc
index b901995e97..7754578f32 100644
--- a/net/dcsctp/tx/retransmission_timeout_test.cc
+++ b/net/dcsctp/tx/retransmission_timeout_test.cc
@@ -15,20 +15,21 @@
namespace dcsctp {
namespace {
+using ::webrtc::TimeDelta;
-constexpr DurationMs kMaxRtt = DurationMs(8'000);
-constexpr DurationMs kInitialRto = DurationMs(200);
-constexpr DurationMs kMaxRto = DurationMs(800);
-constexpr DurationMs kMinRto = DurationMs(120);
-constexpr DurationMs kMinRttVariance = DurationMs(220);
+constexpr TimeDelta kMaxRtt = TimeDelta::Millis(8'000);
+constexpr TimeDelta kInitialRto = TimeDelta::Millis(200);
+constexpr TimeDelta kMaxRto = TimeDelta::Millis(800);
+constexpr TimeDelta kMinRto = TimeDelta::Millis(120);
+constexpr TimeDelta kMinRttVariance = TimeDelta::Millis(220);
DcSctpOptions MakeOptions() {
DcSctpOptions options;
- options.rtt_max = kMaxRtt;
- options.rto_initial = kInitialRto;
- options.rto_max = kMaxRto;
- options.rto_min = kMinRto;
- options.min_rtt_variance = kMinRttVariance;
+ options.rtt_max = DurationMs(kMaxRtt);
+ options.rto_initial = DurationMs(kInitialRto);
+ options.rto_max = DurationMs(kMaxRto);
+ options.rto_min = DurationMs(kMinRto);
+ options.min_rtt_variance = DurationMs(kMinRttVariance);
return options;
}
@@ -45,31 +46,31 @@ TEST(RetransmissionTimeoutTest, HasValidInitialSrtt) {
TEST(RetransmissionTimeoutTest, NegativeValuesDoNotAffectRTO) {
RetransmissionTimeout rto_(MakeOptions());
// Initial negative value
- rto_.ObserveRTT(DurationMs(-10));
+ rto_.ObserveRTT(TimeDelta::Millis(-10));
EXPECT_EQ(rto_.rto(), kInitialRto);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 372);
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
// Subsequent negative value
- rto_.ObserveRTT(DurationMs(-10));
- EXPECT_EQ(*rto_.rto(), 372);
+ rto_.ObserveRTT(TimeDelta::Millis(-10));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
}
TEST(RetransmissionTimeoutTest, TooLargeValuesDoNotAffectRTO) {
RetransmissionTimeout rto_(MakeOptions());
// Initial too large value
- rto_.ObserveRTT(kMaxRtt + DurationMs(100));
+ rto_.ObserveRTT(kMaxRtt + TimeDelta::Millis(100));
EXPECT_EQ(rto_.rto(), kInitialRto);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 372);
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
// Subsequent too large value
- rto_.ObserveRTT(kMaxRtt + DurationMs(100));
- EXPECT_EQ(*rto_.rto(), 372);
+ rto_.ObserveRTT(kMaxRtt + TimeDelta::Millis(100));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
}
TEST(RetransmissionTimeoutTest, WillNeverGoBelowMinimumRto) {
RetransmissionTimeout rto_(MakeOptions());
for (int i = 0; i < 1000; ++i) {
- rto_.ObserveRTT(DurationMs(1));
+ rto_.ObserveRTT(TimeDelta::Millis(1));
}
EXPECT_GE(rto_.rto(), kMinRto);
}
@@ -77,67 +78,67 @@ TEST(RetransmissionTimeoutTest, WillNeverGoBelowMinimumRto) {
TEST(RetransmissionTimeoutTest, WillNeverGoAboveMaximumRto) {
RetransmissionTimeout rto_(MakeOptions());
for (int i = 0; i < 1000; ++i) {
- rto_.ObserveRTT(kMaxRtt - DurationMs(1));
+ rto_.ObserveRTT(kMaxRtt - TimeDelta::Millis(1));
// Adding jitter, which would make it RTO be well above RTT.
- rto_.ObserveRTT(kMaxRtt - DurationMs(100));
+ rto_.ObserveRTT(kMaxRtt - TimeDelta::Millis(100));
}
EXPECT_LE(rto_.rto(), kMaxRto);
}
TEST(RetransmissionTimeoutTest, CalculatesRtoForStableRtt) {
RetransmissionTimeout rto_(MakeOptions());
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 372);
- rto_.ObserveRTT(DurationMs(128));
- EXPECT_EQ(*rto_.rto(), 344);
- rto_.ObserveRTT(DurationMs(123));
- EXPECT_EQ(*rto_.rto(), 344);
- rto_.ObserveRTT(DurationMs(125));
- EXPECT_EQ(*rto_.rto(), 344);
- rto_.ObserveRTT(DurationMs(127));
- EXPECT_EQ(*rto_.rto(), 344);
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
+ rto_.ObserveRTT(TimeDelta::Millis(128));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(344));
+ rto_.ObserveRTT(TimeDelta::Millis(123));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(344));
+ rto_.ObserveRTT(TimeDelta::Millis(125));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(344));
+ rto_.ObserveRTT(TimeDelta::Millis(127));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(344));
}
TEST(RetransmissionTimeoutTest, CalculatesRtoForUnstableRtt) {
RetransmissionTimeout rto_(MakeOptions());
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 372);
- rto_.ObserveRTT(DurationMs(402));
- EXPECT_EQ(*rto_.rto(), 622);
- rto_.ObserveRTT(DurationMs(728));
- EXPECT_EQ(*rto_.rto(), 800);
- rto_.ObserveRTT(DurationMs(89));
- EXPECT_EQ(*rto_.rto(), 800);
- rto_.ObserveRTT(DurationMs(126));
- EXPECT_EQ(*rto_.rto(), 800);
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
+ rto_.ObserveRTT(TimeDelta::Millis(402));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(622));
+ rto_.ObserveRTT(TimeDelta::Millis(728));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(800));
+ rto_.ObserveRTT(TimeDelta::Millis(89));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(800));
+ rto_.ObserveRTT(TimeDelta::Millis(126));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(800));
}
TEST(RetransmissionTimeoutTest, WillStabilizeAfterAWhile) {
RetransmissionTimeout rto_(MakeOptions());
- rto_.ObserveRTT(DurationMs(124));
- rto_.ObserveRTT(DurationMs(402));
- rto_.ObserveRTT(DurationMs(728));
- rto_.ObserveRTT(DurationMs(89));
- rto_.ObserveRTT(DurationMs(126));
- EXPECT_EQ(*rto_.rto(), 800);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 800);
- rto_.ObserveRTT(DurationMs(122));
- EXPECT_EQ(*rto_.rto(), 710);
- rto_.ObserveRTT(DurationMs(123));
- EXPECT_EQ(*rto_.rto(), 631);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 562);
- rto_.ObserveRTT(DurationMs(122));
- EXPECT_EQ(*rto_.rto(), 505);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 454);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 410);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 372);
- rto_.ObserveRTT(DurationMs(124));
- EXPECT_EQ(*rto_.rto(), 367);
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ rto_.ObserveRTT(TimeDelta::Millis(402));
+ rto_.ObserveRTT(TimeDelta::Millis(728));
+ rto_.ObserveRTT(TimeDelta::Millis(89));
+ rto_.ObserveRTT(TimeDelta::Millis(126));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(800));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(800));
+ rto_.ObserveRTT(TimeDelta::Millis(122));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(710));
+ rto_.ObserveRTT(TimeDelta::Millis(123));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(631));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(562));
+ rto_.ObserveRTT(TimeDelta::Millis(122));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(505));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(454));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(410));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(372));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(367));
}
TEST(RetransmissionTimeoutTest, WillAlwaysStayAboveRTT) {
@@ -149,31 +150,33 @@ TEST(RetransmissionTimeoutTest, WillAlwaysStayAboveRTT) {
RetransmissionTimeout rto_(MakeOptions());
for (int i = 0; i < 1000; ++i) {
- rto_.ObserveRTT(DurationMs(124));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
}
- EXPECT_EQ(*rto_.rto(), 344);
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(344));
}
TEST(RetransmissionTimeoutTest, CanSpecifySmallerMinimumRttVariance) {
DcSctpOptions options = MakeOptions();
- options.min_rtt_variance = kMinRttVariance - DurationMs(100);
+ options.min_rtt_variance =
+ DurationMs(kMinRttVariance - TimeDelta::Millis(100));
RetransmissionTimeout rto_(options);
for (int i = 0; i < 1000; ++i) {
- rto_.ObserveRTT(DurationMs(124));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
}
- EXPECT_EQ(*rto_.rto(), 244);
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(244));
}
TEST(RetransmissionTimeoutTest, CanSpecifyLargerMinimumRttVariance) {
DcSctpOptions options = MakeOptions();
- options.min_rtt_variance = kMinRttVariance + DurationMs(100);
+ options.min_rtt_variance =
+ DurationMs(kMinRttVariance + TimeDelta::Millis(100));
RetransmissionTimeout rto_(options);
for (int i = 0; i < 1000; ++i) {
- rto_.ObserveRTT(DurationMs(124));
+ rto_.ObserveRTT(TimeDelta::Millis(124));
}
- EXPECT_EQ(*rto_.rto(), 444);
+ EXPECT_EQ(rto_.rto(), TimeDelta::Millis(444));
}
} // namespace
diff --git a/net/dcsctp/tx/rr_send_queue.cc b/net/dcsctp/tx/rr_send_queue.cc
index 4df253dddf..7cbead296c 100644
--- a/net/dcsctp/tx/rr_send_queue.cc
+++ b/net/dcsctp/tx/rr_send_queue.cc
@@ -20,15 +20,18 @@
#include "absl/algorithm/container.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "net/dcsctp/common/str_join.h"
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/packet/data.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/public/dcsctp_socket.h"
#include "net/dcsctp/public/types.h"
#include "net/dcsctp/tx/send_queue.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
namespace dcsctp {
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
RRSendQueue::RRSendQueue(absl::string_view log_prefix,
DcSctpSocketCallbacks* callbacks,
@@ -123,7 +126,10 @@ void RRSendQueue::OutgoingStream::Add(DcSctpMessage message,
bool was_active = bytes_to_send_in_next_message() > 0;
buffered_amount_.Increase(message.payload().size());
parent_.total_buffered_amount_.Increase(message.payload().size());
- items_.emplace_back(std::move(message), std::move(attributes));
+ OutgoingMessageId message_id = parent_.current_message_id;
+ parent_.current_message_id =
+ OutgoingMessageId(*parent_.current_message_id + 1);
+ items_.emplace_back(message_id, std::move(message), std::move(attributes));
if (!was_active) {
scheduler_stream_->MaybeMakeActive();
@@ -133,7 +139,7 @@ void RRSendQueue::OutgoingStream::Add(DcSctpMessage message,
}
absl::optional<SendQueue::DataToSend> RRSendQueue::OutgoingStream::Produce(
- TimeMs now,
+ Timestamp now,
size_t max_size) {
RTC_DCHECK(pause_state_ != PauseState::kPaused &&
pause_state_ != PauseState::kResetting);
@@ -143,7 +149,7 @@ absl::optional<SendQueue::DataToSend> RRSendQueue::OutgoingStream::Produce(
DcSctpMessage& message = item.message;
// Allocate Message ID and SSN when the first fragment is sent.
- if (!item.message_id.has_value()) {
+ if (!item.mid.has_value()) {
// Oops, this entire message has already expired. Try the next one.
if (item.attributes.expires_at <= now) {
HandleMessageExpired(item);
@@ -153,7 +159,7 @@ absl::optional<SendQueue::DataToSend> RRSendQueue::OutgoingStream::Produce(
MID& mid =
item.attributes.unordered ? next_unordered_mid_ : next_ordered_mid_;
- item.message_id = mid;
+ item.mid = mid;
mid = MID(*mid + 1);
}
if (!item.attributes.unordered && !item.ssn.has_value()) {
@@ -184,10 +190,10 @@ absl::optional<SendQueue::DataToSend> RRSendQueue::OutgoingStream::Produce(
buffered_amount_.Decrease(payload.size());
parent_.total_buffered_amount_.Decrease(payload.size());
- SendQueue::DataToSend chunk(Data(stream_id, item.ssn.value_or(SSN(0)),
- item.message_id.value(), fsn, ppid,
- std::move(payload), is_beginning, is_end,
- item.attributes.unordered));
+ SendQueue::DataToSend chunk(
+ item.message_id, Data(stream_id, item.ssn.value_or(SSN(0)), *item.mid,
+ fsn, ppid, std::move(payload), is_beginning,
+ is_end, item.attributes.unordered));
chunk.max_retransmissions = item.attributes.max_retransmissions;
chunk.expires_at = item.attributes.expires_at;
chunk.lifecycle_id =
@@ -231,13 +237,11 @@ void RRSendQueue::OutgoingStream::HandleMessageExpired(
}
}
-bool RRSendQueue::OutgoingStream::Discard(IsUnordered unordered,
- MID message_id) {
+bool RRSendQueue::OutgoingStream::Discard(OutgoingMessageId message_id) {
bool result = false;
if (!items_.empty()) {
Item& item = items_.front();
- if (item.attributes.unordered == unordered && item.message_id.has_value() &&
- *item.message_id == message_id) {
+ if (item.message_id == message_id) {
HandleMessageExpired(item);
items_.pop_front();
@@ -329,7 +333,7 @@ void RRSendQueue::OutgoingStream::Reset() {
item.remaining_size);
item.remaining_offset = 0;
item.remaining_size = item.message.payload().size();
- item.message_id = absl::nullopt;
+ item.mid = absl::nullopt;
item.ssn = absl::nullopt;
item.current_fsn = FSN(0);
if (old_pause_state == PauseState::kPaused ||
@@ -344,10 +348,10 @@ bool RRSendQueue::OutgoingStream::has_partially_sent_message() const {
if (items_.empty()) {
return false;
}
- return items_.front().message_id.has_value();
+ return items_.front().mid.has_value();
}
-void RRSendQueue::Add(TimeMs now,
+void RRSendQueue::Add(Timestamp now,
DcSctpMessage message,
const SendOptions& send_options) {
RTC_DCHECK(!message.payload().empty());
@@ -364,8 +368,9 @@ void RRSendQueue::Add(TimeMs now,
? MaxRetransmits(send_options.max_retransmissions.value())
: MaxRetransmits::NoLimit(),
.expires_at = send_options.lifetime.has_value()
- ? now + *send_options.lifetime + DurationMs(1)
- : TimeMs::InfiniteFuture(),
+ ? now + send_options.lifetime->ToTimeDelta() +
+ TimeDelta::Millis(1)
+ : Timestamp::PlusInfinity(),
.lifecycle_id = send_options.lifecycle_id,
};
GetOrCreateStreamInfo(message.stream_id())
@@ -381,16 +386,13 @@ bool RRSendQueue::IsEmpty() const {
return total_buffered_amount() == 0;
}
-absl::optional<SendQueue::DataToSend> RRSendQueue::Produce(TimeMs now,
+absl::optional<SendQueue::DataToSend> RRSendQueue::Produce(Timestamp now,
size_t max_size) {
return scheduler_.Produce(now, max_size);
}
-bool RRSendQueue::Discard(IsUnordered unordered,
- StreamID stream_id,
- MID message_id) {
- bool has_discarded =
- GetOrCreateStreamInfo(stream_id).Discard(unordered, message_id);
+bool RRSendQueue::Discard(StreamID stream_id, OutgoingMessageId message_id) {
+ bool has_discarded = GetOrCreateStreamInfo(stream_id).Discard(message_id);
RTC_DCHECK(IsConsistent());
return has_discarded;
diff --git a/net/dcsctp/tx/rr_send_queue.h b/net/dcsctp/tx/rr_send_queue.h
index c4111ff717..b6c359dc1e 100644
--- a/net/dcsctp/tx/rr_send_queue.h
+++ b/net/dcsctp/tx/rr_send_queue.h
@@ -22,6 +22,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/public/dcsctp_socket.h"
#include "net/dcsctp/public/types.h"
@@ -70,15 +71,14 @@ class RRSendQueue : public SendQueue {
// time should be in `now`. Note that it's the responsibility of the caller to
// ensure that the buffer is not full (by calling `IsFull`) before adding
// messages to it.
- void Add(TimeMs now,
+ void Add(webrtc::Timestamp now,
DcSctpMessage message,
const SendOptions& send_options = {});
// Implementation of `SendQueue`.
- absl::optional<DataToSend> Produce(TimeMs now, size_t max_size) override;
- bool Discard(IsUnordered unordered,
- StreamID stream_id,
- MID message_id) override;
+ absl::optional<DataToSend> Produce(webrtc::Timestamp now,
+ size_t max_size) override;
+ bool Discard(StreamID stream_id, OutgoingMessageId message_id) override;
void PrepareResetStream(StreamID streams) override;
bool HasStreamsReadyToBeReset() const override;
std::vector<StreamID> GetStreamsReadyToBeReset() override;
@@ -105,7 +105,7 @@ class RRSendQueue : public SendQueue {
struct MessageAttributes {
IsUnordered unordered;
MaxRetransmits max_retransmissions;
- TimeMs expires_at;
+ webrtc::Timestamp expires_at;
LifecycleId lifecycle_id;
};
@@ -155,7 +155,7 @@ class RRSendQueue : public SendQueue {
void Add(DcSctpMessage message, MessageAttributes attributes);
// Implementing `StreamScheduler::StreamProducer`.
- absl::optional<SendQueue::DataToSend> Produce(TimeMs now,
+ absl::optional<SendQueue::DataToSend> Produce(webrtc::Timestamp now,
size_t max_size) override;
size_t bytes_to_send_in_next_message() const override;
@@ -163,7 +163,7 @@ class RRSendQueue : public SendQueue {
ThresholdWatcher& buffered_amount() { return buffered_amount_; }
// Discards a partially sent message, see `SendQueue::Discard`.
- bool Discard(IsUnordered unordered, MID message_id);
+ bool Discard(OutgoingMessageId message_id);
// Pauses this stream, which is used before resetting it.
void Pause();
@@ -219,11 +219,15 @@ class RRSendQueue : public SendQueue {
// An enqueued message and metadata.
struct Item {
- explicit Item(DcSctpMessage msg, MessageAttributes attributes)
- : message(std::move(msg)),
+ explicit Item(OutgoingMessageId message_id,
+ DcSctpMessage msg,
+ MessageAttributes attributes)
+ : message_id(message_id),
+ message(std::move(msg)),
attributes(std::move(attributes)),
remaining_offset(0),
remaining_size(message.payload().size()) {}
+ OutgoingMessageId message_id;
DcSctpMessage message;
MessageAttributes attributes;
// The remaining payload (offset and size) to be sent, when it has been
@@ -232,7 +236,7 @@ class RRSendQueue : public SendQueue {
size_t remaining_size;
// If set, an allocated Message ID and SSN. Will be allocated when the
// first fragment is sent.
- absl::optional<MID> message_id = absl::nullopt;
+ absl::optional<MID> mid = absl::nullopt;
absl::optional<SSN> ssn = absl::nullopt;
// The current Fragment Sequence Number, incremented for each fragment.
FSN current_fsn = FSN(0);
@@ -262,13 +266,14 @@ class RRSendQueue : public SendQueue {
OutgoingStream& GetOrCreateStreamInfo(StreamID stream_id);
absl::optional<DataToSend> Produce(
std::map<StreamID, OutgoingStream>::iterator it,
- TimeMs now,
+ webrtc::Timestamp now,
size_t max_size);
const absl::string_view log_prefix_;
DcSctpSocketCallbacks& callbacks_;
const size_t buffer_size_;
const StreamPriority default_priority_;
+ OutgoingMessageId current_message_id = OutgoingMessageId(0);
StreamScheduler scheduler_;
// The total amount of buffer data, for all streams.
diff --git a/net/dcsctp/tx/rr_send_queue_test.cc b/net/dcsctp/tx/rr_send_queue_test.cc
index 95416b193a..632cd8fc19 100644
--- a/net/dcsctp/tx/rr_send_queue_test.cc
+++ b/net/dcsctp/tx/rr_send_queue_test.cc
@@ -13,6 +13,7 @@
#include <type_traits>
#include <vector>
+#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/packet/data.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/public/dcsctp_options.h"
@@ -28,8 +29,10 @@ namespace dcsctp {
namespace {
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
+using ::webrtc::TimeDelta;
+using ::webrtc::Timestamp;
-constexpr TimeMs kNow = TimeMs(0);
+constexpr Timestamp kNow = Timestamp::Zero();
constexpr StreamID kStreamID(1);
constexpr PPID kPPID(53);
constexpr size_t kMaxQueueSize = 1000;
@@ -180,9 +183,9 @@ TEST_F(RRSendQueueTest, ProduceWithLifetimeExpiry) {
std::vector<uint8_t> payload(20);
// Default is no expiry
- TimeMs now = kNow;
+ Timestamp now = kNow;
buf_.Add(now, DcSctpMessage(kStreamID, kPPID, payload));
- now += DurationMs(1000000);
+ now += TimeDelta::Seconds(1000);
ASSERT_TRUE(buf_.Produce(now, kOneFragmentPacketSize));
SendOptions expires_2_seconds;
@@ -190,17 +193,17 @@ TEST_F(RRSendQueueTest, ProduceWithLifetimeExpiry) {
// Add and consume within lifetime
buf_.Add(now, DcSctpMessage(kStreamID, kPPID, payload), expires_2_seconds);
- now += DurationMs(2000);
+ now += TimeDelta::Millis(2000);
ASSERT_TRUE(buf_.Produce(now, kOneFragmentPacketSize));
// Add and consume just outside lifetime
buf_.Add(now, DcSctpMessage(kStreamID, kPPID, payload), expires_2_seconds);
- now += DurationMs(2001);
+ now += TimeDelta::Millis(2001);
ASSERT_FALSE(buf_.Produce(now, kOneFragmentPacketSize));
// A long time after expiry
buf_.Add(now, DcSctpMessage(kStreamID, kPPID, payload), expires_2_seconds);
- now += DurationMs(1000000);
+ now += TimeDelta::Seconds(1000);
ASSERT_FALSE(buf_.Produce(now, kOneFragmentPacketSize));
// Expire one message, but produce the second that is not expired.
@@ -210,7 +213,7 @@ TEST_F(RRSendQueueTest, ProduceWithLifetimeExpiry) {
expires_4_seconds.lifetime = DurationMs(4000);
buf_.Add(now, DcSctpMessage(kStreamID, kPPID, payload), expires_4_seconds);
- now += DurationMs(2001);
+ now += TimeDelta::Millis(2001);
ASSERT_TRUE(buf_.Produce(now, kOneFragmentPacketSize));
ASSERT_FALSE(buf_.Produce(now, kOneFragmentPacketSize));
@@ -227,8 +230,7 @@ TEST_F(RRSendQueueTest, DiscardPartialPackets) {
ASSERT_TRUE(chunk_one.has_value());
EXPECT_FALSE(chunk_one->data.is_end);
EXPECT_EQ(chunk_one->data.stream_id, kStreamID);
- buf_.Discard(IsUnordered(false), chunk_one->data.stream_id,
- chunk_one->data.message_id);
+ buf_.Discard(chunk_one->data.stream_id, chunk_one->message_id);
absl::optional<SendQueue::DataToSend> chunk_two =
buf_.Produce(kNow, kOneFragmentPacketSize);
@@ -244,8 +246,7 @@ TEST_F(RRSendQueueTest, DiscardPartialPackets) {
ASSERT_FALSE(buf_.Produce(kNow, kOneFragmentPacketSize));
// Calling it again shouldn't cause issues.
- buf_.Discard(IsUnordered(false), chunk_one->data.stream_id,
- chunk_one->data.message_id);
+ buf_.Discard(chunk_one->data.stream_id, chunk_one->message_id);
ASSERT_FALSE(buf_.Produce(kNow, kOneFragmentPacketSize));
}
@@ -366,6 +367,32 @@ TEST_F(RRSendQueueTest, CommittingResetsSSN) {
EXPECT_EQ(chunk_three->data.ssn, SSN(0));
}
+TEST_F(RRSendQueueTest, CommittingDoesNotResetMessageId) {
+ std::vector<uint8_t> payload(50);
+
+ buf_.Add(kNow, DcSctpMessage(kStreamID, kPPID, payload));
+ ASSERT_HAS_VALUE_AND_ASSIGN(SendQueue::DataToSend chunk1,
+ buf_.Produce(kNow, kOneFragmentPacketSize));
+ EXPECT_EQ(chunk1.data.ssn, SSN(0));
+ EXPECT_EQ(chunk1.message_id, OutgoingMessageId(0));
+
+ buf_.Add(kNow, DcSctpMessage(kStreamID, kPPID, payload));
+ ASSERT_HAS_VALUE_AND_ASSIGN(SendQueue::DataToSend chunk2,
+ buf_.Produce(kNow, kOneFragmentPacketSize));
+ EXPECT_EQ(chunk2.data.ssn, SSN(1));
+ EXPECT_EQ(chunk2.message_id, OutgoingMessageId(1));
+
+ buf_.PrepareResetStream(kStreamID);
+ EXPECT_THAT(buf_.GetStreamsReadyToBeReset(), UnorderedElementsAre(kStreamID));
+ buf_.CommitResetStreams();
+
+ buf_.Add(kNow, DcSctpMessage(kStreamID, kPPID, payload));
+ ASSERT_HAS_VALUE_AND_ASSIGN(SendQueue::DataToSend chunk3,
+ buf_.Produce(kNow, kOneFragmentPacketSize));
+ EXPECT_EQ(chunk3.data.ssn, SSN(0));
+ EXPECT_EQ(chunk3.message_id, OutgoingMessageId(2));
+}
+
TEST_F(RRSendQueueTest, CommittingResetsSSNForPausedStreamsOnly) {
std::vector<uint8_t> payload(50);
@@ -821,8 +848,9 @@ TEST_F(RRSendQueueTest, WillSendLifecycleExpireWhenExpiredInSendQueue) {
EXPECT_CALL(callbacks_, OnLifecycleMessageExpired(LifecycleId(1),
/*maybe_delivered=*/false));
EXPECT_CALL(callbacks_, OnLifecycleEnd(LifecycleId(1)));
- EXPECT_FALSE(buf_.Produce(kNow + DurationMs(1001), kOneFragmentPacketSize)
- .has_value());
+ EXPECT_FALSE(
+ buf_.Produce(kNow + TimeDelta::Millis(1001), kOneFragmentPacketSize)
+ .has_value());
}
TEST_F(RRSendQueueTest, WillSendLifecycleExpireWhenDiscardingDuringPause) {
@@ -859,8 +887,7 @@ TEST_F(RRSendQueueTest, WillSendLifecycleExpireWhenDiscardingExplicitly) {
EXPECT_CALL(callbacks_, OnLifecycleMessageExpired(LifecycleId(1),
/*maybe_delivered=*/false));
EXPECT_CALL(callbacks_, OnLifecycleEnd(LifecycleId(1)));
- buf_.Discard(IsUnordered(false), chunk_one->data.stream_id,
- chunk_one->data.message_id);
+ buf_.Discard(chunk_one->data.stream_id, chunk_one->message_id);
}
} // namespace
} // namespace dcsctp
diff --git a/net/dcsctp/tx/send_queue.h b/net/dcsctp/tx/send_queue.h
index 0b96e9041a..d0d834c901 100644
--- a/net/dcsctp/tx/send_queue.h
+++ b/net/dcsctp/tx/send_queue.h
@@ -17,6 +17,7 @@
#include "absl/types/optional.h"
#include "api/array_view.h"
+#include "api/units/timestamp.h"
#include "net/dcsctp/common/internal_types.h"
#include "net/dcsctp/packet/data.h"
#include "net/dcsctp/public/types.h"
@@ -27,13 +28,17 @@ class SendQueue {
public:
// Container for a data chunk that is produced by the SendQueue
struct DataToSend {
- explicit DataToSend(Data data) : data(std::move(data)) {}
+ DataToSend(OutgoingMessageId message_id, Data data)
+ : message_id(message_id), data(std::move(data)) {}
+
+ OutgoingMessageId message_id;
+
// The data to send, including all parameters.
Data data;
// Partial reliability - RFC3758
MaxRetransmits max_retransmissions = MaxRetransmits::NoLimit();
- TimeMs expires_at = TimeMs::InfiniteFuture();
+ webrtc::Timestamp expires_at = webrtc::Timestamp::PlusInfinity();
// Lifecycle - set for the last fragment, and `LifecycleId::NotSet()` for
// all other fragments.
@@ -51,9 +56,10 @@ class SendQueue {
//
// `max_size` refers to how many payload bytes that may be produced, not
// including any headers.
- virtual absl::optional<DataToSend> Produce(TimeMs now, size_t max_size) = 0;
+ virtual absl::optional<DataToSend> Produce(webrtc::Timestamp now,
+ size_t max_size) = 0;
- // Discards a partially sent message identified by the parameters `unordered`,
+ // Discards a partially sent message identified by the parameters
// `stream_id` and `message_id`. The `message_id` comes from the returned
// information when having called `Produce`. A partially sent message means
// that it has had at least one fragment of it returned when `Produce` was
@@ -67,9 +73,7 @@ class SendQueue {
//
// This function returns true if this message had unsent fragments still in
// the queue that were discarded, and false if there were no such fragments.
- virtual bool Discard(IsUnordered unordered,
- StreamID stream_id,
- MID message_id) = 0;
+ virtual bool Discard(StreamID stream_id, OutgoingMessageId message_id) = 0;
// Prepares the stream to be reset. This is used to close a WebRTC data
// channel and will be signaled to the other side.
diff --git a/net/dcsctp/tx/stream_scheduler.cc b/net/dcsctp/tx/stream_scheduler.cc
index c1d220aaa2..66c4457481 100644
--- a/net/dcsctp/tx/stream_scheduler.cc
+++ b/net/dcsctp/tx/stream_scheduler.cc
@@ -14,7 +14,6 @@
#include "absl/algorithm/container.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "net/dcsctp/common/str_join.h"
#include "net/dcsctp/packet/data.h"
#include "net/dcsctp/public/dcsctp_message.h"
#include "net/dcsctp/public/dcsctp_socket.h"
@@ -22,6 +21,7 @@
#include "net/dcsctp/tx/send_queue.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/strings/str_join.h"
namespace dcsctp {
@@ -31,7 +31,7 @@ void StreamScheduler::Stream::SetPriority(StreamPriority priority) {
}
absl::optional<SendQueue::DataToSend> StreamScheduler::Produce(
- TimeMs now,
+ webrtc::Timestamp now,
size_t max_size) {
// For non-interleaved streams, avoid rescheduling while still sending a
// message as it needs to be sent in full. For interleaved messaging,
@@ -127,7 +127,7 @@ StreamScheduler::VirtualTime StreamScheduler::Stream::CalculateFinishTime(
}
absl::optional<SendQueue::DataToSend> StreamScheduler::Stream::Produce(
- TimeMs now,
+ webrtc::Timestamp now,
size_t max_size) {
absl::optional<SendQueue::DataToSend> data = producer_.Produce(now, max_size);
diff --git a/net/dcsctp/tx/stream_scheduler.h b/net/dcsctp/tx/stream_scheduler.h
index ce836a5826..9d76fc6f56 100644
--- a/net/dcsctp/tx/stream_scheduler.h
+++ b/net/dcsctp/tx/stream_scheduler.h
@@ -87,7 +87,7 @@ class StreamScheduler {
// The parameter `max_size` specifies the maximum amount of actual payload
// that may be returned. If these constraints prevents the stream from
// sending some data, `absl::nullopt` should be returned.
- virtual absl::optional<SendQueue::DataToSend> Produce(TimeMs now,
+ virtual absl::optional<SendQueue::DataToSend> Produce(webrtc::Timestamp now,
size_t max_size) = 0;
// Returns the number of payload bytes that is scheduled to be sent in the
@@ -132,7 +132,8 @@ class StreamScheduler {
// Produces a message from this stream. This will only be called on streams
// that have data.
- absl::optional<SendQueue::DataToSend> Produce(TimeMs now, size_t max_size);
+ absl::optional<SendQueue::DataToSend> Produce(webrtc::Timestamp now,
+ size_t max_size);
void MakeActive(size_t bytes_to_send_next);
void ForceMarkInactive();
@@ -180,7 +181,8 @@ class StreamScheduler {
// `now` and will be used to skip chunks with expired limited lifetime. The
// parameter `max_size` specifies the maximum amount of actual payload that
// may be returned. If no data can be produced, `absl::nullopt` is returned.
- absl::optional<SendQueue::DataToSend> Produce(TimeMs now, size_t max_size);
+ absl::optional<SendQueue::DataToSend> Produce(webrtc::Timestamp now,
+ size_t max_size);
std::set<StreamID> ActiveStreamsForTesting() const;
diff --git a/net/dcsctp/tx/stream_scheduler_test.cc b/net/dcsctp/tx/stream_scheduler_test.cc
index 20833371c1..42d0b3cd35 100644
--- a/net/dcsctp/tx/stream_scheduler_test.cc
+++ b/net/dcsctp/tx/stream_scheduler_test.cc
@@ -19,9 +19,11 @@ namespace dcsctp {
namespace {
using ::testing::Return;
using ::testing::StrictMock;
+using ::webrtc::Timestamp;
constexpr size_t kMtu = 1000;
constexpr size_t kPayloadSize = 4;
+constexpr Timestamp kNow = Timestamp::Zero();
MATCHER_P(HasDataWithMid, mid, "") {
if (!arg.has_value()) {
@@ -29,8 +31,8 @@ MATCHER_P(HasDataWithMid, mid, "") {
return false;
}
- if (arg->data.message_id != mid) {
- *result_listener << "the produced data had mid " << *arg->data.message_id
+ if (arg->data.mid != mid) {
+ *result_listener << "the produced data had mid " << *arg->data.mid
<< " and not the expected " << *mid;
return false;
}
@@ -38,12 +40,17 @@ MATCHER_P(HasDataWithMid, mid, "") {
return true;
}
-std::function<absl::optional<SendQueue::DataToSend>(TimeMs, size_t)>
-CreateChunk(StreamID sid, MID mid, size_t payload_size = kPayloadSize) {
- return [sid, mid, payload_size](TimeMs now, size_t max_size) {
- return SendQueue::DataToSend(Data(
- sid, SSN(0), mid, FSN(0), PPID(42), std::vector<uint8_t>(payload_size),
- Data::IsBeginning(true), Data::IsEnd(true), IsUnordered(true)));
+std::function<absl::optional<SendQueue::DataToSend>(Timestamp, size_t)>
+CreateChunk(OutgoingMessageId message_id,
+ StreamID sid,
+ MID mid,
+ size_t payload_size = kPayloadSize) {
+ return [sid, mid, payload_size, message_id](Timestamp now, size_t max_size) {
+ return SendQueue::DataToSend(
+ message_id,
+ Data(sid, SSN(0), mid, FSN(0), PPID(42),
+ std::vector<uint8_t>(payload_size), Data::IsBeginning(true),
+ Data::IsEnd(true), IsUnordered(true)));
};
}
@@ -51,8 +58,7 @@ std::map<StreamID, size_t> GetPacketCounts(StreamScheduler& scheduler,
size_t packets_to_generate) {
std::map<StreamID, size_t> packet_counts;
for (size_t i = 0; i < packets_to_generate; ++i) {
- absl::optional<SendQueue::DataToSend> data =
- scheduler.Produce(TimeMs(0), kMtu);
+ absl::optional<SendQueue::DataToSend> data = scheduler.Produce(kNow, kMtu);
if (data.has_value()) {
++packet_counts[data->data.stream_id];
}
@@ -64,7 +70,7 @@ class MockStreamProducer : public StreamScheduler::StreamProducer {
public:
MOCK_METHOD(absl::optional<SendQueue::DataToSend>,
Produce,
- (TimeMs, size_t),
+ (Timestamp, size_t),
(override));
MOCK_METHOD(size_t, bytes_to_send_in_next_message, (), (const, override));
};
@@ -76,7 +82,8 @@ class TestStream {
StreamPriority priority,
size_t packet_size = kPayloadSize) {
EXPECT_CALL(producer_, Produce)
- .WillRepeatedly(CreateChunk(stream_id, MID(0), packet_size));
+ .WillRepeatedly(
+ CreateChunk(OutgoingMessageId(0), stream_id, MID(0), packet_size));
EXPECT_CALL(producer_, bytes_to_send_in_next_message)
.WillRepeatedly(Return(packet_size));
stream_ = scheduler.CreateStream(&producer_, stream_id, priority);
@@ -94,7 +101,7 @@ class TestStream {
TEST(StreamSchedulerTest, HasNoActiveStreams) {
StreamScheduler scheduler("", kMtu);
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Stream properties can be set and retrieved
@@ -117,7 +124,8 @@ TEST(StreamSchedulerTest, CanProduceFromSingleStream) {
StreamScheduler scheduler("", kMtu);
StrictMock<MockStreamProducer> producer;
- EXPECT_CALL(producer, Produce).WillOnce(CreateChunk(StreamID(1), MID(0)));
+ EXPECT_CALL(producer, Produce)
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(0)));
EXPECT_CALL(producer, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(0));
@@ -125,8 +133,8 @@ TEST(StreamSchedulerTest, CanProduceFromSingleStream) {
scheduler.CreateStream(&producer, StreamID(1), StreamPriority(2));
stream->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(0)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(0)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Switches between two streams after every packet.
@@ -135,9 +143,9 @@ TEST(StreamSchedulerTest, WillRoundRobinBetweenStreams) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
- .WillOnce(CreateChunk(StreamID(1), MID(101)))
- .WillOnce(CreateChunk(StreamID(1), MID(102)));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102)));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -149,9 +157,9 @@ TEST(StreamSchedulerTest, WillRoundRobinBetweenStreams) {
StrictMock<MockStreamProducer> producer2;
EXPECT_CALL(producer2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(200)))
- .WillOnce(CreateChunk(StreamID(2), MID(201)))
- .WillOnce(CreateChunk(StreamID(2), MID(202)));
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(200)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(201)))
+ .WillOnce(CreateChunk(OutgoingMessageId(6), StreamID(2), MID(202)));
EXPECT_CALL(producer2, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -161,13 +169,13 @@ TEST(StreamSchedulerTest, WillRoundRobinBetweenStreams) {
scheduler.CreateStream(&producer2, StreamID(2), StreamPriority(2));
stream2->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Switches between two streams after every packet, but keeps producing from the
@@ -177,26 +185,29 @@ TEST(StreamSchedulerTest, WillRoundRobinOnlyWhenFinishedProducingChunk) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
.WillOnce([](...) {
return SendQueue::DataToSend(
+ OutgoingMessageId(1),
Data(StreamID(1), SSN(0), MID(101), FSN(0), PPID(42),
std::vector<uint8_t>(4), Data::IsBeginning(true),
Data::IsEnd(false), IsUnordered(true)));
})
.WillOnce([](...) {
return SendQueue::DataToSend(
+ OutgoingMessageId(1),
Data(StreamID(1), SSN(0), MID(101), FSN(0), PPID(42),
std::vector<uint8_t>(4), Data::IsBeginning(false),
Data::IsEnd(false), IsUnordered(true)));
})
.WillOnce([](...) {
return SendQueue::DataToSend(
+ OutgoingMessageId(1),
Data(StreamID(1), SSN(0), MID(101), FSN(0), PPID(42),
std::vector<uint8_t>(4), Data::IsBeginning(false),
Data::IsEnd(true), IsUnordered(true)));
})
- .WillOnce(CreateChunk(StreamID(1), MID(102)));
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102)));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -210,9 +221,9 @@ TEST(StreamSchedulerTest, WillRoundRobinOnlyWhenFinishedProducingChunk) {
StrictMock<MockStreamProducer> producer2;
EXPECT_CALL(producer2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(200)))
- .WillOnce(CreateChunk(StreamID(2), MID(201)))
- .WillOnce(CreateChunk(StreamID(2), MID(202)));
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(200)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(201)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(202)));
EXPECT_CALL(producer2, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -222,15 +233,15 @@ TEST(StreamSchedulerTest, WillRoundRobinOnlyWhenFinishedProducingChunk) {
scheduler.CreateStream(&producer2, StreamID(2), StreamPriority(2));
stream2->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Deactivates a stream before it has finished producing all packets.
@@ -239,8 +250,8 @@ TEST(StreamSchedulerTest, StreamsCanBeMadeInactive) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
- .WillOnce(CreateChunk(StreamID(1), MID(101)));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101)));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -249,12 +260,12 @@ TEST(StreamSchedulerTest, StreamsCanBeMadeInactive) {
scheduler.CreateStream(&producer1, StreamID(1), StreamPriority(2));
stream1->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
// ... but the stream is made inactive before it can be produced.
stream1->MakeInactive();
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Resumes a paused stream - makes a stream active after inactivating it.
@@ -264,9 +275,9 @@ TEST(StreamSchedulerTest, SingleStreamCanBeResumed) {
StrictMock<MockStreamProducer> producer1;
// Callbacks are setup so that they hint that there is a MID(2) coming...
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
- .WillOnce(CreateChunk(StreamID(1), MID(101)))
- .WillOnce(CreateChunk(StreamID(1), MID(102)));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102)));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -277,14 +288,14 @@ TEST(StreamSchedulerTest, SingleStreamCanBeResumed) {
scheduler.CreateStream(&producer1, StreamID(1), StreamPriority(2));
stream1->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
stream1->MakeInactive();
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
stream1->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Iterates between streams, where one is suddenly paused and later resumed.
@@ -293,9 +304,9 @@ TEST(StreamSchedulerTest, WillRoundRobinWithPausedStream) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
- .WillOnce(CreateChunk(StreamID(1), MID(101)))
- .WillOnce(CreateChunk(StreamID(1), MID(102)));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102)));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -308,9 +319,9 @@ TEST(StreamSchedulerTest, WillRoundRobinWithPausedStream) {
StrictMock<MockStreamProducer> producer2;
EXPECT_CALL(producer2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(200)))
- .WillOnce(CreateChunk(StreamID(2), MID(201)))
- .WillOnce(CreateChunk(StreamID(2), MID(202)));
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(200)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(201)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(202)));
EXPECT_CALL(producer2, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -320,15 +331,15 @@ TEST(StreamSchedulerTest, WillRoundRobinWithPausedStream) {
scheduler.CreateStream(&producer2, StreamID(2), StreamPriority(2));
stream2->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
stream1->MakeInactive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
stream1->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Verifies that packet counts are evenly distributed in round robin scheduling.
@@ -384,9 +395,12 @@ TEST(StreamSchedulerTest, WillDoFairQueuingWithSamePriority) {
StrictMock<MockStreamProducer> callback1;
EXPECT_CALL(callback1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100), kSmallPacket))
- .WillOnce(CreateChunk(StreamID(1), MID(101), kSmallPacket))
- .WillOnce(CreateChunk(StreamID(1), MID(102), kSmallPacket));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100),
+ kSmallPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101),
+ kSmallPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102),
+ kSmallPacket));
EXPECT_CALL(callback1, bytes_to_send_in_next_message)
.WillOnce(Return(kSmallPacket)) // When making active
.WillOnce(Return(kSmallPacket))
@@ -398,9 +412,12 @@ TEST(StreamSchedulerTest, WillDoFairQueuingWithSamePriority) {
StrictMock<MockStreamProducer> callback2;
EXPECT_CALL(callback2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(200), kLargePacket))
- .WillOnce(CreateChunk(StreamID(2), MID(201), kLargePacket))
- .WillOnce(CreateChunk(StreamID(2), MID(202), kLargePacket));
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(200),
+ kLargePacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(201),
+ kLargePacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(202),
+ kLargePacket));
EXPECT_CALL(callback2, bytes_to_send_in_next_message)
.WillOnce(Return(kLargePacket)) // When making active
.WillOnce(Return(kLargePacket))
@@ -411,18 +428,18 @@ TEST(StreamSchedulerTest, WillDoFairQueuingWithSamePriority) {
stream2->MaybeMakeActive();
// t = 30
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
// t = 60
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
// t = 70
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
// t = 90
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
// t = 140
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
// t = 210
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Will do weighted fair queuing with three streams having different priority.
@@ -432,9 +449,9 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingSameSizeDifferentPriority) {
StrictMock<MockStreamProducer> callback1;
EXPECT_CALL(callback1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(100)))
- .WillOnce(CreateChunk(StreamID(1), MID(101)))
- .WillOnce(CreateChunk(StreamID(1), MID(102)));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100)))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101)))
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102)));
EXPECT_CALL(callback1, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -447,9 +464,9 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingSameSizeDifferentPriority) {
StrictMock<MockStreamProducer> callback2;
EXPECT_CALL(callback2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(200)))
- .WillOnce(CreateChunk(StreamID(2), MID(201)))
- .WillOnce(CreateChunk(StreamID(2), MID(202)));
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(200)))
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(201)))
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(202)));
EXPECT_CALL(callback2, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -462,9 +479,9 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingSameSizeDifferentPriority) {
StrictMock<MockStreamProducer> callback3;
EXPECT_CALL(callback3, Produce)
- .WillOnce(CreateChunk(StreamID(3), MID(300)))
- .WillOnce(CreateChunk(StreamID(3), MID(301)))
- .WillOnce(CreateChunk(StreamID(3), MID(302)));
+ .WillOnce(CreateChunk(OutgoingMessageId(6), StreamID(3), MID(300)))
+ .WillOnce(CreateChunk(OutgoingMessageId(7), StreamID(3), MID(301)))
+ .WillOnce(CreateChunk(OutgoingMessageId(8), StreamID(3), MID(302)));
EXPECT_CALL(callback3, bytes_to_send_in_next_message)
.WillOnce(Return(kPayloadSize)) // When making active
.WillOnce(Return(kPayloadSize))
@@ -476,24 +493,24 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingSameSizeDifferentPriority) {
stream3->MaybeMakeActive();
// t ~= 20
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(300)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(300)));
// t ~= 40
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(301)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(301)));
// t ~= 50
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
// t ~= 60
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(302)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(302)));
// t ~= 80
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
// t ~= 100
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
// t ~= 150
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
// t ~= 160
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
// t ~= 240
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Will do weighted fair queuing with three streams having different priority
@@ -510,11 +527,14 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingDifferentSizeAndPriority) {
StrictMock<MockStreamProducer> callback1;
EXPECT_CALL(callback1, Produce)
// virtual finish time ~ 0 + 50 * 80 = 4000
- .WillOnce(CreateChunk(StreamID(1), MID(100), kMediumPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(100),
+ kMediumPacket))
// virtual finish time ~ 4000 + 20 * 80 = 5600
- .WillOnce(CreateChunk(StreamID(1), MID(101), kSmallPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(101),
+ kSmallPacket))
// virtual finish time ~ 5600 + 70 * 80 = 11200
- .WillOnce(CreateChunk(StreamID(1), MID(102), kLargePacket));
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(1), MID(102),
+ kLargePacket));
EXPECT_CALL(callback1, bytes_to_send_in_next_message)
.WillOnce(Return(kMediumPacket)) // When making active
.WillOnce(Return(kSmallPacket))
@@ -528,11 +548,14 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingDifferentSizeAndPriority) {
StrictMock<MockStreamProducer> callback2;
EXPECT_CALL(callback2, Produce)
// virtual finish time ~ 0 + 50 * 50 = 2500
- .WillOnce(CreateChunk(StreamID(2), MID(200), kMediumPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(200),
+ kMediumPacket))
// virtual finish time ~ 2500 + 70 * 50 = 6000
- .WillOnce(CreateChunk(StreamID(2), MID(201), kLargePacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(4), StreamID(2), MID(201),
+ kLargePacket))
// virtual finish time ~ 6000 + 20 * 50 = 7000
- .WillOnce(CreateChunk(StreamID(2), MID(202), kSmallPacket));
+ .WillOnce(CreateChunk(OutgoingMessageId(5), StreamID(2), MID(202),
+ kSmallPacket));
EXPECT_CALL(callback2, bytes_to_send_in_next_message)
.WillOnce(Return(kMediumPacket)) // When making active
.WillOnce(Return(kLargePacket))
@@ -546,11 +569,14 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingDifferentSizeAndPriority) {
StrictMock<MockStreamProducer> callback3;
EXPECT_CALL(callback3, Produce)
// virtual finish time ~ 0 + 20 * 20 = 400
- .WillOnce(CreateChunk(StreamID(3), MID(300), kSmallPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(6), StreamID(3), MID(300),
+ kSmallPacket))
// virtual finish time ~ 400 + 50 * 20 = 1400
- .WillOnce(CreateChunk(StreamID(3), MID(301), kMediumPacket))
+ .WillOnce(CreateChunk(OutgoingMessageId(7), StreamID(3), MID(301),
+ kMediumPacket))
// virtual finish time ~ 1400 + 70 * 20 = 2800
- .WillOnce(CreateChunk(StreamID(3), MID(302), kLargePacket));
+ .WillOnce(CreateChunk(OutgoingMessageId(8), StreamID(3), MID(302),
+ kLargePacket));
EXPECT_CALL(callback3, bytes_to_send_in_next_message)
.WillOnce(Return(kSmallPacket)) // When making active
.WillOnce(Return(kMediumPacket))
@@ -561,24 +587,24 @@ TEST(StreamSchedulerTest, WillDoWeightedFairQueuingDifferentSizeAndPriority) {
stream3->MaybeMakeActive();
// t ~= 400
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(300)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(300)));
// t ~= 1400
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(301)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(301)));
// t ~= 2500
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(200)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(200)));
// t ~= 2800
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(302)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(302)));
// t ~= 4000
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(100)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(100)));
// t ~= 5600
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(101)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(101)));
// t ~= 6000
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(201)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(201)));
// t ~= 7000
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(202)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(202)));
// t ~= 11200
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(102)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(102)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
TEST(StreamSchedulerTest, WillDistributeWFQPacketsInTwoStreamsByPriority) {
// A simple test with two streams of different priority, but sending packets
@@ -677,8 +703,8 @@ TEST(StreamSchedulerTest, SendLargeMessageWithSmallMtu) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(0), 100))
- .WillOnce(CreateChunk(StreamID(1), MID(0), 100));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(0), 100))
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(1), MID(0), 100));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(200)) // When making active
.WillOnce(Return(100))
@@ -689,8 +715,8 @@ TEST(StreamSchedulerTest, SendLargeMessageWithSmallMtu) {
StrictMock<MockStreamProducer> producer2;
EXPECT_CALL(producer2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(1), 100))
- .WillOnce(CreateChunk(StreamID(2), MID(1), 50));
+ .WillOnce(CreateChunk(OutgoingMessageId(2), StreamID(2), MID(1), 100))
+ .WillOnce(CreateChunk(OutgoingMessageId(3), StreamID(2), MID(1), 50));
EXPECT_CALL(producer2, bytes_to_send_in_next_message)
.WillOnce(Return(150)) // When making active
.WillOnce(Return(50))
@@ -698,11 +724,11 @@ TEST(StreamSchedulerTest, SendLargeMessageWithSmallMtu) {
auto stream2 =
scheduler.CreateStream(&producer2, StreamID(2), StreamPriority(1));
stream2->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(0)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(1)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(1)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(0)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(0)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(1)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(1)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(0)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
// Sending large messages with large MTU will not fragment messages and will
@@ -714,7 +740,7 @@ TEST(StreamSchedulerTest, SendLargeMessageWithLargeMtu) {
StrictMock<MockStreamProducer> producer1;
EXPECT_CALL(producer1, Produce)
- .WillOnce(CreateChunk(StreamID(1), MID(0), 200));
+ .WillOnce(CreateChunk(OutgoingMessageId(0), StreamID(1), MID(0), 200));
EXPECT_CALL(producer1, bytes_to_send_in_next_message)
.WillOnce(Return(200)) // When making active
.WillOnce(Return(0));
@@ -724,16 +750,16 @@ TEST(StreamSchedulerTest, SendLargeMessageWithLargeMtu) {
StrictMock<MockStreamProducer> producer2;
EXPECT_CALL(producer2, Produce)
- .WillOnce(CreateChunk(StreamID(2), MID(1), 150));
+ .WillOnce(CreateChunk(OutgoingMessageId(1), StreamID(2), MID(1), 150));
EXPECT_CALL(producer2, bytes_to_send_in_next_message)
.WillOnce(Return(150)) // When making active
.WillOnce(Return(0));
auto stream2 =
scheduler.CreateStream(&producer2, StreamID(2), StreamPriority(1));
stream2->MaybeMakeActive();
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(1)));
- EXPECT_THAT(scheduler.Produce(TimeMs(0), kMtu), HasDataWithMid(MID(0)));
- EXPECT_EQ(scheduler.Produce(TimeMs(0), kMtu), absl::nullopt);
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(1)));
+ EXPECT_THAT(scheduler.Produce(kNow, kMtu), HasDataWithMid(MID(0)));
+ EXPECT_EQ(scheduler.Produce(kNow, kMtu), absl::nullopt);
}
} // namespace
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index b8dc0b03ad..bfc0cb5186 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -161,6 +161,7 @@ rtc_library("rtc_p2p") {
"../api/task_queue:pending_task_safety_flag",
"../rtc_base:safe_minmax",
"../rtc_base:weak_ptr",
+ "../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:rtc_export",
@@ -293,6 +294,7 @@ if (rtc_include_tests) {
":p2p_server_utils",
":p2p_test_utils",
":rtc_p2p",
+ "../api:array_view",
"../api:candidate",
"../api:dtls_transport_interface",
"../api:field_trials_view",
@@ -331,6 +333,7 @@ if (rtc_include_tests) {
"../rtc_base:testclient",
"../rtc_base:threading",
"../rtc_base:timeutils",
+ "../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/third_party/sigslot",
"../system_wrappers:metrics",
@@ -393,6 +396,7 @@ rtc_library("libstunprober") {
deps = [
":rtc_p2p",
+ "../api:async_dns_resolver",
"../api:packet_socket_factory",
"../api:sequence_checker",
"../api/task_queue:pending_task_safety_flag",
diff --git a/p2p/base/basic_async_resolver_factory.cc b/p2p/base/basic_async_resolver_factory.cc
index 67c81670d2..5a8c7a27a7 100644
--- a/p2p/base/basic_async_resolver_factory.cc
+++ b/p2p/base/basic_async_resolver_factory.cc
@@ -22,9 +22,12 @@
namespace webrtc {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
rtc::AsyncResolverInterface* BasicAsyncResolverFactory::Create() {
return new rtc::AsyncResolver();
}
+#pragma clang diagnostic pop
std::unique_ptr<webrtc::AsyncDnsResolverInterface>
BasicAsyncDnsResolverFactory::Create() {
diff --git a/p2p/base/basic_async_resolver_factory.h b/p2p/base/basic_async_resolver_factory.h
index 9c1af6a1e1..1a94fb9679 100644
--- a/p2p/base/basic_async_resolver_factory.h
+++ b/p2p/base/basic_async_resolver_factory.h
@@ -21,10 +21,15 @@
namespace webrtc {
-class BasicAsyncResolverFactory final : public AsyncResolverFactory {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+class [[deprecated(
+ "Use BasicAsyncDnsResolverFactory")]] BasicAsyncResolverFactory final
+ : public AsyncResolverFactory {
public:
rtc::AsyncResolverInterface* Create() override;
};
+#pragma clang diagnostic pop
// A factory that vends AsyncDnsResolver instances.
class BasicAsyncDnsResolverFactory final
@@ -47,9 +52,11 @@ class BasicAsyncDnsResolverFactory final
// This class wraps a factory using the older webrtc::AsyncResolverFactory API,
// and produces webrtc::AsyncDnsResolver objects that contain an
// rtc::AsyncResolver object.
-class WrappingAsyncDnsResolverFactory final
+class [[deprecated]] WrappingAsyncDnsResolverFactory final
: public AsyncDnsResolverFactoryInterface {
public:
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
explicit WrappingAsyncDnsResolverFactory(
std::unique_ptr<AsyncResolverFactory> wrapped_factory)
: owned_factory_(std::move(wrapped_factory)),
@@ -58,6 +65,7 @@ class WrappingAsyncDnsResolverFactory final
explicit WrappingAsyncDnsResolverFactory(
AsyncResolverFactory* non_owned_factory)
: wrapped_factory_(non_owned_factory) {}
+#pragma clang diagnostic pop
std::unique_ptr<webrtc::AsyncDnsResolverInterface> CreateAndResolve(
const rtc::SocketAddress& addr,
diff --git a/p2p/base/basic_async_resolver_factory_unittest.cc b/p2p/base/basic_async_resolver_factory_unittest.cc
index 77b97e75e6..313907abb9 100644
--- a/p2p/base/basic_async_resolver_factory_unittest.cc
+++ b/p2p/base/basic_async_resolver_factory_unittest.cc
@@ -22,6 +22,9 @@
namespace webrtc {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+
class BasicAsyncResolverFactoryTest : public ::testing::Test,
public sigslot::has_slots<> {
public:
@@ -108,4 +111,6 @@ TEST(WrappingAsyncDnsResolverFactoryDeathTest, DestroyResolverInCallback) {
}
#endif
+#pragma clang diagnostic pop
+
} // namespace webrtc
diff --git a/p2p/base/basic_packet_socket_factory.cc b/p2p/base/basic_packet_socket_factory.cc
index 5bc02dd0f0..7d87e12859 100644
--- a/p2p/base/basic_packet_socket_factory.cc
+++ b/p2p/base/basic_packet_socket_factory.cc
@@ -18,6 +18,7 @@
#include "api/async_dns_resolver.h"
#include "api/wrapping_async_dns_resolver.h"
#include "p2p/base/async_stun_tcp_socket.h"
+#include "rtc_base/async_dns_resolver.h"
#include "rtc_base/async_tcp_socket.h"
#include "rtc_base/async_udp_socket.h"
#include "rtc_base/checks.h"
@@ -186,8 +187,7 @@ AsyncResolverInterface* BasicPacketSocketFactory::CreateAsyncResolver() {
std::unique_ptr<webrtc::AsyncDnsResolverInterface>
BasicPacketSocketFactory::CreateAsyncDnsResolver() {
- return std::make_unique<webrtc::WrappingAsyncDnsResolver>(
- new AsyncResolver());
+ return std::make_unique<webrtc::AsyncDnsResolver>();
}
int BasicPacketSocketFactory::BindSocket(Socket* socket,
diff --git a/p2p/base/connection.cc b/p2p/base/connection.cc
index 1ef42cc76f..d0e6f1bff8 100644
--- a/p2p/base/connection.cc
+++ b/p2p/base/connection.cc
@@ -13,6 +13,7 @@
#include <math.h>
#include <algorithm>
+#include <cstdint>
#include <memory>
#include <utility>
#include <vector>
@@ -21,6 +22,9 @@
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
+#include "api/array_view.h"
+#include "api/units/timestamp.h"
#include "p2p/base/port_allocator.h"
#include "rtc_base/checks.h"
#include "rtc_base/crc32.h"
@@ -246,6 +250,7 @@ Connection::Connection(rtc::WeakPtr<Port> port,
Connection::~Connection() {
RTC_DCHECK_RUN_ON(network_thread_);
RTC_DCHECK(!port_);
+ RTC_DCHECK(!received_packet_callback_);
}
webrtc::TaskQueueBase* Connection::network_thread() const {
@@ -262,14 +267,17 @@ const Candidate& Connection::remote_candidate() const {
}
const rtc::Network* Connection::network() const {
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in network()";
return port()->Network();
}
int Connection::generation() const {
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in generation()";
return port()->generation();
}
uint64_t Connection::priority() const {
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in priority()";
if (!port_)
return 0;
@@ -442,22 +450,42 @@ void Connection::OnSendStunPacket(const void* data,
}
}
+void Connection::RegisterReceivedPacketCallback(
+ absl::AnyInvocable<void(Connection*, const rtc::ReceivedPacket&)>
+ received_packet_callback) {
+ RTC_DCHECK_RUN_ON(network_thread_);
+ RTC_CHECK(!received_packet_callback_);
+ received_packet_callback_ = std::move(received_packet_callback);
+}
+
+void Connection::DeregisterReceivedPacketCallback() {
+ RTC_DCHECK_RUN_ON(network_thread_);
+ received_packet_callback_ = nullptr;
+}
+
void Connection::OnReadPacket(const char* data,
size_t size,
int64_t packet_time_us) {
+ OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy(data, size, packet_time_us));
+}
+void Connection::OnReadPacket(const rtc::ReceivedPacket& packet) {
RTC_DCHECK_RUN_ON(network_thread_);
std::unique_ptr<IceMessage> msg;
std::string remote_ufrag;
const rtc::SocketAddress& addr(remote_candidate_.address());
- if (!port_->GetStunMessage(data, size, addr, &msg, &remote_ufrag)) {
+ if (!port_->GetStunMessage(
+ reinterpret_cast<const char*>(packet.payload().data()),
+ packet.payload().size(), addr, &msg, &remote_ufrag)) {
// The packet did not parse as a valid STUN message
// This is a data packet, pass it along.
last_data_received_ = rtc::TimeMillis();
UpdateReceiving(last_data_received_);
- recv_rate_tracker_.AddSamples(size);
+ recv_rate_tracker_.AddSamples(packet.payload().size());
stats_.packets_received++;
- SignalReadPacket(this, data, size, packet_time_us);
-
+ if (received_packet_callback_) {
+ received_packet_callback_(this, packet);
+ }
// If timed out sending writability checks, start up again
if (!pruned_ && (write_state_ == STATE_WRITE_TIMEOUT)) {
RTC_LOG(LS_WARNING)
@@ -806,13 +834,14 @@ void Connection::Prune() {
void Connection::Destroy() {
RTC_DCHECK_RUN_ON(network_thread_);
- RTC_DCHECK(port_) << "Calling Destroy() twice?";
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in Destroy()";
if (port_)
port_->DestroyConnection(this);
}
bool Connection::Shutdown() {
RTC_DCHECK_RUN_ON(network_thread_);
+ RTC_DCHECK(port_) << ToDebugId() << ": Calling Shutdown() twice?";
if (!port_)
return false; // already shut down.
@@ -832,6 +861,9 @@ bool Connection::Shutdown() {
// information required for logging needs access to `port_`.
port_.reset();
+ // Clear any pending requests (or responses).
+ requests_.Clear();
+
return true;
}
@@ -846,6 +878,7 @@ void Connection::FailAndPrune() {
// will be nulled.
// In such a case, there's a chance that the Port object gets
// deleted before the Connection object ends up being deleted.
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in FailAndPrune()";
if (!port_)
return;
@@ -882,6 +915,7 @@ void Connection::set_selected(bool selected) {
void Connection::UpdateState(int64_t now) {
RTC_DCHECK_RUN_ON(network_thread_);
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in UpdateState()";
if (!port_)
return;
@@ -958,6 +992,7 @@ int64_t Connection::last_ping_sent() const {
void Connection::Ping(int64_t now,
std::unique_ptr<StunByteStringAttribute> delta) {
RTC_DCHECK_RUN_ON(network_thread_);
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in Ping()";
if (!port_)
return;
@@ -1251,11 +1286,13 @@ std::string Connection::ToDebugId() const {
uint32_t Connection::ComputeNetworkCost() const {
// TODO(honghaiz): Will add rtt as part of the network cost.
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in ComputeNetworkCost()";
return port()->network_cost() + remote_candidate_.network_cost();
}
std::string Connection::ToString() const {
RTC_DCHECK_RUN_ON(network_thread_);
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in ToString()";
constexpr absl::string_view CONNECT_STATE_ABBREV[2] = {
"-", // not connected (false)
"C", // connected (true)
@@ -1457,6 +1494,8 @@ void Connection::OnConnectionRequestResponse(StunRequest* request,
void Connection::OnConnectionRequestErrorResponse(ConnectionRequest* request,
StunMessage* response) {
+ RTC_DCHECK(port_) << ToDebugId()
+ << ": port_ null in OnConnectionRequestErrorResponse";
if (!port_)
return;
@@ -1610,6 +1649,8 @@ ConnectionInfo Connection::stats() {
void Connection::MaybeUpdateLocalCandidate(StunRequest* request,
StunMessage* response) {
+ RTC_DCHECK(port_) << ToDebugId()
+ << ": port_ null in MaybeUpdateLocalCandidate";
if (!port_)
return;
@@ -1754,6 +1795,7 @@ ProxyConnection::ProxyConnection(rtc::WeakPtr<Port> port,
int ProxyConnection::Send(const void* data,
size_t size,
const rtc::PacketOptions& options) {
+ RTC_DCHECK(port_) << ToDebugId() << ": port_ null in Send()";
if (!port_)
return SOCKET_ERROR;
diff --git a/p2p/base/connection.h b/p2p/base/connection.h
index 8e439855fa..cf54dc800f 100644
--- a/p2p/base/connection.h
+++ b/p2p/base/connection.h
@@ -28,6 +28,7 @@
#include "p2p/base/transport_description.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/network.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/numerics/event_based_exponential_moving_average.h"
#include "rtc_base/rate_tracker.h"
#include "rtc_base/system/rtc_export.h"
@@ -111,6 +112,7 @@ class RTC_EXPORT Connection : public CandidatePairInterface {
bool connected() const;
bool weak() const;
bool active() const;
+ bool pending_delete() const { return !port_; }
// A connection is dead if it can be safely deleted.
bool dead(int64_t now) const;
@@ -145,12 +147,18 @@ class RTC_EXPORT Connection : public CandidatePairInterface {
// Error if Send() returns < 0
virtual int GetError() = 0;
- sigslot::signal4<Connection*, const char*, size_t, int64_t> SignalReadPacket;
+ // Register as a recipient of received packets. There can only be one.
+ void RegisterReceivedPacketCallback(
+ absl::AnyInvocable<void(Connection*, const rtc::ReceivedPacket&)>
+ received_packet_callback);
+ void DeregisterReceivedPacketCallback();
sigslot::signal1<Connection*> SignalReadyToSend;
// Called when a packet is received on this connection.
- void OnReadPacket(const char* data, size_t size, int64_t packet_time_us);
+ void OnReadPacket(const rtc::ReceivedPacket& packet);
+ [[deprecated("Pass a rtc::ReceivedPacket")]] void
+ OnReadPacket(const char* data, size_t size, int64_t packet_time_us);
// Called when the socket is currently able to send.
void OnReadyToSend();
@@ -500,6 +508,8 @@ class RTC_EXPORT Connection : public CandidatePairInterface {
absl::optional<
std::function<void(webrtc::RTCErrorOr<const StunUInt64Attribute*>)>>
goog_delta_ack_consumer_;
+ absl::AnyInvocable<void(Connection*, const rtc::ReceivedPacket&)>
+ received_packet_callback_;
};
// ProxyConnection defers all the interesting work to the port.
diff --git a/p2p/base/dtls_transport.cc b/p2p/base/dtls_transport.cc
index 3a61fd4029..a9ff9d3784 100644
--- a/p2p/base/dtls_transport.cc
+++ b/p2p/base/dtls_transport.cc
@@ -416,6 +416,13 @@ bool DtlsTransport::GetSslVersionBytes(int* version) const {
return dtls_->GetSslVersionBytes(version);
}
+uint16_t DtlsTransport::GetSslPeerSignatureAlgorithm() const {
+ if (dtls_state() != webrtc::DtlsTransportState::kConnected) {
+ return rtc::kSslSignatureAlgorithmUnknown; // "not applicable"
+ }
+ return dtls_->GetPeerSignatureAlgorithm();
+}
+
// Called from upper layers to send a media packet.
int DtlsTransport::SendPacket(const char* data,
size_t size,
diff --git a/p2p/base/dtls_transport.h b/p2p/base/dtls_transport.h
index 4e21410b76..9408025be5 100644
--- a/p2p/base/dtls_transport.h
+++ b/p2p/base/dtls_transport.h
@@ -158,6 +158,12 @@ class DtlsTransport : public DtlsTransportInternal {
// Find out which DTLS-SRTP cipher was negotiated
bool GetSrtpCryptoSuite(int* cipher) override;
+ // Find out which signature algorithm was used by the peer. Returns values
+ // from
+ // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-signaturescheme
+ // If not applicable, it returns zero.
+ uint16_t GetSslPeerSignatureAlgorithm() const override;
+
bool GetDtlsRole(rtc::SSLRole* role) const override;
bool SetDtlsRole(rtc::SSLRole role) override;
diff --git a/p2p/base/dtls_transport_internal.h b/p2p/base/dtls_transport_internal.h
index 3d20d1bfd6..cbcd2bdf88 100644
--- a/p2p/base/dtls_transport_internal.h
+++ b/p2p/base/dtls_transport_internal.h
@@ -71,6 +71,12 @@ class DtlsTransportInternal : public rtc::PacketTransportInternal {
// TODO(zhihuang): Remove this once all dependencies implement this.
virtual bool GetSslCipherSuite(int* cipher) = 0;
+ // Find out which signature algorithm was used by the peer. Returns values
+ // from
+ // https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-signaturescheme
+ // If not applicable, it returns zero.
+ virtual uint16_t GetSslPeerSignatureAlgorithm() const = 0;
+
// Gets the local RTCCertificate used for DTLS.
virtual rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate()
const = 0;
diff --git a/p2p/base/fake_dtls_transport.h b/p2p/base/fake_dtls_transport.h
index 283488bc38..5a3db4886b 100644
--- a/p2p/base/fake_dtls_transport.h
+++ b/p2p/base/fake_dtls_transport.h
@@ -205,6 +205,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
void SetSslCipherSuite(absl::optional<int> cipher_suite) {
ssl_cipher_suite_ = cipher_suite;
}
+ uint16_t GetSslPeerSignatureAlgorithm() const override { return 0; }
rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override {
return local_cert_;
}
diff --git a/p2p/base/ice_transport_internal.h b/p2p/base/ice_transport_internal.h
index 98deb492b0..eb21596612 100644
--- a/p2p/base/ice_transport_internal.h
+++ b/p2p/base/ice_transport_internal.h
@@ -105,7 +105,9 @@ webrtc::RTCError VerifyCandidates(const Candidates& candidates);
// Information about ICE configuration.
// TODO(deadbeef): Use absl::optional to represent unset values, instead of
// -1.
-struct IceConfig {
+//
+// TODO(bugs.webrtc.org/15609): Define a public API for this.
+struct RTC_EXPORT IceConfig {
// The ICE connection receiving timeout value in milliseconds.
absl::optional<int> receiving_timeout;
// Time interval in milliseconds to ping a backup connection when the ICE
@@ -234,6 +236,8 @@ enum class IceTransportState {
// Once the public interface is supported,
// (https://www.w3.org/TR/webrtc/#rtcicetransport)
// the IceTransportInterface will be split from this class.
+//
+// TODO(bugs.webrtc.org/15609): Define a public API for this.
class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal {
public:
IceTransportInternal();
diff --git a/p2p/base/mock_async_resolver.h b/p2p/base/mock_async_resolver.h
index 44164716b2..73ad1a4c34 100644
--- a/p2p/base/mock_async_resolver.h
+++ b/p2p/base/mock_async_resolver.h
@@ -20,7 +20,10 @@ namespace rtc {
using ::testing::_;
using ::testing::InvokeWithoutArgs;
-class MockAsyncResolver : public AsyncResolverInterface {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+class [[deprecated]] MockAsyncResolver : public AsyncResolverInterface {
+#pragma clang diagnostic pop
public:
MockAsyncResolver() {
ON_CALL(*this, Start(_)).WillByDefault(InvokeWithoutArgs([this] {
@@ -47,11 +50,13 @@ class MockAsyncResolver : public AsyncResolverInterface {
namespace webrtc {
-class MockAsyncResolverFactory : public AsyncResolverFactory {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+class [[deprecated]] MockAsyncResolverFactory : public AsyncResolverFactory {
public:
MOCK_METHOD(rtc::AsyncResolverInterface*, Create, (), (override));
};
-
+#pragma clang diagnostic pop
} // namespace webrtc
#endif // P2P_BASE_MOCK_ASYNC_RESOLVER_H_
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index fe11920da9..5ddab77de3 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -276,8 +276,10 @@ void P2PTransportChannel::AddConnection(Connection* connection) {
connection->set_unwritable_timeout(config_.ice_unwritable_timeout);
connection->set_unwritable_min_checks(config_.ice_unwritable_min_checks);
connection->set_inactive_timeout(config_.ice_inactive_timeout);
- connection->SignalReadPacket.connect(this,
- &P2PTransportChannel::OnReadPacket);
+ connection->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ OnReadPacket(connection, packet);
+ });
connection->SignalReadyToSend.connect(this,
&P2PTransportChannel::OnReadyToSend);
connection->SignalStateChange.connect(
@@ -2151,6 +2153,7 @@ void P2PTransportChannel::RemoveConnection(Connection* connection) {
RTC_DCHECK_RUN_ON(network_thread_);
auto it = absl::c_find(connections_, connection);
RTC_DCHECK(it != connections_.end());
+ connection->DeregisterReceivedPacketCallback();
connections_.erase(it);
connection->ClearStunDictConsumer();
ice_controller_->OnConnectionDestroyed(connection);
@@ -2221,39 +2224,30 @@ bool P2PTransportChannel::PrunePort(PortInterface* port) {
// We data is available, let listeners know
void P2PTransportChannel::OnReadPacket(Connection* connection,
- const char* data,
- size_t len,
- int64_t packet_time_us) {
+ const rtc::ReceivedPacket& packet) {
RTC_DCHECK_RUN_ON(network_thread_);
+ if (connection != selected_connection_ && !FindConnection(connection)) {
+ // Do not deliver, if packet doesn't belong to the correct transport
+ // channel.
+ RTC_DCHECK_NOTREACHED();
+ return;
+ }
- if (connection == selected_connection_) {
// Let the client know of an incoming packet
packets_received_++;
- bytes_received_ += len;
+ bytes_received_ += packet.payload().size();
RTC_DCHECK(connection->last_data_received() >= last_data_received_ms_);
last_data_received_ms_ =
std::max(last_data_received_ms_, connection->last_data_received());
- SignalReadPacket(this, data, len, packet_time_us, 0);
- return;
- }
-
- // Do not deliver, if packet doesn't belong to the correct transport
- // channel.
- if (!FindConnection(connection))
- return;
-
- packets_received_++;
- bytes_received_ += len;
- RTC_DCHECK(connection->last_data_received() >= last_data_received_ms_);
- last_data_received_ms_ =
- std::max(last_data_received_ms_, connection->last_data_received());
- // Let the client know of an incoming packet
- SignalReadPacket(this, data, len, packet_time_us, 0);
+ SignalReadPacket(
+ this, reinterpret_cast<const char*>(packet.payload().data()),
+ packet.payload().size(),
+ packet.arrival_time() ? packet.arrival_time()->us() : -1, 0);
// May need to switch the sending connection based on the receiving media
// path if this is the controlled side.
- if (ice_role_ == ICEROLE_CONTROLLED) {
+ if (ice_role_ == ICEROLE_CONTROLLED && connection != selected_connection_) {
ice_controller_->OnImmediateSwitchRequest(IceSwitchReason::DATA_RECEIVED,
connection);
}
diff --git a/p2p/base/p2p_transport_channel.h b/p2p/base/p2p_transport_channel.h
index 1e0d1e339a..7f85018cd8 100644
--- a/p2p/base/p2p_transport_channel.h
+++ b/p2p/base/p2p_transport_channel.h
@@ -342,10 +342,7 @@ class RTC_EXPORT P2PTransportChannel : public IceTransportInternal,
void OnRoleConflict(PortInterface* port);
void OnConnectionStateChange(Connection* connection);
- void OnReadPacket(Connection* connection,
- const char* data,
- size_t len,
- int64_t packet_time_us);
+ void OnReadPacket(Connection* connection, const rtc::ReceivedPacket& packet);
void OnSentPacket(const rtc::SentPacket& sent_packet);
void OnReadyToSend(Connection* connection);
void OnConnectionDestroyed(Connection* connection);
diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc
index e414e3f558..9f8df961f7 100644
--- a/p2p/base/p2p_transport_channel_unittest.cc
+++ b/p2p/base/p2p_transport_channel_unittest.cc
@@ -45,11 +45,13 @@
#include "rtc_base/mdns_responder_interface.h"
#include "rtc_base/nat_server.h"
#include "rtc_base/nat_socket_factory.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/proxy_server.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/ssl_adapter.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
+#include "rtc_base/time_utils.h"
#include "rtc_base/virtual_socket_server.h"
#include "system_wrappers/include/metrics.h"
#include "test/scoped_key_value_config.h"
@@ -3595,7 +3597,8 @@ class P2PTransportChannelPingTest : public ::testing::Test,
msg.AddFingerprint();
rtc::ByteBufferWriter buf;
msg.Write(&buf);
- conn->OnReadPacket(buf.Data(), buf.Length(), rtc::TimeMicros());
+ conn->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf.Data(), buf.Length(), rtc::TimeMicros()));
}
void ReceivePingOnConnection(Connection* conn,
@@ -4060,7 +4063,9 @@ TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) {
clock.AdvanceTime(webrtc::TimeDelta::Seconds(1));
conn1->ReceivedPing();
- conn1->OnReadPacket("ABC", 3, rtc::TimeMicros());
+ conn1->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("ABC", 3, rtc::TimeMicros()));
+
EXPECT_TRUE_SIMULATED_WAIT(ch.receiving(), kShortTimeout, clock);
EXPECT_TRUE_SIMULATED_WAIT(!ch.receiving(), kShortTimeout, clock);
}
@@ -4370,7 +4375,8 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) {
Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2);
ASSERT_TRUE(conn2 != nullptr);
conn2->ReceivedPingResponse(LOW_RTT, "id"); // Become writable and receiving.
- conn2->OnReadPacket("ABC", 3, rtc::TimeMicros());
+ conn2->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("ABC", 3, rtc::TimeMicros()));
EXPECT_EQ(conn2, ch.selected_connection());
conn2->ReceivedPingResponse(LOW_RTT, "id"); // Become writable.
@@ -4397,7 +4403,8 @@ TEST_F(P2PTransportChannelPingTest, TestSelectConnectionBasedOnMediaReceived) {
// selected connection was nominated by the controlling side.
conn2->ReceivedPing();
conn2->ReceivedPingResponse(LOW_RTT, "id");
- conn2->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+ conn2->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
EXPECT_EQ_WAIT(conn3, ch.selected_connection(), kDefaultTimeout);
}
@@ -4427,12 +4434,15 @@ TEST_F(P2PTransportChannelPingTest,
// Advance the clock by 1ms so that the last data receiving timestamp of
// conn2 is larger.
SIMULATED_WAIT(false, 1, clock);
- conn2->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+
+ conn2->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
EXPECT_EQ(1, reset_selected_candidate_pair_switches());
EXPECT_TRUE(CandidatePairMatchesNetworkRoute(conn2));
// conn1 also receives data; it becomes selected due to priority again.
- conn1->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+ conn1->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("ABC", 3, rtc::TimeMicros()));
EXPECT_EQ(1, reset_selected_candidate_pair_switches());
EXPECT_TRUE(CandidatePairMatchesNetworkRoute(conn2));
@@ -4441,7 +4451,8 @@ TEST_F(P2PTransportChannelPingTest,
SIMULATED_WAIT(false, 1, clock);
// Need to become writable again because it was pruned.
conn2->ReceivedPingResponse(LOW_RTT, "id");
- conn2->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+ conn2->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("ABC", 3, rtc::TimeMicros()));
EXPECT_EQ(1, reset_selected_candidate_pair_switches());
EXPECT_TRUE(CandidatePairMatchesNetworkRoute(conn2));
@@ -4472,7 +4483,9 @@ TEST_F(P2PTransportChannelPingTest,
// conn1 received data; it is the selected connection.
// Advance the clock to have a non-zero last-data-receiving time.
SIMULATED_WAIT(false, 1, clock);
- conn1->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+
+ conn1->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
EXPECT_EQ(1, reset_selected_candidate_pair_switches());
EXPECT_TRUE(CandidatePairMatchesNetworkRoute(conn1));
@@ -4572,7 +4585,8 @@ TEST_F(P2PTransportChannelPingTest, TestEstimatedDisconnectedTime) {
{
clock.AdvanceTime(webrtc::TimeDelta::Seconds(1));
// This will not parse as STUN, and is considered data
- conn1->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+ conn1->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
clock.AdvanceTime(webrtc::TimeDelta::Seconds(2));
// conn2 is nominated; it becomes selected.
@@ -4584,8 +4598,8 @@ TEST_F(P2PTransportChannelPingTest, TestEstimatedDisconnectedTime) {
{
clock.AdvanceTime(webrtc::TimeDelta::Seconds(1));
- conn2->OnReadPacket("XYZ", 3, rtc::TimeMicros());
-
+ conn2->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
clock.AdvanceTime(webrtc::TimeDelta::Seconds(2));
ReceivePingOnConnection(conn2, kIceUfrag[1], 1, nomination++);
@@ -4758,7 +4772,8 @@ TEST_F(P2PTransportChannelPingTest, TestDontPruneHighPriorityConnections) {
// conn2.
NominateConnection(conn1);
SIMULATED_WAIT(false, 1, clock);
- conn1->OnReadPacket("XYZ", 3, rtc::TimeMicros());
+ conn1->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy("XYZ", 3, rtc::TimeMicros()));
SIMULATED_WAIT(conn2->pruned(), 100, clock);
EXPECT_FALSE(conn2->pruned());
}
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index a90ab632c7..afd998c3ab 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -188,8 +188,8 @@ void Port::Construct() {
Port::~Port() {
RTC_DCHECK_RUN_ON(thread_);
- CancelPendingTasks();
DestroyAllConnections();
+ CancelPendingTasks();
}
const absl::string_view Port::Type() const {
diff --git a/p2p/base/port_allocator.cc b/p2p/base/port_allocator.cc
index d8ff04fe20..9292319b56 100644
--- a/p2p/base/port_allocator.cc
+++ b/p2p/base/port_allocator.cc
@@ -141,6 +141,8 @@ bool PortAllocator::SetConfiguration(
webrtc::PortPrunePolicy turn_port_prune_policy,
webrtc::TurnCustomizer* turn_customizer,
const absl::optional<int>& stun_candidate_keepalive_interval) {
+ RTC_DCHECK_GE(candidate_pool_size, 0);
+ RTC_DCHECK_LE(candidate_pool_size, static_cast<int>(UINT16_MAX));
CheckRunOnValidThreadIfInitialized();
// A positive candidate pool size would lead to the creation of a pooled
// allocator session and starting getting ports, which we should only do on
@@ -152,20 +154,6 @@ bool PortAllocator::SetConfiguration(
turn_servers_ = turn_servers;
turn_port_prune_policy_ = turn_port_prune_policy;
- if (candidate_pool_frozen_) {
- if (candidate_pool_size != candidate_pool_size_) {
- RTC_LOG(LS_ERROR)
- << "Trying to change candidate pool size after pool was frozen.";
- return false;
- }
- return true;
- }
-
- if (candidate_pool_size < 0) {
- RTC_LOG(LS_ERROR) << "Can't set negative pool size.";
- return false;
- }
-
candidate_pool_size_ = candidate_pool_size;
// If ICE servers changed, throw away any existing pooled sessions and create
@@ -286,11 +274,6 @@ PortAllocator::FindPooledSession(const IceParameters* ice_credentials) const {
return pooled_sessions_.end();
}
-void PortAllocator::FreezeCandidatePool() {
- CheckRunOnValidThreadAndInitialized();
- candidate_pool_frozen_ = true;
-}
-
void PortAllocator::DiscardCandidatePool() {
CheckRunOnValidThreadIfInitialized();
pooled_sessions_.clear();
diff --git a/p2p/base/port_allocator.h b/p2p/base/port_allocator.h
index 3ca63cbd41..11462f78f2 100644
--- a/p2p/base/port_allocator.h
+++ b/p2p/base/port_allocator.h
@@ -443,15 +443,6 @@ class RTC_EXPORT PortAllocator : public sigslot::has_slots<> {
const PortAllocatorSession* GetPooledSession(
const IceParameters* ice_credentials = nullptr) const;
- // After FreezeCandidatePool is called, changing the candidate pool size will
- // no longer be allowed, and changing ICE servers will not cause pooled
- // sessions to be recreated.
- //
- // Expected to be called when SetLocalDescription is called on a
- // PeerConnection. Can be called safely on any thread as long as not
- // simultaneously with SetConfiguration.
- void FreezeCandidatePool();
-
// Discard any remaining pooled sessions.
void DiscardCandidatePool();
@@ -655,7 +646,6 @@ class RTC_EXPORT PortAllocator : public sigslot::has_slots<> {
std::vector<RelayServerConfig> turn_servers_;
int candidate_pool_size_ = 0; // Last value passed into SetConfiguration.
std::vector<std::unique_ptr<PortAllocatorSession>> pooled_sessions_;
- bool candidate_pool_frozen_ = false;
webrtc::PortPrunePolicy turn_port_prune_policy_ = webrtc::NO_PRUNE;
// Customizer for TURN messages.
diff --git a/p2p/base/port_allocator_unittest.cc b/p2p/base/port_allocator_unittest.cc
index 48d0bc8a6e..836a2fa494 100644
--- a/p2p/base/port_allocator_unittest.cc
+++ b/p2p/base/port_allocator_unittest.cc
@@ -150,11 +150,6 @@ TEST_F(PortAllocatorTest, SetConfigurationUpdatesCandidatePoolSize) {
EXPECT_EQ(4, allocator_->candidate_pool_size());
}
-// A negative pool size should just be treated as zero.
-TEST_F(PortAllocatorTest, SetConfigurationWithNegativePoolSizeFails) {
- SetConfigurationWithPoolSizeExpectFailure(-1);
-}
-
// Test that if the candidate pool size is nonzero, pooled sessions are
// created, and StartGettingPorts is called on them.
TEST_F(PortAllocatorTest, SetConfigurationCreatesPooledSessions) {
@@ -213,33 +208,6 @@ TEST_F(PortAllocatorTest,
EXPECT_EQ(0, GetAllPooledSessionsReturnCount());
}
-// According to JSEP, after SetLocalDescription, setting different ICE servers
-// will not cause the pool to be refilled. This is implemented by the
-// PeerConnection calling FreezeCandidatePool when a local description is set.
-TEST_F(PortAllocatorTest,
- SetConfigurationDoesNotRecreatePooledSessionsAfterFreezeCandidatePool) {
- cricket::ServerAddresses stun_servers_1 = {stun_server_1};
- std::vector<cricket::RelayServerConfig> turn_servers_1 = {turn_server_1};
- allocator_->SetConfiguration(stun_servers_1, turn_servers_1, 1,
- webrtc::NO_PRUNE);
- EXPECT_EQ(stun_servers_1, allocator_->stun_servers());
- EXPECT_EQ(turn_servers_1, allocator_->turn_servers());
-
- // Update with a different set of servers, but first freeze the pool.
- allocator_->FreezeCandidatePool();
- cricket::ServerAddresses stun_servers_2 = {stun_server_2};
- std::vector<cricket::RelayServerConfig> turn_servers_2 = {turn_server_2};
- allocator_->SetConfiguration(stun_servers_2, turn_servers_2, 2,
- webrtc::NO_PRUNE);
- EXPECT_EQ(stun_servers_2, allocator_->stun_servers());
- EXPECT_EQ(turn_servers_2, allocator_->turn_servers());
- auto session = TakePooledSession();
- ASSERT_NE(nullptr, session.get());
- EXPECT_EQ(stun_servers_1, session->stun_servers());
- EXPECT_EQ(turn_servers_1, session->turn_servers());
- EXPECT_EQ(0, GetAllPooledSessionsReturnCount());
-}
-
TEST_F(PortAllocatorTest, GetPooledSessionReturnsNextSession) {
SetConfigurationWithPoolSize(2);
auto peeked_session_1 = GetPooledSession();
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index b27afe2f39..f3a01d08cd 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -23,6 +23,7 @@
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
+#include "api/array_view.h"
#include "api/candidate.h"
#include "api/packet_socket_factory.h"
#include "api/transport/stun.h"
@@ -55,6 +56,7 @@
#include "rtc_base/nat_types.h"
#include "rtc_base/net_helper.h"
#include "rtc_base/network.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/proxy_info.h"
@@ -162,8 +164,11 @@ class TestPort : public Port {
using cricket::Port::GetStunMessage;
// The last StunMessage that was sent on this Port.
- // TODO(?): Make these const; requires changes to SendXXXXResponse.
- rtc::BufferT<uint8_t>* last_stun_buf() { return last_stun_buf_.get(); }
+ rtc::ArrayView<const uint8_t> last_stun_buf() {
+ if (!last_stun_buf_)
+ return rtc::ArrayView<const uint8_t>();
+ return *last_stun_buf_;
+ }
IceMessage* last_stun_msg() { return last_stun_msg_.get(); }
int last_stun_error_code() {
int code = 0;
@@ -260,14 +265,15 @@ static void SendPingAndReceiveResponse(Connection* lconn,
int64_t ms) {
lconn->Ping(rtc::TimeMillis());
ASSERT_TRUE_WAIT(lport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(lport->last_stun_buf());
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(lport->last_stun_buf().size(), 0u);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
clock->AdvanceTime(webrtc::TimeDelta::Millis(ms));
ASSERT_TRUE_WAIT(rport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(rport->last_stun_buf());
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(rport->last_stun_buf().size(), 0u);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
}
class TestChannel : public sigslot::has_slots<> {
@@ -1488,8 +1494,8 @@ TEST_F(PortTest, TestLoopbackCall) {
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
IceMessage* msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
- conn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ conn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_RESPONSE, msg->type());
@@ -1522,7 +1528,8 @@ TEST_F(PortTest, TestLoopbackCall) {
lport->Reset();
auto buf = std::make_unique<ByteBufferWriter>();
WriteStunMessage(*modified_req, buf.get());
- conn1->OnReadPacket(buf->Data(), buf->Length(), /* packet_time_us */ -1);
+ conn1->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf->Data(), buf->Length(), /*packet_time_us=*/-1));
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_ERROR_RESPONSE, msg->type());
@@ -1555,8 +1562,8 @@ TEST_F(PortTest, TestIceRoleConflict) {
IceMessage* msg = rport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
// Send rport binding request to lport.
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type());
@@ -1878,7 +1885,8 @@ TEST_F(PortTest, TestSendStunMessage) {
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_USE_CANDIDATE) != NULL);
EXPECT_TRUE(msg->GetUInt32(STUN_ATTR_FINGERPRINT) != NULL);
EXPECT_TRUE(StunMessage::ValidateFingerprint(
- lport->last_stun_buf()->data<char>(), lport->last_stun_buf()->size()));
+ reinterpret_cast<const char*>(lport->last_stun_buf().data()),
+ lport->last_stun_buf().size()));
// Request should not include ping count.
ASSERT_TRUE(msg->GetUInt32(STUN_ATTR_RETRANSMIT_COUNT) == NULL);
@@ -1887,14 +1895,15 @@ TEST_F(PortTest, TestSendStunMessage) {
std::unique_ptr<IceMessage> request = CopyStunMessage(*msg);
// Receive the BINDING-REQUEST and respond with BINDING-RESPONSE.
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
msg = rport->last_stun_msg();
ASSERT_TRUE(msg != NULL);
EXPECT_EQ(STUN_BINDING_RESPONSE, msg->type());
// Received a BINDING-RESPONSE.
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
// Verify the STUN Stats.
EXPECT_EQ(1U, lconn->stats().sent_ping_requests_total);
EXPECT_EQ(1U, lconn->stats().sent_ping_requests_before_first_response);
@@ -1912,7 +1921,8 @@ TEST_F(PortTest, TestSendStunMessage) {
msg->ValidateMessageIntegrity("rpass"));
EXPECT_TRUE(msg->GetUInt32(STUN_ATTR_FINGERPRINT) != NULL);
EXPECT_TRUE(StunMessage::ValidateFingerprint(
- lport->last_stun_buf()->data<char>(), lport->last_stun_buf()->size()));
+ reinterpret_cast<const char*>(lport->last_stun_buf().data()),
+ lport->last_stun_buf().size()));
// No USERNAME or PRIORITY in ICE responses.
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_USERNAME) == NULL);
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_PRIORITY) == NULL);
@@ -1942,7 +1952,8 @@ TEST_F(PortTest, TestSendStunMessage) {
msg->ValidateMessageIntegrity("rpass"));
EXPECT_TRUE(msg->GetUInt32(STUN_ATTR_FINGERPRINT) != NULL);
EXPECT_TRUE(StunMessage::ValidateFingerprint(
- lport->last_stun_buf()->data<char>(), lport->last_stun_buf()->size()));
+ reinterpret_cast<const char*>(lport->last_stun_buf().data()),
+ lport->last_stun_buf().size()));
// No USERNAME with ICE.
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_USERNAME) == NULL);
EXPECT_TRUE(msg->GetByteString(STUN_ATTR_PRIORITY) == NULL);
@@ -1971,12 +1982,12 @@ TEST_F(PortTest, TestSendStunMessage) {
// Respond with a BINDING-RESPONSE.
request = CopyStunMessage(*msg);
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
msg = lport->last_stun_msg();
// Receive the BINDING-RESPONSE.
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
// Verify the Stun ping stats.
EXPECT_EQ(3U, rconn->stats().sent_ping_requests_total);
@@ -2026,9 +2037,10 @@ TEST_F(PortTest, TestNomination) {
// should set the remote nomination of `rconn`.
lconn->Ping(0);
ASSERT_TRUE_WAIT(lport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(lport->last_stun_buf());
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(lport->last_stun_buf().size(), 0u);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
EXPECT_EQ(nomination, rconn->remote_nomination());
EXPECT_FALSE(lconn->nominated());
EXPECT_TRUE(rconn->nominated());
@@ -2038,9 +2050,10 @@ TEST_F(PortTest, TestNomination) {
// This should result in an acknowledgment sent back from `rconn` to `lconn`,
// updating the acknowledged nomination of `lconn`.
ASSERT_TRUE_WAIT(rport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(rport->last_stun_buf());
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(rport->last_stun_buf().size(), 0u);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
EXPECT_EQ(nomination, lconn->acked_nomination());
EXPECT_TRUE(lconn->nominated());
EXPECT_TRUE(rconn->nominated());
@@ -2166,8 +2179,9 @@ TEST_F(PortTest, TestNetworkCostChange) {
IceMessage* msg = lport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
// Pass the binding request to rport.
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
// Wait until rport sends the response and then check the remote network cost.
ASSERT_TRUE_WAIT(rport->last_stun_msg() != NULL, kDefaultTimeout);
EXPECT_EQ(rtc::kNetworkCostHigh, rconn->remote_candidate().network_cost());
@@ -2496,8 +2510,8 @@ TEST_F(PortTest,
// Send request.
lconn->Ping(0);
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
// Intercept request and add comprehension required attribute.
ASSERT_TRUE_WAIT(rport->last_stun_msg() != NULL, kDefaultTimeout);
@@ -2507,7 +2521,8 @@ TEST_F(PortTest,
modified_response->AddFingerprint();
ByteBufferWriter buf;
WriteStunMessage(*modified_response, &buf);
- lconn->OnReadPacket(buf.Data(), buf.Length(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf.Data(), buf.Length(), /*packet_time_us=*/-1));
// Response should have been ignored, leaving us unwritable still.
EXPECT_FALSE(lconn->writable());
}
@@ -2535,7 +2550,8 @@ TEST_F(PortTest,
in_msg->AddFingerprint();
ByteBufferWriter buf;
WriteStunMessage(*in_msg, &buf);
- lconn->OnReadPacket(buf.Data(), buf.Length(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf.Data(), buf.Length(), /*packet_time_us=*/-1));
EXPECT_EQ(0u, lconn->last_ping_received());
}
@@ -2581,8 +2597,9 @@ TEST_F(PortTest, TestHandleStunBindingIndication) {
IceMessage* msg = rport->last_stun_msg();
EXPECT_EQ(STUN_BINDING_REQUEST, msg->type());
// Send rport binding request to lport.
- lconn->OnReadPacket(rport->last_stun_buf()->data<char>(),
- rport->last_stun_buf()->size(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type());
int64_t last_ping_received1 = lconn->last_ping_received();
@@ -2590,7 +2607,8 @@ TEST_F(PortTest, TestHandleStunBindingIndication) {
// Adding a delay of 100ms.
rtc::Thread::Current()->ProcessMessages(100);
// Pinging lconn using stun indication message.
- lconn->OnReadPacket(buf->Data(), buf->Length(), /* packet_time_us */ -1);
+ lconn->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf->Data(), buf->Length(), /*packet_time_us=*/-1));
int64_t last_ping_received2 = lconn->last_ping_received();
EXPECT_GT(last_ping_received2, last_ping_received1);
}
@@ -3087,9 +3105,9 @@ TEST_F(PortTest, TestIceLiteConnectivity) {
con->SendStunBindingResponse(request.get());
// Feeding the respone message from litemode to the full mode connection.
- ch1.conn()->OnReadPacket(ice_lite_port->last_stun_buf()->data<char>(),
- ice_lite_port->last_stun_buf()->size(),
- /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket(
+ ice_lite_port->last_stun_buf(), rtc::SocketAddress(), absl::nullopt));
+
// Verifying full mode connection becomes writable from the response.
EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(),
kDefaultTimeout);
@@ -3205,9 +3223,8 @@ TEST_P(GoogPingTest, TestGoogPingAnnounceEnable) {
GetSupportedGoogPingVersion(response) >= kGoogPingVersion);
// Feeding the respone message back.
- ch1.conn()->OnReadPacket(port2->last_stun_buf()->data<char>(),
- port2->last_stun_buf()->size(),
- /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket(
+ port2->last_stun_buf(), rtc::SocketAddress(), absl::nullopt));
port1->Reset();
port2->Reset();
@@ -3390,7 +3407,8 @@ TEST_F(PortTest, TestGoogPingUnsupportedVersionInStunBindingResponse) {
modified_response->Write(&buf);
// Feeding the modified respone message back.
- ch1.conn()->OnReadPacket(buf.Data(), buf.Length(), /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf.Data(), buf.Length(), /*packet_time_us=*/-1));
port1->Reset();
port2->Reset();
@@ -3462,9 +3480,8 @@ TEST_F(PortTest, TestChangeInAttributeMakesGoogPingFallsbackToStunBinding) {
ASSERT_TRUE(GetSupportedGoogPingVersion(response) >= kGoogPingVersion);
// Feeding the respone message back.
- ch1.conn()->OnReadPacket(port2->last_stun_buf()->data<char>(),
- port2->last_stun_buf()->size(),
- /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket(
+ port2->last_stun_buf(), rtc::SocketAddress(), absl::nullopt));
port1->Reset();
port2->Reset();
@@ -3548,9 +3565,8 @@ TEST_F(PortTest, TestErrorResponseMakesGoogPingFallBackToStunBinding) {
ASSERT_TRUE(GetSupportedGoogPingVersion(response) >= kGoogPingVersion);
// Feeding the respone message back.
- ch1.conn()->OnReadPacket(port2->last_stun_buf()->data<char>(),
- port2->last_stun_buf()->size(),
- /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket(
+ port2->last_stun_buf(), rtc::SocketAddress(), absl::nullopt));
port1->Reset();
port2->Reset();
@@ -3576,8 +3592,8 @@ TEST_F(PortTest, TestErrorResponseMakesGoogPingFallBackToStunBinding) {
rtc::ByteBufferWriter buf;
error_response.Write(&buf);
- ch1.conn()->OnReadPacket(buf.Data(), buf.Length(),
- /* packet_time_us */ -1);
+ ch1.conn()->OnReadPacket(rtc::ReceivedPacket::CreateFromLegacy(
+ buf.Data(), buf.Length(), /*packet_time_us=*/-1));
// And now the third ping...this should be a binding.
port1->Reset();
@@ -3813,14 +3829,14 @@ class ConnectionTest : public PortTest {
rconn->PortForTest() == rport_.get() ? rport_.get() : lport_.get();
lconn->Ping(rtc::TimeMillis());
ASSERT_TRUE_WAIT(lport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(lport->last_stun_buf());
- rconn->OnReadPacket(lport->last_stun_buf()->data<char>(),
- lport->last_stun_buf()->size(),
- /* packet_time_us */ -1);
+ ASSERT_GT(lport->last_stun_buf().size(), 0u);
+ rconn->OnReadPacket(rtc::ReceivedPacket(
+ lport->last_stun_buf(), rtc::SocketAddress(), absl::nullopt));
+
clock_.AdvanceTime(webrtc::TimeDelta::Millis(ms));
ASSERT_TRUE_WAIT(rport->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(rport->last_stun_buf());
- *reply = std::move(*rport->last_stun_buf());
+ ASSERT_GT(rport->last_stun_buf().size(), 0u);
+ reply->SetData(rport->last_stun_buf());
}
void SendPingAndReceiveResponse(Connection* lconn,
@@ -3828,8 +3844,9 @@ class ConnectionTest : public PortTest {
int64_t ms) {
rtc::BufferT<uint8_t> reply;
SendPingAndCaptureReply(lconn, rconn, ms, &reply);
- lconn->OnReadPacket(reply.data<char>(), reply.size(),
- /* packet_time_us */ -1);
+
+ lconn->OnReadPacket(
+ rtc::ReceivedPacket(reply, rtc::SocketAddress(), absl::nullopt));
}
void OnConnectionStateChange(Connection* connection) { num_state_changes_++; }
@@ -3890,8 +3907,8 @@ TEST_F(ConnectionTest, ConnectionForgetLearnedStateDiscardsPendingPings) {
EXPECT_FALSE(lconn->writable());
EXPECT_FALSE(lconn->receiving());
- lconn->OnReadPacket(reply.data<char>(), reply.size(),
- /* packet_time_us */ -1);
+ lconn->OnReadPacket(
+ rtc::ReceivedPacket(reply, rtc::SocketAddress(), absl::nullopt));
// That reply was discarded due to the ForgetLearnedState() while it was
// outstanding.
@@ -3962,16 +3979,17 @@ TEST_F(ConnectionTest, SendReceiveGoogDelta) {
lconn->Ping(rtc::TimeMillis(), std::move(delta));
ASSERT_TRUE_WAIT(lport_->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(lport_->last_stun_buf());
- rconn->OnReadPacket(lport_->last_stun_buf()->data<char>(),
- lport_->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(lport_->last_stun_buf().size(), 0u);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport_->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
EXPECT_TRUE(received_goog_delta);
clock_.AdvanceTime(webrtc::TimeDelta::Millis(ms));
ASSERT_TRUE_WAIT(rport_->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(rport_->last_stun_buf());
- lconn->OnReadPacket(rport_->last_stun_buf()->data<char>(),
- rport_->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(rport_->last_stun_buf().size(), 0u);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport_->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
+
EXPECT_TRUE(received_goog_delta_ack);
}
@@ -3999,15 +4017,15 @@ TEST_F(ConnectionTest, SendGoogDeltaNoReply) {
lconn->Ping(rtc::TimeMillis(), std::move(delta));
ASSERT_TRUE_WAIT(lport_->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(lport_->last_stun_buf());
- rconn->OnReadPacket(lport_->last_stun_buf()->data<char>(),
- lport_->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(lport_->last_stun_buf().size(), 0u);
+ rconn->OnReadPacket(rtc::ReceivedPacket(lport_->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
clock_.AdvanceTime(webrtc::TimeDelta::Millis(ms));
ASSERT_TRUE_WAIT(rport_->last_stun_msg(), kDefaultTimeout);
- ASSERT_TRUE(rport_->last_stun_buf());
- lconn->OnReadPacket(rport_->last_stun_buf()->data<char>(),
- rport_->last_stun_buf()->size(), /* packet_time_us */ -1);
+ ASSERT_GT(rport_->last_stun_buf().size(), 0u);
+ lconn->OnReadPacket(rtc::ReceivedPacket(rport_->last_stun_buf(),
+ rtc::SocketAddress(), absl::nullopt));
EXPECT_TRUE(received_goog_delta_ack_error);
}
diff --git a/p2p/base/stun_port.cc b/p2p/base/stun_port.cc
index 3b024bdfea..44776d701b 100644
--- a/p2p/base/stun_port.cc
+++ b/p2p/base/stun_port.cc
@@ -46,7 +46,9 @@ class StunBindingRequest : public StunRequest {
std::make_unique<StunMessage>(STUN_BINDING_REQUEST)),
port_(port),
server_addr_(addr),
- start_time_(start_time) {}
+ start_time_(start_time) {
+ SetAuthenticationRequired(false);
+ }
const rtc::SocketAddress& server_addr() const { return server_addr_; }
@@ -404,7 +406,8 @@ void UDPPort::OnReadPacket(rtc::AsyncPacketSocket* socket,
}
if (Connection* conn = GetConnection(remote_addr)) {
- conn->OnReadPacket(data, size, packet_time_us);
+ conn->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy(data, size, packet_time_us));
} else {
Port::OnReadPacket(data, size, remote_addr, PROTO_UDP);
}
diff --git a/p2p/base/stun_request.cc b/p2p/base/stun_request.cc
index 25d387cc3a..5bf7dfe69c 100644
--- a/p2p/base/stun_request.cc
+++ b/p2p/base/stun_request.cc
@@ -57,6 +57,10 @@ void StunRequestManager::Send(StunRequest* request) {
void StunRequestManager::SendDelayed(StunRequest* request, int delay) {
RTC_DCHECK_RUN_ON(thread_);
RTC_DCHECK_EQ(this, request->manager());
+ RTC_DCHECK(!request->AuthenticationRequired() ||
+ request->msg()->integrity() !=
+ StunMessage::IntegrityStatus::kNotSet)
+ << "Sending request w/o integrity!";
auto [iter, was_inserted] =
requests_.emplace(request->id(), absl::WrapUnique(request));
RTC_DCHECK(was_inserted);
@@ -104,15 +108,23 @@ bool StunRequestManager::CheckResponse(StunMessage* msg) {
StunRequest* request = iter->second.get();
// Now that we know the request, we can see if the response is
- // integrity-protected or not.
- // For some tests, the message integrity is not set in the request.
- // Complain, and then don't check.
+ // integrity-protected or not. Some requests explicitly disables
+ // integrity checks using SetAuthenticationRequired.
+ // TODO(chromium:1177125): Remove below!
+ // And we suspect that for some tests, the message integrity is not set in the
+ // request. Complain, and then don't check.
bool skip_integrity_checking =
(request->msg()->integrity() == StunMessage::IntegrityStatus::kNotSet);
- if (skip_integrity_checking) {
+ if (!request->AuthenticationRequired()) {
+ // This is a STUN_BINDING to from stun_port.cc or
+ // the initial (unauthenticated) TURN_ALLOCATE_REQUEST.
+ } else if (skip_integrity_checking) {
+ // TODO(chromium:1177125): Remove below!
// This indicates lazy test writing (not adding integrity attribute).
// Complain, but only in debug mode (while developing).
- RTC_DLOG(LS_ERROR)
+ RTC_LOG(LS_ERROR)
+ << "CheckResponse called on a passwordless request. Fix test!";
+ RTC_DCHECK(false)
<< "CheckResponse called on a passwordless request. Fix test!";
} else {
if (msg->integrity() == StunMessage::IntegrityStatus::kNotSet) {
@@ -133,31 +145,39 @@ bool StunRequestManager::CheckResponse(StunMessage* msg) {
}
}
- bool success = true;
-
if (!msg->GetNonComprehendedAttributes().empty()) {
// If a response contains unknown comprehension-required attributes, it's
// simply discarded and the transaction is considered failed. See RFC5389
// sections 7.3.3 and 7.3.4.
RTC_LOG(LS_ERROR) << ": Discarding response due to unknown "
"comprehension-required attribute.";
- success = false;
+ requests_.erase(iter);
+ return false;
} else if (msg->type() == GetStunSuccessResponseType(request->type())) {
if (!msg->IntegrityOk() && !skip_integrity_checking) {
return false;
}
- request->OnResponse(msg);
+ // Erase element from hash before calling callback. This ensures
+ // that the callback can modify the StunRequestManager any way it
+ // sees fit.
+ std::unique_ptr<StunRequest> owned_request = std::move(iter->second);
+ requests_.erase(iter);
+ owned_request->OnResponse(msg);
+ return true;
} else if (msg->type() == GetStunErrorResponseType(request->type())) {
- request->OnErrorResponse(msg);
+ // Erase element from hash before calling callback. This ensures
+ // that the callback can modify the StunRequestManager any way it
+ // sees fit.
+ std::unique_ptr<StunRequest> owned_request = std::move(iter->second);
+ requests_.erase(iter);
+ owned_request->OnErrorResponse(msg);
+ return true;
} else {
RTC_LOG(LS_ERROR) << "Received response with wrong type: " << msg->type()
<< " (expecting "
<< GetStunSuccessResponseType(request->type()) << ")";
return false;
}
-
- requests_.erase(iter);
- return success;
}
bool StunRequestManager::empty() const {
diff --git a/p2p/base/stun_request.h b/p2p/base/stun_request.h
index 6e83be3830..f2fd7e5211 100644
--- a/p2p/base/stun_request.h
+++ b/p2p/base/stun_request.h
@@ -115,6 +115,12 @@ class StunRequest {
// Time elapsed since last send (in ms)
int Elapsed() const;
+ // Add method to explitly allow requests w/o password.
+ // - STUN_BINDINGs from StunPort to a stun server
+ // - The initial TURN_ALLOCATE_REQUEST
+ void SetAuthenticationRequired(bool val) { authentication_required_ = val; }
+ bool AuthenticationRequired() const { return authentication_required_; }
+
protected:
friend class StunRequestManager;
@@ -155,6 +161,7 @@ class StunRequest {
bool timeout_ RTC_GUARDED_BY(network_thread());
webrtc::ScopedTaskSafety task_safety_{
webrtc::PendingTaskSafetyFlag::CreateDetachedInactive()};
+ bool authentication_required_ = true;
};
} // namespace cricket
diff --git a/p2p/base/stun_request_unittest.cc b/p2p/base/stun_request_unittest.cc
index 6831d9ffa2..8ce89f8a00 100644
--- a/p2p/base/stun_request_unittest.cc
+++ b/p2p/base/stun_request_unittest.cc
@@ -54,15 +54,15 @@ class StunRequestTest : public ::testing::Test {
request_count_++;
}
- void OnResponse(StunMessage* res) {
+ virtual void OnResponse(StunMessage* res) {
response_ = res;
success_ = true;
}
- void OnErrorResponse(StunMessage* res) {
+ virtual void OnErrorResponse(StunMessage* res) {
response_ = res;
failure_ = true;
}
- void OnTimeout() { timeout_ = true; }
+ virtual void OnTimeout() { timeout_ = true; }
protected:
rtc::AutoThread main_thread_;
@@ -79,7 +79,9 @@ class StunRequestThunker : public StunRequest {
public:
StunRequestThunker(StunRequestManager& manager, StunRequestTest* test)
: StunRequest(manager, CreateStunMessage(STUN_BINDING_REQUEST)),
- test_(test) {}
+ test_(test) {
+ SetAuthenticationRequired(false);
+ }
std::unique_ptr<StunMessage> CreateResponseMessage(StunMessageType type) {
return CreateStunMessage(type, msg());
@@ -216,4 +218,42 @@ TEST_F(StunRequestTest, TestUnrecognizedComprehensionRequiredAttribute) {
EXPECT_FALSE(timeout_);
}
+class StunRequestReentranceTest : public StunRequestTest {
+ public:
+ void OnResponse(StunMessage* res) override {
+ manager_.Clear();
+ StunRequestTest::OnResponse(res);
+ }
+ void OnErrorResponse(StunMessage* res) override {
+ manager_.Clear();
+ StunRequestTest::OnErrorResponse(res);
+ }
+};
+
+TEST_F(StunRequestReentranceTest, TestSuccess) {
+ auto* request = new StunRequestThunker(manager_, this);
+ std::unique_ptr<StunMessage> res =
+ request->CreateResponseMessage(STUN_BINDING_RESPONSE);
+ manager_.Send(request);
+ EXPECT_TRUE(manager_.CheckResponse(res.get()));
+
+ EXPECT_TRUE(response_ == res.get());
+ EXPECT_TRUE(success_);
+ EXPECT_FALSE(failure_);
+ EXPECT_FALSE(timeout_);
+}
+
+TEST_F(StunRequestReentranceTest, TestError) {
+ auto* request = new StunRequestThunker(manager_, this);
+ std::unique_ptr<StunMessage> res =
+ request->CreateResponseMessage(STUN_BINDING_ERROR_RESPONSE);
+ manager_.Send(request);
+ EXPECT_TRUE(manager_.CheckResponse(res.get()));
+
+ EXPECT_TRUE(response_ == res.get());
+ EXPECT_FALSE(success_);
+ EXPECT_TRUE(failure_);
+ EXPECT_FALSE(timeout_);
+}
+
} // namespace cricket
diff --git a/p2p/base/stun_server_unittest.cc b/p2p/base/stun_server_unittest.cc
index 5d3f31fb98..e4ea30cba4 100644
--- a/p2p/base/stun_server_unittest.cc
+++ b/p2p/base/stun_server_unittest.cc
@@ -33,15 +33,13 @@ const rtc::SocketAddress client_addr("1.2.3.4", 1234);
class StunServerTest : public ::testing::Test {
public:
- StunServerTest() : ss_(new rtc::VirtualSocketServer()), network_(ss_.get()) {
+ StunServerTest() : ss_(new rtc::VirtualSocketServer()) {
+ ss_->SetMessageQueue(&main_thread);
server_.reset(
new StunServer(rtc::AsyncUDPSocket::Create(ss_.get(), server_addr)));
client_.reset(new rtc::TestClient(
absl::WrapUnique(rtc::AsyncUDPSocket::Create(ss_.get(), client_addr))));
-
- network_.Start();
}
- ~StunServerTest() override { network_.Stop(); }
void Send(const StunMessage& msg) {
rtc::ByteBufferWriter buf;
@@ -57,7 +55,7 @@ class StunServerTest : public ::testing::Test {
std::unique_ptr<rtc::TestClient::Packet> packet =
client_->NextPacket(rtc::TestClient::kTimeoutMs);
if (packet) {
- rtc::ByteBufferReader buf(packet->buf, packet->size);
+ rtc::ByteBufferReader buf(packet->buf);
msg = new StunMessage();
msg->Read(&buf);
}
@@ -67,7 +65,6 @@ class StunServerTest : public ::testing::Test {
private:
rtc::AutoThread main_thread;
std::unique_ptr<rtc::VirtualSocketServer> ss_;
- rtc::Thread network_;
std::unique_ptr<StunServer> server_;
std::unique_ptr<rtc::TestClient> client_;
};
diff --git a/p2p/base/tcp_port.cc b/p2p/base/tcp_port.cc
index 5f25624d00..edf0ffdabe 100644
--- a/p2p/base/tcp_port.cc
+++ b/p2p/base/tcp_port.cc
@@ -565,7 +565,8 @@ void TCPConnection::OnReadPacket(rtc::AsyncPacketSocket* socket,
const int64_t& packet_time_us) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK_EQ(socket, socket_.get());
- Connection::OnReadPacket(data, size, packet_time_us);
+ Connection::OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy(data, size, packet_time_us));
}
void TCPConnection::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
diff --git a/p2p/base/turn_port.cc b/p2p/base/turn_port.cc
index 1b05d82b89..042727ff67 100644
--- a/p2p/base/turn_port.cc
+++ b/p2p/base/turn_port.cc
@@ -1074,7 +1074,8 @@ void TurnPort::DispatchPacket(const char* data,
ProtocolType proto,
int64_t packet_time_us) {
if (Connection* conn = GetConnection(remote_addr)) {
- conn->OnReadPacket(data, size, packet_time_us);
+ conn->OnReadPacket(
+ rtc::ReceivedPacket::CreateFromLegacy(data, size, packet_time_us));
} else {
Port::OnReadPacket(data, size, remote_addr, proto);
}
@@ -1313,6 +1314,8 @@ TurnAllocateRequest::TurnAllocateRequest(TurnPort* port)
message->AddAttribute(std::move(transport_attr));
if (!port_->hash().empty()) {
port_->AddRequestAuthInfo(message);
+ } else {
+ SetAuthenticationRequired(false);
}
port_->MaybeAddTurnLoggingId(message);
port_->TurnCustomizerMaybeModifyOutgoingStunMessage(message);
diff --git a/p2p/base/turn_port.h b/p2p/base/turn_port.h
index ac660d6599..8fa4607e51 100644
--- a/p2p/base/turn_port.h
+++ b/p2p/base/turn_port.h
@@ -267,7 +267,7 @@ class TurnPort : public Port {
void HandleRefreshError();
bool SetAlternateServer(const rtc::SocketAddress& address);
void ResolveTurnAddress(const rtc::SocketAddress& address);
- void OnResolveResult(rtc::AsyncResolverInterface* resolver);
+ void OnResolveResult(const webrtc::AsyncDnsResolverResult& result);
void AddRequestAuthInfo(StunMessage* msg);
void OnSendStunPacket(const void* data, size_t size, StunRequest* request);
diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc
index cf9ca09853..55706e142b 100644
--- a/p2p/base/turn_port_unittest.cc
+++ b/p2p/base/turn_port_unittest.cc
@@ -216,19 +216,7 @@ class TurnPortTest : public ::testing::Test,
bool /*port_muxed*/) {
turn_unknown_address_ = true;
}
- void OnTurnReadPacket(Connection* conn,
- const char* data,
- size_t size,
- int64_t packet_time_us) {
- turn_packets_.push_back(rtc::Buffer(data, size));
- }
void OnUdpPortComplete(Port* port) { udp_ready_ = true; }
- void OnUdpReadPacket(Connection* conn,
- const char* data,
- size_t size,
- int64_t packet_time_us) {
- udp_packets_.push_back(rtc::Buffer(data, size));
- }
void OnSocketReadPacket(rtc::AsyncPacketSocket* socket,
const char* data,
size_t size,
@@ -248,6 +236,10 @@ class TurnPortTest : public ::testing::Test,
}
void OnTurnPortClosed() override { turn_port_closed_ = true; }
+ void OnConnectionSignalDestroyed(Connection* connection) {
+ connection->DeregisterReceivedPacketCallback();
+ }
+
rtc::Socket* CreateServerSocket(const SocketAddress addr) {
rtc::Socket* socket = ss_->CreateSocket(AF_INET, SOCK_STREAM);
EXPECT_GE(socket->Bind(addr), 0);
@@ -727,10 +719,20 @@ class TurnPortTest : public ::testing::Test,
Port::ORIGIN_MESSAGE);
ASSERT_TRUE(conn1 != NULL);
ASSERT_TRUE(conn2 != NULL);
- conn1->SignalReadPacket.connect(static_cast<TurnPortTest*>(this),
- &TurnPortTest::OnTurnReadPacket);
- conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this),
- &TurnPortTest::OnUdpReadPacket);
+ conn1->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ turn_packets_.push_back(
+ rtc::Buffer(packet.payload().data(), packet.payload().size()));
+ });
+ conn1->SignalDestroyed.connect(this,
+ &TurnPortTest::OnConnectionSignalDestroyed);
+ conn2->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ udp_packets_.push_back(
+ rtc::Buffer(packet.payload().data(), packet.payload().size()));
+ });
+ conn2->SignalDestroyed.connect(this,
+ &TurnPortTest::OnConnectionSignalDestroyed);
conn1->Ping(0);
EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(),
kSimulatedRtt * 2, fake_clock_);
@@ -780,10 +782,21 @@ class TurnPortTest : public ::testing::Test,
Port::ORIGIN_MESSAGE);
ASSERT_TRUE(conn1 != NULL);
ASSERT_TRUE(conn2 != NULL);
- conn1->SignalReadPacket.connect(static_cast<TurnPortTest*>(this),
- &TurnPortTest::OnTurnReadPacket);
- conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this),
- &TurnPortTest::OnUdpReadPacket);
+ conn1->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ turn_packets_.push_back(
+ rtc::Buffer(packet.payload().data(), packet.payload().size()));
+ });
+ conn1->SignalDestroyed.connect(this,
+ &TurnPortTest::OnConnectionSignalDestroyed);
+ conn2->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ udp_packets_.push_back(
+ rtc::Buffer(packet.payload().data(), packet.payload().size()));
+ });
+ conn2->SignalDestroyed.connect(this,
+ &TurnPortTest::OnConnectionSignalDestroyed);
+
conn1->Ping(0);
EXPECT_EQ_SIMULATED_WAIT(Connection::STATE_WRITABLE, conn1->write_state(),
kSimulatedRtt * 2, fake_clock_);
@@ -1507,10 +1520,15 @@ TEST_F(TurnPortTest, TestChannelBindGetErrorResponse) {
kSimulatedRtt, fake_clock_);
// Verify that packets are allowed to be sent after a bind request error.
// They'll just use a send indication instead.
- conn2->SignalReadPacket.connect(static_cast<TurnPortTest*>(this),
- &TurnPortTest::OnUdpReadPacket);
+
+ conn2->RegisterReceivedPacketCallback(
+ [&](Connection* connection, const rtc::ReceivedPacket& packet) {
+ udp_packets_.push_back(
+ rtc::Buffer(packet.payload().data(), packet.payload().size()));
+ });
conn1->Send(data.data(), data.length(), options);
EXPECT_TRUE_SIMULATED_WAIT(!udp_packets_.empty(), kSimulatedRtt, fake_clock_);
+ conn2->DeregisterReceivedPacketCallback();
}
// Do a TURN allocation, establish a UDP connection, and send some data.
diff --git a/p2p/stunprober/stun_prober.cc b/p2p/stunprober/stun_prober.cc
index 977ead4d72..f5abf43beb 100644
--- a/p2p/stunprober/stun_prober.cc
+++ b/p2p/stunprober/stun_prober.cc
@@ -329,13 +329,12 @@ bool StunProber::Start(StunProber::Observer* observer) {
}
bool StunProber::ResolveServerName(const rtc::SocketAddress& addr) {
- rtc::AsyncResolverInterface* resolver =
- socket_factory_->CreateAsyncResolver();
- if (!resolver) {
+ RTC_DCHECK(!resolver_);
+ resolver_ = socket_factory_->CreateAsyncDnsResolver();
+ if (!resolver_) {
return false;
}
- resolver->SignalDone.connect(this, &StunProber::OnServerResolved);
- resolver->Start(addr);
+ resolver_->Start(addr, [this] { OnServerResolved(resolver_->result()); });
return true;
}
@@ -347,20 +346,17 @@ void StunProber::OnSocketReady(rtc::AsyncPacketSocket* socket,
}
}
-void StunProber::OnServerResolved(rtc::AsyncResolverInterface* resolver) {
+void StunProber::OnServerResolved(
+ const webrtc::AsyncDnsResolverResult& result) {
RTC_DCHECK(thread_checker_.IsCurrent());
-
- if (resolver->GetError() == 0) {
- rtc::SocketAddress addr(resolver->address().ipaddr(),
- resolver->address().port());
+ rtc::SocketAddress received_address;
+ if (result.GetResolvedAddress(AF_INET, &received_address)) {
+ // Construct an address without the name in it.
+ rtc::SocketAddress addr(received_address.ipaddr(), received_address.port());
all_servers_addrs_.push_back(addr);
}
-
- // Deletion of AsyncResolverInterface can't be done in OnResolveResult which
- // handles SignalDone.
- thread_->PostTask([resolver] { resolver->Destroy(false); });
+ resolver_.reset();
servers_.pop_back();
-
if (servers_.size()) {
if (!ResolveServerName(servers_.back())) {
ReportOnPrepared(RESOLVE_FAILED);
diff --git a/p2p/stunprober/stun_prober.h b/p2p/stunprober/stun_prober.h
index 7d5094a3b9..3f0f4a2476 100644
--- a/p2p/stunprober/stun_prober.h
+++ b/p2p/stunprober/stun_prober.h
@@ -11,10 +11,12 @@
#ifndef P2P_STUNPROBER_STUN_PROBER_H_
#define P2P_STUNPROBER_STUN_PROBER_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
+#include "api/async_dns_resolver.h"
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/byte_buffer.h"
@@ -166,7 +168,7 @@ class RTC_EXPORT StunProber : public sigslot::has_slots<> {
};
bool ResolveServerName(const rtc::SocketAddress& addr);
- void OnServerResolved(rtc::AsyncResolverInterface* resolver);
+ void OnServerResolved(const webrtc::AsyncDnsResolverResult& resolver);
void OnSocketReady(rtc::AsyncPacketSocket* socket,
const rtc::SocketAddress& addr);
@@ -241,6 +243,7 @@ class RTC_EXPORT StunProber : public sigslot::has_slots<> {
ObserverAdapter observer_adapter_;
const std::vector<const rtc::Network*> networks_;
+ std::unique_ptr<webrtc::AsyncDnsResolverInterface> resolver_;
webrtc::ScopedTaskSafety task_safety_;
};
diff --git a/p2p/stunprober/stun_prober_unittest.cc b/p2p/stunprober/stun_prober_unittest.cc
index b57f93b634..ca20fccb6b 100644
--- a/p2p/stunprober/stun_prober_unittest.cc
+++ b/p2p/stunprober/stun_prober_unittest.cc
@@ -51,16 +51,23 @@ class StunProberTest : public ::testing::Test {
rtc::InitializeSSL();
}
+ static constexpr int pings_per_ip = 3;
+
void set_expected_result(int result) { result_ = result; }
+ void CreateProber(rtc::PacketSocketFactory* socket_factory,
+ std::vector<const rtc::Network*> networks) {
+ prober_ = std::make_unique<StunProber>(
+ socket_factory, rtc::Thread::Current(), std::move(networks));
+ }
+
void StartProbing(rtc::PacketSocketFactory* socket_factory,
const std::vector<rtc::SocketAddress>& addrs,
std::vector<const rtc::Network*> networks,
bool shared_socket,
uint16_t interval,
uint16_t pings_per_ip) {
- prober_ = std::make_unique<StunProber>(
- socket_factory, rtc::Thread::Current(), std::move(networks));
+ CreateProber(socket_factory, networks);
prober_->Start(addrs, shared_socket, interval, pings_per_ip,
100 /* timeout_ms */,
[this](StunProber* prober, int result) {
@@ -69,13 +76,17 @@ class StunProberTest : public ::testing::Test {
}
void RunProber(bool shared_mode) {
- const int pings_per_ip = 3;
std::vector<rtc::SocketAddress> addrs;
addrs.push_back(kStunAddr1);
addrs.push_back(kStunAddr2);
// Add a non-existing server. This shouldn't pollute the result.
addrs.push_back(kFailedStunAddr);
+ RunProber(shared_mode, addrs, /* check_results= */ true);
+ }
+ void RunProber(bool shared_mode,
+ const std::vector<rtc::SocketAddress>& addrs,
+ bool check_results) {
rtc::Network ipv4_network1("test_eth0", "Test Network Adapter 1",
rtc::IPAddress(0x12345600U), 24);
ipv4_network1.AddIP(rtc::IPAddress(0x12345678));
@@ -100,17 +111,21 @@ class StunProberTest : public ::testing::Test {
WAIT(stopped_, 1000);
- StunProber::Stats stats;
- EXPECT_TRUE(prober_->GetStats(&stats));
- EXPECT_EQ(stats.success_percent, 100);
- EXPECT_TRUE(stats.nat_type > stunprober::NATTYPE_NONE);
- EXPECT_EQ(stats.srflx_addrs, srflx_addresses);
- EXPECT_EQ(static_cast<uint32_t>(stats.num_request_sent),
- total_pings_reported);
- EXPECT_EQ(static_cast<uint32_t>(stats.num_response_received),
- total_pings_reported);
+ EXPECT_TRUE(prober_->GetStats(&stats_));
+ if (check_results) {
+ EXPECT_EQ(stats_.success_percent, 100);
+ EXPECT_TRUE(stats_.nat_type > stunprober::NATTYPE_NONE);
+ EXPECT_EQ(stats_.srflx_addrs, srflx_addresses);
+ EXPECT_EQ(static_cast<uint32_t>(stats_.num_request_sent),
+ total_pings_reported);
+ EXPECT_EQ(static_cast<uint32_t>(stats_.num_response_received),
+ total_pings_reported);
+ }
}
+ StunProber* prober() { return prober_.get(); }
+ StunProber::Stats& stats() { return stats_; }
+
private:
void StopCallback(StunProber* prober, int result) {
EXPECT_EQ(result, result_);
@@ -124,6 +139,7 @@ class StunProberTest : public ::testing::Test {
bool stopped_ = false;
std::unique_ptr<cricket::TestStunServer> stun_server_1_;
std::unique_ptr<cricket::TestStunServer> stun_server_2_;
+ StunProber::Stats stats_;
};
TEST_F(StunProberTest, NonSharedMode) {
@@ -134,4 +150,26 @@ TEST_F(StunProberTest, SharedMode) {
RunProber(true);
}
+TEST_F(StunProberTest, ResolveNonexistentHostname) {
+ std::vector<rtc::SocketAddress> addrs;
+ addrs.push_back(kStunAddr1);
+ // Add a non-existing server by name. This should cause a failed lookup.
+ addrs.push_back(rtc::SocketAddress("nonexistent.test", 3478));
+ RunProber(false, addrs, false);
+ // One server is pinged
+ EXPECT_EQ(stats().raw_num_request_sent, pings_per_ip);
+}
+
+TEST_F(StunProberTest, ResolveExistingHostname) {
+ std::vector<rtc::SocketAddress> addrs;
+ addrs.push_back(kStunAddr1);
+ // Add a non-existing server by name. This should cause a failed lookup.
+ addrs.push_back(rtc::SocketAddress("localhost", 3478));
+ RunProber(false, addrs, false);
+ // Two servers are pinged, only one responds.
+ // TODO(bugs.webrtc.org/15559): Figure out why this doesn't always work
+ // EXPECT_EQ(stats().raw_num_request_sent, pings_per_ip * 2);
+ EXPECT_EQ(stats().num_request_sent, pings_per_ip);
+}
+
} // namespace stunprober
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index e9a49ca999..1ff7b99713 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -314,6 +314,15 @@ rtc_source_set("jsep_transport_controller") {
]
}
+rtc_source_set("media_factory") {
+ sources = [ "media_factory.h" ]
+ deps = [
+ "../api:callfactory_api",
+ "../call:call_interfaces",
+ "../media:rtc_media_base",
+ ]
+}
+
rtc_source_set("media_session") {
visibility = [ "*" ] # Used by Chrome
sources = [
@@ -919,6 +928,7 @@ rtc_library("connection_context") {
"connection_context.h",
]
deps = [
+ ":media_factory",
"../api:callfactory_api",
"../api:field_trials_view",
"../api:libjingle_peerconnection_api",
@@ -2106,6 +2116,7 @@ if (rtc_include_tests && !build_with_chromium) {
":rtc_pc",
":rtcp_mux_filter",
":rtp_media_utils",
+ ":rtp_parameters_conversion",
":rtp_transport",
":rtp_transport_internal",
":sctp_transport",
@@ -2361,6 +2372,7 @@ if (rtc_include_tests && !build_with_chromium) {
":dtls_srtp_transport",
":dtls_transport",
":dtmf_sender",
+ ":enable_fake_media",
":ice_server_parsing",
":integration_test_helpers",
":jitter_buffer_delay",
@@ -2404,6 +2416,8 @@ if (rtc_include_tests && !build_with_chromium) {
"../api:create_peerconnection_factory",
"../api:dtls_transport_interface",
"../api:dtmf_sender_interface",
+ "../api:enable_media",
+ "../api:enable_media_with_defaults",
"../api:fake_frame_decryptor",
"../api:fake_frame_encryptor",
"../api:field_trials_view",
@@ -2519,7 +2533,6 @@ if (rtc_include_tests && !build_with_chromium) {
":libjingle_peerconnection",
":pc_test_utils",
":rtc_pc",
- "../api:callfactory_api",
"../api:rtc_event_log_output_file",
"../api:rtc_stats_api",
"../api:rtp_parameters",
@@ -2626,9 +2639,9 @@ if (rtc_include_tests && !build_with_chromium) {
":video_track_source",
"../api:array_view",
"../api:audio_options_api",
- "../api:callfactory_api",
"../api:candidate",
"../api:create_peerconnection_factory",
+ "../api:enable_media_with_defaults",
"../api:fake_frame_decryptor",
"../api:fake_frame_encryptor",
"../api:field_trials_view",
@@ -2664,10 +2677,8 @@ if (rtc_include_tests && !build_with_chromium) {
"../call:call_interfaces",
"../call/adaptation:resource_adaptation_test_utilities",
"../logging:fake_rtc_event_log",
- "../media:rtc_audio_video",
"../media:rtc_media_base",
"../media:rtc_media_config",
- "../media:rtc_media_engine_defaults",
"../media:rtc_media_tests_utils",
"../media:stream_params",
"../modules/audio_device:audio_device_api",
@@ -2718,6 +2729,23 @@ if (rtc_include_tests && !build_with_chromium) {
]
}
+ rtc_library("enable_fake_media") {
+ testonly = true
+ visibility = [ ":*" ]
+ sources = [
+ "test/enable_fake_media.cc",
+ "test/enable_fake_media.h",
+ ]
+ deps = [
+ ":media_factory",
+ "../api:libjingle_peerconnection_api",
+ "../call:call_interfaces",
+ "../media:rtc_media_tests_utils",
+ "../rtc_base:checks",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
+ }
+
rtc_library("pc_test_utils") {
testonly = true
sources = [
@@ -2750,6 +2778,7 @@ if (rtc_include_tests && !build_with_chromium) {
deps = [
":channel",
":channel_interface",
+ ":enable_fake_media",
":jitter_buffer_delay",
":libjingle_peerconnection",
":peer_connection_internal",
diff --git a/pc/audio_rtp_receiver.cc b/pc/audio_rtp_receiver.cc
index a8659de5f9..6e7ca6d0b5 100644
--- a/pc/audio_rtp_receiver.cc
+++ b/pc/audio_rtp_receiver.cc
@@ -278,7 +278,7 @@ std::vector<RtpSource> AudioRtpReceiver::GetSources() const {
}
void AudioRtpReceiver::SetDepacketizerToDecoderFrameTransformer(
- rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) {
RTC_DCHECK_RUN_ON(worker_thread_);
if (media_channel_) {
media_channel_->SetDepacketizerToDecoderFrameTransformer(
diff --git a/pc/audio_rtp_receiver.h b/pc/audio_rtp_receiver.h
index 86c42d532a..36cbdffc35 100644
--- a/pc/audio_rtp_receiver.h
+++ b/pc/audio_rtp_receiver.h
@@ -118,8 +118,7 @@ class AudioRtpReceiver : public ObserverInterface,
std::vector<RtpSource> GetSources() const override;
int AttachmentId() const override { return attachment_id_; }
void SetDepacketizerToDecoderFrameTransformer(
- rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer)
- override;
+ rtc::scoped_refptr<FrameTransformerInterface> frame_transformer) override;
private:
void RestartMediaChannel(absl::optional<uint32_t> ssrc)
diff --git a/pc/audio_rtp_receiver_unittest.cc b/pc/audio_rtp_receiver_unittest.cc
index 9eb20c982f..e031f90359 100644
--- a/pc/audio_rtp_receiver_unittest.cc
+++ b/pc/audio_rtp_receiver_unittest.cc
@@ -98,7 +98,7 @@ TEST_F(AudioRtpReceiverTest, VolumesSetBeforeStartingAreRespected) {
// thread when a media channel pointer is passed to the receiver via the
// constructor.
TEST(AudioRtpReceiver, OnChangedNotificationsAfterConstruction) {
- webrtc::test::RunLoop loop;
+ test::RunLoop loop;
auto* thread = rtc::Thread::Current(); // Points to loop's thread.
cricket::MockVoiceMediaReceiveChannelInterface receive_channel;
auto receiver = rtc::make_ref_counted<AudioRtpReceiver>(
diff --git a/pc/audio_track.h b/pc/audio_track.h
index ae326b304b..92c3141d8a 100644
--- a/pc/audio_track.h
+++ b/pc/audio_track.h
@@ -58,7 +58,7 @@ class AudioTrack : public MediaStreamTrack<AudioTrackInterface>,
private:
const rtc::scoped_refptr<AudioSourceInterface> audio_source_;
- RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker signaling_thread_checker_;
+ RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_checker_;
};
} // namespace webrtc
diff --git a/pc/channel.cc b/pc/channel.cc
index 4b8959cb50..00ef3aef30 100644
--- a/pc/channel.cc
+++ b/pc/channel.cc
@@ -78,12 +78,13 @@ struct StreamFinder {
} // namespace
-template <class Codec>
void MediaChannelParametersFromMediaDescription(
- const MediaContentDescriptionImpl<Codec>* desc,
+ const RtpMediaContentDescription* desc,
const RtpHeaderExtensions& extensions,
bool is_stream_active,
MediaChannelParameters* params) {
+ RTC_DCHECK(desc->type() == MEDIA_TYPE_AUDIO ||
+ desc->type() == MEDIA_TYPE_VIDEO);
params->is_stream_active = is_stream_active;
params->codecs = desc->codecs();
// TODO(bugs.webrtc.org/11513): See if we really need
@@ -95,9 +96,8 @@ void MediaChannelParametersFromMediaDescription(
params->rtcp.remote_estimate = desc->remote_estimate();
}
-template <class Codec>
void RtpSendParametersFromMediaDescription(
- const MediaContentDescriptionImpl<Codec>* desc,
+ const RtpMediaContentDescription* desc,
webrtc::RtpExtension::Filter extensions_filter,
SenderParameters* send_params) {
RtpHeaderExtensions extensions =
@@ -112,9 +112,9 @@ void RtpSendParametersFromMediaDescription(
}
BaseChannel::BaseChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<MediaSendChannelInterface> send_media_channel_impl,
std::unique_ptr<MediaReceiveChannelInterface> receive_media_channel_impl,
absl::string_view mid,
@@ -819,9 +819,9 @@ void BaseChannel::SignalSentPacket_n(const rtc::SentPacket& sent_packet) {
}
VoiceChannel::VoiceChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<VoiceMediaSendChannelInterface> media_send_channel,
std::unique_ptr<VoiceMediaReceiveChannelInterface> media_receive_channel,
absl::string_view mid,
@@ -844,19 +844,6 @@ VoiceChannel::~VoiceChannel() {
DisableMedia_w();
}
-void VoiceChannel::InitCallback() {
- RTC_DCHECK_RUN_ON(worker_thread());
- // TODO(bugs.webrtc.org/13931): Remove when values are set
- // in a more sensible fashion
- send_channel()->SetSendCodecChangedCallback([this]() {
- RTC_DCHECK_RUN_ON(worker_thread());
- // Adjust receive streams based on send codec.
- receive_channel()->SetReceiveNackEnabled(
- send_channel()->SendCodecHasNack());
- receive_channel()->SetReceiveNonSenderRttEnabled(
- send_channel()->SenderNonSenderRttEnabled());
- });
-}
void VoiceChannel::UpdateMediaSendRecvState_w() {
// Render incoming data if we're the active call, and we have the local
// content. We receive data on the default channel and multiplexed streams.
@@ -902,7 +889,7 @@ bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content,
bool criteria_modified = false;
if (webrtc::RtpTransceiverDirectionHasRecv(content->direction())) {
- for (const AudioCodec& codec : content->as_audio()->codecs()) {
+ for (const Codec& codec : content->codecs()) {
if (MaybeAddHandledPayloadType(codec.id)) {
criteria_modified = true;
}
@@ -911,7 +898,7 @@ bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content,
last_recv_params_ = recv_params;
- if (!UpdateLocalStreams_w(content->as_audio()->streams(), type, error_desc)) {
+ if (!UpdateLocalStreams_w(content->streams(), type, error_desc)) {
RTC_DCHECK(!error_desc.empty());
return false;
}
@@ -965,9 +952,9 @@ bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content,
}
VideoChannel::VideoChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<VideoMediaSendChannelInterface> media_send_channel,
std::unique_ptr<VideoMediaReceiveChannelInterface> media_receive_channel,
absl::string_view mid,
@@ -1045,7 +1032,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
webrtc::flat_set<const VideoCodec*> matched_codecs;
for (VideoCodec& send_codec : send_params.codecs) {
if (absl::c_any_of(matched_codecs, [&](const VideoCodec* c) {
- return send_codec.Matches(*c);
+ return send_codec.MatchesWithoutPacketization(*c);
})) {
continue;
}
@@ -1095,7 +1082,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
bool criteria_modified = false;
if (webrtc::RtpTransceiverDirectionHasRecv(content->direction())) {
- for (const VideoCodec& codec : content->as_video()->codecs()) {
+ for (const Codec& codec : content->codecs()) {
if (MaybeAddHandledPayloadType(codec.id))
criteria_modified = true;
}
@@ -1161,7 +1148,7 @@ bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content,
webrtc::flat_set<const VideoCodec*> matched_codecs;
for (VideoCodec& recv_codec : recv_params.codecs) {
if (absl::c_any_of(matched_codecs, [&](const VideoCodec* c) {
- return recv_codec.Matches(*c);
+ return recv_codec.MatchesWithoutPacketization(*c);
})) {
continue;
}
diff --git a/pc/channel.h b/pc/channel.h
index d3a7e89366..c933091e92 100644
--- a/pc/channel.h
+++ b/pc/channel.h
@@ -82,9 +82,9 @@ class BaseChannel : public ChannelInterface,
// Constructor for use when the MediaChannels are split
BaseChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<MediaSendChannelInterface> media_send_channel,
std::unique_ptr<MediaReceiveChannelInterface> media_receive_channel,
absl::string_view mid,
@@ -93,7 +93,7 @@ class BaseChannel : public ChannelInterface,
rtc::UniqueRandomIdGenerator* ssrc_generator);
virtual ~BaseChannel();
- rtc::Thread* worker_thread() const { return worker_thread_; }
+ webrtc::TaskQueueBase* worker_thread() const { return worker_thread_; }
rtc::Thread* network_thread() const { return network_thread_; }
const std::string& mid() const override { return demuxer_criteria_.mid(); }
// TODO(deadbeef): This is redundant; remove this.
@@ -206,7 +206,7 @@ class BaseChannel : public ChannelInterface,
}
bool enabled() const RTC_RUN_ON(worker_thread()) { return enabled_; }
- rtc::Thread* signaling_thread() const { return signaling_thread_; }
+ webrtc::TaskQueueBase* signaling_thread() const { return signaling_thread_; }
// Call to verify that:
// * The required content description directions have been set.
@@ -311,9 +311,9 @@ class BaseChannel : public ChannelInterface,
void DisconnectFromRtpTransport_n() RTC_RUN_ON(network_thread());
void SignalSentPacket_n(const rtc::SentPacket& sent_packet);
- rtc::Thread* const worker_thread_;
+ webrtc::TaskQueueBase* const worker_thread_;
rtc::Thread* const network_thread_;
- rtc::Thread* const signaling_thread_;
+ webrtc::TaskQueueBase* const signaling_thread_;
rtc::scoped_refptr<webrtc::PendingTaskSafetyFlag> alive_;
std::function<void()> on_first_packet_received_
@@ -367,9 +367,9 @@ class BaseChannel : public ChannelInterface,
class VoiceChannel : public BaseChannel {
public:
VoiceChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<VoiceMediaSendChannelInterface> send_channel_impl,
std::unique_ptr<VoiceMediaReceiveChannelInterface> receive_channel_impl,
absl::string_view mid,
@@ -414,7 +414,6 @@ class VoiceChannel : public BaseChannel {
}
private:
- void InitCallback();
// overrides from BaseChannel
void UpdateMediaSendRecvState_w() RTC_RUN_ON(worker_thread()) override;
bool SetLocalContent_w(const MediaContentDescription* content,
@@ -438,9 +437,9 @@ class VoiceChannel : public BaseChannel {
class VideoChannel : public BaseChannel {
public:
VideoChannel(
- rtc::Thread* worker_thread,
+ webrtc::TaskQueueBase* worker_thread,
rtc::Thread* network_thread,
- rtc::Thread* signaling_thread,
+ webrtc::TaskQueueBase* signaling_thread,
std::unique_ptr<VideoMediaSendChannelInterface> media_send_channel,
std::unique_ptr<VideoMediaReceiveChannelInterface> media_receive_channel,
absl::string_view mid,
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index 7d60376141..98a61ea673 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -62,15 +62,14 @@ using ::testing::Field;
using ::webrtc::RtpTransceiverDirection;
using ::webrtc::SdpType;
-const cricket::AudioCodec kPcmuCodec =
+const cricket::Codec kPcmuCodec =
cricket::CreateAudioCodec(0, "PCMU", 64000, 1);
-const cricket::AudioCodec kPcmaCodec =
+const cricket::Codec kPcmaCodec =
cricket::CreateAudioCodec(8, "PCMA", 64000, 1);
-const cricket::AudioCodec kIsacCodec =
+const cricket::Codec kIsacCodec =
cricket::CreateAudioCodec(103, "ISAC", 40000, 1);
-const cricket::VideoCodec kH264Codec = cricket::CreateVideoCodec(97, "H264");
-const cricket::VideoCodec kH264SvcCodec =
- cricket::CreateVideoCodec(99, "H264-SVC");
+const cricket::Codec kH264Codec = cricket::CreateVideoCodec(97, "H264");
+const cricket::Codec kH264SvcCodec = cricket::CreateVideoCodec(99, "H264-SVC");
const uint32_t kSsrc1 = 0x1111;
const uint32_t kSsrc2 = 0x2222;
const uint32_t kSsrc3 = 0x3333;
@@ -86,7 +85,6 @@ template <class ChannelT,
class MediaSendChannelInterfaceT,
class MediaReceiveChannelInterfaceT,
class ContentT,
- class CodecT,
class MediaInfoT,
class OptionsT>
class Traits {
@@ -97,7 +95,6 @@ class Traits {
typedef MediaSendChannelInterfaceT MediaSendChannelInterface;
typedef MediaReceiveChannelInterfaceT MediaReceiveChannelInterface;
typedef ContentT Content;
- typedef CodecT Codec;
typedef MediaInfoT MediaInfo;
typedef OptionsT Options;
};
@@ -108,7 +105,6 @@ class VoiceTraits : public Traits<cricket::VoiceChannel,
cricket::VoiceMediaSendChannelInterface,
cricket::VoiceMediaReceiveChannelInterface,
cricket::AudioContentDescription,
- cricket::AudioCodec,
cricket::VoiceMediaInfo,
cricket::AudioOptions> {};
@@ -118,7 +114,6 @@ class VideoTraits : public Traits<cricket::VideoChannel,
cricket::VideoMediaSendChannelInterface,
cricket::VideoMediaReceiveChannelInterface,
cricket::VideoContentDescription,
- cricket::VideoCodec,
cricket::VideoMediaInfo,
cricket::VideoOptions> {};
@@ -507,8 +502,8 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
bool CheckNoRtp2() { return media_send_channel2_impl()->CheckNoRtp(); }
void CreateContent(int flags,
- const cricket::AudioCodec& audio_codec,
- const cricket::VideoCodec& video_codec,
+ const cricket::Codec& audio_codec,
+ const cricket::Codec& video_codec,
typename T::Content* content) {
// overridden in specialized classes
}
@@ -544,10 +539,6 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
std::unique_ptr<rtc::Thread> thread_;
};
- bool CodecMatches(const typename T::Codec& c1, const typename T::Codec& c2) {
- return false; // overridden in specialized classes
- }
-
cricket::CandidatePairInterface* last_selected_candidate_pair() {
return last_selected_candidate_pair_;
}
@@ -613,8 +604,8 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_EQ(0U, media_send_channel1_impl()->send_codecs().size());
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kAnswer, err));
ASSERT_EQ(1U, media_send_channel1_impl()->send_codecs().size());
- EXPECT_TRUE(CodecMatches(content.codecs()[0],
- media_send_channel1_impl()->send_codecs()[0]));
+ EXPECT_EQ(content.codecs()[0],
+ media_send_channel1_impl()->send_codecs()[0]);
}
// Test that SetLocalContent and SetRemoteContent properly configure
@@ -661,8 +652,8 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_EQ(0U, media_send_channel1_impl()->send_codecs().size());
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kAnswer, err));
ASSERT_EQ(1U, media_send_channel1_impl()->send_codecs().size());
- EXPECT_TRUE(CodecMatches(content.codecs()[0],
- media_send_channel1_impl()->send_codecs()[0]));
+ EXPECT_EQ(content.codecs()[0],
+ media_send_channel1_impl()->send_codecs()[0]);
}
// Test that SetLocalContent and SetRemoteContent properly set RTCP
@@ -1562,8 +1553,8 @@ std::unique_ptr<cricket::VoiceChannel> ChannelTest<VoiceTraits>::CreateChannel(
template <>
void ChannelTest<VoiceTraits>::CreateContent(
int flags,
- const cricket::AudioCodec& audio_codec,
- const cricket::VideoCodec& video_codec,
+ const cricket::Codec& audio_codec,
+ const cricket::Codec& video_codec,
cricket::AudioContentDescription* audio) {
audio->AddCodec(audio_codec);
audio->set_rtcp_mux((flags & RTCP_MUX) != 0);
@@ -1577,13 +1568,6 @@ void ChannelTest<VoiceTraits>::CopyContent(
}
template <>
-bool ChannelTest<VoiceTraits>::CodecMatches(const cricket::AudioCodec& c1,
- const cricket::AudioCodec& c2) {
- return c1.name == c2.name && c1.clockrate == c2.clockrate &&
- c1.bitrate == c2.bitrate && c1.channels == c2.channels;
-}
-
-template <>
void ChannelTest<VoiceTraits>::AddLegacyStreamInContent(
uint32_t ssrc,
int flags,
@@ -1649,8 +1633,8 @@ std::unique_ptr<cricket::VideoChannel> ChannelTest<VideoTraits>::CreateChannel(
template <>
void ChannelTest<VideoTraits>::CreateContent(
int flags,
- const cricket::AudioCodec& audio_codec,
- const cricket::VideoCodec& video_codec,
+ const cricket::Codec& audio_codec,
+ const cricket::Codec& video_codec,
cricket::VideoContentDescription* video) {
video->AddCodec(video_codec);
video->set_rtcp_mux((flags & RTCP_MUX) != 0);
@@ -1664,12 +1648,6 @@ void ChannelTest<VideoTraits>::CopyContent(
}
template <>
-bool ChannelTest<VideoTraits>::CodecMatches(const cricket::VideoCodec& c1,
- const cricket::VideoCodec& c2) {
- return c1.name == c2.name;
-}
-
-template <>
void ChannelTest<VideoTraits>::AddLegacyStreamInContent(
uint32_t ssrc,
int flags,
@@ -2116,12 +2094,12 @@ TEST_F(VideoChannelSingleThreadTest, TestSetLocalOfferWithPacketization) {
EXPECT_TRUE(channel1_->SetLocalContent(&video, SdpType::kOffer, err));
EXPECT_THAT(media_send_channel1_impl()->send_codecs(), testing::IsEmpty());
ASSERT_THAT(media_receive_channel1_impl()->recv_codecs(), testing::SizeIs(2));
- EXPECT_TRUE(media_receive_channel1_impl()->recv_codecs()[0].Matches(
- kVp8Codec, &field_trials_));
+ EXPECT_TRUE(
+ media_receive_channel1_impl()->recv_codecs()[0].Matches(kVp8Codec));
EXPECT_EQ(media_receive_channel1_impl()->recv_codecs()[0].packetization,
absl::nullopt);
- EXPECT_TRUE(media_receive_channel1_impl()->recv_codecs()[1].Matches(
- vp9_codec, &field_trials_));
+ EXPECT_TRUE(
+ media_receive_channel1_impl()->recv_codecs()[1].Matches(vp9_codec));
EXPECT_EQ(media_receive_channel1_impl()->recv_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
@@ -2140,12 +2118,10 @@ TEST_F(VideoChannelSingleThreadTest, TestSetRemoteOfferWithPacketization) {
EXPECT_TRUE(err.empty());
EXPECT_THAT(media_receive_channel1_impl()->recv_codecs(), testing::IsEmpty());
ASSERT_THAT(media_send_channel1_impl()->send_codecs(), testing::SizeIs(2));
- EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[0].Matches(
- kVp8Codec, &field_trials_));
+ EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[0].Matches(kVp8Codec));
EXPECT_EQ(media_send_channel1_impl()->send_codecs()[0].packetization,
absl::nullopt);
- EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[1].Matches(
- vp9_codec, &field_trials_));
+ EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[1].Matches(vp9_codec));
EXPECT_EQ(media_send_channel1_impl()->send_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
@@ -2165,21 +2141,19 @@ TEST_F(VideoChannelSingleThreadTest, TestSetAnswerWithPacketization) {
EXPECT_TRUE(channel1_->SetRemoteContent(&video, SdpType::kAnswer, err));
EXPECT_TRUE(err.empty());
ASSERT_THAT(media_receive_channel1_impl()->recv_codecs(), testing::SizeIs(2));
- EXPECT_TRUE(media_receive_channel1_impl()->recv_codecs()[0].Matches(
- kVp8Codec, &field_trials_));
+ EXPECT_TRUE(
+ media_receive_channel1_impl()->recv_codecs()[0].Matches(kVp8Codec));
EXPECT_EQ(media_receive_channel1_impl()->recv_codecs()[0].packetization,
absl::nullopt);
- EXPECT_TRUE(media_receive_channel1_impl()->recv_codecs()[1].Matches(
- vp9_codec, &field_trials_));
+ EXPECT_TRUE(
+ media_receive_channel1_impl()->recv_codecs()[1].Matches(vp9_codec));
EXPECT_EQ(media_receive_channel1_impl()->recv_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
EXPECT_THAT(media_send_channel1_impl()->send_codecs(), testing::SizeIs(2));
- EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[0].Matches(
- kVp8Codec, &field_trials_));
+ EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[0].Matches(kVp8Codec));
EXPECT_EQ(media_send_channel1_impl()->send_codecs()[0].packetization,
absl::nullopt);
- EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[1].Matches(
- vp9_codec, &field_trials_));
+ EXPECT_TRUE(media_send_channel1_impl()->send_codecs()[1].Matches(vp9_codec));
EXPECT_EQ(media_send_channel1_impl()->send_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
diff --git a/pc/connection_context.cc b/pc/connection_context.cc
index f436e27c0a..09d4b4aa39 100644
--- a/pc/connection_context.cc
+++ b/pc/connection_context.cc
@@ -17,6 +17,7 @@
#include "api/transport/field_trial_based_config.h"
#include "media/base/media_engine.h"
#include "media/sctp/sctp_transport_factory.h"
+#include "pc/media_factory.h"
#include "rtc_base/helpers.h"
#include "rtc_base/internal/default_socket_server.h"
#include "rtc_base/socket_server.h"
@@ -78,6 +79,18 @@ std::unique_ptr<SctpTransportFactoryInterface> MaybeCreateSctpFactory(
// Static
rtc::scoped_refptr<ConnectionContext> ConnectionContext::Create(
PeerConnectionFactoryDependencies* dependencies) {
+// TODO(bugs.webrtc.org/15574): Remove when call_factory and media_engine
+// are removed from PeerConnectionFactoryDependencies
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ if (dependencies->media_factory != nullptr) {
+ RTC_CHECK(dependencies->media_engine == nullptr)
+ << "media_factory replaces media_engine. Do not set media_engine.";
+ RTC_CHECK(dependencies->call_factory == nullptr)
+ << "media_factory replaces call_factory. Do not set call_factory.";
+ }
+#pragma clang diagnostic pop
+
return rtc::scoped_refptr<ConnectionContext>(
new ConnectionContext(dependencies));
}
@@ -98,11 +111,22 @@ ConnectionContext::ConnectionContext(
wraps_current_thread_)),
trials_(dependencies->trials ? std::move(dependencies->trials)
: std::make_unique<FieldTrialBasedConfig>()),
- media_engine_(std::move(dependencies->media_engine)),
+ media_engine_(
+ dependencies->media_factory != nullptr
+ ? dependencies->media_factory->CreateMediaEngine(*dependencies)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ : std::move(dependencies->media_engine)),
+#pragma clang diagnostic pop
network_monitor_factory_(
std::move(dependencies->network_monitor_factory)),
default_network_manager_(std::move(dependencies->network_manager)),
- call_factory_(std::move(dependencies->call_factory)),
+ call_factory_(dependencies->media_factory != nullptr
+ ? std::move(dependencies->media_factory)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ : std::move(dependencies->call_factory)),
+#pragma clang diagnostic pop
default_socket_factory_(std::move(dependencies->packet_socket_factory)),
sctp_factory_(
MaybeCreateSctpFactory(std::move(dependencies->sctp_factory),
diff --git a/pc/connection_context.h b/pc/connection_context.h
index 399e7c2b45..af5b7a9b5f 100644
--- a/pc/connection_context.h
+++ b/pc/connection_context.h
@@ -138,7 +138,7 @@ class ConnectionContext final
RTC_GUARDED_BY(signaling_thread_);
std::unique_ptr<rtc::NetworkManager> default_network_manager_
RTC_GUARDED_BY(signaling_thread_);
- std::unique_ptr<webrtc::CallFactoryInterface> const call_factory_
+ std::unique_ptr<CallFactoryInterface> const call_factory_
RTC_GUARDED_BY(worker_thread());
std::unique_ptr<rtc::PacketSocketFactory> default_socket_factory_
diff --git a/pc/data_channel_controller_unittest.cc b/pc/data_channel_controller_unittest.cc
index 3b8adb6819..7d4e60467e 100644
--- a/pc/data_channel_controller_unittest.cc
+++ b/pc/data_channel_controller_unittest.cc
@@ -27,7 +27,7 @@ namespace {
using ::testing::NiceMock;
using ::testing::Return;
-class MockDataChannelTransport : public webrtc::DataChannelTransportInterface {
+class MockDataChannelTransport : public DataChannelTransportInterface {
public:
~MockDataChannelTransport() override {}
diff --git a/pc/data_channel_integrationtest.cc b/pc/data_channel_integrationtest.cc
index faec76d03e..5a8004c72a 100644
--- a/pc/data_channel_integrationtest.cc
+++ b/pc/data_channel_integrationtest.cc
@@ -90,7 +90,7 @@ class FakeClockForTest : public rtc::ScopedFakeClock {
// Some things use a time of "0" as a special value, so we need to start out
// the fake clock at a nonzero time.
// TODO(deadbeef): Fix this.
- AdvanceTime(webrtc::TimeDelta::Seconds(1));
+ AdvanceTime(TimeDelta::Seconds(1));
}
// Explicit handle.
@@ -422,7 +422,7 @@ TEST_P(DataChannelIntegrationTest, CalleeClosesSctpDataChannel) {
TEST_P(DataChannelIntegrationTest, SctpDataChannelConfigSentToOtherSide) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::DataChannelInit init;
+ DataChannelInit init;
init.id = 53;
init.maxRetransmits = 52;
caller()->CreateDataChannel("data-channel", &init);
@@ -453,7 +453,7 @@ TEST_P(DataChannelIntegrationTest, StressTestUnorderedSctpDataChannel) {
// Normal procedure, but with unordered data channel config.
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::DataChannelInit init;
+ DataChannelInit init;
init.ordered = false;
caller()->CreateDataChannel(&init);
caller()->CreateAndSetAndSignalOffer();
@@ -515,7 +515,7 @@ TEST_P(DataChannelIntegrationTest, StressTestOpenCloseChannelNoDelay) {
const size_t kIterations = 10;
bool has_negotiated = false;
- webrtc::DataChannelInit init;
+ DataChannelInit init;
for (size_t repeats = 0; repeats < kIterations; ++repeats) {
RTC_LOG(LS_INFO) << "Iteration " << (repeats + 1) << "/" << kIterations;
@@ -592,7 +592,7 @@ TEST_P(DataChannelIntegrationTest, StressTestOpenCloseChannelWithDelay) {
const size_t kIterations = 10;
bool has_negotiated = false;
- webrtc::DataChannelInit init;
+ DataChannelInit init;
for (size_t repeats = 0; repeats < kIterations; ++repeats) {
RTC_LOG(LS_INFO) << "Iteration " << (repeats + 1) << "/" << kIterations;
diff --git a/pc/data_channel_unittest.cc b/pc/data_channel_unittest.cc
index 9b84a1be61..a27a66c3de 100644
--- a/pc/data_channel_unittest.cc
+++ b/pc/data_channel_unittest.cc
@@ -81,8 +81,7 @@ class SctpDataChannelTest : public ::testing::Test {
controller_(new FakeDataChannelController(&network_thread_)) {
network_thread_.Start();
inner_channel_ = controller_->CreateDataChannel("test", init_);
- channel_ =
- webrtc::SctpDataChannel::CreateProxy(inner_channel_, signaling_safety_);
+ channel_ = SctpDataChannel::CreateProxy(inner_channel_, signaling_safety_);
}
~SctpDataChannelTest() override {
run_loop_.Flush();
@@ -510,7 +509,7 @@ TEST_F(SctpDataChannelTest, LateCreatedChannelTransitionToOpen) {
SetChannelReady();
InternalDataChannelInit init;
init.id = 1;
- auto dc = webrtc::SctpDataChannel::CreateProxy(
+ auto dc = SctpDataChannel::CreateProxy(
controller_->CreateDataChannel("test1", init), signaling_safety_);
EXPECT_EQ(DataChannelInterface::kOpen, dc->state());
}
@@ -524,7 +523,7 @@ TEST_F(SctpDataChannelTest, SendUnorderedAfterReceivesOpenAck) {
init.ordered = false;
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", init);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
@@ -553,7 +552,7 @@ TEST_F(SctpDataChannelTest, DeprecatedSendUnorderedAfterReceivesOpenAck) {
init.ordered = false;
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", init);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
@@ -582,7 +581,7 @@ TEST_F(SctpDataChannelTest, SendUnorderedAfterReceiveData) {
init.ordered = false;
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", init);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
@@ -605,7 +604,7 @@ TEST_F(SctpDataChannelTest, DeprecatedSendUnorderedAfterReceiveData) {
init.ordered = false;
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", init);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
@@ -714,7 +713,7 @@ TEST_F(SctpDataChannelTest, NoMsgSentIfNegotiatedAndNotFromOpenMsg) {
SetChannelReady();
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", config);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
EXPECT_EQ(0, controller_->last_sid());
@@ -779,7 +778,7 @@ TEST_F(SctpDataChannelTest, OpenAckSentIfCreatedFromOpenMessage) {
SetChannelReady();
rtc::scoped_refptr<SctpDataChannel> dc =
controller_->CreateDataChannel("test1", config);
- auto proxy = webrtc::SctpDataChannel::CreateProxy(dc, signaling_safety_);
+ auto proxy = SctpDataChannel::CreateProxy(dc, signaling_safety_);
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, proxy->state(), 1000);
diff --git a/pc/dtls_srtp_transport.h b/pc/dtls_srtp_transport.h
index 0f8338ca0d..995809ed4b 100644
--- a/pc/dtls_srtp_transport.h
+++ b/pc/dtls_srtp_transport.h
@@ -49,15 +49,6 @@ class DtlsSrtpTransport : public SrtpTransport {
void SetOnDtlsStateChange(std::function<void(void)> callback);
- RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override {
- return RTCError(RTCErrorType::UNSUPPORTED_OPERATION,
- "Set SRTP keys for DTLS-SRTP is not supported.");
- }
- RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override {
- return RTCError(RTCErrorType::UNSUPPORTED_OPERATION,
- "Set SRTP keys for DTLS-SRTP is not supported.");
- }
-
// If `active_reset_srtp_params_` is set to be true, the SRTP parameters will
// be reset whenever the DtlsTransports are reset.
void SetActiveResetSrtpParams(bool active_reset_srtp_params) {
diff --git a/pc/ice_server_parsing_unittest.cc b/pc/ice_server_parsing_unittest.cc
index 4356b1efb0..a38638e507 100644
--- a/pc/ice_server_parsing_unittest.cc
+++ b/pc/ice_server_parsing_unittest.cc
@@ -62,9 +62,7 @@ class IceServerParsingTest : public ::testing::Test {
server.tls_cert_policy = tls_certificate_policy;
server.hostname = hostname;
servers.push_back(server);
- return webrtc::ParseIceServersOrError(servers, &stun_servers_,
- &turn_servers_)
- .ok();
+ return ParseIceServersOrError(servers, &stun_servers_, &turn_servers_).ok();
}
protected:
@@ -233,8 +231,7 @@ TEST_F(IceServerParsingTest, ParseMultipleUrls) {
server.password = "bar";
servers.push_back(server);
EXPECT_TRUE(
- webrtc::ParseIceServersOrError(servers, &stun_servers_, &turn_servers_)
- .ok());
+ ParseIceServersOrError(servers, &stun_servers_, &turn_servers_).ok());
EXPECT_EQ(1U, stun_servers_.size());
EXPECT_EQ(1U, turn_servers_.size());
}
diff --git a/pc/ice_transport_unittest.cc b/pc/ice_transport_unittest.cc
index aaf9f2e57a..a42c107072 100644
--- a/pc/ice_transport_unittest.cc
+++ b/pc/ice_transport_unittest.cc
@@ -32,7 +32,7 @@ class IceTransportTest : public ::testing::Test {
rtc::SocketServer* socket_server() const { return socket_server_.get(); }
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
private:
std::unique_ptr<rtc::SocketServer> socket_server_;
diff --git a/pc/jsep_transport.cc b/pc/jsep_transport.cc
index c7d41c8a4c..2398a0ad2d 100644
--- a/pc/jsep_transport.cc
+++ b/pc/jsep_transport.cc
@@ -704,6 +704,8 @@ bool JsepTransport::GetTransportStats(DtlsTransportInternal* dtls_transport,
&substats.ice_transport_stats)) {
return false;
}
+ substats.ssl_peer_signature_algorithm =
+ dtls_transport->GetSslPeerSignatureAlgorithm();
stats->channel_stats.push_back(substats);
return true;
}
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index fdf6598eea..2a701cce7f 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -148,7 +148,7 @@ JsepTransportController::GetRtcpDtlsTransport(const std::string& mid) const {
return jsep_transport->rtcp_dtls_transport();
}
-rtc::scoped_refptr<webrtc::DtlsTransport>
+rtc::scoped_refptr<DtlsTransport>
JsepTransportController::LookupDtlsTransportByMid(const std::string& mid) {
RTC_DCHECK_RUN_ON(network_thread_);
auto jsep_transport = GetJsepTransportForMid(mid);
@@ -360,11 +360,6 @@ bool JsepTransportController::GetStats(const std::string& transport_name,
void JsepTransportController::SetActiveResetSrtpParams(
bool active_reset_srtp_params) {
- if (!network_thread_->IsCurrent()) {
- network_thread_->BlockingCall(
- [=] { SetActiveResetSrtpParams(active_reset_srtp_params); });
- return;
- }
RTC_DCHECK_RUN_ON(network_thread_);
RTC_LOG(LS_INFO)
<< "Updating the active_reset_srtp_params for JsepTransportController: "
@@ -388,7 +383,7 @@ RTCError JsepTransportController::RollbackTransports() {
return RTCError::OK();
}
-rtc::scoped_refptr<webrtc::IceTransportInterface>
+rtc::scoped_refptr<IceTransportInterface>
JsepTransportController::CreateIceTransport(const std::string& transport_name,
bool rtcp) {
int component = rtcp ? cricket::ICE_CANDIDATE_COMPONENT_RTCP
@@ -460,7 +455,7 @@ JsepTransportController::CreateDtlsTransport(
return dtls;
}
-std::unique_ptr<webrtc::RtpTransport>
+std::unique_ptr<RtpTransport>
JsepTransportController::CreateUnencryptedRtpTransport(
const std::string& transport_name,
rtc::PacketTransportInternal* rtp_packet_transport,
@@ -475,13 +470,12 @@ JsepTransportController::CreateUnencryptedRtpTransport(
return unencrypted_rtp_transport;
}
-std::unique_ptr<webrtc::SrtpTransport>
-JsepTransportController::CreateSdesTransport(
+std::unique_ptr<SrtpTransport> JsepTransportController::CreateSdesTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) {
RTC_DCHECK_RUN_ON(network_thread_);
- auto srtp_transport = std::make_unique<webrtc::SrtpTransport>(
+ auto srtp_transport = std::make_unique<SrtpTransport>(
rtcp_dtls_transport == nullptr, *config_.field_trials);
RTC_DCHECK(rtp_dtls_transport);
srtp_transport->SetRtpPacketTransport(rtp_dtls_transport);
@@ -494,13 +488,13 @@ JsepTransportController::CreateSdesTransport(
return srtp_transport;
}
-std::unique_ptr<webrtc::DtlsSrtpTransport>
+std::unique_ptr<DtlsSrtpTransport>
JsepTransportController::CreateDtlsSrtpTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport) {
RTC_DCHECK_RUN_ON(network_thread_);
- auto dtls_srtp_transport = std::make_unique<webrtc::DtlsSrtpTransport>(
+ auto dtls_srtp_transport = std::make_unique<DtlsSrtpTransport>(
rtcp_dtls_transport == nullptr, *config_.field_trials);
if (config_.enable_external_auth) {
dtls_srtp_transport->EnableExternalAuth();
@@ -990,13 +984,12 @@ int JsepTransportController::GetRtpAbsSendTimeHeaderExtensionId(
const cricket::MediaContentDescription* content_desc =
content_info.media_description();
- const webrtc::RtpExtension* send_time_extension =
- webrtc::RtpExtension::FindHeaderExtensionByUri(
- content_desc->rtp_header_extensions(),
- webrtc::RtpExtension::kAbsSendTimeUri,
+ const RtpExtension* send_time_extension =
+ RtpExtension::FindHeaderExtensionByUri(
+ content_desc->rtp_header_extensions(), RtpExtension::kAbsSendTimeUri,
config_.crypto_options.srtp.enable_encrypted_rtp_header_extensions
- ? webrtc::RtpExtension::kPreferEncryptedExtension
- : webrtc::RtpExtension::kDiscardEncryptedExtension);
+ ? RtpExtension::kPreferEncryptedExtension
+ : RtpExtension::kDiscardEncryptedExtension);
return send_time_extension ? send_time_extension->id : -1;
}
@@ -1044,7 +1037,7 @@ RTCError JsepTransportController::MaybeCreateJsepTransport(
"SDES and DTLS-SRTP cannot be enabled at the same time.");
}
- rtc::scoped_refptr<webrtc::IceTransportInterface> ice =
+ rtc::scoped_refptr<IceTransportInterface> ice =
CreateIceTransport(content_info.name, /*rtcp=*/false);
std::unique_ptr<cricket::DtlsTransportInternal> rtp_dtls_transport =
@@ -1055,7 +1048,7 @@ RTCError JsepTransportController::MaybeCreateJsepTransport(
std::unique_ptr<SrtpTransport> sdes_transport;
std::unique_ptr<DtlsSrtpTransport> dtls_srtp_transport;
- rtc::scoped_refptr<webrtc::IceTransportInterface> rtcp_ice;
+ rtc::scoped_refptr<IceTransportInterface> rtcp_ice;
if (config_.rtcp_mux_policy !=
PeerConnectionInterface::kRtcpMuxPolicyRequire &&
content_info.type == cricket::MediaProtocolType::kRtp) {
@@ -1101,7 +1094,7 @@ RTCError JsepTransportController::MaybeCreateJsepTransport(
OnRtcpPacketReceived_n(buffer, packet_time_ms);
});
jsep_transport->rtp_transport()->SetUnDemuxableRtpPacketReceivedHandler(
- [this](webrtc::RtpPacketReceived& packet) {
+ [this](RtpPacketReceived& packet) {
RTC_DCHECK_RUN_ON(network_thread_);
OnUnDemuxableRtpPacketReceived_n(packet);
});
@@ -1426,7 +1419,7 @@ void JsepTransportController::OnRtcpPacketReceived_n(
}
void JsepTransportController::OnUnDemuxableRtpPacketReceived_n(
- const webrtc::RtpPacketReceived& packet) {
+ const RtpPacketReceived& packet) {
RTC_DCHECK(config_.un_demuxable_packet_handler);
config_.un_demuxable_packet_handler(packet);
}
diff --git a/pc/jsep_transport_controller.h b/pc/jsep_transport_controller.h
index 5880e346cd..8f9b9c8491 100644
--- a/pc/jsep_transport_controller.h
+++ b/pc/jsep_transport_controller.h
@@ -112,7 +112,7 @@ class JsepTransportController : public sigslot::has_slots<> {
rtc::SSLProtocolVersion ssl_max_version = rtc::SSL_PROTOCOL_DTLS_12;
// `crypto_options` is used to determine if created DTLS transports
// negotiate GCM crypto suites or not.
- webrtc::CryptoOptions crypto_options;
+ CryptoOptions crypto_options;
PeerConnectionInterface::BundlePolicy bundle_policy =
PeerConnectionInterface::kBundlePolicyBalanced;
PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy =
@@ -120,7 +120,7 @@ class JsepTransportController : public sigslot::has_slots<> {
bool disable_encryption = false;
bool enable_external_auth = false;
// Used to inject the ICE/DTLS transports created externally.
- webrtc::IceTransportFactory* ice_transport_factory = nullptr;
+ IceTransportFactory* ice_transport_factory = nullptr;
cricket::DtlsTransportFactory* dtls_transport_factory = nullptr;
Observer* transport_observer = nullptr;
// Must be provided and valid for the lifetime of the
@@ -140,7 +140,7 @@ class JsepTransportController : public sigslot::has_slots<> {
std::function<void(rtc::SSLHandshakeError)> on_dtls_handshake_error_;
// Field trials.
- const webrtc::FieldTrialsView* field_trials;
+ const FieldTrialsView* field_trials;
};
// The ICE related events are fired on the `network_thread`.
@@ -174,7 +174,7 @@ class JsepTransportController : public sigslot::has_slots<> {
const cricket::DtlsTransportInternal* GetRtcpDtlsTransport(
const std::string& mid) const;
// Gets the externally sharable version of the DtlsTransport.
- rtc::scoped_refptr<webrtc::DtlsTransport> LookupDtlsTransportByMid(
+ rtc::scoped_refptr<DtlsTransport> LookupDtlsTransportByMid(
const std::string& mid);
rtc::scoped_refptr<SctpTransport> GetSctpTransport(
const std::string& mid) const;
@@ -399,19 +399,19 @@ class JsepTransportController : public sigslot::has_slots<> {
std::unique_ptr<cricket::DtlsTransportInternal> CreateDtlsTransport(
const cricket::ContentInfo& content_info,
cricket::IceTransportInternal* ice);
- rtc::scoped_refptr<webrtc::IceTransportInterface> CreateIceTransport(
+ rtc::scoped_refptr<IceTransportInterface> CreateIceTransport(
const std::string& transport_name,
bool rtcp);
- std::unique_ptr<webrtc::RtpTransport> CreateUnencryptedRtpTransport(
+ std::unique_ptr<RtpTransport> CreateUnencryptedRtpTransport(
const std::string& transport_name,
rtc::PacketTransportInternal* rtp_packet_transport,
rtc::PacketTransportInternal* rtcp_packet_transport);
- std::unique_ptr<webrtc::SrtpTransport> CreateSdesTransport(
+ std::unique_ptr<SrtpTransport> CreateSdesTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport);
- std::unique_ptr<webrtc::DtlsSrtpTransport> CreateDtlsSrtpTransport(
+ std::unique_ptr<DtlsSrtpTransport> CreateDtlsSrtpTransport(
const std::string& transport_name,
cricket::DtlsTransportInternal* rtp_dtls_transport,
cricket::DtlsTransportInternal* rtcp_dtls_transport);
@@ -453,7 +453,7 @@ class JsepTransportController : public sigslot::has_slots<> {
void OnRtcpPacketReceived_n(rtc::CopyOnWriteBuffer* packet,
int64_t packet_time_us)
RTC_RUN_ON(network_thread_);
- void OnUnDemuxableRtpPacketReceived_n(const webrtc::RtpPacketReceived& packet)
+ void OnUnDemuxableRtpPacketReceived_n(const RtpPacketReceived& packet)
RTC_RUN_ON(network_thread_);
void OnDtlsHandshakeError(rtc::SSLHandshakeError error);
diff --git a/pc/jsep_transport_controller_unittest.cc b/pc/jsep_transport_controller_unittest.cc
index faa8842e35..f5e258c664 100644
--- a/pc/jsep_transport_controller_unittest.cc
+++ b/pc/jsep_transport_controller_unittest.cc
@@ -56,7 +56,7 @@ static const char kDataMid1[] = "data1";
namespace webrtc {
-class FakeIceTransportFactory : public webrtc::IceTransportFactory {
+class FakeIceTransportFactory : public IceTransportFactory {
public:
~FakeIceTransportFactory() override = default;
rtc::scoped_refptr<IceTransportInterface> CreateIceTransport(
@@ -72,7 +72,7 @@ class FakeDtlsTransportFactory : public cricket::DtlsTransportFactory {
public:
std::unique_ptr<cricket::DtlsTransportInternal> CreateDtlsTransport(
cricket::IceTransportInternal* ice,
- const webrtc::CryptoOptions& crypto_options,
+ const CryptoOptions& crypto_options,
rtc::SSLProtocolVersion max_version) override {
return std::make_unique<FakeDtlsTransport>(
static_cast<cricket::FakeIceTransport*>(ice));
@@ -379,7 +379,7 @@ class JsepTransportControllerTest : public JsepTransportController::Observer,
// Transport controller needs to be destroyed first, because it may issue
// callbacks that modify the changed_*_by_mid in the destructor.
std::unique_ptr<JsepTransportController> transport_controller_;
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
};
TEST_F(JsepTransportControllerTest, GetRtpTransport) {
@@ -425,7 +425,7 @@ TEST_F(JsepTransportControllerTest, GetDtlsTransport) {
// and verify that the resulting container is empty.
auto dtls_transport =
transport_controller_->LookupDtlsTransportByMid(kVideoMid1);
- webrtc::DtlsTransport* my_transport =
+ DtlsTransport* my_transport =
static_cast<DtlsTransport*>(dtls_transport.get());
EXPECT_NE(nullptr, my_transport->internal());
transport_controller_.reset();
@@ -899,7 +899,7 @@ TEST_F(JsepTransportControllerTest,
transport_controller_->GetDtlsTransport(kAudioMid1));
fake_audio_dtls->fake_ice_transport()->MaybeStartGathering();
fake_audio_dtls->fake_ice_transport()->SetTransportState(
- webrtc::IceTransportState::kChecking,
+ IceTransportState::kChecking,
cricket::IceTransportState::STATE_CONNECTING);
EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionChecking,
ice_connection_state_, kTimeout);
diff --git a/pc/legacy_stats_collector.cc b/pc/legacy_stats_collector.cc
index 3bc65ee3ee..98b7cb9677 100644
--- a/pc/legacy_stats_collector.cc
+++ b/pc/legacy_stats_collector.cc
@@ -355,9 +355,8 @@ void ExtractStats(const cricket::VideoReceiverInfo& info,
report->AddInt64(StatsReport::kStatsValueNameInterframeDelayMaxMs,
info.interframe_delay_max_ms);
- report->AddString(
- StatsReport::kStatsValueNameContentType,
- webrtc::videocontenttypehelpers::ToString(info.content_type));
+ report->AddString(StatsReport::kStatsValueNameContentType,
+ videocontenttypehelpers::ToString(info.content_type));
}
void ExtractStats(const cricket::VideoSenderInfo& info,
@@ -398,9 +397,8 @@ void ExtractStats(const cricket::VideoSenderInfo& info,
for (const auto& i : ints)
report->AddInt(i.name, i.value);
report->AddString(StatsReport::kStatsValueNameMediaType, "video");
- report->AddString(
- StatsReport::kStatsValueNameContentType,
- webrtc::videocontenttypehelpers::ToString(info.content_type));
+ report->AddString(StatsReport::kStatsValueNameContentType,
+ videocontenttypehelpers::ToString(info.content_type));
}
void ExtractStats(const cricket::BandwidthEstimationInfo& info,
@@ -1033,7 +1031,7 @@ void LegacyStatsCollector::ExtractBweInfo() {
if (pc_->signaling_state() == PeerConnectionInterface::kClosed)
return;
- webrtc::Call::Stats call_stats = pc_->GetCallStats();
+ Call::Stats call_stats = pc_->GetCallStats();
cricket::BandwidthEstimationInfo bwe_info;
bwe_info.available_send_bandwidth = call_stats.send_bandwidth_bps;
bwe_info.available_recv_bandwidth = call_stats.recv_bandwidth_bps;
diff --git a/pc/legacy_stats_collector.h b/pc/legacy_stats_collector.h
index e905b39d48..1c7aad0636 100644
--- a/pc/legacy_stats_collector.h
+++ b/pc/legacy_stats_collector.h
@@ -177,9 +177,9 @@ class LegacyStatsCollector : public LegacyStatsCollectorInterface {
void ExtractMediaInfo(
const std::map<std::string, std::string>& transport_names_by_mid);
void ExtractSenderInfo();
- webrtc::StatsReport* GetReport(const StatsReport::StatsType& type,
- const std::string& id,
- StatsReport::Direction direction);
+ StatsReport* GetReport(const StatsReport::StatsType& type,
+ const std::string& id,
+ StatsReport::Direction direction);
// Helper method to get stats from the local audio tracks.
void UpdateStatsFromExistingLocalAudioTracks(bool has_remote_tracks);
diff --git a/pc/media_factory.h b/pc/media_factory.h
new file mode 100644
index 0000000000..323744a3e2
--- /dev/null
+++ b/pc/media_factory.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef PC_MEDIA_FACTORY_H_
+#define PC_MEDIA_FACTORY_H_
+
+#include <memory>
+
+#include "api/call/call_factory_interface.h"
+#include "call/call.h"
+#include "call/call_config.h"
+#include "media/base/media_engine.h"
+
+namespace webrtc {
+
+// PeerConnectionFactoryDependencies is forward declared because of circular
+// dependency between MediaFactory and PeerConnectionFactoryDependencies:
+// PeerConnectionFactoryDependencies keeps an instance of MediaFactory and thus
+// needs to know how to destroy it.
+// MediaFactory mentions PeerConnectionFactoryDependencies in api, but does not
+// need its full definition.
+struct PeerConnectionFactoryDependencies;
+
+// Interface repsponsible for constructing media specific classes for
+// PeerConnectionFactory and PeerConnection.
+// TODO(bugs.webrtc.org/15574): Delete CallFactoryInterface inheritance
+// when call_factory is removed from PeerConnectionFactoryDependencies.
+class MediaFactory : public CallFactoryInterface {
+ public:
+ virtual ~MediaFactory() = default;
+
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override = 0;
+ virtual std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
+ PeerConnectionFactoryDependencies& dependencies) = 0;
+};
+
+} // namespace webrtc
+
+#endif // PC_MEDIA_FACTORY_H_
diff --git a/pc/media_session.cc b/pc/media_session.cc
index 4375c50143..0eb2bec4a9 100644
--- a/pc/media_session.cc
+++ b/pc/media_session.cc
@@ -727,12 +727,10 @@ RTCError CreateMediaContentOffer(
bool ReferencedCodecsMatch(const std::vector<Codec>& codecs1,
const int codec1_id,
const std::vector<Codec>& codecs2,
- const int codec2_id,
- const webrtc::FieldTrialsView* field_trials) {
+ const int codec2_id) {
const Codec* codec1 = FindCodecById(codecs1, codec1_id);
const Codec* codec2 = FindCodecById(codecs2, codec2_id);
- return codec1 != nullptr && codec2 != nullptr &&
- codec1->Matches(*codec2, field_trials);
+ return codec1 != nullptr && codec2 != nullptr && codec1->Matches(*codec2);
}
void NegotiatePacketization(const Codec& local_codec,
@@ -747,11 +745,9 @@ void NegotiatePacketization(const Codec& local_codec,
// Finds a codec in `codecs2` that matches `codec_to_match`, which is
// a member of `codecs1`. If `codec_to_match` is an RED or RTX codec, both
// the codecs themselves and their associated codecs must match.
-absl::optional<Codec> FindMatchingCodec(
- const std::vector<Codec>& codecs1,
- const std::vector<Codec>& codecs2,
- const Codec& codec_to_match,
- const webrtc::FieldTrialsView* field_trials) {
+absl::optional<Codec> FindMatchingCodec(const std::vector<Codec>& codecs1,
+ const std::vector<Codec>& codecs2,
+ const Codec& codec_to_match) {
// `codec_to_match` should be a member of `codecs1`, in order to look up
// RED/RTX codecs' associated codecs correctly. If not, that's a programming
// error.
@@ -759,7 +755,7 @@ absl::optional<Codec> FindMatchingCodec(
return &codec == &codec_to_match;
}));
for (const Codec& potential_match : codecs2) {
- if (potential_match.Matches(codec_to_match, field_trials)) {
+ if (potential_match.Matches(codec_to_match)) {
if (IsRtxCodec(codec_to_match)) {
int apt_value_1 = 0;
int apt_value_2 = 0;
@@ -770,8 +766,8 @@ absl::optional<Codec> FindMatchingCodec(
RTC_LOG(LS_WARNING) << "RTX missing associated payload type.";
continue;
}
- if (!ReferencedCodecsMatch(codecs1, apt_value_1, codecs2, apt_value_2,
- field_trials)) {
+ if (!ReferencedCodecsMatch(codecs1, apt_value_1, codecs2,
+ apt_value_2)) {
continue;
}
} else if (IsRedCodec(codec_to_match)) {
@@ -814,7 +810,7 @@ absl::optional<Codec> FindMatchingCodec(
if (rtc::FromString(redundant_payloads_1[0], &red_value_1) &&
rtc::FromString(redundant_payloads_2[0], &red_value_2)) {
if (!ReferencedCodecsMatch(codecs1, red_value_1, codecs2,
- red_value_2, field_trials)) {
+ red_value_2)) {
continue;
}
}
@@ -832,11 +828,10 @@ absl::optional<Codec> FindMatchingCodec(
void NegotiateCodecs(const std::vector<Codec>& local_codecs,
const std::vector<Codec>& offered_codecs,
std::vector<Codec>* negotiated_codecs,
- bool keep_offer_order,
- const webrtc::FieldTrialsView* field_trials) {
+ bool keep_offer_order) {
for (const Codec& ours : local_codecs) {
absl::optional<Codec> theirs =
- FindMatchingCodec(local_codecs, offered_codecs, ours, field_trials);
+ FindMatchingCodec(local_codecs, offered_codecs, ours);
// Note that we intentionally only find one matching codec for each of our
// local codecs, in case the remote offer contains duplicate codecs.
if (theirs) {
@@ -960,15 +955,14 @@ const Codec* GetAssociatedCodecForRed(const std::vector<Codec>& codec_list,
// collide.
void MergeCodecs(const std::vector<Codec>& reference_codecs,
std::vector<Codec>* offered_codecs,
- UsedPayloadTypes* used_pltypes,
- const webrtc::FieldTrialsView* field_trials) {
+ UsedPayloadTypes* used_pltypes) {
// Add all new codecs that are not RTX/RED codecs.
// The two-pass splitting of the loops means preferring payload types
// of actual codecs with respect to collisions.
for (const Codec& reference_codec : reference_codecs) {
if (!IsRtxCodec(reference_codec) && !IsRedCodec(reference_codec) &&
- !FindMatchingCodec(reference_codecs, *offered_codecs, reference_codec,
- field_trials)) {
+ !FindMatchingCodec(reference_codecs, *offered_codecs,
+ reference_codec)) {
Codec codec = reference_codec;
used_pltypes->FindAndSetIdUsed(&codec);
offered_codecs->push_back(codec);
@@ -978,8 +972,8 @@ void MergeCodecs(const std::vector<Codec>& reference_codecs,
// Add all new RTX or RED codecs.
for (const Codec& reference_codec : reference_codecs) {
if (IsRtxCodec(reference_codec) &&
- !FindMatchingCodec(reference_codecs, *offered_codecs, reference_codec,
- field_trials)) {
+ !FindMatchingCodec(reference_codecs, *offered_codecs,
+ reference_codec)) {
Codec rtx_codec = reference_codec;
const Codec* associated_codec =
GetAssociatedCodecForRtx(reference_codecs, rtx_codec);
@@ -989,7 +983,7 @@ void MergeCodecs(const std::vector<Codec>& reference_codecs,
// Find a codec in the offered list that matches the reference codec.
// Its payload type may be different than the reference codec.
absl::optional<Codec> matching_codec = FindMatchingCodec(
- reference_codecs, *offered_codecs, *associated_codec, field_trials);
+ reference_codecs, *offered_codecs, *associated_codec);
if (!matching_codec) {
RTC_LOG(LS_WARNING)
<< "Couldn't find matching " << associated_codec->name << " codec.";
@@ -1002,13 +996,13 @@ void MergeCodecs(const std::vector<Codec>& reference_codecs,
offered_codecs->push_back(rtx_codec);
} else if (IsRedCodec(reference_codec) &&
!FindMatchingCodec(reference_codecs, *offered_codecs,
- reference_codec, field_trials)) {
+ reference_codec)) {
Codec red_codec = reference_codec;
const Codec* associated_codec =
GetAssociatedCodecForRed(reference_codecs, red_codec);
if (associated_codec) {
absl::optional<Codec> matching_codec = FindMatchingCodec(
- reference_codecs, *offered_codecs, *associated_codec, field_trials);
+ reference_codecs, *offered_codecs, *associated_codec);
if (!matching_codec) {
RTC_LOG(LS_WARNING) << "Couldn't find matching "
<< associated_codec->name << " codec.";
@@ -1029,13 +1023,11 @@ void MergeCodecs(const std::vector<Codec>& reference_codecs,
// don't conflict with mappings of the other media type; `supported_codecs` is
// a list filtered for the media section`s direction but with default payload
// types.
-template <typename Codecs>
-Codecs MatchCodecPreference(
+std::vector<Codec> MatchCodecPreference(
const std::vector<webrtc::RtpCodecCapability>& codec_preferences,
- const Codecs& codecs,
- const Codecs& supported_codecs,
- const webrtc::FieldTrialsView* field_trials) {
- Codecs filtered_codecs;
+ const std::vector<Codec>& codecs,
+ const std::vector<Codec>& supported_codecs) {
+ std::vector<Codec> filtered_codecs;
bool want_rtx = false;
bool want_red = false;
@@ -1046,10 +1038,10 @@ Codecs MatchCodecPreference(
want_red = true;
}
}
+ bool red_was_added = false;
for (const auto& codec_preference : codec_preferences) {
auto found_codec = absl::c_find_if(
- supported_codecs,
- [&codec_preference](const typename Codecs::value_type& codec) {
+ supported_codecs, [&codec_preference](const Codec& codec) {
webrtc::RtpCodecParameters codec_parameters =
codec.ToCodecParameters();
return codec_parameters.name == codec_preference.name &&
@@ -1061,11 +1053,16 @@ Codecs MatchCodecPreference(
});
if (found_codec != supported_codecs.end()) {
- absl::optional<typename Codecs::value_type> found_codec_with_correct_pt =
- FindMatchingCodec(supported_codecs, codecs, *found_codec,
- field_trials);
+ absl::optional<Codec> found_codec_with_correct_pt =
+ FindMatchingCodec(supported_codecs, codecs, *found_codec);
if (found_codec_with_correct_pt) {
- filtered_codecs.push_back(*found_codec_with_correct_pt);
+ // RED may already have been added if its primary codec is before RED
+ // in the codec list.
+ bool is_red_codec = IsRedCodec(*found_codec_with_correct_pt);
+ if (!is_red_codec || !red_was_added) {
+ filtered_codecs.push_back(*found_codec_with_correct_pt);
+ red_was_added = is_red_codec ? true : red_was_added;
+ }
std::string id = rtc::ToString(found_codec_with_correct_pt->id);
// Search for the matching rtx or red codec.
if (want_red || want_rtx) {
@@ -1086,11 +1083,11 @@ Codecs MatchCodecPreference(
if (fmtp != codec.params.end()) {
std::vector<absl::string_view> redundant_payloads =
rtc::split(fmtp->second, '/');
- if (redundant_payloads.size() > 0 &&
+ if (!redundant_payloads.empty() &&
redundant_payloads[0] == id) {
- if (std::find(filtered_codecs.begin(), filtered_codecs.end(),
- codec) == filtered_codecs.end()) {
+ if (!red_was_added) {
filtered_codecs.push_back(codec);
+ red_was_added = true;
}
break;
}
@@ -1106,10 +1103,8 @@ Codecs MatchCodecPreference(
}
// Compute the union of `codecs1` and `codecs2`.
-std::vector<Codec> ComputeCodecsUnion(
- const std::vector<Codec>& codecs1,
- const std::vector<Codec>& codecs2,
- const webrtc::FieldTrialsView* field_trials) {
+std::vector<Codec> ComputeCodecsUnion(const std::vector<Codec>& codecs1,
+ const std::vector<Codec>& codecs2) {
std::vector<Codec> all_codecs;
UsedPayloadTypes used_payload_types;
for (const Codec& codec : codecs1) {
@@ -1120,7 +1115,7 @@ std::vector<Codec> ComputeCodecsUnion(
// Use MergeCodecs to merge the second half of our list as it already checks
// and fixes problems with duplicate payload types.
- MergeCodecs(codecs2, &all_codecs, &used_payload_types, field_trials);
+ MergeCodecs(codecs2, &all_codecs, &used_payload_types);
return all_codecs;
}
@@ -1337,19 +1332,19 @@ void StripCNCodecs(AudioCodecs* audio_codecs) {
audio_codecs->end());
}
-template <class C>
-bool SetCodecsInAnswer(const MediaContentDescriptionImpl<C>* offer,
- const std::vector<C>& local_codecs,
+bool SetCodecsInAnswer(const MediaContentDescription* offer,
+ const std::vector<Codec>& local_codecs,
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
UniqueRandomIdGenerator* ssrc_generator,
StreamParamsVec* current_streams,
MediaContentDescription* answer,
const webrtc::FieldTrialsView& field_trials) {
+ RTC_DCHECK(offer->type() == MEDIA_TYPE_AUDIO ||
+ offer->type() == MEDIA_TYPE_VIDEO);
std::vector<Codec> negotiated_codecs;
NegotiateCodecs(local_codecs, offer->codecs(), &negotiated_codecs,
- media_description_options.codec_preferences.empty(),
- &field_trials);
+ media_description_options.codec_preferences.empty());
answer->AddCodecs(negotiated_codecs);
answer->set_protocol(offer->protocol());
if (!AddStreamParams(media_description_options.sender_options,
@@ -1507,6 +1502,233 @@ bool IsDtlsActive(const ContentInfo* content,
.description.secure();
}
+webrtc::RTCErrorOr<AudioCodecs> GetNegotiatedAudioCodecsForOffer(
+ const MediaDescriptionOptions& media_description_options,
+ const MediaSessionOptions& session_options,
+ const ContentInfo* current_content,
+ const AudioCodecs& audio_codecs,
+ const AudioCodecs& supported_audio_codecs) {
+ AudioCodecs filtered_codecs;
+ if (!media_description_options.codec_preferences.empty()) {
+ // Add the codecs from the current transceiver's codec preferences.
+ // They override any existing codecs from previous negotiations.
+ filtered_codecs =
+ MatchCodecPreference(media_description_options.codec_preferences,
+ audio_codecs, supported_audio_codecs);
+ } else {
+ // Add the codecs from current content if it exists and is not rejected nor
+ // recycled.
+ if (current_content && !current_content->rejected &&
+ current_content->name == media_description_options.mid) {
+ if (!IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)) {
+ // Can happen if the remote side re-uses a MID while recycling.
+ LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
+ "Media type for content with mid='" +
+ current_content->name +
+ "' does not match previous type.");
+ }
+ const MediaContentDescription* mcd = current_content->media_description();
+ for (const Codec& codec : mcd->codecs()) {
+ if (FindMatchingCodec(mcd->codecs(), audio_codecs, codec)) {
+ filtered_codecs.push_back(codec);
+ }
+ }
+ }
+ // Add other supported audio codecs.
+ for (const Codec& codec : supported_audio_codecs) {
+ absl::optional<Codec> found_codec =
+ FindMatchingCodec(supported_audio_codecs, audio_codecs, codec);
+ if (found_codec &&
+ !FindMatchingCodec(supported_audio_codecs, filtered_codecs, codec)) {
+ // Use the `found_codec` from `audio_codecs` because it has the
+ // correctly mapped payload type.
+ filtered_codecs.push_back(*found_codec);
+ }
+ }
+ }
+ if (!session_options.vad_enabled) {
+ // If application doesn't want CN codecs in offer.
+ StripCNCodecs(&filtered_codecs);
+ }
+ return filtered_codecs;
+}
+
+webrtc::RTCErrorOr<VideoCodecs> GetNegotiatedVideoCodecsForOffer(
+ const MediaDescriptionOptions& media_description_options,
+ const MediaSessionOptions& session_options,
+ const ContentInfo* current_content,
+ const VideoCodecs& video_codecs,
+ const VideoCodecs& supported_video_codecs) {
+ VideoCodecs filtered_codecs;
+
+ if (!media_description_options.codec_preferences.empty()) {
+ // Add the codecs from the current transceiver's codec preferences.
+ // They override any existing codecs from previous negotiations.
+ filtered_codecs =
+ MatchCodecPreference(media_description_options.codec_preferences,
+ video_codecs, supported_video_codecs);
+ } else {
+ // Add the codecs from current content if it exists and is not rejected nor
+ // recycled.
+ if (current_content && !current_content->rejected &&
+ current_content->name == media_description_options.mid) {
+ if (!IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)) {
+ // Can happen if the remote side re-uses a MID while recycling.
+ LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
+ "Media type for content with mid='" +
+ current_content->name +
+ "' does not match previous type.");
+ }
+ const MediaContentDescription* mcd = current_content->media_description();
+ for (const Codec& codec : mcd->codecs()) {
+ if (FindMatchingCodec(mcd->codecs(), video_codecs, codec)) {
+ filtered_codecs.push_back(codec);
+ }
+ }
+ }
+ // Add other supported video codecs.
+ for (const Codec& codec : supported_video_codecs) {
+ absl::optional<Codec> found_codec =
+ FindMatchingCodec(supported_video_codecs, video_codecs, codec);
+ if (found_codec &&
+ !FindMatchingCodec(supported_video_codecs, filtered_codecs, codec)) {
+ // Use the `found_codec` from `video_codecs` because it has the
+ // correctly mapped payload type.
+ if (IsRtxCodec(codec)) {
+ // For RTX we might need to adjust the apt parameter if we got a
+ // remote offer without RTX for a codec for which we support RTX.
+ auto referenced_codec =
+ GetAssociatedCodecForRtx(supported_video_codecs, codec);
+ RTC_DCHECK(referenced_codec);
+
+ // Find the codec we should be referencing and point to it.
+ absl::optional<Codec> changed_referenced_codec = FindMatchingCodec(
+ supported_video_codecs, filtered_codecs, *referenced_codec);
+ if (changed_referenced_codec) {
+ found_codec->SetParam(kCodecParamAssociatedPayloadType,
+ changed_referenced_codec->id);
+ }
+ }
+ filtered_codecs.push_back(*found_codec);
+ }
+ }
+ }
+
+ if (session_options.raw_packetization_for_video) {
+ for (Codec& codec : filtered_codecs) {
+ if (codec.IsMediaCodec()) {
+ codec.packetization = kPacketizationParamRaw;
+ }
+ }
+ }
+
+ return filtered_codecs;
+}
+
+webrtc::RTCErrorOr<AudioCodecs> GetNegotiatedAudioCodecsForAnswer(
+ const MediaDescriptionOptions& media_description_options,
+ const MediaSessionOptions& session_options,
+ const ContentInfo* current_content,
+ const AudioCodecs& audio_codecs,
+ const AudioCodecs& supported_audio_codecs) {
+ AudioCodecs filtered_codecs;
+
+ if (!media_description_options.codec_preferences.empty()) {
+ filtered_codecs =
+ MatchCodecPreference(media_description_options.codec_preferences,
+ audio_codecs, supported_audio_codecs);
+ } else {
+ // Add the codecs from current content if it exists and is not rejected nor
+ // recycled.
+ if (current_content && !current_content->rejected &&
+ current_content->name == media_description_options.mid) {
+ if (!IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)) {
+ // Can happen if the remote side re-uses a MID while recycling.
+ LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
+ "Media type for content with mid='" +
+ current_content->name +
+ "' does not match previous type.");
+ }
+ const MediaContentDescription* mcd = current_content->media_description();
+ for (const Codec& codec : mcd->codecs()) {
+ if (FindMatchingCodec(mcd->codecs(), audio_codecs, codec)) {
+ filtered_codecs.push_back(codec);
+ }
+ }
+ }
+ // Add other supported audio codecs.
+ for (const Codec& codec : supported_audio_codecs) {
+ if (FindMatchingCodec(supported_audio_codecs, audio_codecs, codec) &&
+ !FindMatchingCodec(supported_audio_codecs, filtered_codecs, codec)) {
+ // We should use the local codec with local parameters and the codec id
+ // would be correctly mapped in `NegotiateCodecs`.
+ filtered_codecs.push_back(codec);
+ }
+ }
+ }
+ if (!session_options.vad_enabled) {
+ // If application doesn't want CN codecs in answer.
+ StripCNCodecs(&filtered_codecs);
+ }
+ return filtered_codecs;
+}
+
+webrtc::RTCErrorOr<VideoCodecs> GetNegotiatedVideoCodecsForAnswer(
+ const MediaDescriptionOptions& media_description_options,
+ const MediaSessionOptions& session_options,
+ const ContentInfo* current_content,
+ const VideoCodecs& video_codecs,
+ const VideoCodecs& supported_video_codecs) {
+ VideoCodecs filtered_codecs;
+
+ if (!media_description_options.codec_preferences.empty()) {
+ filtered_codecs =
+ MatchCodecPreference(media_description_options.codec_preferences,
+ video_codecs, supported_video_codecs);
+ } else {
+ // Add the codecs from current content if it exists and is not rejected nor
+ // recycled.
+ if (current_content && !current_content->rejected &&
+ current_content->name == media_description_options.mid) {
+ if (!IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)) {
+ // Can happen if the remote side re-uses a MID while recycling.
+ LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
+ "Media type for content with mid='" +
+ current_content->name +
+ "' does not match previous type.");
+ }
+ const MediaContentDescription* mcd = current_content->media_description();
+ for (const Codec& codec : mcd->codecs()) {
+ if (FindMatchingCodec(mcd->codecs(), video_codecs, codec)) {
+ filtered_codecs.push_back(codec);
+ }
+ }
+ }
+
+ // Add other supported video codecs.
+ VideoCodecs other_video_codecs;
+ for (const Codec& codec : supported_video_codecs) {
+ if (FindMatchingCodec(supported_video_codecs, video_codecs, codec) &&
+ !FindMatchingCodec(supported_video_codecs, filtered_codecs, codec)) {
+ // We should use the local codec with local parameters and the codec id
+ // would be correctly mapped in `NegotiateCodecs`.
+ other_video_codecs.push_back(codec);
+ }
+ }
+
+ // Use ComputeCodecsUnion to avoid having duplicate payload IDs
+ filtered_codecs = ComputeCodecsUnion(filtered_codecs, other_video_codecs);
+ }
+ if (session_options.raw_packetization_for_video) {
+ for (Codec& codec : filtered_codecs) {
+ if (codec.IsMediaCodec()) {
+ codec.packetization = kPacketizationParamRaw;
+ }
+ }
+ }
+ return filtered_codecs;
+}
+
} // namespace
void MediaDescriptionOptions::AddAudioSender(
@@ -1674,22 +1896,20 @@ MediaSessionDescriptionFactory::CreateOfferOrError(
msection_index < current_description->contents().size()) {
current_content = &current_description->contents()[msection_index];
// Media type must match unless this media section is being recycled.
- RTC_DCHECK(current_content->name != media_description_options.mid ||
- IsMediaContentOfType(current_content,
- media_description_options.type));
}
RTCError error;
switch (media_description_options.type) {
case MEDIA_TYPE_AUDIO:
- error = AddAudioContentForOffer(
- media_description_options, session_options, current_content,
- current_description, extensions_with_ids.audio, offer_audio_codecs,
- &current_streams, offer.get(), &ice_credentials);
- break;
case MEDIA_TYPE_VIDEO:
- error = AddVideoContentForOffer(
+ error = AddRtpContentForOffer(
media_description_options, session_options, current_content,
- current_description, extensions_with_ids.video, offer_video_codecs,
+ current_description,
+ media_description_options.type == MEDIA_TYPE_AUDIO
+ ? extensions_with_ids.audio
+ : extensions_with_ids.video,
+ media_description_options.type == MEDIA_TYPE_AUDIO
+ ? offer_audio_codecs
+ : offer_video_codecs,
&current_streams, offer.get(), &ice_credentials);
break;
case MEDIA_TYPE_DATA:
@@ -1850,18 +2070,15 @@ MediaSessionDescriptionFactory::CreateAnswerOrError(
RTCError error;
switch (media_description_options.type) {
case MEDIA_TYPE_AUDIO:
- error = AddAudioContentForAnswer(
- media_description_options, session_options, offer_content, offer,
- current_content, current_description, bundle_transport,
- answer_audio_codecs, header_extensions, &current_streams,
- answer.get(), &ice_credentials);
- break;
case MEDIA_TYPE_VIDEO:
- error = AddVideoContentForAnswer(
+ error = AddRtpContentForAnswer(
media_description_options, session_options, offer_content, offer,
current_content, current_description, bundle_transport,
- answer_video_codecs, header_extensions, &current_streams,
- answer.get(), &ice_credentials);
+ media_description_options.type == MEDIA_TYPE_AUDIO
+ ? answer_audio_codecs
+ : answer_video_codecs,
+ header_extensions, &current_streams, answer.get(),
+ &ice_credentials);
break;
case MEDIA_TYPE_DATA:
error = AddDataContentForAnswer(
@@ -2033,17 +2250,14 @@ void MergeCodecsFromDescription(
const std::vector<const ContentInfo*>& current_active_contents,
AudioCodecs* audio_codecs,
VideoCodecs* video_codecs,
- UsedPayloadTypes* used_pltypes,
- const webrtc::FieldTrialsView* field_trials) {
+ UsedPayloadTypes* used_pltypes) {
for (const ContentInfo* content : current_active_contents) {
if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) {
- const AudioContentDescription* audio =
- content->media_description()->as_audio();
- MergeCodecs(audio->codecs(), audio_codecs, used_pltypes, field_trials);
+ MergeCodecs(content->media_description()->codecs(), audio_codecs,
+ used_pltypes);
} else if (IsMediaContentOfType(content, MEDIA_TYPE_VIDEO)) {
- const VideoContentDescription* video =
- content->media_description()->as_video();
- MergeCodecs(video->codecs(), video_codecs, used_pltypes, field_trials);
+ MergeCodecs(content->media_description()->codecs(), video_codecs,
+ used_pltypes);
}
}
}
@@ -2058,18 +2272,16 @@ void MediaSessionDescriptionFactory::GetCodecsForOffer(
const std::vector<const ContentInfo*>& current_active_contents,
AudioCodecs* audio_codecs,
VideoCodecs* video_codecs) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
// First - get all codecs from the current description if the media type
// is used. Add them to `used_pltypes` so the payload type is not reused if a
// new media type is added.
UsedPayloadTypes used_pltypes;
MergeCodecsFromDescription(current_active_contents, audio_codecs,
- video_codecs, &used_pltypes, field_trials);
+ video_codecs, &used_pltypes);
// Add our codecs that are not in the current description.
- MergeCodecs(all_audio_codecs_, audio_codecs, &used_pltypes, field_trials);
- MergeCodecs(all_video_codecs_, video_codecs, &used_pltypes, field_trials);
+ MergeCodecs(all_audio_codecs_, audio_codecs, &used_pltypes);
+ MergeCodecs(all_video_codecs_, video_codecs, &used_pltypes);
}
// Getting codecs for an answer involves these steps:
@@ -2084,38 +2296,34 @@ void MediaSessionDescriptionFactory::GetCodecsForAnswer(
const SessionDescription& remote_offer,
AudioCodecs* audio_codecs,
VideoCodecs* video_codecs) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
// First - get all codecs from the current description if the media type
// is used. Add them to `used_pltypes` so the payload type is not reused if a
// new media type is added.
UsedPayloadTypes used_pltypes;
MergeCodecsFromDescription(current_active_contents, audio_codecs,
- video_codecs, &used_pltypes, field_trials);
+ video_codecs, &used_pltypes);
// Second - filter out codecs that we don't support at all and should ignore.
AudioCodecs filtered_offered_audio_codecs;
VideoCodecs filtered_offered_video_codecs;
for (const ContentInfo& content : remote_offer.contents()) {
if (IsMediaContentOfType(&content, MEDIA_TYPE_AUDIO)) {
- const AudioContentDescription* audio =
- content.media_description()->as_audio();
- for (const AudioCodec& offered_audio_codec : audio->codecs()) {
- if (!FindMatchingCodec(audio->codecs(), filtered_offered_audio_codecs,
- offered_audio_codec, field_trials) &&
- FindMatchingCodec(audio->codecs(), all_audio_codecs_,
- offered_audio_codec, field_trials)) {
+ std::vector<Codec> offered_codecs = content.media_description()->codecs();
+ for (const Codec& offered_audio_codec : offered_codecs) {
+ if (!FindMatchingCodec(offered_codecs, filtered_offered_audio_codecs,
+ offered_audio_codec) &&
+ FindMatchingCodec(offered_codecs, all_audio_codecs_,
+ offered_audio_codec)) {
filtered_offered_audio_codecs.push_back(offered_audio_codec);
}
}
} else if (IsMediaContentOfType(&content, MEDIA_TYPE_VIDEO)) {
- const VideoContentDescription* video =
- content.media_description()->as_video();
- for (const VideoCodec& offered_video_codec : video->codecs()) {
- if (!FindMatchingCodec(video->codecs(), filtered_offered_video_codecs,
- offered_video_codec, field_trials) &&
- FindMatchingCodec(video->codecs(), all_video_codecs_,
- offered_video_codec, field_trials)) {
+ std::vector<Codec> offered_codecs = content.media_description()->codecs();
+ for (const Codec& offered_video_codec : offered_codecs) {
+ if (!FindMatchingCodec(offered_codecs, filtered_offered_video_codecs,
+ offered_video_codec) &&
+ FindMatchingCodec(offered_codecs, all_video_codecs_,
+ offered_video_codec)) {
filtered_offered_video_codecs.push_back(offered_video_codec);
}
}
@@ -2124,10 +2332,8 @@ void MediaSessionDescriptionFactory::GetCodecsForAnswer(
// Add codecs that are not in the current description but were in
// `remote_offer`.
- MergeCodecs(filtered_offered_audio_codecs, audio_codecs, &used_pltypes,
- field_trials);
- MergeCodecs(filtered_offered_video_codecs, video_codecs, &used_pltypes,
- field_trials);
+ MergeCodecs(filtered_offered_audio_codecs, audio_codecs, &used_pltypes);
+ MergeCodecs(filtered_offered_video_codecs, video_codecs, &used_pltypes);
}
MediaSessionDescriptionFactory::AudioVideoRtpHeaderExtensions
@@ -2156,17 +2362,13 @@ MediaSessionDescriptionFactory::GetOfferedRtpHeaderExtensionsWithIds(
// type is added.
for (const ContentInfo* content : current_active_contents) {
if (IsMediaContentOfType(content, MEDIA_TYPE_AUDIO)) {
- const AudioContentDescription* audio =
- content->media_description()->as_audio();
- MergeRtpHdrExts(audio->rtp_header_extensions(), &offered_extensions.audio,
- &all_regular_extensions, &all_encrypted_extensions,
- &used_ids);
+ MergeRtpHdrExts(content->media_description()->rtp_header_extensions(),
+ &offered_extensions.audio, &all_regular_extensions,
+ &all_encrypted_extensions, &used_ids);
} else if (IsMediaContentOfType(content, MEDIA_TYPE_VIDEO)) {
- const VideoContentDescription* video =
- content->media_description()->as_video();
- MergeRtpHdrExts(video->rtp_header_extensions(), &offered_extensions.video,
- &all_regular_extensions, &all_encrypted_extensions,
- &used_ids);
+ MergeRtpHdrExts(content->media_description()->rtp_header_extensions(),
+ &offered_extensions.video, &all_regular_extensions,
+ &all_encrypted_extensions, &used_ids);
}
}
@@ -2243,230 +2445,91 @@ RTCError MediaSessionDescriptionFactory::AddTransportAnswer(
return RTCError::OK();
}
-// `audio_codecs` = set of all possible codecs that can be used, with correct
+// `codecs` = set of all possible codecs that can be used, with correct
// payload type mappings
//
-// `supported_audio_codecs` = set of codecs that are supported for the direction
+// `supported_codecs` = set of codecs that are supported for the direction
// of this m= section
+// `current_content` = current description, may be null.
+// current_content->codecs() = set of previously negotiated codecs for this m=
+// section
//
-// mcd->codecs() = set of previously negotiated codecs for this m= section
-//
-// The payload types should come from audio_codecs, but the order should come
-// from mcd->codecs() and then supported_codecs, to ensure that re-offers don't
-// change existing codec priority, and that new codecs are added with the right
-// priority.
-RTCError MediaSessionDescriptionFactory::AddAudioContentForOffer(
+// The payload types should come from codecs, but the order should come
+// from current_content->codecs() and then supported_codecs, to ensure that
+// re-offers don't change existing codec priority, and that new codecs are added
+// with the right priority.
+RTCError MediaSessionDescriptionFactory::AddRtpContentForOffer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const ContentInfo* current_content,
const SessionDescription* current_description,
- const RtpHeaderExtensions& audio_rtp_extensions,
- const AudioCodecs& audio_codecs,
+ const RtpHeaderExtensions& header_extensions,
+ const std::vector<Codec>& codecs,
StreamParamsVec* current_streams,
- SessionDescription* desc,
+ SessionDescription* session_description,
IceCredentialsIterator* ice_credentials) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
- // Filter audio_codecs (which includes all codecs, with correctly remapped
- // payload types) based on transceiver direction.
- const AudioCodecs& supported_audio_codecs =
- GetAudioCodecsForOffer(media_description_options.direction);
-
- AudioCodecs filtered_codecs;
-
- if (!media_description_options.codec_preferences.empty()) {
- // Add the codecs from the current transceiver's codec preferences.
- // They override any existing codecs from previous negotiations.
- filtered_codecs = MatchCodecPreference(
- media_description_options.codec_preferences, audio_codecs,
- supported_audio_codecs, field_trials);
+ RTC_DCHECK(media_description_options.type == MEDIA_TYPE_AUDIO ||
+ media_description_options.type == MEDIA_TYPE_VIDEO);
+ webrtc::RTCErrorOr<std::vector<Codec>> error_or_filtered_codecs;
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ const AudioCodecs& supported_codecs =
+ GetAudioCodecsForOffer(media_description_options.direction);
+ error_or_filtered_codecs = GetNegotiatedAudioCodecsForOffer(
+ media_description_options, session_options, current_content, codecs,
+ supported_codecs);
} else {
- // Add the codecs from current content if it exists and is not rejected nor
- // recycled.
- if (current_content && !current_content->rejected &&
- current_content->name == media_description_options.mid) {
- if (!IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)) {
- // TODO(bugs.webrtc.org/15471): add a unit test for this since
- // it is not clear how this can happen for offers.
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Media type for content with mid='" +
- current_content->name +
- "' does not match previous type.");
- }
- const MediaContentDescription* mcd = current_content->media_description();
- for (const Codec& codec : mcd->codecs()) {
- if (FindMatchingCodec(mcd->codecs(), audio_codecs, codec,
- field_trials)) {
- filtered_codecs.push_back(codec);
- }
- }
- }
- // Add other supported audio codecs.
- for (const Codec& codec : supported_audio_codecs) {
- absl::optional<Codec> found_codec = FindMatchingCodec(
- supported_audio_codecs, audio_codecs, codec, field_trials);
- if (found_codec &&
- !FindMatchingCodec(supported_audio_codecs, filtered_codecs, codec,
- field_trials)) {
- // Use the `found_codec` from `audio_codecs` because it has the
- // correctly mapped payload type.
- filtered_codecs.push_back(*found_codec);
- }
- }
+ const VideoCodecs& supported_codecs =
+ GetVideoCodecsForOffer(media_description_options.direction);
+ error_or_filtered_codecs = GetNegotiatedVideoCodecsForOffer(
+ media_description_options, session_options, current_content, codecs,
+ supported_codecs);
}
- if (!session_options.vad_enabled) {
- // If application doesn't want CN codecs in offer.
- StripCNCodecs(&filtered_codecs);
+ if (!error_or_filtered_codecs.ok()) {
+ return error_or_filtered_codecs.MoveError();
}
cricket::SecurePolicy sdes_policy =
IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED
: secure();
- auto audio = std::make_unique<AudioContentDescription>();
std::vector<std::string> crypto_suites;
- GetSupportedAudioSdesCryptoSuiteNames(session_options.crypto_options,
- &crypto_suites);
- auto error = CreateMediaContentOffer(
- media_description_options, session_options, filtered_codecs, sdes_policy,
- GetCryptos(current_content), crypto_suites, audio_rtp_extensions,
- ssrc_generator(), current_streams, audio.get(),
- transport_desc_factory_->trials());
- if (!error.ok()) {
- return error;
- }
-
- bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
- SetMediaProtocol(secure_transport, audio.get());
-
- audio->set_direction(media_description_options.direction);
-
- desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp,
- media_description_options.stopped, std::move(audio));
- error = AddTransportOffer(media_description_options.mid,
- media_description_options.transport_options,
- current_description, desc, ice_credentials);
- if (!error.ok()) {
- return error;
- }
-
- return RTCError::OK();
-}
-
-// TODO(kron): This function is very similar to AddAudioContentForOffer.
-// Refactor to reuse shared code.
-RTCError MediaSessionDescriptionFactory::AddVideoContentForOffer(
- const MediaDescriptionOptions& media_description_options,
- const MediaSessionOptions& session_options,
- const ContentInfo* current_content,
- const SessionDescription* current_description,
- const RtpHeaderExtensions& video_rtp_extensions,
- const VideoCodecs& video_codecs,
- StreamParamsVec* current_streams,
- SessionDescription* desc,
- IceCredentialsIterator* ice_credentials) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
- // Filter video_codecs (which includes all codecs, with correctly remapped
- // payload types) based on transceiver direction.
- const VideoCodecs& supported_video_codecs =
- GetVideoCodecsForOffer(media_description_options.direction);
-
- VideoCodecs filtered_codecs;
-
- if (!media_description_options.codec_preferences.empty()) {
- // Add the codecs from the current transceiver's codec preferences.
- // They override any existing codecs from previous negotiations.
- filtered_codecs = MatchCodecPreference(
- media_description_options.codec_preferences, video_codecs,
- supported_video_codecs, field_trials);
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ GetSupportedAudioSdesCryptoSuiteNames(session_options.crypto_options,
+ &crypto_suites);
} else {
- // Add the codecs from current content if it exists and is not rejected nor
- // recycled.
- if (current_content && !current_content->rejected &&
- current_content->name == media_description_options.mid) {
- if (!IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)) {
- // TODO(bugs.webrtc.org/15471): add a unit test for this since
- // it is not clear how this can happen for offers.
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Media type for content with mid='" +
- current_content->name +
- "' does not match previous type.");
- }
- const MediaContentDescription* mcd = current_content->media_description();
- for (const Codec& codec : mcd->codecs()) {
- if (FindMatchingCodec(mcd->codecs(), video_codecs, codec,
- field_trials)) {
- filtered_codecs.push_back(codec);
- }
- }
- }
- // Add other supported video codecs.
- for (const Codec& codec : supported_video_codecs) {
- absl::optional<Codec> found_codec = FindMatchingCodec(
- supported_video_codecs, video_codecs, codec, field_trials);
- if (found_codec &&
- !FindMatchingCodec(supported_video_codecs, filtered_codecs, codec,
- field_trials)) {
- // Use the `found_codec` from `video_codecs` because it has the
- // correctly mapped payload type.
- if (IsRtxCodec(codec)) {
- // For RTX we might need to adjust the apt parameter if we got a
- // remote offer without RTX for a codec for which we support RTX.
- auto referenced_codec =
- GetAssociatedCodecForRtx(supported_video_codecs, codec);
- RTC_DCHECK(referenced_codec);
-
- // Find the codec we should be referencing and point to it.
- absl::optional<Codec> changed_referenced_codec =
- FindMatchingCodec(supported_video_codecs, filtered_codecs,
- *referenced_codec, field_trials);
- if (changed_referenced_codec) {
- found_codec->SetParam(kCodecParamAssociatedPayloadType,
- changed_referenced_codec->id);
- }
- }
- filtered_codecs.push_back(*found_codec);
- }
- }
+ GetSupportedVideoSdesCryptoSuiteNames(session_options.crypto_options,
+ &crypto_suites);
}
- if (session_options.raw_packetization_for_video) {
- for (Codec& codec : filtered_codecs) {
- if (codec.IsMediaCodec()) {
- codec.packetization = kPacketizationParamRaw;
- }
- }
+ std::unique_ptr<MediaContentDescription> content_description;
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ content_description = std::make_unique<AudioContentDescription>();
+ } else {
+ content_description = std::make_unique<VideoContentDescription>();
}
- cricket::SecurePolicy sdes_policy =
- IsDtlsActive(current_content, current_description) ? cricket::SEC_DISABLED
- : secure();
- auto video = std::make_unique<VideoContentDescription>();
- std::vector<std::string> crypto_suites;
- GetSupportedVideoSdesCryptoSuiteNames(session_options.crypto_options,
- &crypto_suites);
auto error = CreateMediaContentOffer(
- media_description_options, session_options, filtered_codecs, sdes_policy,
- GetCryptos(current_content), crypto_suites, video_rtp_extensions,
- ssrc_generator(), current_streams, video.get(),
+ media_description_options, session_options,
+ error_or_filtered_codecs.MoveValue(), sdes_policy,
+ GetCryptos(current_content), crypto_suites, header_extensions,
+ ssrc_generator(), current_streams, content_description.get(),
transport_desc_factory_->trials());
if (!error.ok()) {
return error;
}
- video->set_bandwidth(kAutoBandwidth);
+ bool secure_transport = transport_desc_factory_->secure() != SEC_DISABLED;
+ SetMediaProtocol(secure_transport, content_description.get());
- bool secure_transport = (transport_desc_factory_->secure() != SEC_DISABLED);
- SetMediaProtocol(secure_transport, video.get());
-
- video->set_direction(media_description_options.direction);
+ content_description->set_direction(media_description_options.direction);
- desc->AddContent(media_description_options.mid, MediaProtocolType::kRtp,
- media_description_options.stopped, std::move(video));
+ session_description->AddContent(
+ media_description_options.mid, MediaProtocolType::kRtp,
+ media_description_options.stopped, std::move(content_description));
return AddTransportOffer(media_description_options.mid,
media_description_options.transport_options,
- current_description, desc, ice_credentials);
+ current_description, session_description,
+ ice_credentials);
}
RTCError MediaSessionDescriptionFactory::AddDataContentForOffer(
@@ -2534,19 +2597,19 @@ RTCError MediaSessionDescriptionFactory::AddUnsupportedContentForOffer(
current_description, desc, ice_credentials);
}
-// `audio_codecs` = set of all possible codecs that can be used, with correct
+// `codecs` = set of all possible codecs that can be used, with correct
// payload type mappings
//
-// `supported_audio_codecs` = set of codecs that are supported for the direction
+// `supported_codecs` = set of codecs that are supported for the direction
// of this m= section
//
// mcd->codecs() = set of previously negotiated codecs for this m= section
//
-// The payload types should come from audio_codecs, but the order should come
+// The payload types should come from codecs, but the order should come
// from mcd->codecs() and then supported_codecs, to ensure that re-offers don't
// change existing codec priority, and that new codecs are added with the right
// priority.
-RTCError MediaSessionDescriptionFactory::AddAudioContentForAnswer(
+RTCError MediaSessionDescriptionFactory::AddRtpContentForAnswer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const ContentInfo* offer_content,
@@ -2554,272 +2617,111 @@ RTCError MediaSessionDescriptionFactory::AddAudioContentForAnswer(
const ContentInfo* current_content,
const SessionDescription* current_description,
const TransportInfo* bundle_transport,
- const AudioCodecs& audio_codecs,
- const RtpHeaderExtensions& rtp_header_extensions,
+ const std::vector<Codec>& codecs,
+ const RtpHeaderExtensions& header_extensions,
StreamParamsVec* current_streams,
SessionDescription* answer,
IceCredentialsIterator* ice_credentials) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
- RTC_CHECK(IsMediaContentOfType(offer_content, MEDIA_TYPE_AUDIO));
- const AudioContentDescription* offer_audio_description =
- offer_content->media_description()->as_audio();
-
- std::unique_ptr<TransportDescription> audio_transport = CreateTransportAnswer(
+ RTC_DCHECK(media_description_options.type == MEDIA_TYPE_AUDIO ||
+ media_description_options.type == MEDIA_TYPE_VIDEO);
+ RTC_CHECK(
+ IsMediaContentOfType(offer_content, media_description_options.type));
+ const RtpMediaContentDescription* offer_content_description;
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ offer_content_description = offer_content->media_description()->as_audio();
+ } else {
+ offer_content_description = offer_content->media_description()->as_video();
+ }
+ std::unique_ptr<TransportDescription> transport = CreateTransportAnswer(
media_description_options.mid, offer_description,
media_description_options.transport_options, current_description,
bundle_transport != nullptr, ice_credentials);
- if (!audio_transport) {
+ if (!transport) {
LOG_AND_RETURN_ERROR(
RTCErrorType::INTERNAL_ERROR,
- "Failed to create transport answer, audio transport is missing");
+ "Failed to create transport answer, transport is missing");
}
// Pick codecs based on the requested communications direction in the offer
// and the selected direction in the answer.
// Note these will be filtered one final time in CreateMediaContentAnswer.
auto wants_rtd = media_description_options.direction;
- auto offer_rtd = offer_audio_description->direction();
+ auto offer_rtd = offer_content_description->direction();
auto answer_rtd = NegotiateRtpTransceiverDirection(offer_rtd, wants_rtd);
- AudioCodecs supported_audio_codecs =
- GetAudioCodecsForAnswer(offer_rtd, answer_rtd);
-
- AudioCodecs filtered_codecs;
- if (!media_description_options.codec_preferences.empty()) {
- filtered_codecs = MatchCodecPreference(
- media_description_options.codec_preferences, audio_codecs,
- supported_audio_codecs, field_trials);
+ std::vector<Codec> supported_codecs;
+ webrtc::RTCErrorOr<std::vector<Codec>> error_or_filtered_codecs;
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ supported_codecs = GetAudioCodecsForAnswer(offer_rtd, answer_rtd);
+ error_or_filtered_codecs = GetNegotiatedAudioCodecsForAnswer(
+ media_description_options, session_options, current_content, codecs,
+ supported_codecs);
} else {
- // Add the codecs from current content if it exists and is not rejected nor
- // recycled.
- if (current_content && !current_content->rejected &&
- current_content->name == media_description_options.mid) {
- if (!IsMediaContentOfType(current_content, MEDIA_TYPE_AUDIO)) {
- // Can happen if the remote side re-uses a MID while recycling.
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Media type for content with mid='" +
- current_content->name +
- "' does not match previous type.");
- }
- const MediaContentDescription* mcd = current_content->media_description();
- for (const Codec& codec : mcd->codecs()) {
- if (FindMatchingCodec(mcd->codecs(), audio_codecs, codec,
- field_trials)) {
- filtered_codecs.push_back(codec);
- }
- }
- }
- // Add other supported audio codecs.
- for (const Codec& codec : supported_audio_codecs) {
- if (FindMatchingCodec(supported_audio_codecs, audio_codecs, codec,
- field_trials) &&
- !FindMatchingCodec(supported_audio_codecs, filtered_codecs, codec,
- field_trials)) {
- // We should use the local codec with local parameters and the codec id
- // would be correctly mapped in `NegotiateCodecs`.
- filtered_codecs.push_back(codec);
- }
- }
+ supported_codecs = GetVideoCodecsForAnswer(offer_rtd, answer_rtd);
+ error_or_filtered_codecs = GetNegotiatedVideoCodecsForAnswer(
+ media_description_options, session_options, current_content, codecs,
+ supported_codecs);
}
- if (!session_options.vad_enabled) {
- // If application doesn't want CN codecs in answer.
- StripCNCodecs(&filtered_codecs);
+ if (!error_or_filtered_codecs.ok()) {
+ return error_or_filtered_codecs.MoveError();
}
+ auto filtered_codecs = error_or_filtered_codecs.MoveValue();
// Determine if we have media codecs in common.
bool has_common_media_codecs =
std::find_if(filtered_codecs.begin(), filtered_codecs.end(),
- [](const AudioCodec& c) {
- return !(IsRedCodec(c) || IsComfortNoiseCodec(c));
+ [](const Codec& c) {
+ return !(IsRedCodec(c) || IsComfortNoiseCodec(c) ||
+ IsUlpfecCodec(c) || IsFlexfecCodec(c));
}) != filtered_codecs.end();
bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) &&
session_options.bundle_enabled;
- auto audio_answer = std::make_unique<AudioContentDescription>();
+ std::unique_ptr<MediaContentDescription> answer_content;
+ if (media_description_options.type == MEDIA_TYPE_AUDIO) {
+ answer_content = std::make_unique<AudioContentDescription>();
+ } else {
+ answer_content = std::make_unique<VideoContentDescription>();
+ }
// Do not require or create SDES cryptos if DTLS is used.
cricket::SecurePolicy sdes_policy =
- audio_transport->secure() ? cricket::SEC_DISABLED : secure();
- if (!SetCodecsInAnswer(offer_audio_description, filtered_codecs,
- media_description_options, session_options,
- ssrc_generator(), current_streams, audio_answer.get(),
- transport_desc_factory_->trials())) {
+ transport->secure() ? cricket::SEC_DISABLED : secure();
+ if (!SetCodecsInAnswer(
+ offer_content_description, filtered_codecs, media_description_options,
+ session_options, ssrc_generator(), current_streams,
+ answer_content.get(), transport_desc_factory_->trials())) {
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to set codecs in answer");
}
if (!CreateMediaContentAnswer(
- offer_audio_description, media_description_options, session_options,
+ offer_content_description, media_description_options, session_options,
sdes_policy, GetCryptos(current_content),
- filtered_rtp_header_extensions(rtp_header_extensions),
- ssrc_generator(), enable_encrypted_rtp_header_extensions_,
- current_streams, bundle_enabled, audio_answer.get())) {
+ filtered_rtp_header_extensions(header_extensions), ssrc_generator(),
+ enable_encrypted_rtp_header_extensions_, current_streams,
+ bundle_enabled, answer_content.get())) {
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to create answer");
}
bool secure = bundle_transport ? bundle_transport->description.secure()
- : audio_transport->secure();
+ : transport->secure();
bool rejected = media_description_options.stopped ||
offer_content->rejected || !has_common_media_codecs ||
!IsMediaProtocolSupported(MEDIA_TYPE_AUDIO,
- audio_answer->protocol(), secure);
- auto error = AddTransportAnswer(media_description_options.mid,
- *(audio_transport.get()), answer);
- if (!error.ok()) {
- return error;
- }
-
+ answer_content->protocol(), secure);
if (rejected) {
- RTC_LOG(LS_INFO) << "Audio m= section '" << media_description_options.mid
+ RTC_LOG(LS_INFO) << "m= section '" << media_description_options.mid
<< "' being rejected in answer.";
}
- answer->AddContent(media_description_options.mid, offer_content->type,
- rejected, std::move(audio_answer));
- return RTCError::OK();
-}
-
-// TODO(kron): This function is very similar to AddAudioContentForAnswer.
-// Refactor to reuse shared code.
-RTCError MediaSessionDescriptionFactory::AddVideoContentForAnswer(
- const MediaDescriptionOptions& media_description_options,
- const MediaSessionOptions& session_options,
- const ContentInfo* offer_content,
- const SessionDescription* offer_description,
- const ContentInfo* current_content,
- const SessionDescription* current_description,
- const TransportInfo* bundle_transport,
- const VideoCodecs& video_codecs,
- const RtpHeaderExtensions& default_video_rtp_header_extensions,
- StreamParamsVec* current_streams,
- SessionDescription* answer,
- IceCredentialsIterator* ice_credentials) const {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
- RTC_CHECK(IsMediaContentOfType(offer_content, MEDIA_TYPE_VIDEO));
- const VideoContentDescription* offer_video_description =
- offer_content->media_description()->as_video();
-
- std::unique_ptr<TransportDescription> video_transport = CreateTransportAnswer(
- media_description_options.mid, offer_description,
- media_description_options.transport_options, current_description,
- bundle_transport != nullptr, ice_credentials);
- if (!video_transport) {
- LOG_AND_RETURN_ERROR(
- RTCErrorType::INTERNAL_ERROR,
- "Failed to create transport answer, video transport is missing");
- }
-
- // Pick codecs based on the requested communications direction in the offer
- // and the selected direction in the answer.
- // Note these will be filtered one final time in CreateMediaContentAnswer.
- auto wants_rtd = media_description_options.direction;
- auto offer_rtd = offer_video_description->direction();
- auto answer_rtd = NegotiateRtpTransceiverDirection(offer_rtd, wants_rtd);
- VideoCodecs supported_video_codecs =
- GetVideoCodecsForAnswer(offer_rtd, answer_rtd);
-
- VideoCodecs filtered_codecs;
-
- if (!media_description_options.codec_preferences.empty()) {
- filtered_codecs = MatchCodecPreference(
- media_description_options.codec_preferences, video_codecs,
- supported_video_codecs, field_trials);
- } else {
- // Add the codecs from current content if it exists and is not rejected nor
- // recycled.
- if (current_content && !current_content->rejected &&
- current_content->name == media_description_options.mid) {
- if (!IsMediaContentOfType(current_content, MEDIA_TYPE_VIDEO)) {
- // Can happen if the remote side re-uses a MID while recycling.
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Media type for content with mid='" +
- current_content->name +
- "' does not match previous type.");
- }
- const MediaContentDescription* mcd = current_content->media_description();
- for (const Codec& codec : mcd->codecs()) {
- if (FindMatchingCodec(mcd->codecs(), video_codecs, codec,
- field_trials)) {
- filtered_codecs.push_back(codec);
- }
- }
- }
-
- // Add other supported video codecs.
- VideoCodecs other_video_codecs;
- for (const Codec& codec : supported_video_codecs) {
- if (FindMatchingCodec(supported_video_codecs, video_codecs, codec,
- field_trials) &&
- !FindMatchingCodec(supported_video_codecs, filtered_codecs, codec,
- field_trials)) {
- // We should use the local codec with local parameters and the codec id
- // would be correctly mapped in `NegotiateCodecs`.
- other_video_codecs.push_back(codec);
- }
- }
-
- // Use ComputeCodecsUnion to avoid having duplicate payload IDs
- filtered_codecs =
- ComputeCodecsUnion(filtered_codecs, other_video_codecs, field_trials);
- }
- // Determine if we have media codecs in common.
- bool has_common_media_codecs =
- std::find_if(
- filtered_codecs.begin(), filtered_codecs.end(), [](const Codec& c) {
- return !(IsRedCodec(c) || IsUlpfecCodec(c) || IsFlexfecCodec(c));
- }) != filtered_codecs.end();
-
- if (session_options.raw_packetization_for_video) {
- for (Codec& codec : filtered_codecs) {
- if (codec.IsMediaCodec()) {
- codec.packetization = kPacketizationParamRaw;
- }
- }
- }
-
- bool bundle_enabled = offer_description->HasGroup(GROUP_TYPE_BUNDLE) &&
- session_options.bundle_enabled;
- auto video_answer = std::make_unique<VideoContentDescription>();
- // Do not require or create SDES cryptos if DTLS is used.
- cricket::SecurePolicy sdes_policy =
- video_transport->secure() ? cricket::SEC_DISABLED : secure();
- if (!SetCodecsInAnswer(offer_video_description, filtered_codecs,
- media_description_options, session_options,
- ssrc_generator(), current_streams, video_answer.get(),
- transport_desc_factory_->trials())) {
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Failed to set codecs in answer");
- }
- if (!CreateMediaContentAnswer(
- offer_video_description, media_description_options, session_options,
- sdes_policy, GetCryptos(current_content),
- filtered_rtp_header_extensions(default_video_rtp_header_extensions),
- ssrc_generator(), enable_encrypted_rtp_header_extensions_,
- current_streams, bundle_enabled, video_answer.get())) {
- LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
- "Failed to create answer");
- }
- bool secure = bundle_transport ? bundle_transport->description.secure()
- : video_transport->secure();
- bool rejected = media_description_options.stopped ||
- offer_content->rejected || !has_common_media_codecs ||
- !IsMediaProtocolSupported(MEDIA_TYPE_VIDEO,
- video_answer->protocol(), secure);
auto error = AddTransportAnswer(media_description_options.mid,
- *(video_transport.get()), answer);
+ *(transport.get()), answer);
if (!error.ok()) {
return error;
}
- if (!rejected) {
- video_answer->set_bandwidth(kAutoBandwidth);
- } else {
- RTC_LOG(LS_INFO) << "Video m= section '" << media_description_options.mid
- << "' being rejected in answer.";
- }
answer->AddContent(media_description_options.mid, offer_content->type,
- rejected, std::move(video_answer));
+ rejected, std::move(answer_content));
return RTCError::OK();
}
@@ -2942,23 +2844,19 @@ RTCError MediaSessionDescriptionFactory::AddUnsupportedContentForAnswer(
}
void MediaSessionDescriptionFactory::ComputeAudioCodecsIntersectionAndUnion() {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
audio_sendrecv_codecs_.clear();
all_audio_codecs_.clear();
// Compute the audio codecs union.
for (const Codec& send : audio_send_codecs_) {
all_audio_codecs_.push_back(send);
- if (!FindMatchingCodec(audio_send_codecs_, audio_recv_codecs_, send,
- field_trials)) {
+ if (!FindMatchingCodec(audio_send_codecs_, audio_recv_codecs_, send)) {
// It doesn't make sense to have an RTX codec we support sending but not
// receiving.
RTC_DCHECK(!IsRtxCodec(send));
}
}
for (const Codec& recv : audio_recv_codecs_) {
- if (!FindMatchingCodec(audio_recv_codecs_, audio_send_codecs_, recv,
- field_trials)) {
+ if (!FindMatchingCodec(audio_recv_codecs_, audio_send_codecs_, recv)) {
all_audio_codecs_.push_back(recv);
}
}
@@ -2968,17 +2866,15 @@ void MediaSessionDescriptionFactory::ComputeAudioCodecsIntersectionAndUnion() {
// expensive than decoding, and prioritizing a codec in the send list probably
// means it's a codec we can handle efficiently.
NegotiateCodecs(audio_recv_codecs_, audio_send_codecs_,
- &audio_sendrecv_codecs_, true, field_trials);
+ &audio_sendrecv_codecs_, true);
}
void MediaSessionDescriptionFactory::ComputeVideoCodecsIntersectionAndUnion() {
- const webrtc::FieldTrialsView* field_trials =
- &transport_desc_factory_->trials();
video_sendrecv_codecs_.clear();
// Use ComputeCodecsUnion to avoid having duplicate payload IDs
all_video_codecs_ =
- ComputeCodecsUnion(video_recv_codecs_, video_send_codecs_, field_trials);
+ ComputeCodecsUnion(video_recv_codecs_, video_send_codecs_);
// Use NegotiateCodecs to merge our codec lists, since the operation is
// essentially the same. Put send_codecs as the offered_codecs, which is the
@@ -2986,7 +2882,7 @@ void MediaSessionDescriptionFactory::ComputeVideoCodecsIntersectionAndUnion() {
// expensive than decoding, and prioritizing a codec in the send list probably
// means it's a codec we can handle efficiently.
NegotiateCodecs(video_recv_codecs_, video_send_codecs_,
- &video_sendrecv_codecs_, true, field_trials);
+ &video_sendrecv_codecs_, true);
}
bool IsMediaContent(const ContentInfo* content) {
diff --git a/pc/media_session.h b/pc/media_session.h
index 3100fb6fdb..0b3cb67c35 100644
--- a/pc/media_session.h
+++ b/pc/media_session.h
@@ -19,7 +19,6 @@
#include <vector>
#include "api/crypto/crypto_options.h"
-#include "api/field_trials_view.h"
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "api/rtp_transceiver_direction.h"
@@ -230,28 +229,14 @@ class MediaSessionDescriptionFactory {
const TransportDescription& transport_desc,
SessionDescription* answer_desc) const;
- // Helpers for adding media contents to the SessionDescription. Returns true
- // it succeeds or the media content is not needed, or false if there is any
- // error.
-
- webrtc::RTCError AddAudioContentForOffer(
- const MediaDescriptionOptions& media_description_options,
- const MediaSessionOptions& session_options,
- const ContentInfo* current_content,
- const SessionDescription* current_description,
- const RtpHeaderExtensions& audio_rtp_extensions,
- const AudioCodecs& audio_codecs,
- StreamParamsVec* current_streams,
- SessionDescription* desc,
- IceCredentialsIterator* ice_credentials) const;
-
- webrtc::RTCError AddVideoContentForOffer(
+ // Helpers for adding media contents to the SessionDescription.
+ webrtc::RTCError AddRtpContentForOffer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const ContentInfo* current_content,
const SessionDescription* current_description,
- const RtpHeaderExtensions& video_rtp_extensions,
- const VideoCodecs& video_codecs,
+ const RtpHeaderExtensions& header_extensions,
+ const std::vector<Codec>& codecs,
StreamParamsVec* current_streams,
SessionDescription* desc,
IceCredentialsIterator* ice_credentials) const;
@@ -273,21 +258,7 @@ class MediaSessionDescriptionFactory {
SessionDescription* desc,
IceCredentialsIterator* ice_credentials) const;
- webrtc::RTCError AddAudioContentForAnswer(
- const MediaDescriptionOptions& media_description_options,
- const MediaSessionOptions& session_options,
- const ContentInfo* offer_content,
- const SessionDescription* offer_description,
- const ContentInfo* current_content,
- const SessionDescription* current_description,
- const TransportInfo* bundle_transport,
- const AudioCodecs& audio_codecs,
- const RtpHeaderExtensions& rtp_header_extensions,
- StreamParamsVec* current_streams,
- SessionDescription* answer,
- IceCredentialsIterator* ice_credentials) const;
-
- webrtc::RTCError AddVideoContentForAnswer(
+ webrtc::RTCError AddRtpContentForAnswer(
const MediaDescriptionOptions& media_description_options,
const MediaSessionOptions& session_options,
const ContentInfo* offer_content,
@@ -295,8 +266,8 @@ class MediaSessionDescriptionFactory {
const ContentInfo* current_content,
const SessionDescription* current_description,
const TransportInfo* bundle_transport,
- const VideoCodecs& video_codecs,
- const RtpHeaderExtensions& rtp_header_extensions,
+ const std::vector<Codec>& codecs,
+ const RtpHeaderExtensions& header_extensions,
StreamParamsVec* current_streams,
SessionDescription* answer,
IceCredentialsIterator* ice_credentials) const;
diff --git a/pc/media_session_unittest.cc b/pc/media_session_unittest.cc
index 467d25fe25..e15cc39e30 100644
--- a/pc/media_session_unittest.cc
+++ b/pc/media_session_unittest.cc
@@ -16,6 +16,7 @@
#include <cstdint>
#include <map>
#include <memory>
+#include <set>
#include <string>
#include <tuple>
#include <vector>
@@ -26,6 +27,7 @@
#include "absl/types/optional.h"
#include "api/candidate.h"
#include "api/crypto_params.h"
+#include "api/rtp_parameters.h"
#include "media/base/codec.h"
#include "media/base/media_constants.h"
#include "media/base/test_utils.h"
@@ -35,6 +37,7 @@
#include "p2p/base/transport_info.h"
#include "pc/media_protocol_names.h"
#include "pc/rtp_media_utils.h"
+#include "pc/rtp_parameters_conversion.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
#include "rtc_base/fake_ssl_identity.h"
@@ -52,50 +55,17 @@
ASSERT_EQ(s, cd->cryptos().size()); \
ASSERT_EQ(cs, cd->cryptos()[0].crypto_suite)
-typedef std::vector<cricket::Candidate> Candidates;
-
-using cricket::AudioCodec;
-using cricket::AudioContentDescription;
-using cricket::ContentInfo;
-using cricket::CryptoParamsVec;
-using cricket::GetFirstAudioContent;
-using cricket::GetFirstAudioContentDescription;
-using cricket::GetFirstDataContent;
-using cricket::GetFirstVideoContent;
-using cricket::GetFirstVideoContentDescription;
-using cricket::kAutoBandwidth;
-using cricket::MEDIA_TYPE_AUDIO;
-using cricket::MEDIA_TYPE_DATA;
-using cricket::MEDIA_TYPE_VIDEO;
-using cricket::MediaContentDescription;
-using cricket::MediaDescriptionOptions;
-using cricket::MediaProtocolType;
-using cricket::MediaSessionDescriptionFactory;
-using cricket::MediaSessionOptions;
-using cricket::MediaType;
-using cricket::RidDescription;
-using cricket::RidDirection;
-using cricket::SctpDataContentDescription;
-using cricket::SEC_DISABLED;
-using cricket::SEC_ENABLED;
-using cricket::SEC_REQUIRED;
-using cricket::SessionDescription;
-using cricket::SimulcastDescription;
-using cricket::SimulcastLayer;
-using cricket::SimulcastLayerList;
-using cricket::SsrcGroup;
-using cricket::StreamParams;
-using cricket::StreamParamsVec;
-using cricket::TransportDescription;
-using cricket::TransportDescriptionFactory;
-using cricket::TransportInfo;
-using cricket::VideoCodec;
-using cricket::VideoContentDescription;
-using rtc::kCsAeadAes128Gcm;
-using rtc::kCsAeadAes256Gcm;
-using rtc::kCsAesCm128HmacSha1_32;
-using rtc::kCsAesCm128HmacSha1_80;
-using rtc::UniqueRandomIdGenerator;
+namespace cricket {
+namespace {
+
+using ::rtc::kCsAeadAes128Gcm;
+using ::rtc::kCsAeadAes256Gcm;
+using ::rtc::kCsAesCm128HmacSha1_32;
+using ::rtc::kCsAesCm128HmacSha1_80;
+using ::rtc::UniqueRandomIdGenerator;
+using ::testing::AllOf;
+using ::testing::Bool;
+using ::testing::Combine;
using ::testing::Contains;
using ::testing::Each;
using ::testing::ElementsAre;
@@ -104,142 +74,151 @@ using ::testing::Eq;
using ::testing::Field;
using ::testing::IsEmpty;
using ::testing::IsFalse;
+using ::testing::IsSupersetOf;
using ::testing::Ne;
using ::testing::Not;
+using ::testing::NotNull;
using ::testing::Pointwise;
using ::testing::SizeIs;
-using webrtc::RtpExtension;
-using webrtc::RtpTransceiverDirection;
-
-static const AudioCodec kAudioCodecs1[] = {
- cricket::CreateAudioCodec(103, "ISAC", 16000, 1),
- cricket::CreateAudioCodec(102, "iLBC", 8000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
- cricket::CreateAudioCodec(8, "PCMA", 8000, 1),
- cricket::CreateAudioCodec(117, "red", 8000, 1),
- cricket::CreateAudioCodec(107, "CN", 48000, 1)};
-
-static const AudioCodec kAudioCodecs2[] = {
- cricket::CreateAudioCodec(126, "foo", 16000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
- cricket::CreateAudioCodec(127, "iLBC", 8000, 1),
+using ::testing::Values;
+using ::testing::ValuesIn;
+using ::webrtc::RtpExtension;
+using ::webrtc::RtpTransceiverDirection;
+
+using Candidates = std::vector<Candidate>;
+
+AudioCodec CreateRedAudioCodec(absl::string_view encoding_id) {
+ AudioCodec red = CreateAudioCodec(63, "red", 48000, 2);
+ red.SetParam(kCodecParamNotInNameValueFormat,
+ std::string(encoding_id) + '/' + std::string(encoding_id));
+ return red;
+}
+
+const AudioCodec kAudioCodecs1[] = {CreateAudioCodec(111, "opus", 48000, 2),
+ CreateRedAudioCodec("111"),
+ CreateAudioCodec(102, "iLBC", 8000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
+ CreateAudioCodec(8, "PCMA", 8000, 1),
+ CreateAudioCodec(117, "red", 8000, 1),
+ CreateAudioCodec(107, "CN", 48000, 1)};
+
+const AudioCodec kAudioCodecs2[] = {
+ CreateAudioCodec(126, "foo", 16000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
+ CreateAudioCodec(127, "iLBC", 8000, 1),
};
-static const AudioCodec kAudioCodecsAnswer[] = {
- cricket::CreateAudioCodec(102, "iLBC", 8000, 1),
- cricket::CreateAudioCodec(0, "PCMU", 8000, 1),
+const AudioCodec kAudioCodecsAnswer[] = {
+ CreateAudioCodec(102, "iLBC", 8000, 1),
+ CreateAudioCodec(0, "PCMU", 8000, 1),
};
-static const VideoCodec kVideoCodecs1[] = {
- cricket::CreateVideoCodec(96, "H264-SVC"),
- cricket::CreateVideoCodec(97, "H264")};
+const VideoCodec kVideoCodecs1[] = {CreateVideoCodec(96, "H264-SVC"),
+ CreateVideoCodec(97, "H264")};
-static const VideoCodec kVideoCodecs1Reverse[] = {
- cricket::CreateVideoCodec(97, "H264"),
- cricket::CreateVideoCodec(96, "H264-SVC")};
+const VideoCodec kVideoCodecs1Reverse[] = {CreateVideoCodec(97, "H264"),
+ CreateVideoCodec(96, "H264-SVC")};
-static const VideoCodec kVideoCodecs2[] = {
- cricket::CreateVideoCodec(126, "H264"),
- cricket::CreateVideoCodec(127, "H263")};
+const VideoCodec kVideoCodecs2[] = {CreateVideoCodec(126, "H264"),
+ CreateVideoCodec(127, "H263")};
-static const VideoCodec kVideoCodecsAnswer[] = {
- cricket::CreateVideoCodec(97, "H264")};
+const VideoCodec kVideoCodecsAnswer[] = {CreateVideoCodec(97, "H264")};
-static const RtpExtension kAudioRtpExtension1[] = {
+const RtpExtension kAudioRtpExtension1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
RtpExtension("http://google.com/testing/audio_something", 10),
};
-static const RtpExtension kAudioRtpExtensionEncrypted1[] = {
+const RtpExtension kAudioRtpExtensionEncrypted1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
RtpExtension("http://google.com/testing/audio_something", 10),
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
RtpExtension("http://google.com/testing/audio_something", 11, true),
};
-static const RtpExtension kAudioRtpExtension2[] = {
+const RtpExtension kAudioRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 2),
RtpExtension("http://google.com/testing/audio_something_else", 8),
RtpExtension("http://google.com/testing/both_audio_and_video", 7),
};
-static const RtpExtension kAudioRtpExtension3[] = {
+const RtpExtension kAudioRtpExtension3[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
RtpExtension("http://google.com/testing/both_audio_and_video", 3),
};
-static const RtpExtension kAudioRtpExtension3ForEncryption[] = {
+const RtpExtension kAudioRtpExtension3ForEncryption[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
// Use RTP extension that supports encryption.
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
};
-static const RtpExtension kAudioRtpExtension3ForEncryptionOffer[] = {
+const RtpExtension kAudioRtpExtension3ForEncryptionOffer[] = {
RtpExtension("http://google.com/testing/audio_something", 2),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
RtpExtension("http://google.com/testing/audio_something", 14, true),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 13, true),
};
-static const RtpExtension kVideoRtpExtension3ForEncryptionOffer[] = {
+const RtpExtension kVideoRtpExtension3ForEncryptionOffer[] = {
RtpExtension("http://google.com/testing/video_something", 4),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 3),
RtpExtension("http://google.com/testing/video_something", 12, true),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 13, true),
};
-static const RtpExtension kAudioRtpExtensionAnswer[] = {
+const RtpExtension kAudioRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 8),
};
-static const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = {
+const RtpExtension kAudioRtpExtensionEncryptedAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:ssrc-audio-level", 12, true),
};
-static const RtpExtension kVideoRtpExtension1[] = {
+const RtpExtension kVideoRtpExtension1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
RtpExtension("http://google.com/testing/video_something", 13),
};
-static const RtpExtension kVideoRtpExtensionEncrypted1[] = {
+const RtpExtension kVideoRtpExtensionEncrypted1[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
RtpExtension("http://google.com/testing/video_something", 13),
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 9, true),
RtpExtension("http://google.com/testing/video_something", 7, true),
};
-static const RtpExtension kVideoRtpExtension2[] = {
+const RtpExtension kVideoRtpExtension2[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 2),
RtpExtension("http://google.com/testing/video_something_else", 14),
RtpExtension("http://google.com/testing/both_audio_and_video", 7),
};
-static const RtpExtension kVideoRtpExtension3[] = {
+const RtpExtension kVideoRtpExtension3[] = {
RtpExtension("http://google.com/testing/video_something", 4),
RtpExtension("http://google.com/testing/both_audio_and_video", 5),
};
-static const RtpExtension kVideoRtpExtension3ForEncryption[] = {
+const RtpExtension kVideoRtpExtension3ForEncryption[] = {
RtpExtension("http://google.com/testing/video_something", 4),
// Use RTP extension that supports encryption.
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 5),
};
-static const RtpExtension kVideoRtpExtensionAnswer[] = {
+const RtpExtension kVideoRtpExtensionAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 14),
};
-static const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = {
+const RtpExtension kVideoRtpExtensionEncryptedAnswer[] = {
RtpExtension("urn:ietf:params:rtp-hdrext:toffset", 9, true),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber01[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber01[] = {
RtpExtension("http://www.ietf.org/id/"
"draft-holmer-rmcat-transport-wide-cc-extensions-01",
1),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber01And02[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber01And02[] = {
RtpExtension("http://www.ietf.org/id/"
"draft-holmer-rmcat-transport-wide-cc-extensions-01",
1),
@@ -248,68 +227,64 @@ static const RtpExtension kRtpExtensionTransportSequenceNumber01And02[] = {
2),
};
-static const RtpExtension kRtpExtensionTransportSequenceNumber02[] = {
+const RtpExtension kRtpExtensionTransportSequenceNumber02[] = {
RtpExtension(
"http://www.webrtc.org/experiments/rtp-hdrext/transport-wide-cc-02",
2),
};
-static const RtpExtension kRtpExtensionGenericFrameDescriptorUri00[] = {
+const RtpExtension kRtpExtensionGenericFrameDescriptorUri00[] = {
RtpExtension("http://www.webrtc.org/experiments/rtp-hdrext/"
"generic-frame-descriptor-00",
3),
};
-static const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
-static const uint32_t kSimSsrc[] = {10, 20, 30};
-static const uint32_t kFec1Ssrc[] = {10, 11};
-static const uint32_t kFec2Ssrc[] = {20, 21};
-static const uint32_t kFec3Ssrc[] = {30, 31};
-
-static const char kMediaStream1[] = "stream_1";
-static const char kMediaStream2[] = "stream_2";
-static const char kVideoTrack1[] = "video_1";
-static const char kVideoTrack2[] = "video_2";
-static const char kAudioTrack1[] = "audio_1";
-static const char kAudioTrack2[] = "audio_2";
-static const char kAudioTrack3[] = "audio_3";
-
-static const char* kMediaProtocols[] = {"RTP/AVP", "RTP/SAVP", "RTP/AVPF",
- "RTP/SAVPF"};
-static const char* kMediaProtocolsDtls[] = {
- "TCP/TLS/RTP/SAVPF", "TCP/TLS/RTP/SAVP", "UDP/TLS/RTP/SAVPF",
- "UDP/TLS/RTP/SAVP"};
+const uint32_t kSimulcastParamsSsrc[] = {10, 11, 20, 21, 30, 31};
+const uint32_t kSimSsrc[] = {10, 20, 30};
+const uint32_t kFec1Ssrc[] = {10, 11};
+const uint32_t kFec2Ssrc[] = {20, 21};
+const uint32_t kFec3Ssrc[] = {30, 31};
+
+const char kMediaStream1[] = "stream_1";
+const char kMediaStream2[] = "stream_2";
+const char kVideoTrack1[] = "video_1";
+const char kVideoTrack2[] = "video_2";
+const char kAudioTrack1[] = "audio_1";
+const char kAudioTrack2[] = "audio_2";
+const char kAudioTrack3[] = "audio_3";
+
+const char* kMediaProtocols[] = {"RTP/AVP", "RTP/SAVP", "RTP/AVPF",
+ "RTP/SAVPF"};
+const char* kMediaProtocolsDtls[] = {"TCP/TLS/RTP/SAVPF", "TCP/TLS/RTP/SAVP",
+ "UDP/TLS/RTP/SAVPF", "UDP/TLS/RTP/SAVP"};
// SRTP cipher name negotiated by the tests. This must be updated if the
// default changes.
-static const char* kDefaultSrtpCryptoSuite = kCsAesCm128HmacSha1_80;
-static const char* kDefaultSrtpCryptoSuiteGcm = kCsAeadAes256Gcm;
-static const uint8_t kDefaultCryptoSuiteSize = 3U;
+const char* kDefaultSrtpCryptoSuite = kCsAesCm128HmacSha1_80;
+const char* kDefaultSrtpCryptoSuiteGcm = kCsAeadAes256Gcm;
+const uint8_t kDefaultCryptoSuiteSize = 3U;
// These constants are used to make the code using "AddMediaDescriptionOptions"
// more readable.
-static constexpr bool kStopped = true;
-static constexpr bool kActive = false;
+constexpr bool kStopped = true;
+constexpr bool kActive = false;
-static bool IsMediaContentOfType(const ContentInfo* content,
- MediaType media_type) {
+bool IsMediaContentOfType(const ContentInfo* content, MediaType media_type) {
RTC_DCHECK(content);
return content->media_description()->type() == media_type;
}
-static RtpTransceiverDirection GetMediaDirection(const ContentInfo* content) {
+RtpTransceiverDirection GetMediaDirection(const ContentInfo* content) {
RTC_DCHECK(content);
return content->media_description()->direction();
}
-static void AddRtxCodec(const VideoCodec& rtx_codec,
- std::vector<VideoCodec>* codecs) {
- ASSERT_FALSE(cricket::FindCodecById(*codecs, rtx_codec.id));
+void AddRtxCodec(const VideoCodec& rtx_codec, std::vector<VideoCodec>* codecs) {
+ ASSERT_FALSE(FindCodecById(*codecs, rtx_codec.id));
codecs->push_back(rtx_codec);
}
-static std::vector<std::string> GetCodecNames(
- const std::vector<cricket::Codec>& codecs) {
+std::vector<std::string> GetCodecNames(const std::vector<Codec>& codecs) {
std::vector<std::string> codec_names;
codec_names.reserve(codecs.size());
for (const auto& codec : codecs) {
@@ -338,29 +313,29 @@ FindFirstMediaDescriptionByMid(const std::string& mid,
}
// Add a media section to the `session_options`.
-static void AddMediaDescriptionOptions(MediaType type,
- const std::string& mid,
- RtpTransceiverDirection direction,
- bool stopped,
- MediaSessionOptions* opts) {
+void AddMediaDescriptionOptions(MediaType type,
+ const std::string& mid,
+ RtpTransceiverDirection direction,
+ bool stopped,
+ MediaSessionOptions* opts) {
opts->media_description_options.push_back(
MediaDescriptionOptions(type, mid, direction, stopped));
}
-static void AddAudioVideoSections(RtpTransceiverDirection direction,
- MediaSessionOptions* opts) {
+void AddAudioVideoSections(RtpTransceiverDirection direction,
+ MediaSessionOptions* opts) {
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio", direction, kActive,
opts);
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video", direction, kActive,
opts);
}
-static void AddDataSection(RtpTransceiverDirection direction,
- MediaSessionOptions* opts) {
+void AddDataSection(RtpTransceiverDirection direction,
+ MediaSessionOptions* opts) {
AddMediaDescriptionOptions(MEDIA_TYPE_DATA, "data", direction, kActive, opts);
}
-static void AttachSenderToMediaDescriptionOptions(
+void AttachSenderToMediaDescriptionOptions(
const std::string& mid,
MediaType type,
const std::string& track_id,
@@ -383,7 +358,7 @@ static void AttachSenderToMediaDescriptionOptions(
}
}
-static void AttachSenderToMediaDescriptionOptions(
+void AttachSenderToMediaDescriptionOptions(
const std::string& mid,
MediaType type,
const std::string& track_id,
@@ -395,23 +370,21 @@ static void AttachSenderToMediaDescriptionOptions(
session_options);
}
-static void DetachSenderFromMediaSection(const std::string& mid,
- const std::string& track_id,
- MediaSessionOptions* session_options) {
- std::vector<cricket::SenderOptions>& sender_options_list =
+void DetachSenderFromMediaSection(const std::string& mid,
+ const std::string& track_id,
+ MediaSessionOptions* session_options) {
+ std::vector<SenderOptions>& sender_options_list =
FindFirstMediaDescriptionByMid(mid, session_options)->sender_options;
- auto sender_it =
- absl::c_find_if(sender_options_list,
- [track_id](const cricket::SenderOptions& sender_options) {
- return sender_options.track_id == track_id;
- });
+ auto sender_it = absl::c_find_if(
+ sender_options_list, [track_id](const SenderOptions& sender_options) {
+ return sender_options.track_id == track_id;
+ });
RTC_DCHECK(sender_it != sender_options_list.end());
sender_options_list.erase(sender_it);
}
-// Helper function used to create a default MediaSessionOptions for Plan B SDP.
-// (https://tools.ietf.org/html/draft-uberti-rtcweb-plan-00).
-static MediaSessionOptions CreatePlanBMediaSessionOptions() {
+// Helper function used to create recv-only audio MediaSessionOptions.
+MediaSessionOptions CreateAudioMediaSession() {
MediaSessionOptions session_options;
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio",
RtpTransceiverDirection::kRecvOnly, kActive,
@@ -423,7 +396,7 @@ static MediaSessionOptions CreatePlanBMediaSessionOptions() {
void PreferGcmCryptoParameters(CryptoParamsVec* cryptos) {
cryptos->erase(
std::remove_if(cryptos->begin(), cryptos->end(),
- [](const cricket::CryptoParams& crypto) {
+ [](const CryptoParams& crypto) {
return crypto.crypto_suite != kCsAeadAes256Gcm &&
crypto.crypto_suite != kCsAeadAes128Gcm;
}),
@@ -434,7 +407,7 @@ void PreferGcmCryptoParameters(CryptoParamsVec* cryptos) {
// was designed for Plan B SDP, where only one audio "m=" section and one video
// "m=" section could be generated, and ordering couldn't be controlled. Many of
// these tests may be obsolete as a result, and should be refactored or removed.
-class MediaSessionDescriptionFactoryTest : public ::testing::Test {
+class MediaSessionDescriptionFactoryTest : public testing::Test {
public:
MediaSessionDescriptionFactoryTest()
: tdf1_(field_trials),
@@ -538,9 +511,9 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
EXPECT_EQ(current_audio_ufrag, ti_audio->description.ice_ufrag);
EXPECT_EQ(current_audio_pwd, ti_audio->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_audio->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_audio->description.ice_pwd.size());
}
auto media_desc_options_it =
@@ -562,9 +535,9 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
EXPECT_EQ(current_video_ufrag, ti_video->description.ice_ufrag);
EXPECT_EQ(current_video_pwd, ti_video->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_video->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_video->description.ice_pwd.size());
}
}
@@ -583,9 +556,9 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
EXPECT_EQ(current_data_ufrag, ti_data->description.ice_ufrag);
EXPECT_EQ(current_data_pwd, ti_data->description.ice_pwd);
} else {
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_UFRAG_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_UFRAG_LENGTH),
ti_data->description.ice_ufrag.size());
- EXPECT_EQ(static_cast<size_t>(cricket::ICE_PWD_LENGTH),
+ EXPECT_EQ(static_cast<size_t>(ICE_PWD_LENGTH),
ti_data->description.ice_pwd.size());
}
}
@@ -615,10 +588,10 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
f1_.CreateAnswerOrError(ref_desc.get(), options, nullptr).MoveValue();
}
ASSERT_TRUE(desc);
- const cricket::MediaContentDescription* audio_media_desc =
+ const MediaContentDescription* audio_media_desc =
desc->GetContentDescriptionByName("audio");
ASSERT_TRUE(audio_media_desc);
- const cricket::MediaContentDescription* video_media_desc =
+ const MediaContentDescription* video_media_desc =
desc->GetContentDescriptionByName("video");
ASSERT_TRUE(video_media_desc);
EXPECT_TRUE(CompareCryptoParams(audio_media_desc->cryptos(),
@@ -628,7 +601,7 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
// Verify the selected crypto is one from the reference audio
// media content.
- const cricket::MediaContentDescription* ref_audio_media_desc =
+ const MediaContentDescription* ref_audio_media_desc =
ref_desc->GetContentDescriptionByName("audio");
bool found = false;
for (size_t i = 0; i < ref_audio_media_desc->cryptos().size(); ++i) {
@@ -670,13 +643,10 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
EXPECT_EQ(expected_direction_in_answer, vcd_answer->direction());
}
- bool VerifyNoCNCodecs(const cricket::ContentInfo* content) {
+ bool VerifyNoCNCodecs(const ContentInfo* content) {
RTC_DCHECK(content);
RTC_CHECK(content->media_description());
- const cricket::AudioContentDescription* audio_desc =
- content->media_description()->as_audio();
- RTC_CHECK(audio_desc);
- for (const cricket::AudioCodec& codec : audio_desc->codecs()) {
+ for (const Codec& codec : content->media_description()->codecs()) {
if (codec.name == "CN") {
return false;
}
@@ -699,7 +669,7 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
f1_.CreateOfferOrError(offer_opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
if (gcm_offer && gcm_answer) {
- for (cricket::ContentInfo& content : offer->contents()) {
+ for (ContentInfo& content : offer->contents()) {
auto cryptos = content.media_description()->cryptos();
PreferGcmCryptoParameters(&cryptos);
content.media_description()->set_cryptos(cryptos);
@@ -734,13 +704,13 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
} else {
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
}
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
void TestTransportSequenceNumberNegotiation(
- const cricket::RtpHeaderExtensions& local,
- const cricket::RtpHeaderExtensions& offered,
- const cricket::RtpHeaderExtensions& expectedAnswer) {
+ const RtpHeaderExtensions& local,
+ const RtpHeaderExtensions& offered,
+ const RtpHeaderExtensions& expectedAnswer) {
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
SetAudioVideoRtpHeaderExtensions(offered, offered, &opts);
@@ -760,8 +730,7 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
}
std::vector<webrtc::RtpHeaderExtensionCapability>
- HeaderExtensionCapabilitiesFromRtpExtensions(
- cricket::RtpHeaderExtensions extensions) {
+ HeaderExtensionCapabilitiesFromRtpExtensions(RtpHeaderExtensions extensions) {
std::vector<webrtc::RtpHeaderExtensionCapability> capabilities;
for (const auto& extension : extensions) {
webrtc::RtpHeaderExtensionCapability capability(
@@ -772,8 +741,8 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
return capabilities;
}
- void SetAudioVideoRtpHeaderExtensions(cricket::RtpHeaderExtensions audio_exts,
- cricket::RtpHeaderExtensions video_exts,
+ void SetAudioVideoRtpHeaderExtensions(RtpHeaderExtensions audio_exts,
+ RtpHeaderExtensions video_exts,
MediaSessionOptions* opts) {
auto audio_caps = HeaderExtensionCapabilitiesFromRtpExtensions(audio_exts);
auto video_caps = HeaderExtensionCapabilitiesFromRtpExtensions(video_exts);
@@ -805,8 +774,7 @@ class MediaSessionDescriptionFactoryTest : public ::testing::Test {
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) {
f1_.set_secure(SEC_ENABLED);
std::unique_ptr<SessionDescription> offer =
- f1_.CreateOfferOrError(CreatePlanBMediaSessionOptions(), nullptr)
- .MoveValue();
+ f1_.CreateOfferOrError(CreateAudioMediaSession(), nullptr).MoveValue();
ASSERT_TRUE(offer.get());
const ContentInfo* ac = offer->GetContentByName("audio");
const ContentInfo* vc = offer->GetContentByName("video");
@@ -820,7 +788,66 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOffer) {
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(acd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
+}
+
+// Create an offer with just Opus and RED.
+TEST_F(MediaSessionDescriptionFactoryTest,
+ TestCreateAudioOfferWithJustOpusAndRed) {
+ f1_.set_secure(SEC_ENABLED);
+ // First, prefer to only use opus and red.
+ std::vector<webrtc::RtpCodecCapability> preferences;
+ preferences.push_back(
+ webrtc::ToRtpCodecCapability(f1_.audio_sendrecv_codecs()[0]));
+ preferences.push_back(
+ webrtc::ToRtpCodecCapability(f1_.audio_sendrecv_codecs()[1]));
+ EXPECT_EQ("opus", preferences[0].name);
+ EXPECT_EQ("red", preferences[1].name);
+
+ auto opts = CreateAudioMediaSession();
+ opts.media_description_options.at(0).codec_preferences = preferences;
+ std::unique_ptr<SessionDescription> offer =
+ f1_.CreateOfferOrError(opts, nullptr).MoveValue();
+ ASSERT_TRUE(offer.get());
+ const ContentInfo* ac = offer->GetContentByName("audio");
+ const ContentInfo* vc = offer->GetContentByName("video");
+ ASSERT_TRUE(ac != NULL);
+ ASSERT_TRUE(vc == NULL);
+ EXPECT_EQ(MediaProtocolType::kRtp, ac->type);
+ const AudioContentDescription* acd = ac->media_description()->as_audio();
+ EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
+ EXPECT_EQ(2U, acd->codecs().size());
+ EXPECT_EQ("opus", acd->codecs()[0].name);
+ EXPECT_EQ("red", acd->codecs()[1].name);
+}
+
+// Create an offer with RED before Opus, which enables RED with Opus encoding.
+TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioOfferWithRedForOpus) {
+ f1_.set_secure(SEC_ENABLED);
+ // First, prefer to only use opus and red.
+ std::vector<webrtc::RtpCodecCapability> preferences;
+ preferences.push_back(
+ webrtc::ToRtpCodecCapability(f1_.audio_sendrecv_codecs()[1]));
+ preferences.push_back(
+ webrtc::ToRtpCodecCapability(f1_.audio_sendrecv_codecs()[0]));
+ EXPECT_EQ("red", preferences[0].name);
+ EXPECT_EQ("opus", preferences[1].name);
+
+ auto opts = CreateAudioMediaSession();
+ opts.media_description_options.at(0).codec_preferences = preferences;
+ std::unique_ptr<SessionDescription> offer =
+ f1_.CreateOfferOrError(opts, nullptr).MoveValue();
+ ASSERT_TRUE(offer.get());
+ const ContentInfo* ac = offer->GetContentByName("audio");
+ const ContentInfo* vc = offer->GetContentByName("video");
+ ASSERT_TRUE(ac != NULL);
+ ASSERT_TRUE(vc == NULL);
+ EXPECT_EQ(MediaProtocolType::kRtp, ac->type);
+ const AudioContentDescription* acd = ac->media_description()->as_audio();
+ EXPECT_EQ(MEDIA_TYPE_AUDIO, acd->type());
+ EXPECT_EQ(2U, acd->codecs().size());
+ EXPECT_EQ("red", acd->codecs()[0].name);
+ EXPECT_EQ("opus", acd->codecs()[1].name);
}
// Create a typical video offer, and ensure it matches what we expect.
@@ -845,14 +872,14 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoOffer) {
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(acd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(acd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
EXPECT_EQ(MEDIA_TYPE_VIDEO, vcd->type());
EXPECT_EQ(f1_.video_sendrecv_codecs(), vcd->codecs());
EXPECT_EQ(0U, vcd->first_ssrc()); // no sender is attached
EXPECT_EQ(kAutoBandwidth, vcd->bandwidth()); // default bandwidth (auto)
EXPECT_TRUE(vcd->rtcp_mux()); // rtcp-mux defaults on
ASSERT_CRYPTO(vcd, kDefaultCryptoSuiteSize, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Test creating an offer with bundle where the Codecs have the same dynamic
@@ -912,9 +939,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
EXPECT_TRUE(acd);
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Create an SCTP data offer with bundle without error.
@@ -930,7 +957,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSctpDataOffer) {
auto dcd = GetFirstSctpDataContentDescription(offer.get());
ASSERT_TRUE(dcd);
// Since this transport is insecure, the protocol should be "SCTP".
- EXPECT_EQ(cricket::kMediaProtocolSctp, dcd->protocol());
+ EXPECT_EQ(kMediaProtocolSctp, dcd->protocol());
}
// Create an SCTP data offer with bundle without error.
@@ -947,7 +974,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSecureSctpDataOffer) {
auto dcd = GetFirstSctpDataContentDescription(offer.get());
ASSERT_TRUE(dcd);
// The protocol should now be "UDP/DTLS/SCTP"
- EXPECT_EQ(cricket::kMediaProtocolUdpDtlsSctp, dcd->protocol());
+ EXPECT_EQ(kMediaProtocolUdpDtlsSctp, dcd->protocol());
}
// Test creating an sctp data channel from an already generated offer.
@@ -961,13 +988,13 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateImplicitSctpDataOffer) {
ASSERT_TRUE(offer1.get());
const ContentInfo* data = offer1->GetContentByName("data");
ASSERT_TRUE(data);
- ASSERT_EQ(cricket::kMediaProtocolSctp, data->media_description()->protocol());
+ ASSERT_EQ(kMediaProtocolSctp, data->media_description()->protocol());
std::unique_ptr<SessionDescription> offer2(
f1_.CreateOfferOrError(opts, offer1.get()).MoveValue());
data = offer2->GetContentByName("data");
ASSERT_TRUE(data);
- EXPECT_EQ(cricket::kMediaProtocolSctp, data->media_description()->protocol());
+ EXPECT_EQ(kMediaProtocolSctp, data->media_description()->protocol());
}
// Test that if BUNDLE is enabled and all media sections are rejected then the
@@ -985,7 +1012,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, ReOfferNoBundleGroupIfAllRejected) {
std::unique_ptr<SessionDescription> reoffer =
f1_.CreateOfferOrError(opts, offer.get()).MoveValue();
- EXPECT_FALSE(reoffer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE));
+ EXPECT_FALSE(reoffer->GetGroupByName(GROUP_TYPE_BUNDLE));
}
// Test that if BUNDLE is enabled and the remote re-offer does not include a
@@ -1008,7 +1035,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, ReAnswerNoBundleGroupIfAllRejected) {
std::unique_ptr<SessionDescription> reanswer =
f2_.CreateAnswerOrError(reoffer.get(), opts, answer.get()).MoveValue();
- EXPECT_FALSE(reanswer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE));
+ EXPECT_FALSE(reanswer->GetGroupByName(GROUP_TYPE_BUNDLE));
}
// Test that if BUNDLE is enabled and the previous offerer-tagged media section
@@ -1031,8 +1058,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, ReOfferChangeBundleOffererTagged) {
std::unique_ptr<SessionDescription> reoffer =
f1_.CreateOfferOrError(opts, offer.get()).MoveValue();
- const cricket::ContentGroup* bundle_group =
- reoffer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
+ const ContentGroup* bundle_group = reoffer->GetGroupByName(GROUP_TYPE_BUNDLE);
ASSERT_TRUE(bundle_group);
EXPECT_FALSE(bundle_group->HasContentName("audio"));
EXPECT_TRUE(bundle_group->HasContentName("video"));
@@ -1062,8 +1088,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, ReAnswerChangedBundleOffererTagged) {
std::unique_ptr<SessionDescription> reanswer =
f2_.CreateAnswerOrError(reoffer.get(), opts, answer.get()).MoveValue();
- const cricket::ContentGroup* bundle_group =
- reanswer->GetGroupByName(cricket::GROUP_TYPE_BUNDLE);
+ const ContentGroup* bundle_group =
+ reanswer->GetGroupByName(GROUP_TYPE_BUNDLE);
ASSERT_TRUE(bundle_group);
EXPECT_FALSE(bundle_group->HasContentName("audio"));
EXPECT_TRUE(bundle_group->HasContentName("video"));
@@ -1093,10 +1119,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// Munge the offer to have two groups. Offers like these cannot be generated
// without munging, but it is valid to receive such offers from remote
// endpoints.
- cricket::ContentGroup bundle_group1(cricket::GROUP_TYPE_BUNDLE);
+ ContentGroup bundle_group1(GROUP_TYPE_BUNDLE);
bundle_group1.AddContentName("1");
bundle_group1.AddContentName("2");
- cricket::ContentGroup bundle_group2(cricket::GROUP_TYPE_BUNDLE);
+ ContentGroup bundle_group2(GROUP_TYPE_BUNDLE);
bundle_group2.AddContentName("3");
bundle_group2.AddContentName("4");
offer->AddGroup(bundle_group1);
@@ -1108,8 +1134,8 @@ TEST_F(MediaSessionDescriptionFactoryTest,
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
- std::vector<const cricket::ContentGroup*> answer_groups =
- answer->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
+ std::vector<const ContentGroup*> answer_groups =
+ answer->GetGroupsByName(GROUP_TYPE_BUNDLE);
ASSERT_EQ(answer_groups.size(), 2u);
EXPECT_EQ(answer_groups[0]->content_names().size(), 2u);
EXPECT_TRUE(answer_groups[0]->HasContentName("1"));
@@ -1123,7 +1149,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
opts.bundle_enabled = false;
answer = f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
- answer_groups = answer->GetGroupsByName(cricket::GROUP_TYPE_BUNDLE);
+ answer_groups = answer->GetGroupsByName(GROUP_TYPE_BUNDLE);
// Rejected groups are still listed, but they are empty.
ASSERT_EQ(answer_groups.size(), 2u);
EXPECT_TRUE(answer_groups[0]->content_names().empty());
@@ -1270,12 +1296,10 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswer) {
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
std::unique_ptr<SessionDescription> offer =
- f1_.CreateOfferOrError(CreatePlanBMediaSessionOptions(), nullptr)
- .MoveValue();
+ f1_.CreateOfferOrError(CreateAudioMediaSession(), nullptr).MoveValue();
ASSERT_TRUE(offer.get());
std::unique_ptr<SessionDescription> answer =
- f2_.CreateAnswerOrError(offer.get(), CreatePlanBMediaSessionOptions(),
- nullptr)
+ f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr)
.MoveValue();
const ContentInfo* ac = answer->GetContentByName("audio");
const ContentInfo* vc = answer->GetContentByName("video");
@@ -1289,7 +1313,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswer) {
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw
EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
}
// Create a typical audio answer with GCM ciphers enabled, and ensure it
@@ -1297,11 +1321,11 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswer) {
TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswerGcm) {
f1_.set_secure(SEC_ENABLED);
f2_.set_secure(SEC_ENABLED);
- MediaSessionOptions opts = CreatePlanBMediaSessionOptions();
+ MediaSessionOptions opts = CreateAudioMediaSession();
std::unique_ptr<SessionDescription> offer =
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
- for (cricket::ContentInfo& content : offer->contents()) {
+ for (ContentInfo& content : offer->contents()) {
auto cryptos = content.media_description()->cryptos();
PreferGcmCryptoParameters(&cryptos);
content.media_description()->set_cryptos(cryptos);
@@ -1320,7 +1344,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAudioAnswerGcm) {
EXPECT_EQ(kAutoBandwidth, acd->bandwidth()); // negotiated auto bw
EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(acd, 1U, kDefaultSrtpCryptoSuiteGcm);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, acd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, acd->protocol());
}
// Create an audio answer with no common codecs, and ensure it is rejected.
@@ -1330,10 +1354,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddMediaDescriptionOptions(MEDIA_TYPE_AUDIO, "audio",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateAudioCodec(96, "opus", 48000, 1)};
+ std::vector f1_codecs = {CreateAudioCodec(96, "opus", 48000, 1)};
f1_.set_audio_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateAudioCodec(0, "PCMU", 8000, 1)};
+ std::vector f2_codecs = {CreateAudioCodec(0, "PCMU", 8000, 1)};
f2_.set_audio_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1375,7 +1399,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateVideoAnswer) {
EXPECT_EQ(0U, vcd->first_ssrc()); // no sender is attached
EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux
ASSERT_CRYPTO(vcd, 1U, kDefaultSrtpCryptoSuite);
- EXPECT_EQ(cricket::kMediaProtocolSavpf, vcd->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, vcd->protocol());
}
// Create a typical video answer with GCM ciphers enabled, and ensure it
@@ -1403,10 +1427,10 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264")};
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(97, "VP8")};
+ std::vector f2_codecs = {CreateVideoCodec(97, "VP8")};
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1426,12 +1450,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264"),
- cricket::CreateVideoCodec(118, "flexfec-03")};
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264"),
+ CreateVideoCodec(118, "flexfec-03")};
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(97, "VP8"),
- cricket::CreateVideoCodec(118, "flexfec-03")};
+ std::vector f2_codecs = {CreateVideoCodec(97, "VP8"),
+ CreateVideoCodec(118, "flexfec-03")};
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -1582,7 +1606,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
const SctpDataContentDescription* dcd_answer =
dc_answer->media_description()->as_sctp();
EXPECT_FALSE(dc_answer->rejected);
- EXPECT_EQ(cricket::kSctpSendBufferSize, dcd_answer->max_message_size());
+ EXPECT_EQ(kSctpSendBufferSize, dcd_answer->max_message_size());
}
// Verifies that the order of the media contents in the offer is preserved in
@@ -1654,7 +1678,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, CreateAnswerToInactiveOffer) {
// Test that the media protocol is RTP/AVPF if DTLS and SDES are disabled.
TEST_F(MediaSessionDescriptionFactoryTest, AudioOfferAnswerWithCryptoDisabled) {
- MediaSessionOptions opts = CreatePlanBMediaSessionOptions();
+ MediaSessionOptions opts = CreateAudioMediaSession();
f1_.set_secure(SEC_DISABLED);
f2_.set_secure(SEC_DISABLED);
tdf1_.set_secure(SEC_DISABLED);
@@ -1665,7 +1689,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AudioOfferAnswerWithCryptoDisabled) {
const AudioContentDescription* offer_acd =
GetFirstAudioContentDescription(offer.get());
ASSERT_TRUE(offer_acd);
- EXPECT_EQ(cricket::kMediaProtocolAvpf, offer_acd->protocol());
+ EXPECT_EQ(kMediaProtocolAvpf, offer_acd->protocol());
std::unique_ptr<SessionDescription> answer =
f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
@@ -1677,7 +1701,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AudioOfferAnswerWithCryptoDisabled) {
const AudioContentDescription* answer_acd =
GetFirstAudioContentDescription(answer.get());
ASSERT_TRUE(answer_acd);
- EXPECT_EQ(cricket::kMediaProtocolAvpf, answer_acd->protocol());
+ EXPECT_EQ(kMediaProtocolAvpf, answer_acd->protocol());
}
// Create a video offer and answer and ensure the RTP header extensions
@@ -1820,9 +1844,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kTransportSequenceNumberUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -1844,9 +1868,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -1868,9 +1892,9 @@ TEST_F(MediaSessionDescriptionFactoryTest,
MediaSessionOptions opts;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &opts);
- const cricket::RtpHeaderExtensions offered_extensions = {
+ const RtpHeaderExtensions offered_extensions = {
RtpExtension(RtpExtension::kTransportSequenceNumberUri, 7)};
- const cricket::RtpHeaderExtensions local_extensions = {
+ const RtpHeaderExtensions local_extensions = {
RtpExtension(RtpExtension::kAbsoluteCaptureTimeUri, 5)};
SetAudioVideoRtpHeaderExtensions(offered_extensions, offered_extensions,
&opts);
@@ -2556,18 +2580,18 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCreateSimulcastVideoOffer) {
ASSERT_EQ(1U, video_streams.size());
EXPECT_EQ(kVideoTrack1, video_streams[0].id);
const SsrcGroup* sim_ssrc_group =
- video_streams[0].get_ssrc_group(cricket::kSimSsrcGroupSemantics);
+ video_streams[0].get_ssrc_group(kSimSsrcGroupSemantics);
ASSERT_TRUE(sim_ssrc_group);
EXPECT_EQ(static_cast<size_t>(num_sim_layers), sim_ssrc_group->ssrcs.size());
}
MATCHER(RidDescriptionEquals, "Verifies that two RidDescriptions are equal.") {
- const RidDescription& rid1 = ::testing::get<0>(arg);
- const RidDescription& rid2 = ::testing::get<1>(arg);
+ const RidDescription& rid1 = std::get<0>(arg);
+ const RidDescription& rid2 = std::get<1>(arg);
return rid1.rid == rid2.rid && rid1.direction == rid2.direction;
}
-static void CheckSimulcastInSessionDescription(
+void CheckSimulcastInSessionDescription(
const SessionDescription* description,
const std::string& content_name,
const std::vector<RidDescription>& send_rids,
@@ -3016,14 +3040,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates rtx for H264 with the payload type `f1_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates rtx for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3036,8 +3058,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
GetFirstVideoContentDescription(answer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
@@ -3070,14 +3091,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
&opts);
// We specifically choose different preferred payload types for VP8 to
// trigger the issue.
- cricket::VideoCodec vp8_offerer = cricket::CreateVideoCodec(100, "VP8");
- cricket::VideoCodec vp8_offerer_rtx =
- cricket::CreateVideoRtxCodec(101, vp8_offerer.id);
- cricket::VideoCodec vp8_answerer = cricket::CreateVideoCodec(110, "VP8");
- cricket::VideoCodec vp8_answerer_rtx =
- cricket::CreateVideoRtxCodec(111, vp8_answerer.id);
- cricket::VideoCodec vp9 = cricket::CreateVideoCodec(120, "VP9");
- cricket::VideoCodec vp9_rtx = cricket::CreateVideoRtxCodec(121, vp9.id);
+ VideoCodec vp8_offerer = CreateVideoCodec(100, "VP8");
+ VideoCodec vp8_offerer_rtx = CreateVideoRtxCodec(101, vp8_offerer.id);
+ VideoCodec vp8_answerer = CreateVideoCodec(110, "VP8");
+ VideoCodec vp8_answerer_rtx = CreateVideoRtxCodec(111, vp8_answerer.id);
+ VideoCodec vp9 = CreateVideoCodec(120, "VP9");
+ VideoCodec vp9_rtx = CreateVideoRtxCodec(121, vp9.id);
std::vector<VideoCodec> f1_codecs = {vp8_offerer, vp8_offerer_rtx};
// We also specifically cause the answerer to prefer VP9, such that if it
@@ -3105,7 +3124,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(updated_offer.get());
- std::vector<cricket::VideoCodec> codecs = vcd->codecs();
+ std::vector<VideoCodec> codecs = vcd->codecs();
ASSERT_EQ(4u, codecs.size());
EXPECT_EQ(vp8_offerer, codecs[0]);
EXPECT_EQ(vp8_offerer_rtx, codecs[1]);
@@ -3121,8 +3140,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
RespondentCreatesOfferWithVideoAndRtxAfterCreatingAudioAnswer) {
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates rtx for H264 with the payload type `f1_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
MediaSessionOptions opts;
@@ -3148,7 +3166,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
int used_pl_type = acd->codecs()[0].id;
f2_codecs[0].id = used_pl_type; // Set the payload type for H264.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, used_pl_type), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> updated_offer(
@@ -3166,12 +3184,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
GetFirstVideoContentDescription(updated_answer.get());
ASSERT_EQ("H264", updated_vcd->codecs()[0].name);
- ASSERT_EQ(cricket::kRtxCodecName, updated_vcd->codecs()[1].name);
+ ASSERT_EQ(kRtxCodecName, updated_vcd->codecs()[1].name);
int new_h264_pl_type = updated_vcd->codecs()[0].id;
EXPECT_NE(used_pl_type, new_h264_pl_type);
VideoCodec rtx = updated_vcd->codecs()[1];
- int pt_referenced_by_rtx = rtc::FromString<int>(
- rtx.params[cricket::kCodecParamAssociatedPayloadType]);
+ int pt_referenced_by_rtx =
+ rtc::FromString<int>(rtx.params[kCodecParamAssociatedPayloadType]);
EXPECT_EQ(new_h264_pl_type, pt_referenced_by_rtx);
}
@@ -3185,8 +3203,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates rtx for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3213,8 +3230,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
// New offer should attempt to add H263, and RTX for H264.
expected_codecs.push_back(kVideoCodecs2[1]);
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, updated_vcd->codecs());
}
@@ -3226,14 +3242,12 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX without associated payload type parameter.
- AddRtxCodec(cricket::CreateVideoCodec(126, cricket::kRtxCodecName),
- &f1_codecs);
+ AddRtxCodec(CreateVideoCodec(126, kRtxCodecName), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H264 with the payload type `f2_` uses.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3244,12 +3258,12 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
// is possible to test that that RTX is dropped when
// kCodecParamAssociatedPayloadType is missing in the offer.
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
std::vector<VideoCodec> codecs = desc->codecs();
for (VideoCodec& codec : codecs) {
- if (absl::StartsWith(codec.name, cricket::kRtxCodecName)) {
+ if (absl::StartsWith(codec.name, kRtxCodecName)) {
codec.params.clear();
}
}
@@ -3260,7 +3274,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtxWithoutApt) {
EXPECT_THAT(
GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()),
- Not(Contains(cricket::kRtxCodecName)));
+ Not(Contains(kRtxCodecName)));
}
// Test that RTX will be filtered out in the answer if its associated payload
@@ -3272,14 +3286,12 @@ TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) {
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264 in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H263 in receiver.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs2[1].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs2[1].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f2_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3292,7 +3304,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, FilterOutRtxIfAptDoesntMatch) {
EXPECT_THAT(
GetCodecNames(GetFirstVideoContentDescription(answer.get())->codecs()),
- Not(Contains(cricket::kRtxCodecName)));
+ Not(Contains(kRtxCodecName)));
}
// Test that when multiple RTX codecs are offered, only the matched RTX codec
@@ -3305,19 +3317,16 @@ TEST_F(MediaSessionDescriptionFactoryTest,
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264-SVC in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
// This creates RTX for H264 in sender.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::vector<VideoCodec> f2_codecs = MAKE_VECTOR(kVideoCodecs2);
// This creates RTX for H264 in receiver.
- AddRtxCodec(cricket::CreateVideoRtxCodec(124, kVideoCodecs2[0].id),
- &f2_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(124, kVideoCodecs2[0].id), &f2_codecs);
f2_.set_video_codecs(f2_codecs, f1_codecs);
// H264-SVC codec is removed in the answer, therefore, associated RTX codec
@@ -3330,8 +3339,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
const VideoContentDescription* vcd =
GetFirstVideoContentDescription(answer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecsAnswer);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
}
@@ -3345,8 +3353,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
&opts);
std::vector<VideoCodec> f1_codecs = MAKE_VECTOR(kVideoCodecs1);
// This creates RTX for H264 for the offerer.
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::unique_ptr<SessionDescription> offer =
@@ -3356,13 +3363,11 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
GetFirstVideoContentDescription(offer.get());
std::vector<VideoCodec> expected_codecs = MAKE_VECTOR(kVideoCodecs1);
- AddRtxCodec(cricket::CreateVideoRtxCodec(126, kVideoCodecs1[1].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(126, kVideoCodecs1[1].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
// Now, attempt to add RTX for H264-SVC.
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &f1_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
std::unique_ptr<SessionDescription> updated_offer(
@@ -3370,8 +3375,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, AddSecondRtxInNewOffer) {
ASSERT_TRUE(updated_offer);
vcd = GetFirstVideoContentDescription(updated_offer.get());
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, kVideoCodecs1[0].id),
- &expected_codecs);
+ AddRtxCodec(CreateVideoRtxCodec(125, kVideoCodecs1[0].id), &expected_codecs);
EXPECT_EQ(expected_codecs, vcd->codecs());
}
@@ -3388,8 +3392,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) {
// Use a single real codec, and then add RTX for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- AddRtxCodec(cricket::CreateVideoRtxCodec(125, 97), &f1_codecs);
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ AddRtxCodec(CreateVideoRtxCodec(125, 97), &f1_codecs);
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has an RTX ssrc for each regular ssrc, and that there
@@ -3398,7 +3402,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateMultipleRtxSsrcs) {
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3433,8 +3437,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, GenerateFlexfecSsrc) {
// Use a single real codec, and then add FlexFEC for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- f1_codecs.push_back(cricket::CreateVideoCodec(118, "flexfec-03"));
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has a single FlexFEC ssrc and that
@@ -3443,7 +3447,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, GenerateFlexfecSsrc) {
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3477,8 +3481,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateNoFlexfecSsrcs) {
// Use a single real codec, and then add FlexFEC for it.
std::vector<VideoCodec> f1_codecs;
- f1_codecs.push_back(cricket::CreateVideoCodec(97, "H264"));
- f1_codecs.push_back(cricket::CreateVideoCodec(118, "flexfec-03"));
+ f1_codecs.push_back(CreateVideoCodec(97, "H264"));
+ f1_codecs.push_back(CreateVideoCodec(118, "flexfec-03"));
f1_.set_video_codecs(f1_codecs, f1_codecs);
// Ensure that the offer has no FlexFEC ssrcs for each regular ssrc, and that
@@ -3487,7 +3491,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, SimSsrcsGenerateNoFlexfecSsrcs) {
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
ASSERT_TRUE(offer.get());
MediaContentDescription* media_desc =
- offer->GetContentDescriptionByName(cricket::CN_VIDEO);
+ offer->GetContentDescriptionByName(CN_VIDEO);
ASSERT_TRUE(media_desc);
VideoContentDescription* desc = media_desc->as_video();
const StreamParamsVec& streams = desc->streams();
@@ -3638,22 +3642,22 @@ TEST_F(MediaSessionDescriptionFactoryTest, RtpExtensionIdReusedEncrypted) {
TEST(MediaSessionDescription, CopySessionDescription) {
SessionDescription source;
- cricket::ContentGroup group(cricket::CN_AUDIO);
+ ContentGroup group(CN_AUDIO);
source.AddGroup(group);
std::unique_ptr<AudioContentDescription> acd =
std::make_unique<AudioContentDescription>();
acd->set_codecs(MAKE_VECTOR(kAudioCodecs1));
acd->AddLegacyStream(1);
- source.AddContent(cricket::CN_AUDIO, MediaProtocolType::kRtp, acd->Clone());
+ source.AddContent(CN_AUDIO, MediaProtocolType::kRtp, acd->Clone());
std::unique_ptr<VideoContentDescription> vcd =
std::make_unique<VideoContentDescription>();
vcd->set_codecs(MAKE_VECTOR(kVideoCodecs1));
vcd->AddLegacyStream(2);
- source.AddContent(cricket::CN_VIDEO, MediaProtocolType::kRtp, vcd->Clone());
+ source.AddContent(CN_VIDEO, MediaProtocolType::kRtp, vcd->Clone());
std::unique_ptr<SessionDescription> copy = source.Clone();
ASSERT_TRUE(copy.get());
- EXPECT_TRUE(copy->HasGroup(cricket::CN_AUDIO));
+ EXPECT_TRUE(copy->HasGroup(CN_AUDIO));
const ContentInfo* ac = copy->GetContentByName("audio");
const ContentInfo* vc = copy->GetContentByName("video");
ASSERT_TRUE(ac);
@@ -3804,18 +3808,16 @@ TEST_F(MediaSessionDescriptionFactoryTest,
tdf2_.set_secure(SEC_DISABLED);
std::unique_ptr<SessionDescription> offer =
- f1_.CreateOfferOrError(CreatePlanBMediaSessionOptions(), nullptr)
- .MoveValue();
+ f1_.CreateOfferOrError(CreateAudioMediaSession(), nullptr).MoveValue();
ASSERT_TRUE(offer.get());
ContentInfo* offer_content = offer->GetContentByName("audio");
ASSERT_TRUE(offer_content);
AudioContentDescription* offer_audio_desc =
offer_content->media_description()->as_audio();
- offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+ offer_audio_desc->set_protocol(kMediaProtocolDtlsSavpf);
std::unique_ptr<SessionDescription> answer =
- f2_.CreateAnswerOrError(offer.get(), CreatePlanBMediaSessionOptions(),
- nullptr)
+ f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr)
.MoveValue();
ASSERT_TRUE(answer);
ContentInfo* answer_content = answer->GetContentByName("audio");
@@ -3833,18 +3835,16 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) {
tdf2_.set_secure(SEC_ENABLED);
std::unique_ptr<SessionDescription> offer =
- f1_.CreateOfferOrError(CreatePlanBMediaSessionOptions(), nullptr)
- .MoveValue();
+ f1_.CreateOfferOrError(CreateAudioMediaSession(), nullptr).MoveValue();
ASSERT_TRUE(offer.get());
ContentInfo* offer_content = offer->GetContentByName("audio");
ASSERT_TRUE(offer_content);
AudioContentDescription* offer_audio_desc =
offer_content->media_description()->as_audio();
- offer_audio_desc->set_protocol(cricket::kMediaProtocolDtlsSavpf);
+ offer_audio_desc->set_protocol(kMediaProtocolDtlsSavpf);
std::unique_ptr<SessionDescription> answer =
- f2_.CreateAnswerOrError(offer.get(), CreatePlanBMediaSessionOptions(),
- nullptr)
+ f2_.CreateAnswerOrError(offer.get(), CreateAudioMediaSession(), nullptr)
.MoveValue();
ASSERT_TRUE(answer);
@@ -3854,7 +3854,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestOfferDtlsSavpfCreateAnswer) {
const AudioContentDescription* answer_audio_desc =
answer_content->media_description()->as_audio();
- EXPECT_EQ(cricket::kMediaProtocolDtlsSavpf, answer_audio_desc->protocol());
+ EXPECT_EQ(kMediaProtocolDtlsSavpf, answer_audio_desc->protocol());
}
// Test that we include both SDES and DTLS in the offer, but only include SDES
@@ -3867,10 +3867,10 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoDtls) {
MediaSessionOptions options;
AddAudioVideoSections(RtpTransceiverDirection::kRecvOnly, &options);
std::unique_ptr<SessionDescription> offer, answer;
- const cricket::MediaContentDescription* audio_media_desc;
- const cricket::MediaContentDescription* video_media_desc;
- const cricket::TransportDescription* audio_trans_desc;
- const cricket::TransportDescription* video_trans_desc;
+ const MediaContentDescription* audio_media_desc;
+ const MediaContentDescription* video_media_desc;
+ const TransportDescription* audio_trans_desc;
+ const TransportDescription* video_trans_desc;
// Generate an offer with SDES and DTLS support.
offer = f1_.CreateOfferOrError(options, nullptr).MoveValue();
@@ -3919,8 +3919,8 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoDtls) {
ASSERT_TRUE(video_media_desc);
EXPECT_TRUE(audio_media_desc->cryptos().empty());
EXPECT_TRUE(video_media_desc->cryptos().empty());
- EXPECT_EQ(cricket::kMediaProtocolSavpf, audio_media_desc->protocol());
- EXPECT_EQ(cricket::kMediaProtocolSavpf, video_media_desc->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, audio_media_desc->protocol());
+ EXPECT_EQ(kMediaProtocolSavpf, video_media_desc->protocol());
audio_trans_desc = answer->GetTransportDescriptionByName("audio");
ASSERT_TRUE(audio_trans_desc);
@@ -3951,7 +3951,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoDtls) {
// Test that an answer can't be created if cryptos are required but the offer is
// unsecure.
TEST_F(MediaSessionDescriptionFactoryTest, TestSecureAnswerToUnsecureOffer) {
- MediaSessionOptions options = CreatePlanBMediaSessionOptions();
+ MediaSessionOptions options = CreateAudioMediaSession();
f1_.set_secure(SEC_DISABLED);
tdf1_.set_secure(SEC_DISABLED);
f2_.set_secure(SEC_REQUIRED);
@@ -3987,10 +3987,10 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoOfferDtlsButNotSdes) {
GetFirstVideoContentDescription(offer.get());
ASSERT_TRUE(video_offer->cryptos().empty());
- const cricket::TransportDescription* audio_offer_trans_desc =
+ const TransportDescription* audio_offer_trans_desc =
offer->GetTransportDescriptionByName("audio");
ASSERT_TRUE(audio_offer_trans_desc->identity_fingerprint.get());
- const cricket::TransportDescription* video_offer_trans_desc =
+ const TransportDescription* video_offer_trans_desc =
offer->GetTransportDescriptionByName("video");
ASSERT_TRUE(video_offer_trans_desc->identity_fingerprint.get());
@@ -3999,10 +3999,10 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestCryptoOfferDtlsButNotSdes) {
f2_.CreateAnswerOrError(offer.get(), options, nullptr).MoveValue();
ASSERT_TRUE(answer.get());
- const cricket::TransportDescription* audio_answer_trans_desc =
+ const TransportDescription* audio_answer_trans_desc =
answer->GetTransportDescriptionByName("audio");
EXPECT_TRUE(audio_answer_trans_desc->identity_fingerprint.get());
- const cricket::TransportDescription* video_answer_trans_desc =
+ const TransportDescription* video_answer_trans_desc =
answer->GetTransportDescriptionByName("video");
EXPECT_TRUE(video_answer_trans_desc->identity_fingerprint.get());
}
@@ -4337,51 +4337,55 @@ TEST_F(MediaSessionDescriptionFactoryTest,
EXPECT_EQ(vcd1->codecs()[0].id, vcd2->codecs()[0].id);
}
-// Test verifying that negotiating codecs with the same packetization retains
-// the packetization value.
-TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsEqual) {
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
- f1_codecs.back().packetization = "raw";
- f1_.set_video_codecs(f1_codecs, f1_codecs);
-
- std::vector f2_codecs = {cricket::CreateVideoCodec(96, "H264")};
- f2_codecs.back().packetization = "raw";
- f2_.set_video_codecs(f2_codecs, f2_codecs);
+TEST_F(MediaSessionDescriptionFactoryTest,
+ DoesntReusePayloadIdWhenAddingExistingCodecWithDifferentPacketization) {
+ VideoCodec vp8 = CreateVideoCodec(96, "VP8");
+ VideoCodec vp8_raw = CreateVideoCodec(98, "VP8");
+ vp8_raw.packetization = "raw";
+ VideoCodec vp9 = CreateVideoCodec(98, "VP9");
+ f1_.set_video_codecs({vp8, vp9}, {vp8, vp9});
MediaSessionOptions opts;
- AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video1",
+ AddMediaDescriptionOptions(MEDIA_TYPE_VIDEO, "video",
RtpTransceiverDirection::kSendRecv, kActive,
&opts);
- // Create an offer with two video sections using same codecs.
std::unique_ptr<SessionDescription> offer =
f1_.CreateOfferOrError(opts, nullptr).MoveValue();
- ASSERT_TRUE(offer);
- ASSERT_EQ(1u, offer->contents().size());
- const VideoContentDescription* vcd1 =
- offer->contents()[0].media_description()->as_video();
- ASSERT_EQ(1u, vcd1->codecs().size());
- EXPECT_EQ(vcd1->codecs()[0].packetization, "raw");
+ ASSERT_THAT(offer, NotNull());
+ VideoContentDescription& video =
+ *offer->contents()[0].media_description()->as_video();
+ video.set_codecs({vp8, vp8_raw});
+ std::unique_ptr<SessionDescription> updated_offer =
+ f1_.CreateOfferOrError(opts, offer.get()).MoveValue();
+ ASSERT_THAT(updated_offer, NotNull());
- // Create answer and negotiate the codecs.
- std::unique_ptr<SessionDescription> answer =
- f2_.CreateAnswerOrError(offer.get(), opts, nullptr).MoveValue();
- ASSERT_TRUE(answer);
- ASSERT_EQ(1u, answer->contents().size());
- vcd1 = answer->contents()[0].media_description()->as_video();
- ASSERT_EQ(1u, vcd1->codecs().size());
- EXPECT_EQ(vcd1->codecs()[0].packetization, "raw");
+ VideoContentDescription& updated_video =
+ *updated_offer->contents()[0].media_description()->as_video();
+ EXPECT_THAT(
+ updated_video.codecs(),
+ ElementsAre(AllOf(Field(&cricket::Codec::name, "VP8"),
+ Field(&cricket::Codec::packetization, absl::nullopt)),
+ AllOf(Field(&cricket::Codec::name, "VP8"),
+ Field(&cricket::Codec::packetization, "raw")),
+ AllOf(Field(&cricket::Codec::name, "VP9"),
+ Field(&cricket::Codec::packetization, absl::nullopt))));
+ std::set<int> used_ids;
+ for (const VideoCodec& c : updated_video.codecs()) {
+ used_ids.insert(c.id);
+ }
+ EXPECT_THAT(used_ids, AllOf(SizeIs(3), IsSupersetOf({96, 98})));
}
-// Test verifying that negotiating codecs with different packetization removes
+// Test verifying that negotiating codecs with the same packetization retains
// the packetization value.
-TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsDifferent) {
- std::vector f1_codecs = {cricket::CreateVideoCodec(96, "H264")};
+TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsEqual) {
+ std::vector f1_codecs = {CreateVideoCodec(96, "H264")};
f1_codecs.back().packetization = "raw";
f1_.set_video_codecs(f1_codecs, f1_codecs);
- std::vector f2_codecs = {cricket::CreateVideoCodec(96, "H264")};
- f2_codecs.back().packetization = "notraw";
+ std::vector f2_codecs = {CreateVideoCodec(96, "H264")};
+ f2_codecs.back().packetization = "raw";
f2_.set_video_codecs(f2_codecs, f2_codecs);
MediaSessionOptions opts;
@@ -4406,7 +4410,7 @@ TEST_F(MediaSessionDescriptionFactoryTest, PacketizationIsDifferent) {
ASSERT_EQ(1u, answer->contents().size());
vcd1 = answer->contents()[0].media_description()->as_video();
ASSERT_EQ(1u, vcd1->codecs().size());
- EXPECT_EQ(vcd1->codecs()[0].packetization, absl::nullopt);
+ EXPECT_EQ(vcd1->codecs()[0].packetization, "raw");
}
// Test that the codec preference order per media section is respected in
@@ -4549,12 +4553,12 @@ TEST_F(MediaSessionDescriptionFactoryTest,
H264MatchCriteriaIncludesPacketizationMode) {
// Create two H264 codecs with the same profile level ID and different
// packetization modes.
- VideoCodec h264_pm0 = cricket::CreateVideoCodec(96, "H264");
- h264_pm0.params[cricket::kH264FmtpProfileLevelId] = "42c01f";
- h264_pm0.params[cricket::kH264FmtpPacketizationMode] = "0";
- VideoCodec h264_pm1 = cricket::CreateVideoCodec(97, "H264");
- h264_pm1.params[cricket::kH264FmtpProfileLevelId] = "42c01f";
- h264_pm1.params[cricket::kH264FmtpPacketizationMode] = "1";
+ VideoCodec h264_pm0 = CreateVideoCodec(96, "H264");
+ h264_pm0.params[kH264FmtpProfileLevelId] = "42c01f";
+ h264_pm0.params[kH264FmtpPacketizationMode] = "0";
+ VideoCodec h264_pm1 = CreateVideoCodec(97, "H264");
+ h264_pm1.params[kH264FmtpProfileLevelId] = "42c01f";
+ h264_pm1.params[kH264FmtpPacketizationMode] = "1";
// Offerer will send both codecs, answerer should choose the one with matching
// packetization mode (and not the first one it sees).
@@ -4583,7 +4587,7 @@ TEST_F(MediaSessionDescriptionFactoryTest,
EXPECT_EQ(h264_pm1.id, answer_codec.id);
}
-class MediaProtocolTest : public ::testing::TestWithParam<const char*> {
+class MediaProtocolTest : public testing::TestWithParam<const char*> {
public:
MediaProtocolTest()
: tdf1_(field_trials_),
@@ -4644,10 +4648,10 @@ TEST_P(MediaProtocolTest, TestAudioVideoAcceptance) {
INSTANTIATE_TEST_SUITE_P(MediaProtocolPatternTest,
MediaProtocolTest,
- ::testing::ValuesIn(kMediaProtocols));
+ ValuesIn(kMediaProtocols));
INSTANTIATE_TEST_SUITE_P(MediaProtocolDtlsPatternTest,
MediaProtocolTest,
- ::testing::ValuesIn(kMediaProtocolsDtls));
+ ValuesIn(kMediaProtocolsDtls));
TEST_F(MediaSessionDescriptionFactoryTest, TestSetAudioCodecs) {
webrtc::test::ScopedKeyValueConfig field_trials;
@@ -4666,13 +4670,13 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestSetAudioCodecs) {
MAKE_VECTOR(kAudioCodecsAnswer);
const std::vector<AudioCodec> no_codecs;
- RTC_CHECK_EQ(send_codecs[1].name, "iLBC")
+ RTC_CHECK_EQ(send_codecs[2].name, "iLBC")
<< "Please don't change shared test data!";
RTC_CHECK_EQ(recv_codecs[2].name, "iLBC")
<< "Please don't change shared test data!";
// Alter iLBC send codec to have zero channels, to test that that is handled
// properly.
- send_codecs[1].channels = 0;
+ send_codecs[2].channels = 0;
// Alter iLBC receive codec to be lowercase, to test that case conversions
// are handled properly.
@@ -4703,17 +4707,15 @@ TEST_F(MediaSessionDescriptionFactoryTest, TestSetAudioCodecs) {
EXPECT_EQ(no_codecs, sf.audio_sendrecv_codecs());
}
-namespace {
// Compare the two vectors of codecs ignoring the payload type.
-bool CodecsMatch(const std::vector<cricket::Codec>& codecs1,
- const std::vector<cricket::Codec>& codecs2,
- const webrtc::FieldTrialsView* field_trials) {
+bool CodecsMatch(const std::vector<Codec>& codecs1,
+ const std::vector<Codec>& codecs2) {
if (codecs1.size() != codecs2.size()) {
return false;
}
for (size_t i = 0; i < codecs1.size(); ++i) {
- if (!codecs1[i].Matches(codecs2[i], field_trials)) {
+ if (!codecs1[i].Matches(codecs2[i])) {
return false;
}
}
@@ -4757,23 +4759,23 @@ void TestAudioCodecsOffer(RtpTransceiverDirection direction) {
// might eventually be used anything, but we don't know more at this
// moment.
if (acd->direction() == RtpTransceiverDirection::kSendOnly) {
- EXPECT_TRUE(CodecsMatch(send_codecs, acd->codecs(), &field_trials));
+ EXPECT_TRUE(CodecsMatch(send_codecs, acd->codecs()));
} else if (acd->direction() == RtpTransceiverDirection::kRecvOnly) {
- EXPECT_TRUE(CodecsMatch(recv_codecs, acd->codecs(), &field_trials));
+ EXPECT_TRUE(CodecsMatch(recv_codecs, acd->codecs()));
} else {
- EXPECT_TRUE(CodecsMatch(sendrecv_codecs, acd->codecs(), &field_trials));
+ EXPECT_TRUE(CodecsMatch(sendrecv_codecs, acd->codecs()));
}
}
}
-static const AudioCodec kOfferAnswerCodecs[] = {
- cricket::CreateAudioCodec(0, "codec0", 16000, 1),
- cricket::CreateAudioCodec(1, "codec1", 8000, 1),
- cricket::CreateAudioCodec(2, "codec2", 8000, 1),
- cricket::CreateAudioCodec(3, "codec3", 8000, 1),
- cricket::CreateAudioCodec(4, "codec4", 8000, 2),
- cricket::CreateAudioCodec(5, "codec5", 32000, 1),
- cricket::CreateAudioCodec(6, "codec6", 48000, 1)};
+const AudioCodec kOfferAnswerCodecs[] = {
+ CreateAudioCodec(0, "codec0", 16000, 1),
+ CreateAudioCodec(1, "codec1", 8000, 1),
+ CreateAudioCodec(2, "codec2", 8000, 1),
+ CreateAudioCodec(3, "codec3", 8000, 1),
+ CreateAudioCodec(4, "codec4", 8000, 2),
+ CreateAudioCodec(5, "codec5", 32000, 1),
+ CreateAudioCodec(6, "codec6", 48000, 1)};
/* The codecs groups below are chosen as per the matrix below. The objective
* is to have different sets of codecs in the inputs, to get unique sets of
@@ -4794,18 +4796,18 @@ static const AudioCodec kOfferAnswerCodecs[] = {
* 6 | x x x | x x x | x x x x x
*/
// Codecs used by offerer in the AudioCodecsAnswerTest
-static const int kOfferSendCodecs[] = {0, 1, 3, 5, 6};
-static const int kOfferRecvCodecs[] = {1, 2, 3, 4, 6};
+const int kOfferSendCodecs[] = {0, 1, 3, 5, 6};
+const int kOfferRecvCodecs[] = {1, 2, 3, 4, 6};
// Codecs used in the answerer in the AudioCodecsAnswerTest. The order is
// jumbled to catch the answer not following the order in the offer.
-static const int kAnswerSendCodecs[] = {6, 5, 2, 3, 4};
-static const int kAnswerRecvCodecs[] = {6, 5, 4, 1, 0};
+const int kAnswerSendCodecs[] = {6, 5, 2, 3, 4};
+const int kAnswerRecvCodecs[] = {6, 5, 4, 1, 0};
// The resulting sets of codecs in the answer in the AudioCodecsAnswerTest
-static const int kResultSend_RecvCodecs[] = {0, 1, 5, 6};
-static const int kResultRecv_SendCodecs[] = {2, 3, 4, 6};
-static const int kResultSendrecv_SendCodecs[] = {3, 6};
-static const int kResultSendrecv_RecvCodecs[] = {1, 6};
-static const int kResultSendrecv_SendrecvCodecs[] = {6};
+const int kResultSend_RecvCodecs[] = {0, 1, 5, 6};
+const int kResultRecv_SendCodecs[] = {2, 3, 4, 6};
+const int kResultSendrecv_SendCodecs[] = {3, 6};
+const int kResultSendrecv_RecvCodecs[] = {1, 6};
+const int kResultSendrecv_SendrecvCodecs[] = {6};
template <typename T, int IDXS>
std::vector<T> VectorFromIndices(const T* array, const int (&indices)[IDXS]) {
@@ -4932,10 +4934,7 @@ void TestAudioCodecsAnswer(RtpTransceiverDirection offer_direction,
}
}
-} // namespace
-
-class AudioCodecsOfferTest
- : public ::testing::TestWithParam<RtpTransceiverDirection> {};
+using AudioCodecsOfferTest = testing::TestWithParam<RtpTransceiverDirection>;
TEST_P(AudioCodecsOfferTest, TestCodecsInOffer) {
TestAudioCodecsOffer(GetParam());
@@ -4943,31 +4942,30 @@ TEST_P(AudioCodecsOfferTest, TestCodecsInOffer) {
INSTANTIATE_TEST_SUITE_P(MediaSessionDescriptionFactoryTest,
AudioCodecsOfferTest,
- ::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive));
+ Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive));
-class AudioCodecsAnswerTest
- : public ::testing::TestWithParam<::testing::tuple<RtpTransceiverDirection,
- RtpTransceiverDirection,
- bool>> {};
+using AudioCodecsAnswerTest = testing::TestWithParam<
+ std::tuple<RtpTransceiverDirection, RtpTransceiverDirection, bool>>;
TEST_P(AudioCodecsAnswerTest, TestCodecsInAnswer) {
- TestAudioCodecsAnswer(::testing::get<0>(GetParam()),
- ::testing::get<1>(GetParam()),
- ::testing::get<2>(GetParam()));
-}
-
-INSTANTIATE_TEST_SUITE_P(
- MediaSessionDescriptionFactoryTest,
- AudioCodecsAnswerTest,
- ::testing::Combine(::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive),
- ::testing::Values(RtpTransceiverDirection::kSendOnly,
- RtpTransceiverDirection::kRecvOnly,
- RtpTransceiverDirection::kSendRecv,
- RtpTransceiverDirection::kInactive),
- ::testing::Bool()));
+ TestAudioCodecsAnswer(std::get<0>(GetParam()), std::get<1>(GetParam()),
+ std::get<2>(GetParam()));
+}
+
+INSTANTIATE_TEST_SUITE_P(MediaSessionDescriptionFactoryTest,
+ AudioCodecsAnswerTest,
+ Combine(Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive),
+ Values(RtpTransceiverDirection::kSendOnly,
+ RtpTransceiverDirection::kRecvOnly,
+ RtpTransceiverDirection::kSendRecv,
+ RtpTransceiverDirection::kInactive),
+ Bool()));
+
+} // namespace
+} // namespace cricket
diff --git a/pc/media_stream_unittest.cc b/pc/media_stream_unittest.cc
index f55ea203fb..d6c79efae9 100644
--- a/pc/media_stream_unittest.cc
+++ b/pc/media_stream_unittest.cc
@@ -91,7 +91,7 @@ TEST_F(MediaStreamTest, GetTrackInfo) {
ASSERT_EQ(1u, stream_->GetAudioTracks().size());
// Verify the video track.
- scoped_refptr<webrtc::MediaStreamTrackInterface> video_track(
+ scoped_refptr<MediaStreamTrackInterface> video_track(
stream_->GetVideoTracks()[0]);
EXPECT_EQ(0, video_track->id().compare(kVideoTrackId));
EXPECT_TRUE(video_track->enabled());
@@ -105,7 +105,7 @@ TEST_F(MediaStreamTest, GetTrackInfo) {
EXPECT_TRUE(video_track->enabled());
// Verify the audio track.
- scoped_refptr<webrtc::MediaStreamTrackInterface> audio_track(
+ scoped_refptr<MediaStreamTrackInterface> audio_track(
stream_->GetAudioTracks()[0]);
EXPECT_EQ(0, audio_track->id().compare(kAudioTrackId));
EXPECT_TRUE(audio_track->enabled());
@@ -139,14 +139,12 @@ TEST_F(MediaStreamTest, RemoveTrack) {
}
TEST_F(MediaStreamTest, ChangeVideoTrack) {
- scoped_refptr<webrtc::VideoTrackInterface> video_track(
- stream_->GetVideoTracks()[0]);
+ scoped_refptr<VideoTrackInterface> video_track(stream_->GetVideoTracks()[0]);
ChangeTrack(video_track.get());
}
TEST_F(MediaStreamTest, ChangeAudioTrack) {
- scoped_refptr<webrtc::AudioTrackInterface> audio_track(
- stream_->GetAudioTracks()[0]);
+ scoped_refptr<AudioTrackInterface> audio_track(stream_->GetAudioTracks()[0]);
ChangeTrack(audio_track.get());
}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index cde3d91047..8cb0825336 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -185,7 +185,7 @@ IceCandidatePairType GetIceCandidatePairCounter(
absl::optional<int> RTCConfigurationToIceConfigOptionalInt(
int rtc_configuration_parameter) {
if (rtc_configuration_parameter ==
- webrtc::PeerConnectionInterface::RTCConfiguration::kUndefined) {
+ PeerConnectionInterface::RTCConfiguration::kUndefined) {
return absl::nullopt;
}
return rtc_configuration_parameter;
@@ -264,6 +264,87 @@ RTCError ValidateConfiguration(
ParseIceConfig(config));
}
+// Checks for valid pool size range and if a previous value has already been
+// set, which is done via SetLocalDescription.
+RTCError ValidateIceCandidatePoolSize(
+ int ice_candidate_pool_size,
+ absl::optional<int> previous_ice_candidate_pool_size) {
+ // Note that this isn't possible through chromium, since it's an unsigned
+ // short in WebIDL.
+ if (ice_candidate_pool_size < 0 ||
+ ice_candidate_pool_size > static_cast<int>(UINT16_MAX)) {
+ return RTCError(RTCErrorType::INVALID_RANGE);
+ }
+
+ // According to JSEP, after setLocalDescription, changing the candidate pool
+ // size is not allowed, and changing the set of ICE servers will not result
+ // in new candidates being gathered.
+ if (previous_ice_candidate_pool_size.has_value() &&
+ ice_candidate_pool_size != previous_ice_candidate_pool_size.value()) {
+ LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
+ "Can't change candidate pool size after calling "
+ "SetLocalDescription.");
+ }
+
+ return RTCError::OK();
+}
+
+// The simplest (and most future-compatible) way to tell if a config was
+// modified in an invalid way is to copy each property we do support modifying,
+// then use operator==. There are far more properties we don't support modifying
+// than those we do, and more could be added.
+// This helper function accepts a proposed new `configuration` object, an
+// existing configuration and returns a valid, modified, configuration that's
+// based on the existing configuration, with modified properties copied from
+// `configuration`.
+// If the result of creating a modified configuration doesn't pass the above
+// `operator==` test or a call to `ValidateConfiguration()`, then the function
+// will return an error. Otherwise, the return value will be the new config.
+RTCErrorOr<PeerConnectionInterface::RTCConfiguration> ApplyConfiguration(
+ const PeerConnectionInterface::RTCConfiguration& configuration,
+ const PeerConnectionInterface::RTCConfiguration& existing_configuration) {
+ PeerConnectionInterface::RTCConfiguration modified_config =
+ existing_configuration;
+ modified_config.servers = configuration.servers;
+ modified_config.type = configuration.type;
+ modified_config.ice_candidate_pool_size =
+ configuration.ice_candidate_pool_size;
+ modified_config.prune_turn_ports = configuration.prune_turn_ports;
+ modified_config.turn_port_prune_policy = configuration.turn_port_prune_policy;
+ modified_config.surface_ice_candidates_on_ice_transport_type_changed =
+ configuration.surface_ice_candidates_on_ice_transport_type_changed;
+ modified_config.ice_check_min_interval = configuration.ice_check_min_interval;
+ modified_config.ice_check_interval_strong_connectivity =
+ configuration.ice_check_interval_strong_connectivity;
+ modified_config.ice_check_interval_weak_connectivity =
+ configuration.ice_check_interval_weak_connectivity;
+ modified_config.ice_unwritable_timeout = configuration.ice_unwritable_timeout;
+ modified_config.ice_unwritable_min_checks =
+ configuration.ice_unwritable_min_checks;
+ modified_config.ice_inactive_timeout = configuration.ice_inactive_timeout;
+ modified_config.stun_candidate_keepalive_interval =
+ configuration.stun_candidate_keepalive_interval;
+ modified_config.turn_customizer = configuration.turn_customizer;
+ modified_config.network_preference = configuration.network_preference;
+ modified_config.active_reset_srtp_params =
+ configuration.active_reset_srtp_params;
+ modified_config.turn_logging_id = configuration.turn_logging_id;
+ modified_config.allow_codec_switching = configuration.allow_codec_switching;
+ modified_config.stable_writable_connection_ping_interval_ms =
+ configuration.stable_writable_connection_ping_interval_ms;
+ if (configuration != modified_config) {
+ LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
+ "Modifying the configuration in an unsupported way.");
+ }
+
+ RTCError err = ValidateConfiguration(modified_config);
+ if (!err.ok()) {
+ return err;
+ }
+
+ return modified_config;
+}
+
bool HasRtcpMuxEnabled(const cricket::ContentInfo* content) {
return content->media_description()->rtcp_mux();
}
@@ -286,6 +367,46 @@ bool DtlsEnabled(const PeerConnectionInterface::RTCConfiguration& configuration,
#endif
}
+// Calls `ParseIceServersOrError` to extract ice server information from the
+// `configuration` and then validates the extracted configuration. For a
+// non-empty list of servers, usage gets recorded via `usage_pattern`.
+RTCError ParseAndValidateIceServersFromConfiguration(
+ const PeerConnectionInterface::RTCConfiguration& configuration,
+ cricket::ServerAddresses& stun_servers,
+ std::vector<cricket::RelayServerConfig>& turn_servers,
+ UsagePattern& usage_pattern) {
+ RTC_DCHECK(stun_servers.empty());
+ RTC_DCHECK(turn_servers.empty());
+ RTCError err = ParseIceServersOrError(configuration.servers, &stun_servers,
+ &turn_servers);
+ if (!err.ok()) {
+ return err;
+ }
+
+ // Restrict number of TURN servers.
+ if (turn_servers.size() > cricket::kMaxTurnServers) {
+ RTC_LOG(LS_WARNING) << "Number of configured TURN servers is "
+ << turn_servers.size()
+ << " which exceeds the maximum allowed number of "
+ << cricket::kMaxTurnServers;
+ turn_servers.resize(cricket::kMaxTurnServers);
+ }
+
+ // Add the turn logging id to all turn servers
+ for (cricket::RelayServerConfig& turn_server : turn_servers) {
+ turn_server.turn_logging_id = configuration.turn_logging_id;
+ }
+
+ // Note if STUN or TURN servers were supplied.
+ if (!stun_servers.empty()) {
+ usage_pattern.NoteUsageEvent(UsageEvent::STUN_SERVER_ADDED);
+ }
+ if (!turn_servers.empty()) {
+ usage_pattern.NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
+ }
+ return RTCError::OK();
+}
+
} // namespace
bool PeerConnectionInterface::RTCConfiguration::operator==(
@@ -329,7 +450,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
absl::optional<int> ice_unwritable_min_checks;
absl::optional<int> ice_inactive_timeout;
absl::optional<int> stun_candidate_keepalive_interval;
- webrtc::TurnCustomizer* turn_customizer;
+ TurnCustomizer* turn_customizer;
SdpSemantics sdp_semantics;
absl::optional<rtc::AdapterType> network_preference;
bool active_reset_srtp_params;
@@ -340,7 +461,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
absl::optional<bool> allow_codec_switching;
absl::optional<int> report_usage_pattern_delay_ms;
absl::optional<int> stable_writable_connection_ping_interval_ms;
- webrtc::VpnPreference vpn_preference;
+ VpnPreference vpn_preference;
std::vector<rtc::NetworkMask> vpn_list;
PortAllocatorConfig port_allocator_config;
absl::optional<TimeDelta> pacer_burst_interval;
@@ -518,6 +639,9 @@ PeerConnection::PeerConnection(
ice_transport_factory_(std::move(dependencies.ice_transport_factory)),
tls_cert_verifier_(std::move(dependencies.tls_cert_verifier)),
call_(std::move(call)),
+ worker_thread_safety_(PendingTaskSafetyFlag::CreateAttachedToTaskQueue(
+ /*alive=*/call_ != nullptr,
+ worker_thread())),
call_ptr_(call_.get()),
// RFC 3264: The numeric value of the session id and version in the
// o line MUST be representable with a "64 bit signed integer".
@@ -527,14 +651,7 @@ PeerConnection::PeerConnection(
dtls_enabled_(dtls_enabled),
data_channel_controller_(this),
message_handler_(signaling_thread()),
- weak_factory_(this) {
- worker_thread()->BlockingCall([this] {
- RTC_DCHECK_RUN_ON(worker_thread());
- worker_thread_safety_ = PendingTaskSafetyFlag::Create();
- if (!call_)
- worker_thread_safety_->SetNotAlive();
- });
-}
+ weak_factory_(this) {}
PeerConnection::~PeerConnection() {
TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection");
@@ -566,10 +683,8 @@ PeerConnection::~PeerConnection() {
if (sdp_handler_) {
// Don't destroy BaseChannels until after stats has been cleaned up so that
// the last stats request can still read from the channels.
- sdp_handler_->DestroyAllChannels();
-
+ sdp_handler_->DestroyMediaChannels();
RTC_LOG(LS_INFO) << "Session: " << session_id() << " is destroyed.";
-
sdp_handler_->ResetSessionDescFactory();
}
@@ -584,6 +699,8 @@ PeerConnection::~PeerConnection() {
if (network_thread_safety_)
network_thread_safety_->SetNotAlive();
});
+ sctp_mid_s_.reset();
+ SetSctpTransportName("");
// call_ and event_log_ must be destroyed on the worker thread.
worker_thread()->BlockingCall([this] {
@@ -605,35 +722,12 @@ RTCError PeerConnection::Initialize(
cricket::ServerAddresses stun_servers;
std::vector<cricket::RelayServerConfig> turn_servers;
-
- RTCError parse_error = ParseIceServersOrError(configuration.servers,
- &stun_servers, &turn_servers);
+ RTCError parse_error = ParseAndValidateIceServersFromConfiguration(
+ configuration, stun_servers, turn_servers, usage_pattern_);
if (!parse_error.ok()) {
return parse_error;
}
- // Restrict number of TURN servers.
- if (turn_servers.size() > cricket::kMaxTurnServers) {
- RTC_LOG(LS_WARNING) << "Number of configured TURN servers is "
- << turn_servers.size()
- << " which exceeds the maximum allowed number of "
- << cricket::kMaxTurnServers;
- turn_servers.resize(cricket::kMaxTurnServers);
- }
-
- // Add the turn logging id to all turn servers
- for (cricket::RelayServerConfig& turn_server : turn_servers) {
- turn_server.turn_logging_id = configuration.turn_logging_id;
- }
-
- // Note if STUN or TURN servers were supplied.
- if (!stun_servers.empty()) {
- NoteUsageEvent(UsageEvent::STUN_SERVER_ADDED);
- }
- if (!turn_servers.empty()) {
- NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
- }
-
// Network thread initialization.
transport_controller_copy_ = network_thread()->BlockingCall([&] {
RTC_DCHECK_RUN_ON(network_thread());
@@ -1505,106 +1599,42 @@ RTCError PeerConnection::SetConfiguration(
"SetConfiguration: PeerConnection is closed.");
}
- // According to JSEP, after setLocalDescription, changing the candidate pool
- // size is not allowed, and changing the set of ICE servers will not result
- // in new candidates being gathered.
- if (local_description() && configuration.ice_candidate_pool_size !=
- configuration_.ice_candidate_pool_size) {
- LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
- "Can't change candidate pool size after calling "
- "SetLocalDescription.");
+ const bool has_local_description = local_description() != nullptr;
+
+ RTCError validate_error = ValidateIceCandidatePoolSize(
+ configuration.ice_candidate_pool_size,
+ has_local_description
+ ? absl::optional<int>(configuration_.ice_candidate_pool_size)
+ : absl::nullopt);
+ if (!validate_error.ok()) {
+ return validate_error;
}
- if (local_description() &&
+ if (has_local_description &&
configuration.crypto_options != configuration_.crypto_options) {
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
"Can't change crypto_options after calling "
"SetLocalDescription.");
}
- // The simplest (and most future-compatible) way to tell if the config was
- // modified in an invalid way is to copy each property we do support
- // modifying, then use operator==. There are far more properties we don't
- // support modifying than those we do, and more could be added.
- RTCConfiguration modified_config = configuration_;
- modified_config.servers = configuration.servers;
- modified_config.type = configuration.type;
- modified_config.ice_candidate_pool_size =
- configuration.ice_candidate_pool_size;
- modified_config.prune_turn_ports = configuration.prune_turn_ports;
- modified_config.turn_port_prune_policy = configuration.turn_port_prune_policy;
- modified_config.surface_ice_candidates_on_ice_transport_type_changed =
- configuration.surface_ice_candidates_on_ice_transport_type_changed;
- modified_config.ice_check_min_interval = configuration.ice_check_min_interval;
- modified_config.ice_check_interval_strong_connectivity =
- configuration.ice_check_interval_strong_connectivity;
- modified_config.ice_check_interval_weak_connectivity =
- configuration.ice_check_interval_weak_connectivity;
- modified_config.ice_unwritable_timeout = configuration.ice_unwritable_timeout;
- modified_config.ice_unwritable_min_checks =
- configuration.ice_unwritable_min_checks;
- modified_config.ice_inactive_timeout = configuration.ice_inactive_timeout;
- modified_config.stun_candidate_keepalive_interval =
- configuration.stun_candidate_keepalive_interval;
- modified_config.turn_customizer = configuration.turn_customizer;
- modified_config.network_preference = configuration.network_preference;
- modified_config.active_reset_srtp_params =
- configuration.active_reset_srtp_params;
- modified_config.turn_logging_id = configuration.turn_logging_id;
- modified_config.allow_codec_switching = configuration.allow_codec_switching;
- modified_config.stable_writable_connection_ping_interval_ms =
- configuration.stable_writable_connection_ping_interval_ms;
- if (configuration != modified_config) {
- LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
- "Modifying the configuration in an unsupported way.");
- }
-
- // Validate the modified configuration.
- RTCError validate_error = ValidateConfiguration(modified_config);
- if (!validate_error.ok()) {
- return validate_error;
- }
-
- // Note that this isn't possible through chromium, since it's an unsigned
- // short in WebIDL.
- if (configuration.ice_candidate_pool_size < 0 ||
- configuration.ice_candidate_pool_size > static_cast<int>(UINT16_MAX)) {
- return RTCError(RTCErrorType::INVALID_RANGE);
+ // Create a new, configuration object whose Ice config will have been
+ // validated..
+ RTCErrorOr<RTCConfiguration> validated_config =
+ ApplyConfiguration(configuration, configuration_);
+ if (!validated_config.ok()) {
+ return validated_config.error();
}
// Parse ICE servers before hopping to network thread.
cricket::ServerAddresses stun_servers;
std::vector<cricket::RelayServerConfig> turn_servers;
- RTCError parse_error = ParseIceServersOrError(configuration.servers,
- &stun_servers, &turn_servers);
- if (!parse_error.ok()) {
- return parse_error;
- }
-
- // Restrict number of TURN servers.
- if (turn_servers.size() > cricket::kMaxTurnServers) {
- RTC_LOG(LS_WARNING) << "Number of configured TURN servers is "
- << turn_servers.size()
- << " which exceeds the maximum allowed number of "
- << cricket::kMaxTurnServers;
- turn_servers.resize(cricket::kMaxTurnServers);
- }
-
- // Add the turn logging id to all turn servers
- for (cricket::RelayServerConfig& turn_server : turn_servers) {
- turn_server.turn_logging_id = configuration.turn_logging_id;
- }
-
- // Note if STUN or TURN servers were supplied.
- if (!stun_servers.empty()) {
- NoteUsageEvent(UsageEvent::STUN_SERVER_ADDED);
- }
- if (!turn_servers.empty()) {
- NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
+ validate_error = ParseAndValidateIceServersFromConfiguration(
+ configuration, stun_servers, turn_servers, usage_pattern_);
+ if (!validate_error.ok()) {
+ return validate_error;
}
- const bool has_local_description = local_description() != nullptr;
-
+ const RTCConfiguration& modified_config = validated_config.value();
const bool needs_ice_restart =
modified_config.servers != configuration_.servers ||
NeedIceRestart(
@@ -1628,6 +1658,8 @@ RTCError PeerConnection::SetConfiguration(
transport_controller_->SetNeedsIceRestartFlag();
transport_controller_->SetIceConfig(ice_config);
+ transport_controller_->SetActiveResetSrtpParams(
+ modified_config.active_reset_srtp_params);
return ReconfigurePortAllocator_n(
stun_servers, turn_servers, modified_config.type,
modified_config.ice_candidate_pool_size,
@@ -1640,37 +1672,6 @@ RTCError PeerConnection::SetConfiguration(
"Failed to apply configuration to PortAllocator.");
}
- if (configuration_.active_reset_srtp_params !=
- modified_config.active_reset_srtp_params) {
- // TODO(tommi): merge BlockingCalls
- network_thread()->BlockingCall([this, &modified_config] {
- RTC_DCHECK_RUN_ON(network_thread());
- transport_controller_->SetActiveResetSrtpParams(
- modified_config.active_reset_srtp_params);
- });
- }
-
- if (modified_config.allow_codec_switching.has_value()) {
- std::vector<cricket::VideoMediaSendChannelInterface*> channels;
- for (const auto& transceiver : rtp_manager()->transceivers()->List()) {
- if (transceiver->media_type() != cricket::MEDIA_TYPE_VIDEO)
- continue;
-
- auto* video_channel = transceiver->internal()->channel();
- if (video_channel)
- channels.push_back(
- static_cast<cricket::VideoMediaSendChannelInterface*>(
- video_channel->media_send_channel()));
- }
-
- worker_thread()->BlockingCall(
- [channels = std::move(channels),
- allow_codec_switching = *modified_config.allow_codec_switching]() {
- for (auto* ch : channels)
- ch->SetVideoCodecSwitchingEnabled(allow_codec_switching);
- });
- }
-
configuration_ = modified_config;
return RTCError::OK();
}
@@ -1687,7 +1688,7 @@ void PeerConnection::AddIceCandidate(
std::function<void(RTCError)> callback) {
RTC_DCHECK_RUN_ON(signaling_thread());
sdp_handler_->AddIceCandidate(std::move(candidate),
- [this, callback](webrtc::RTCError result) {
+ [this, callback](RTCError result) {
ClearStatsCache();
callback(result);
});
@@ -1791,7 +1792,7 @@ bool PeerConnection::StartRtcEventLog(
std::unique_ptr<RtcEventLogOutput> output) {
int64_t output_period_ms = 5000;
if (trials().IsDisabled("WebRTC-RtcEventLogNewFormat")) {
- output_period_ms = webrtc::RtcEventLog::kImmediateOutput;
+ output_period_ms = RtcEventLog::kImmediateOutput;
}
return StartRtcEventLog(std::move(output), output_period_ms);
}
@@ -1899,7 +1900,12 @@ void PeerConnection::Close() {
// Don't destroy BaseChannels until after stats has been cleaned up so that
// the last stats request can still read from the channels.
- sdp_handler_->DestroyAllChannels();
+ // TODO(tommi): The voice/video channels will be partially uninitialized on
+ // the network thread (see `RtpTransceiver::ClearChannel`), partially on the
+ // worker thread (see `PushNewMediaChannelAndDeleteChannel`) and then
+ // eventually freed on the signaling thread.
+ // It would be good to combine those steps with the teardown steps here.
+ sdp_handler_->DestroyMediaChannels();
// The event log is used in the transport controller, which must be outlived
// by the former. CreateOffer by the peer connection is implemented
@@ -1912,12 +1918,8 @@ void PeerConnection::Close() {
}
network_thread()->BlockingCall([this] {
- // Data channels will already have been unset via the DestroyAllChannels()
- // call above, which triggers a call to TeardownDataChannelTransport_n().
- // TODO(tommi): ^^ That's not exactly optimal since this is yet another
- // blocking hop to the network thread during Close(). Further still, the
- // voice/video/data channels will be cleared on the worker thread.
RTC_DCHECK_RUN_ON(network_thread());
+ TeardownDataChannelTransport_n({});
transport_controller_.reset();
port_allocator_->DiscardCandidatePool();
if (network_thread_safety_) {
@@ -1925,6 +1927,9 @@ void PeerConnection::Close() {
}
});
+ sctp_mid_s_.reset();
+ SetSctpTransportName("");
+
worker_thread()->BlockingCall([this] {
RTC_DCHECK_RUN_ON(worker_thread());
worker_thread_safety_->SetNotAlive();
@@ -2027,13 +2032,13 @@ void PeerConnection::ReportFirstConnectUsageMetrics() {
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.ProvisionalAnswer", pranswer,
kProvisionalAnswerMax);
- // Record the number of valid / invalid ice-ufrag. We do allow certain
- // non-spec ice-char for backward-compat reasons. At this point we know
- // that the ufrag/pwd consists of a valid ice-char or one of the four
- // not allowed characters since we have passed the IsIceChar check done
- // by the p2p transport description on setRemoteDescription calls.
auto transport_infos = remote_description()->description()->transport_infos();
- if (transport_infos.size() > 0) {
+ if (!transport_infos.empty()) {
+ // Record the number of valid / invalid ice-ufrag. We do allow certain
+ // non-spec ice-char for backward-compat reasons. At this point we know
+ // that the ufrag/pwd consists of a valid ice-char or one of the four
+ // not allowed characters since we have passed the IsIceChar check done
+ // by the p2p transport description on setRemoteDescription calls.
auto ice_parameters = transport_infos[0].description.GetIceParameters();
auto is_invalid_char = [](char c) {
return c == '-' || c == '=' || c == '#' || c == '_';
@@ -2045,6 +2050,16 @@ void PeerConnection::ReportFirstConnectUsageMetrics() {
RTC_HISTOGRAM_BOOLEAN(
"WebRTC.PeerConnection.ValidIceChars",
!(isUsingInvalidIceCharInUfrag || isUsingInvalidIceCharInPwd));
+
+ // Record whether the hash algorithm of the first transport's
+ // DTLS fingerprint is still using SHA-1.
+ if (transport_infos[0].description.identity_fingerprint) {
+ RTC_HISTOGRAM_BOOLEAN(
+ "WebRTC.PeerConnection.DtlsFingerprintLegacySha1",
+ absl::EqualsIgnoreCase(
+ transport_infos[0].description.identity_fingerprint->algorithm,
+ "sha-1"));
+ }
}
// Record RtcpMuxPolicy setting.
@@ -2115,20 +2130,31 @@ void PeerConnection::OnSelectedCandidatePairChanged(
Observer()->OnIceSelectedCandidatePairChanged(event);
}
-absl::optional<std::string> PeerConnection::GetDataMid() const {
+bool PeerConnection::CreateDataChannelTransport(absl::string_view mid) {
RTC_DCHECK_RUN_ON(signaling_thread());
- return sctp_mid_s_;
-}
+ RTC_DCHECK(!sctp_mid().has_value() || mid == sctp_mid().value());
+ RTC_LOG(LS_INFO) << "Creating data channel, mid=" << mid;
+
+ absl::optional<std::string> transport_name =
+ network_thread()->BlockingCall([&] {
+ RTC_DCHECK_RUN_ON(network_thread());
+ return SetupDataChannelTransport_n(mid);
+ });
+ if (!transport_name)
+ return false;
-void PeerConnection::SetSctpDataInfo(absl::string_view mid,
- absl::string_view transport_name) {
- RTC_DCHECK_RUN_ON(signaling_thread());
sctp_mid_s_ = std::string(mid);
- SetSctpTransportName(std::string(transport_name));
+ SetSctpTransportName(transport_name.value());
+
+ return true;
}
-void PeerConnection::ResetSctpDataInfo() {
+void PeerConnection::DestroyDataChannelTransport(RTCError error) {
RTC_DCHECK_RUN_ON(signaling_thread());
+ network_thread()->BlockingCall([&] {
+ RTC_DCHECK_RUN_ON(network_thread());
+ TeardownDataChannelTransport_n(error);
+ });
sctp_mid_s_.reset();
SetSctpTransportName("");
}
@@ -2209,18 +2235,12 @@ bool PeerConnection::ReconfigurePortAllocator_n(
IceTransportsType type,
int candidate_pool_size,
PortPrunePolicy turn_port_prune_policy,
- webrtc::TurnCustomizer* turn_customizer,
+ TurnCustomizer* turn_customizer,
absl::optional<int> stun_candidate_keepalive_interval,
bool have_local_description) {
RTC_DCHECK_RUN_ON(network_thread());
port_allocator_->SetCandidateFilter(
ConvertIceTransportTypeToCandidateFilter(type));
- // According to JSEP, after setLocalDescription, changing the candidate pool
- // size is not allowed, and changing the set of ICE servers will not result
- // in new candidates being gathered.
- if (have_local_description) {
- port_allocator_->FreezeCandidatePool();
- }
// Add the custom tls turn servers if they exist.
auto turn_servers_copy = turn_servers;
for (auto& turn_server : turn_servers_copy) {
@@ -2885,6 +2905,36 @@ void PeerConnection::ReportNegotiatedCiphers(
}
}
}
+
+ uint16_t ssl_peer_signature_algorithm =
+ stats.channel_stats[0].ssl_peer_signature_algorithm;
+ if (ssl_peer_signature_algorithm != rtc::kSslSignatureAlgorithmUnknown) {
+ for (cricket::MediaType media_type : media_types) {
+ switch (media_type) {
+ case cricket::MEDIA_TYPE_AUDIO:
+ RTC_HISTOGRAM_ENUMERATION_SPARSE(
+ "WebRTC.PeerConnection.SslPeerSignatureAlgorithm.Audio",
+ ssl_peer_signature_algorithm,
+ rtc::kSslSignatureAlgorithmMaxValue);
+ break;
+ case cricket::MEDIA_TYPE_VIDEO:
+ RTC_HISTOGRAM_ENUMERATION_SPARSE(
+ "WebRTC.PeerConnection.SslPeerSignatureAlgorithm.Video",
+ ssl_peer_signature_algorithm,
+ rtc::kSslSignatureAlgorithmMaxValue);
+ break;
+ case cricket::MEDIA_TYPE_DATA:
+ RTC_HISTOGRAM_ENUMERATION_SPARSE(
+ "WebRTC.PeerConnection.SslPeerSignatureAlgorithm.Data",
+ ssl_peer_signature_algorithm,
+ rtc::kSslSignatureAlgorithmMaxValue);
+ break;
+ default:
+ RTC_DCHECK_NOTREACHED();
+ continue;
+ }
+ }
+ }
}
bool PeerConnection::OnTransportChanged(
diff --git a/pc/peer_connection.h b/pc/peer_connection.h
index aac1635484..a345089191 100644
--- a/pc/peer_connection.h
+++ b/pc/peer_connection.h
@@ -163,7 +163,7 @@ class PeerConnection : public PeerConnectionInternal,
const DataChannelInit* config) override;
// WARNING: LEGACY. See peerconnectioninterface.h
bool GetStats(StatsObserver* observer,
- webrtc::MediaStreamTrackInterface* track,
+ MediaStreamTrackInterface* track,
StatsOutputLevel level) override;
// Spec-complaint GetStats(). See peerconnectioninterface.h
void GetStats(RTCStatsCollectorCallback* callback) override;
@@ -394,15 +394,8 @@ class PeerConnection : public PeerConnectionInternal,
const std::map<std::string, const cricket::ContentGroup*>&
bundle_groups_by_mid) override;
- // Returns the MID for the data section associated with the
- // SCTP data channel, if it has been set. If no data
- // channels are configured this will return nullopt.
- absl::optional<std::string> GetDataMid() const override;
-
- void SetSctpDataInfo(absl::string_view mid,
- absl::string_view transport_name) override;
-
- void ResetSctpDataInfo() override;
+ bool CreateDataChannelTransport(absl::string_view mid) override;
+ void DestroyDataChannelTransport(RTCError error) override;
// Asynchronously calls SctpTransport::Start() on the network thread for
// `sctp_mid()` if set. Called as part of setting the local description.
@@ -430,9 +423,9 @@ class PeerConnection : public PeerConnectionInternal,
// this session.
bool SrtpRequired() const override;
- absl::optional<std::string> SetupDataChannelTransport_n(
- absl::string_view mid) override RTC_RUN_ON(network_thread());
- void TeardownDataChannelTransport_n(RTCError error) override
+ absl::optional<std::string> SetupDataChannelTransport_n(absl::string_view mid)
+ RTC_RUN_ON(network_thread());
+ void TeardownDataChannelTransport_n(RTCError error)
RTC_RUN_ON(network_thread());
const FieldTrialsView& trials() const override { return *trials_; }
@@ -517,7 +510,7 @@ class PeerConnection : public PeerConnectionInternal,
IceTransportsType type,
int candidate_pool_size,
PortPrunePolicy turn_port_prune_policy,
- webrtc::TurnCustomizer* turn_customizer,
+ TurnCustomizer* turn_customizer,
absl::optional<int> stun_candidate_keepalive_interval,
bool have_local_description);
@@ -609,7 +602,7 @@ class PeerConnection : public PeerConnectionInternal,
// a) Specified in PeerConnectionDependencies (owned).
// b) Accessed via ConnectionContext (e.g PeerConnectionFactoryDependencies>
// c) Created as Default (FieldTrialBasedConfig).
- const webrtc::AlwaysValidPointer<const FieldTrialsView, FieldTrialBasedConfig>
+ const AlwaysValidPointer<const FieldTrialsView, FieldTrialBasedConfig>
trials_;
const PeerConnectionFactoryInterface::Options options_;
PeerConnectionObserver* observer_ RTC_GUARDED_BY(signaling_thread()) =
@@ -641,7 +634,7 @@ class PeerConnection : public PeerConnectionInternal,
std::unique_ptr<cricket::PortAllocator>
port_allocator_; // TODO(bugs.webrtc.org/9987): Accessed on both
// signaling and network thread.
- const std::unique_ptr<webrtc::IceTransportFactory>
+ const std::unique_ptr<IceTransportFactory>
ice_transport_factory_; // TODO(bugs.webrtc.org/9987): Accessed on the
// signaling thread but the underlying raw
// pointer is given to
diff --git a/pc/peer_connection_bundle_unittest.cc b/pc/peer_connection_bundle_unittest.cc
index e5ef16ff8a..0db401276a 100644
--- a/pc/peer_connection_bundle_unittest.cc
+++ b/pc/peer_connection_bundle_unittest.cc
@@ -60,6 +60,7 @@
#include "pc/rtp_transport_internal.h"
#include "pc/sdp_utils.h"
#include "pc/session_description.h"
+#include "pc/test/integration_test_helpers.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -90,8 +91,6 @@ using ::testing::ElementsAre;
using ::testing::UnorderedElementsAre;
using ::testing::Values;
-constexpr int kDefaultTimeout = 10000;
-
// TODO(steveanton): These tests should be rewritten to use the standard
// RtpSenderInterface/DtlsTransportInterface objects once they're available in
// the API. The RtpSender can be used to determine which transport a given media
@@ -743,18 +742,18 @@ TEST_P(PeerConnectionBundleTest, ApplyDescriptionWithSameSsrcsBundledFails) {
caller->SetLocalDescription(CloneSessionDescription(offer.get())));
// Modify the remote SDP to make two m= sections have the same SSRC.
ASSERT_GE(offer->description()->contents().size(), 2U);
- offer->description()
- ->contents()[0]
- .media_description()
- ->mutable_streams()[0]
- .ssrcs[0] = 1111222;
- offer->description()
- ->contents()[1]
- .media_description()
- ->mutable_streams()[0]
- .ssrcs[0] = 1111222;
- EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer)));
+ ReplaceFirstSsrc(offer->description()
+ ->contents()[0]
+ .media_description()
+ ->mutable_streams()[0],
+ 1111222);
+ ReplaceFirstSsrc(offer->description()
+ ->contents()[1]
+ .media_description()
+ ->mutable_streams()[0],
+ 1111222);
+ EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer)));
// When BUNDLE is enabled, applying the description is expected to fail
// because the demuxing criteria can not be satisfied.
auto answer = callee->CreateAnswer(options);
@@ -774,16 +773,16 @@ TEST_P(PeerConnectionBundleTest,
caller->SetLocalDescription(CloneSessionDescription(offer.get())));
// Modify the remote SDP to make two m= sections have the same SSRC.
ASSERT_GE(offer->description()->contents().size(), 2U);
- offer->description()
- ->contents()[0]
- .media_description()
- ->mutable_streams()[0]
- .ssrcs[0] = 1111222;
- offer->description()
- ->contents()[1]
- .media_description()
- ->mutable_streams()[0]
- .ssrcs[0] = 1111222;
+ ReplaceFirstSsrc(offer->description()
+ ->contents()[0]
+ .media_description()
+ ->mutable_streams()[0],
+ 1111222);
+ ReplaceFirstSsrc(offer->description()
+ ->contents()[1]
+ .media_description()
+ ->mutable_streams()[0],
+ 1111222);
EXPECT_TRUE(callee->SetRemoteDescription(std::move(offer)));
// Without BUNDLE, demuxing is done per-transport.
diff --git a/pc/peer_connection_crypto_unittest.cc b/pc/peer_connection_crypto_unittest.cc
index dc350b2be0..a65988ab05 100644
--- a/pc/peer_connection_crypto_unittest.cc
+++ b/pc/peer_connection_crypto_unittest.cc
@@ -162,7 +162,7 @@ class PeerConnectionCryptoBaseTest : public ::testing::Test {
return transport_info->description.connection_role;
}
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::VirtualSocketServer> vss_;
rtc::AutoSocketServerThread main_;
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
diff --git a/pc/peer_connection_data_channel_unittest.cc b/pc/peer_connection_data_channel_unittest.cc
index 3bb2088866..8682cfa9fb 100644
--- a/pc/peer_connection_data_channel_unittest.cc
+++ b/pc/peer_connection_data_channel_unittest.cc
@@ -15,7 +15,6 @@
#include <vector>
#include "absl/types/optional.h"
-#include "api/call/call_factory_interface.h"
#include "api/jsep.h"
#include "api/media_types.h"
#include "api/peer_connection_interface.h"
@@ -24,8 +23,6 @@
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/transport/sctp_transport_factory_interface.h"
-#include "media/base/fake_media_engine.h"
-#include "media/base/media_engine.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/port_allocator.h"
#include "pc/media_session.h"
@@ -35,6 +32,7 @@
#include "pc/sctp_transport.h"
#include "pc/sdp_utils.h"
#include "pc/session_description.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
@@ -64,8 +62,7 @@ PeerConnectionFactoryDependencies CreatePeerConnectionFactoryDependencies() {
deps.worker_thread = rtc::Thread::Current();
deps.signaling_thread = rtc::Thread::Current();
deps.task_queue_factory = CreateDefaultTaskQueueFactory();
- deps.media_engine = std::make_unique<cricket::FakeMediaEngine>();
- deps.call_factory = CreateCallFactory();
+ EnableFakeMedia(deps);
deps.sctp_factory = std::make_unique<FakeSctpTransportFactory>();
return deps;
}
diff --git a/pc/peer_connection_encodings_integrationtest.cc b/pc/peer_connection_encodings_integrationtest.cc
index 5b25e293cd..ae238671c2 100644
--- a/pc/peer_connection_encodings_integrationtest.cc
+++ b/pc/peer_connection_encodings_integrationtest.cc
@@ -77,18 +77,17 @@ struct StringParamToString {
// RTX, RED and FEC are reliability mechanisms used in combinations with other
// codecs, but are not themselves a specific codec. Typically you don't want to
// filter these out of the list of codec preferences.
-bool IsReliabilityMechanism(const webrtc::RtpCodecCapability& codec) {
+bool IsReliabilityMechanism(const RtpCodecCapability& codec) {
return absl::EqualsIgnoreCase(codec.name, cricket::kRtxCodecName) ||
absl::EqualsIgnoreCase(codec.name, cricket::kRedCodecName) ||
absl::EqualsIgnoreCase(codec.name, cricket::kUlpfecCodecName);
}
std::string GetCurrentCodecMimeType(
- rtc::scoped_refptr<const webrtc::RTCStatsReport> report,
- const webrtc::RTCOutboundRtpStreamStats& outbound_rtp) {
+ rtc::scoped_refptr<const RTCStatsReport> report,
+ const RTCOutboundRtpStreamStats& outbound_rtp) {
return outbound_rtp.codec_id.is_defined()
- ? *report->GetAs<webrtc::RTCCodecStats>(*outbound_rtp.codec_id)
- ->mime_type
+ ? *report->GetAs<RTCCodecStats>(*outbound_rtp.codec_id)->mime_type
: "";
}
@@ -98,8 +97,8 @@ struct RidAndResolution {
uint32_t height;
};
-const webrtc::RTCOutboundRtpStreamStats* FindOutboundRtpByRid(
- const std::vector<const webrtc::RTCOutboundRtpStreamStats*>& outbound_rtps,
+const RTCOutboundRtpStreamStats* FindOutboundRtpByRid(
+ const std::vector<const RTCOutboundRtpStreamStats*>& outbound_rtps,
const absl::string_view& rid) {
for (const auto* outbound_rtp : outbound_rtps) {
if (outbound_rtp->rid.is_defined() && *outbound_rtp->rid == rid) {
@@ -121,8 +120,8 @@ class PeerConnectionEncodingsIntegrationTest : public ::testing::Test {
rtc::scoped_refptr<PeerConnectionTestWrapper> CreatePc() {
auto pc_wrapper = rtc::make_ref_counted<PeerConnectionTestWrapper>(
"pc", &pss_, background_thread_.get(), background_thread_.get());
- pc_wrapper->CreatePc({}, webrtc::CreateBuiltinAudioEncoderFactory(),
- webrtc::CreateBuiltinAudioDecoderFactory());
+ pc_wrapper->CreatePc({}, CreateBuiltinAudioEncoderFactory(),
+ CreateBuiltinAudioDecoderFactory());
return pc_wrapper;
}
@@ -130,10 +129,9 @@ class PeerConnectionEncodingsIntegrationTest : public ::testing::Test {
rtc::scoped_refptr<PeerConnectionTestWrapper> local,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote,
std::vector<cricket::SimulcastLayer> init_layers) {
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
- local->GetUserMedia(
- /*audio=*/false, cricket::AudioOptions(), /*video=*/true,
- {.width = 1280, .height = 720});
+ rtc::scoped_refptr<MediaStreamInterface> stream = local->GetUserMedia(
+ /*audio=*/false, cricket::AudioOptions(), /*video=*/true,
+ {.width = 1280, .height = 720});
rtc::scoped_refptr<VideoTrackInterface> track = stream->GetVideoTracks()[0];
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
@@ -925,6 +923,47 @@ TEST_F(PeerConnectionEncodingsIntegrationTest, VP9_TargetBitrate_StandardL1T3) {
}
TEST_F(PeerConnectionEncodingsIntegrationTest,
+ SimulcastProducesUniqueSsrcAndRtxSsrcs) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ std::vector<cricket::SimulcastLayer> layers =
+ CreateLayers({"f", "h", "q"}, /*active=*/true);
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver =
+ AddTransceiverWithSimulcastLayers(local_pc_wrapper, remote_pc_wrapper,
+ layers);
+ std::vector<RtpCodecCapability> codecs =
+ GetCapabilitiesAndRestrictToCodec(local_pc_wrapper, "VP8");
+ transceiver->SetCodecPreferences(codecs);
+
+ NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ // Wait until media is flowing on all three layers.
+ // Ramp up time is needed before all three layers are sending.
+ ASSERT_TRUE_WAIT(HasOutboundRtpBytesSent(local_pc_wrapper, 3u),
+ kLongTimeoutForRampingUp.ms());
+ // Verify SSRCs and RTX SSRCs.
+ rtc::scoped_refptr<const RTCStatsReport> report = GetStats(local_pc_wrapper);
+ std::vector<const RTCOutboundRtpStreamStats*> outbound_rtps =
+ report->GetStatsOfType<RTCOutboundRtpStreamStats>();
+ ASSERT_THAT(outbound_rtps, SizeIs(3u));
+
+ std::set<uint32_t> ssrcs;
+ std::set<uint32_t> rtx_ssrcs;
+ for (const auto& outbound_rtp : outbound_rtps) {
+ ASSERT_TRUE(outbound_rtp->ssrc.has_value());
+ ASSERT_TRUE(outbound_rtp->rtx_ssrc.has_value());
+ ssrcs.insert(*outbound_rtp->ssrc);
+ rtx_ssrcs.insert(*outbound_rtp->rtx_ssrc);
+ }
+ EXPECT_EQ(ssrcs.size(), 3u);
+ EXPECT_EQ(rtx_ssrcs.size(), 3u);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
EncodingParameterCodecIsEmptyWhenCreatedAudio) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
@@ -932,8 +971,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->pc()->AddTransceiver(cricket::MEDIA_TYPE_AUDIO);
rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
EXPECT_FALSE(parameters.encodings[0].codec.has_value());
}
@@ -945,8 +983,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->pc()->AddTransceiver(cricket::MEDIA_TYPE_VIDEO);
rtc::scoped_refptr<RtpTransceiverInterface> video_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
EXPECT_FALSE(parameters.encodings[0].codec.has_value());
}
@@ -956,19 +993,19 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/true, {}, /*video=*/false, {});
rtc::scoped_refptr<AudioTrackInterface> track = stream->GetAudioTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> pcmu =
+ absl::optional<RtpCodecCapability> pcmu =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"pcmu");
ASSERT_TRUE(pcmu);
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = pcmu;
init.send_encodings.push_back(encoding_parameters);
@@ -976,8 +1013,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->pc()->AddTransceiver(track, init);
rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
EXPECT_EQ(*parameters.encodings[0].codec, *pcmu);
NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
@@ -998,19 +1034,19 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/false, {}, /*video=*/true, {.width = 1280, .height = 720});
rtc::scoped_refptr<VideoTrackInterface> track = stream->GetVideoTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> vp9 =
+ absl::optional<RtpCodecCapability> vp9 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp9");
ASSERT_TRUE(vp9);
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = vp9;
encoding_parameters.scalability_mode = "L3T3";
init.send_encodings.push_back(encoding_parameters);
@@ -1019,8 +1055,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->pc()->AddTransceiver(track, init);
rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
EXPECT_EQ(*parameters.encodings[0].codec, *vp9);
NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
@@ -1046,20 +1081,19 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/true, {}, /*video=*/false, {});
rtc::scoped_refptr<AudioTrackInterface> track = stream->GetAudioTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> pcmu =
+ absl::optional<RtpCodecCapability> pcmu =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"pcmu");
auto transceiver_or_error = local_pc_wrapper->pc()->AddTransceiver(track);
rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = pcmu;
EXPECT_TRUE(audio_transceiver->sender()->SetParameters(parameters).ok());
@@ -1084,12 +1118,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/true, {}, /*video=*/false, {});
rtc::scoped_refptr<AudioTrackInterface> track = stream->GetAudioTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> pcmu =
+ absl::optional<RtpCodecCapability> pcmu =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"pcmu");
@@ -1109,8 +1143,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
EXPECT_STRCASENE(("audio/" + pcmu->name).c_str(), codec_name.c_str());
std::string last_codec_id = outbound_rtps[0]->codec_id.value();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = pcmu;
EXPECT_TRUE(audio_transceiver->sender()->SetParameters(parameters).ok());
@@ -1133,20 +1166,19 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/false, {}, /*video=*/true, {.width = 1280, .height = 720});
rtc::scoped_refptr<VideoTrackInterface> track = stream->GetVideoTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> vp9 =
+ absl::optional<RtpCodecCapability> vp9 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp9");
auto transceiver_or_error = local_pc_wrapper->pc()->AddTransceiver(track);
rtc::scoped_refptr<RtpTransceiverInterface> video_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = vp9;
parameters.encodings[0].scalability_mode = "L3T3";
EXPECT_TRUE(video_transceiver->sender()->SetParameters(parameters).ok());
@@ -1177,12 +1209,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
+ rtc::scoped_refptr<MediaStreamInterface> stream =
local_pc_wrapper->GetUserMedia(
/*audio=*/false, {}, /*video=*/true, {.width = 1280, .height = 720});
rtc::scoped_refptr<VideoTrackInterface> track = stream->GetVideoTracks()[0];
- absl::optional<webrtc::RtpCodecCapability> vp9 =
+ absl::optional<RtpCodecCapability> vp9 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp9");
@@ -1202,8 +1234,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
EXPECT_STRCASENE(("audio/" + vp9->name).c_str(), codec_name.c_str());
std::string last_codec_id = outbound_rtps[0]->codec_id.value();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = vp9;
parameters.encodings[0].scalability_mode = "L3T3";
EXPECT_TRUE(video_transceiver->sender()->SetParameters(parameters).ok());
@@ -1228,15 +1259,15 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
AddTransceiverRejectsUnknownCodecParameterAudio) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- webrtc::RtpCodec dummy_codec;
+ RtpCodec dummy_codec;
dummy_codec.kind = cricket::MEDIA_TYPE_AUDIO;
dummy_codec.name = "FOOBAR";
dummy_codec.clock_rate = 90000;
dummy_codec.num_channels = 2;
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = dummy_codec;
init.send_encodings.push_back(encoding_parameters);
@@ -1251,14 +1282,14 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
AddTransceiverRejectsUnknownCodecParameterVideo) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- webrtc::RtpCodec dummy_codec;
+ RtpCodec dummy_codec;
dummy_codec.kind = cricket::MEDIA_TYPE_VIDEO;
dummy_codec.name = "FOOBAR";
dummy_codec.clock_rate = 90000;
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = dummy_codec;
init.send_encodings.push_back(encoding_parameters);
@@ -1273,7 +1304,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
SetParametersRejectsUnknownCodecParameterAudio) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- webrtc::RtpCodec dummy_codec;
+ RtpCodec dummy_codec;
dummy_codec.kind = cricket::MEDIA_TYPE_AUDIO;
dummy_codec.name = "FOOBAR";
dummy_codec.clock_rate = 90000;
@@ -1285,8 +1316,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = dummy_codec;
RTCError error = audio_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1296,7 +1326,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
SetParametersRejectsUnknownCodecParameterVideo) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- webrtc::RtpCodec dummy_codec;
+ RtpCodec dummy_codec;
dummy_codec.kind = cricket::MEDIA_TYPE_VIDEO;
dummy_codec.name = "FOOBAR";
dummy_codec.clock_rate = 90000;
@@ -1307,8 +1337,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<RtpTransceiverInterface> video_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = dummy_codec;
RTCError error = video_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1318,12 +1347,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
SetParametersRejectsNonPreferredCodecParameterAudio) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- absl::optional<webrtc::RtpCodecCapability> opus =
+ absl::optional<RtpCodecCapability> opus =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"opus");
ASSERT_TRUE(opus);
- std::vector<webrtc::RtpCodecCapability> not_opus_codecs =
+ std::vector<RtpCodecCapability> not_opus_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
.codecs;
@@ -1341,8 +1370,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
transceiver_or_error.MoveValue();
ASSERT_TRUE(audio_transceiver->SetCodecPreferences(not_opus_codecs).ok());
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = opus;
RTCError error = audio_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1352,12 +1380,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
SetParametersRejectsNonPreferredCodecParameterVideo) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- absl::optional<webrtc::RtpCodecCapability> vp8 =
+ absl::optional<RtpCodecCapability> vp8 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp8");
ASSERT_TRUE(vp8);
- std::vector<webrtc::RtpCodecCapability> not_vp8_codecs =
+ std::vector<RtpCodecCapability> not_vp8_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO)
.codecs;
@@ -1375,8 +1403,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
transceiver_or_error.MoveValue();
ASSERT_TRUE(video_transceiver->SetCodecPreferences(not_vp8_codecs).ok());
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = vp8;
RTCError error = video_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1388,12 +1415,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- absl::optional<webrtc::RtpCodecCapability> opus =
+ absl::optional<RtpCodecCapability> opus =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"opus");
ASSERT_TRUE(opus);
- std::vector<webrtc::RtpCodecCapability> not_opus_codecs =
+ std::vector<RtpCodecCapability> not_opus_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
.codecs;
@@ -1415,8 +1442,69 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->WaitForConnection();
remote_pc_wrapper->WaitForConnection();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
+ parameters.encodings[0].codec = opus;
+ RTCError error = audio_transceiver->sender()->SetParameters(parameters);
+ EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
+ SetParametersRejectsNonRemotelyNegotiatedCodecParameterAudio) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ absl::optional<RtpCodecCapability> opus =
+ local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
+ "opus");
+ ASSERT_TRUE(opus);
+
+ std::vector<RtpCodecCapability> not_opus_codecs =
+ local_pc_wrapper->pc_factory()
+ ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
+ .codecs;
+ not_opus_codecs.erase(
+ std::remove_if(not_opus_codecs.begin(), not_opus_codecs.end(),
+ [&](const auto& codec) {
+ return absl::EqualsIgnoreCase(codec.name, opus->name);
+ }),
+ not_opus_codecs.end());
+
+ auto transceiver_or_error =
+ local_pc_wrapper->pc()->AddTransceiver(cricket::MEDIA_TYPE_AUDIO);
+ ASSERT_TRUE(transceiver_or_error.ok());
+ rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
+ transceiver_or_error.MoveValue();
+
+ // Negotiation, create offer and apply it
+ std::unique_ptr<SessionDescriptionInterface> offer =
+ CreateOffer(local_pc_wrapper);
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver> p1 =
+ SetLocalDescription(local_pc_wrapper, offer.get());
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver> p2 =
+ SetRemoteDescription(remote_pc_wrapper, offer.get());
+ EXPECT_TRUE(Await({p1, p2}));
+
+ // Update the remote transceiver to reject Opus
+ std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> remote_transceivers =
+ remote_pc_wrapper->pc()->GetTransceivers();
+ ASSERT_TRUE(!remote_transceivers.empty());
+ rtc::scoped_refptr<RtpTransceiverInterface> remote_audio_transceiver =
+ remote_transceivers[0];
+ ASSERT_TRUE(
+ remote_audio_transceiver->SetCodecPreferences(not_opus_codecs).ok());
+
+ // Create answer and apply it
+ std::unique_ptr<SessionDescriptionInterface> answer =
+ CreateAnswer(remote_pc_wrapper);
+ p1 = SetLocalDescription(remote_pc_wrapper, answer.get());
+ p2 = SetRemoteDescription(local_pc_wrapper, answer.get());
+ EXPECT_TRUE(Await({p1, p2}));
+
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = opus;
RTCError error = audio_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1428,12 +1516,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- absl::optional<webrtc::RtpCodecCapability> vp8 =
+ absl::optional<RtpCodecCapability> vp8 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp8");
ASSERT_TRUE(vp8);
- std::vector<webrtc::RtpCodecCapability> not_vp8_codecs =
+ std::vector<RtpCodecCapability> not_vp8_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO)
.codecs;
@@ -1455,8 +1543,69 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->WaitForConnection();
remote_pc_wrapper->WaitForConnection();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
+ parameters.encodings[0].codec = vp8;
+ RTCError error = video_transceiver->sender()->SetParameters(parameters);
+ EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
+ SetParametersRejectsNonRemotelyNegotiatedCodecParameterVideo) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ absl::optional<RtpCodecCapability> vp8 =
+ local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
+ "vp8");
+ ASSERT_TRUE(vp8);
+
+ std::vector<RtpCodecCapability> not_vp8_codecs =
+ local_pc_wrapper->pc_factory()
+ ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO)
+ .codecs;
+ not_vp8_codecs.erase(
+ std::remove_if(not_vp8_codecs.begin(), not_vp8_codecs.end(),
+ [&](const auto& codec) {
+ return absl::EqualsIgnoreCase(codec.name, vp8->name);
+ }),
+ not_vp8_codecs.end());
+
+ auto transceiver_or_error =
+ local_pc_wrapper->pc()->AddTransceiver(cricket::MEDIA_TYPE_VIDEO);
+ ASSERT_TRUE(transceiver_or_error.ok());
+ rtc::scoped_refptr<RtpTransceiverInterface> video_transceiver =
+ transceiver_or_error.MoveValue();
+
+ // Negotiation, create offer and apply it
+ std::unique_ptr<SessionDescriptionInterface> offer =
+ CreateOffer(local_pc_wrapper);
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver> p1 =
+ SetLocalDescription(local_pc_wrapper, offer.get());
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver> p2 =
+ SetRemoteDescription(remote_pc_wrapper, offer.get());
+ EXPECT_TRUE(Await({p1, p2}));
+
+ // Update the remote transceiver to reject VP8
+ std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> remote_transceivers =
+ remote_pc_wrapper->pc()->GetTransceivers();
+ ASSERT_TRUE(!remote_transceivers.empty());
+ rtc::scoped_refptr<RtpTransceiverInterface> remote_video_transceiver =
+ remote_transceivers[0];
+ ASSERT_TRUE(
+ remote_video_transceiver->SetCodecPreferences(not_vp8_codecs).ok());
+
+ // Create answer and apply it
+ std::unique_ptr<SessionDescriptionInterface> answer =
+ CreateAnswer(remote_pc_wrapper);
+ p1 = SetLocalDescription(remote_pc_wrapper, answer.get());
+ p2 = SetRemoteDescription(local_pc_wrapper, answer.get());
+ EXPECT_TRUE(Await({p1, p2}));
+
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].codec = vp8;
RTCError error = video_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1468,12 +1617,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- absl::optional<webrtc::RtpCodecCapability> opus =
+ absl::optional<RtpCodecCapability> opus =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
"opus");
ASSERT_TRUE(opus);
- std::vector<webrtc::RtpCodecCapability> not_opus_codecs =
+ std::vector<RtpCodecCapability> not_opus_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
.codecs;
@@ -1484,9 +1633,9 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
}),
not_opus_codecs.end());
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = opus;
init.send_encodings.push_back(encoding_parameters);
@@ -1500,8 +1649,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->WaitForConnection();
remote_pc_wrapper->WaitForConnection();
- webrtc::RtpParameters parameters =
- audio_transceiver->sender()->GetParameters();
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
EXPECT_EQ(parameters.encodings[0].codec, opus);
ASSERT_TRUE(audio_transceiver->SetCodecPreferences(not_opus_codecs).ok());
@@ -1512,17 +1660,77 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
}
TEST_F(PeerConnectionEncodingsIntegrationTest,
+ EncodingParametersRedEnabledBeforeNegotiationAudio) {
+ rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
+ rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
+ ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
+
+ std::vector<RtpCodecCapability> send_codecs =
+ local_pc_wrapper->pc_factory()
+ ->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
+ .codecs;
+
+ absl::optional<RtpCodecCapability> opus =
+ local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
+ "opus");
+ ASSERT_TRUE(opus);
+
+ absl::optional<RtpCodecCapability> red =
+ local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_AUDIO,
+ "red");
+ ASSERT_TRUE(red);
+
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
+ encoding_parameters.codec = opus;
+ init.send_encodings.push_back(encoding_parameters);
+
+ auto transceiver_or_error =
+ local_pc_wrapper->pc()->AddTransceiver(cricket::MEDIA_TYPE_AUDIO, init);
+ ASSERT_TRUE(transceiver_or_error.ok());
+ rtc::scoped_refptr<RtpTransceiverInterface> audio_transceiver =
+ transceiver_or_error.MoveValue();
+
+ // Preferring RED over Opus should enable RED with Opus encoding.
+ send_codecs[0] = red.value();
+ send_codecs[1] = opus.value();
+
+ ASSERT_TRUE(audio_transceiver->SetCodecPreferences(send_codecs).ok());
+ NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
+ local_pc_wrapper->WaitForConnection();
+ remote_pc_wrapper->WaitForConnection();
+
+ RtpParameters parameters = audio_transceiver->sender()->GetParameters();
+ EXPECT_EQ(parameters.encodings[0].codec, opus);
+ EXPECT_EQ(parameters.codecs[0].payload_type, red->preferred_payload_type);
+ EXPECT_EQ(parameters.codecs[0].name, red->name);
+
+ // Check that it's possible to switch back to Opus without RED.
+ send_codecs[0] = opus.value();
+ send_codecs[1] = red.value();
+
+ ASSERT_TRUE(audio_transceiver->SetCodecPreferences(send_codecs).ok());
+ NegotiateWithSimulcastTweaks(local_pc_wrapper, remote_pc_wrapper);
+
+ parameters = audio_transceiver->sender()->GetParameters();
+ EXPECT_EQ(parameters.encodings[0].codec, opus);
+ EXPECT_EQ(parameters.codecs[0].payload_type, opus->preferred_payload_type);
+ EXPECT_EQ(parameters.codecs[0].name, opus->name);
+}
+
+TEST_F(PeerConnectionEncodingsIntegrationTest,
SetParametersRejectsScalabilityModeForSelectedCodec) {
rtc::scoped_refptr<PeerConnectionTestWrapper> local_pc_wrapper = CreatePc();
- absl::optional<webrtc::RtpCodecCapability> vp8 =
+ absl::optional<RtpCodecCapability> vp8 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp8");
ASSERT_TRUE(vp8);
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.codec = vp8;
encoding_parameters.scalability_mode = "L1T3";
init.send_encodings.push_back(encoding_parameters);
@@ -1533,8 +1741,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<RtpTransceiverInterface> video_transceiver =
transceiver_or_error.MoveValue();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
parameters.encodings[0].scalability_mode = "L3T3";
RTCError error = video_transceiver->sender()->SetParameters(parameters);
EXPECT_EQ(error.type(), RTCErrorType::INVALID_MODIFICATION);
@@ -1546,12 +1753,12 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- absl::optional<webrtc::RtpCodecCapability> vp8 =
+ absl::optional<RtpCodecCapability> vp8 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp8");
ASSERT_TRUE(vp8);
- std::vector<webrtc::RtpCodecCapability> not_vp8_codecs =
+ std::vector<RtpCodecCapability> not_vp8_codecs =
local_pc_wrapper->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO)
.codecs;
@@ -1562,9 +1769,9 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
}),
not_vp8_codecs.end());
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.rid = "h";
encoding_parameters.codec = vp8;
encoding_parameters.scale_resolution_down_by = 2;
@@ -1583,8 +1790,7 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
local_pc_wrapper->WaitForConnection();
remote_pc_wrapper->WaitForConnection();
- webrtc::RtpParameters parameters =
- video_transceiver->sender()->GetParameters();
+ RtpParameters parameters = video_transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 2u);
EXPECT_EQ(parameters.encodings[0].codec, vp8);
EXPECT_EQ(parameters.encodings[1].codec, vp8);
@@ -1605,17 +1811,17 @@ TEST_F(PeerConnectionEncodingsIntegrationTest,
rtc::scoped_refptr<PeerConnectionTestWrapper> remote_pc_wrapper = CreatePc();
ExchangeIceCandidates(local_pc_wrapper, remote_pc_wrapper);
- absl::optional<webrtc::RtpCodecCapability> vp8 =
+ absl::optional<RtpCodecCapability> vp8 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp8");
ASSERT_TRUE(vp8);
- absl::optional<webrtc::RtpCodecCapability> vp9 =
+ absl::optional<RtpCodecCapability> vp9 =
local_pc_wrapper->FindFirstSendCodecWithName(cricket::MEDIA_TYPE_VIDEO,
"vp9");
- webrtc::RtpTransceiverInit init;
- init.direction = webrtc::RtpTransceiverDirection::kSendOnly;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ init.direction = RtpTransceiverDirection::kSendOnly;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.rid = "h";
encoding_parameters.codec = vp8;
encoding_parameters.scale_resolution_down_by = 2;
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index d933ba6aea..81780cf51e 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -301,7 +301,7 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
const PeerConnectionInterface::RTCConfiguration& configuration) {
RTC_DCHECK_RUN_ON(worker_thread());
- webrtc::Call::Config call_config(event_log, network_thread());
+ CallConfig call_config(event_log, network_thread());
if (!media_engine() || !context_->call_factory()) {
return nullptr;
}
@@ -342,8 +342,7 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
transport_controller_send_factory_.get();
call_config.metronome = metronome_.get();
call_config.pacer_burst_interval = configuration.pacer_burst_interval;
- return std::unique_ptr<Call>(
- context_->call_factory()->CreateCall(call_config));
+ return context_->call_factory()->CreateCall(call_config);
}
bool PeerConnectionFactory::IsTrialEnabled(absl::string_view key) const {
diff --git a/pc/peer_connection_factory_proxy.h b/pc/peer_connection_factory_proxy.h
index 4781497642..b9bd1cbf0e 100644
--- a/pc/peer_connection_factory_proxy.h
+++ b/pc/peer_connection_factory_proxy.h
@@ -29,10 +29,10 @@ PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>,
CreatePeerConnectionOrError,
const PeerConnectionInterface::RTCConfiguration&,
PeerConnectionDependencies)
-PROXY_CONSTMETHOD1(webrtc::RtpCapabilities,
+PROXY_CONSTMETHOD1(RtpCapabilities,
GetRtpSenderCapabilities,
cricket::MediaType)
-PROXY_CONSTMETHOD1(webrtc::RtpCapabilities,
+PROXY_CONSTMETHOD1(RtpCapabilities,
GetRtpReceiverCapabilities,
cricket::MediaType)
PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
diff --git a/pc/peer_connection_factory_unittest.cc b/pc/peer_connection_factory_unittest.cc
index 11e232c01f..989b70f84e 100644
--- a/pc/peer_connection_factory_unittest.cc
+++ b/pc/peer_connection_factory_unittest.cc
@@ -20,6 +20,7 @@
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/data_channel_interface.h"
+#include "api/enable_media.h"
#include "api/jsep.h"
#include "api/media_stream_interface.h"
#include "api/task_queue/default_task_queue_factory.h"
@@ -35,7 +36,6 @@
#include "api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter.h"
#include "api/video_codecs/video_encoder_factory_template_open_h264_adapter.h"
#include "media/base/fake_frame_source.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "p2p/base/fake_port_allocator.h"
@@ -106,8 +106,7 @@ class NullPeerConnectionObserver : public PeerConnectionObserver {
PeerConnectionInterface::IceConnectionState new_state) override {}
void OnIceGatheringChange(
PeerConnectionInterface::IceGatheringState new_state) override {}
- void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override {
- }
+ void OnIceCandidate(const IceCandidateInterface* candidate) override {}
};
class MockNetworkManager : public rtc::NetworkManager {
@@ -133,17 +132,15 @@ class PeerConnectionFactoryTest : public ::testing::Test {
private:
void SetUp() {
#ifdef WEBRTC_ANDROID
- webrtc::InitializeAndroidObjects();
+ InitializeAndroidObjects();
#endif
// Use fake audio device module since we're only testing the interface
// level, and using a real one could make tests flaky e.g. when run in
// parallel.
- factory_ = webrtc::CreatePeerConnectionFactory(
+ factory_ = CreatePeerConnectionFactory(
rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(),
- rtc::scoped_refptr<webrtc::AudioDeviceModule>(
- FakeAudioCaptureModule::Create()),
- webrtc::CreateBuiltinAudioEncoderFactory(),
- webrtc::CreateBuiltinAudioDecoderFactory(),
+ rtc::scoped_refptr<AudioDeviceModule>(FakeAudioCaptureModule::Create()),
+ CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(),
std::make_unique<VideoEncoderFactoryTemplate<
LibvpxVp8EncoderTemplateAdapter, LibvpxVp9EncoderTemplateAdapter,
OpenH264EncoderTemplateAdapter, LibaomAv1EncoderTemplateAdapter>>(),
@@ -182,64 +179,64 @@ class PeerConnectionFactoryTest : public ::testing::Test {
}
}
- void VerifyAudioCodecCapability(const webrtc::RtpCodecCapability& codec) {
+ void VerifyAudioCodecCapability(const RtpCodecCapability& codec) {
EXPECT_EQ(codec.kind, cricket::MEDIA_TYPE_AUDIO);
EXPECT_FALSE(codec.name.empty());
EXPECT_GT(codec.clock_rate, 0);
EXPECT_GT(codec.num_channels, 0);
}
- void VerifyVideoCodecCapability(const webrtc::RtpCodecCapability& codec,
+ void VerifyVideoCodecCapability(const RtpCodecCapability& codec,
bool sender) {
EXPECT_EQ(codec.kind, cricket::MEDIA_TYPE_VIDEO);
EXPECT_FALSE(codec.name.empty());
EXPECT_GT(codec.clock_rate, 0);
if (sender) {
if (codec.name == "VP8" || codec.name == "H264") {
- EXPECT_THAT(codec.scalability_modes,
- UnorderedElementsAre(webrtc::ScalabilityMode::kL1T1,
- webrtc::ScalabilityMode::kL1T2,
- webrtc::ScalabilityMode::kL1T3))
+ EXPECT_THAT(
+ codec.scalability_modes,
+ UnorderedElementsAre(ScalabilityMode::kL1T1, ScalabilityMode::kL1T2,
+ ScalabilityMode::kL1T3))
<< "Codec: " << codec.name;
} else if (codec.name == "VP9" || codec.name == "AV1") {
EXPECT_THAT(
codec.scalability_modes,
UnorderedElementsAre(
// clang-format off
- webrtc::ScalabilityMode::kL1T1,
- webrtc::ScalabilityMode::kL1T2,
- webrtc::ScalabilityMode::kL1T3,
- webrtc::ScalabilityMode::kL2T1,
- webrtc::ScalabilityMode::kL2T1h,
- webrtc::ScalabilityMode::kL2T1_KEY,
- webrtc::ScalabilityMode::kL2T2,
- webrtc::ScalabilityMode::kL2T2h,
- webrtc::ScalabilityMode::kL2T2_KEY,
- webrtc::ScalabilityMode::kL2T2_KEY_SHIFT,
- webrtc::ScalabilityMode::kL2T3,
- webrtc::ScalabilityMode::kL2T3h,
- webrtc::ScalabilityMode::kL2T3_KEY,
- webrtc::ScalabilityMode::kL3T1,
- webrtc::ScalabilityMode::kL3T1h,
- webrtc::ScalabilityMode::kL3T1_KEY,
- webrtc::ScalabilityMode::kL3T2,
- webrtc::ScalabilityMode::kL3T2h,
- webrtc::ScalabilityMode::kL3T2_KEY,
- webrtc::ScalabilityMode::kL3T3,
- webrtc::ScalabilityMode::kL3T3h,
- webrtc::ScalabilityMode::kL3T3_KEY,
- webrtc::ScalabilityMode::kS2T1,
- webrtc::ScalabilityMode::kS2T1h,
- webrtc::ScalabilityMode::kS2T2,
- webrtc::ScalabilityMode::kS2T2h,
- webrtc::ScalabilityMode::kS2T3,
- webrtc::ScalabilityMode::kS2T3h,
- webrtc::ScalabilityMode::kS3T1,
- webrtc::ScalabilityMode::kS3T1h,
- webrtc::ScalabilityMode::kS3T2,
- webrtc::ScalabilityMode::kS3T2h,
- webrtc::ScalabilityMode::kS3T3,
- webrtc::ScalabilityMode::kS3T3h)
+ ScalabilityMode::kL1T1,
+ ScalabilityMode::kL1T2,
+ ScalabilityMode::kL1T3,
+ ScalabilityMode::kL2T1,
+ ScalabilityMode::kL2T1h,
+ ScalabilityMode::kL2T1_KEY,
+ ScalabilityMode::kL2T2,
+ ScalabilityMode::kL2T2h,
+ ScalabilityMode::kL2T2_KEY,
+ ScalabilityMode::kL2T2_KEY_SHIFT,
+ ScalabilityMode::kL2T3,
+ ScalabilityMode::kL2T3h,
+ ScalabilityMode::kL2T3_KEY,
+ ScalabilityMode::kL3T1,
+ ScalabilityMode::kL3T1h,
+ ScalabilityMode::kL3T1_KEY,
+ ScalabilityMode::kL3T2,
+ ScalabilityMode::kL3T2h,
+ ScalabilityMode::kL3T2_KEY,
+ ScalabilityMode::kL3T3,
+ ScalabilityMode::kL3T3h,
+ ScalabilityMode::kL3T3_KEY,
+ ScalabilityMode::kS2T1,
+ ScalabilityMode::kS2T1h,
+ ScalabilityMode::kS2T2,
+ ScalabilityMode::kS2T2h,
+ ScalabilityMode::kS2T3,
+ ScalabilityMode::kS2T3h,
+ ScalabilityMode::kS3T1,
+ ScalabilityMode::kS3T1h,
+ ScalabilityMode::kS3T2,
+ ScalabilityMode::kS3T2h,
+ ScalabilityMode::kS3T3,
+ ScalabilityMode::kS3T3h)
// clang-format on
)
<< "Codec: " << codec.name;
@@ -251,7 +248,7 @@ class PeerConnectionFactoryTest : public ::testing::Test {
}
}
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::SocketServer> socket_server_;
rtc::AutoSocketServerThread main_thread_;
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory_;
@@ -267,36 +264,27 @@ class PeerConnectionFactoryTest : public ::testing::Test {
// to reconstruct factory with our own ConnectionContext.
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithRtxDisabled() {
- webrtc::PeerConnectionFactoryDependencies pcf_dependencies;
+ PeerConnectionFactoryDependencies pcf_dependencies;
pcf_dependencies.signaling_thread = rtc::Thread::Current();
pcf_dependencies.worker_thread = rtc::Thread::Current();
pcf_dependencies.network_thread = rtc::Thread::Current();
pcf_dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
- pcf_dependencies.call_factory = CreateCallFactory();
- pcf_dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
-
- cricket::MediaEngineDependencies media_dependencies;
- media_dependencies.task_queue_factory =
- pcf_dependencies.task_queue_factory.get();
- media_dependencies.adm = rtc::scoped_refptr<webrtc::AudioDeviceModule>(
- FakeAudioCaptureModule::Create());
- media_dependencies.audio_encoder_factory =
- webrtc::CreateBuiltinAudioEncoderFactory();
- media_dependencies.audio_decoder_factory =
- webrtc::CreateBuiltinAudioDecoderFactory();
- media_dependencies.video_encoder_factory =
+ pcf_dependencies.trials = std::make_unique<FieldTrialBasedConfig>();
+
+ pcf_dependencies.adm = FakeAudioCaptureModule::Create();
+ pcf_dependencies.audio_encoder_factory = CreateBuiltinAudioEncoderFactory();
+ pcf_dependencies.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
+ pcf_dependencies.video_encoder_factory =
std::make_unique<VideoEncoderFactoryTemplate<
LibvpxVp8EncoderTemplateAdapter, LibvpxVp9EncoderTemplateAdapter,
OpenH264EncoderTemplateAdapter, LibaomAv1EncoderTemplateAdapter>>();
- media_dependencies.video_decoder_factory =
+ pcf_dependencies.video_decoder_factory =
std::make_unique<VideoDecoderFactoryTemplate<
LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter,
OpenH264DecoderTemplateAdapter, Dav1dDecoderTemplateAdapter>>(),
- media_dependencies.trials = pcf_dependencies.trials.get();
- pcf_dependencies.media_engine =
- cricket::CreateMediaEngine(std::move(media_dependencies));
+ EnableMedia(pcf_dependencies);
- rtc::scoped_refptr<webrtc::ConnectionContext> context =
+ rtc::scoped_refptr<ConnectionContext> context =
ConnectionContext::Create(&pcf_dependencies);
context->set_use_rtx(false);
return rtc::make_ref_counted<PeerConnectionFactory>(context,
@@ -311,26 +299,26 @@ CreatePeerConnectionFactoryWithRtxDisabled() {
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=7806 for details.
TEST(PeerConnectionFactoryTestInternal, DISABLED_CreatePCUsingInternalModules) {
#ifdef WEBRTC_ANDROID
- webrtc::InitializeAndroidObjects();
+ InitializeAndroidObjects();
#endif
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
- webrtc::CreatePeerConnectionFactory(
+ CreatePeerConnectionFactory(
nullptr /* network_thread */, nullptr /* worker_thread */,
nullptr /* signaling_thread */, nullptr /* default_adm */,
- webrtc::CreateBuiltinAudioEncoderFactory(),
- webrtc::CreateBuiltinAudioDecoderFactory(),
+ CreateBuiltinAudioEncoderFactory(),
+ CreateBuiltinAudioDecoderFactory(),
nullptr /* video_encoder_factory */,
nullptr /* video_decoder_factory */, nullptr /* audio_mixer */,
nullptr /* audio_processing */));
NullPeerConnectionObserver observer;
- webrtc::PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::RTCConfiguration config;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
new FakeRTCCertificateGenerator());
- webrtc::PeerConnectionDependencies pc_dependencies(&observer);
+ PeerConnectionDependencies pc_dependencies(&observer);
pc_dependencies.cert_generator = std::move(cert_generator);
auto result =
factory->CreatePeerConnectionOrError(config, std::move(pc_dependencies));
@@ -339,7 +327,7 @@ TEST(PeerConnectionFactoryTestInternal, DISABLED_CreatePCUsingInternalModules) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderAudioCapabilities) {
- webrtc::RtpCapabilities audio_capabilities =
+ RtpCapabilities audio_capabilities =
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO);
EXPECT_FALSE(audio_capabilities.codecs.empty());
for (const auto& codec : audio_capabilities.codecs) {
@@ -352,7 +340,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpSenderAudioCapabilities) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderVideoCapabilities) {
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO);
EXPECT_FALSE(video_capabilities.codecs.empty());
for (const auto& codec : video_capabilities.codecs) {
@@ -365,7 +353,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpSenderVideoCapabilities) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderRtxEnabledCapabilities) {
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO);
const auto it = std::find_if(
video_capabilities.codecs.begin(), video_capabilities.codecs.end(),
@@ -375,7 +363,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpSenderRtxEnabledCapabilities) {
TEST(PeerConnectionFactoryTestInternal, CheckRtpSenderRtxDisabledCapabilities) {
auto factory = CreatePeerConnectionFactoryWithRtxDisabled();
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO);
const auto it = std::find_if(
video_capabilities.codecs.begin(), video_capabilities.codecs.end(),
@@ -384,14 +372,14 @@ TEST(PeerConnectionFactoryTestInternal, CheckRtpSenderRtxDisabledCapabilities) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpSenderDataCapabilities) {
- webrtc::RtpCapabilities data_capabilities =
+ RtpCapabilities data_capabilities =
factory_->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_DATA);
EXPECT_TRUE(data_capabilities.codecs.empty());
EXPECT_TRUE(data_capabilities.header_extensions.empty());
}
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverAudioCapabilities) {
- webrtc::RtpCapabilities audio_capabilities =
+ RtpCapabilities audio_capabilities =
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_AUDIO);
EXPECT_FALSE(audio_capabilities.codecs.empty());
for (const auto& codec : audio_capabilities.codecs) {
@@ -404,7 +392,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverAudioCapabilities) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverVideoCapabilities) {
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_VIDEO);
EXPECT_FALSE(video_capabilities.codecs.empty());
for (const auto& codec : video_capabilities.codecs) {
@@ -417,7 +405,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverVideoCapabilities) {
}
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverRtxEnabledCapabilities) {
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_VIDEO);
const auto it = std::find_if(
video_capabilities.codecs.begin(), video_capabilities.codecs.end(),
@@ -428,7 +416,7 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverRtxEnabledCapabilities) {
TEST(PeerConnectionFactoryTestInternal,
CheckRtpReceiverRtxDisabledCapabilities) {
auto factory = CreatePeerConnectionFactoryWithRtxDisabled();
- webrtc::RtpCapabilities video_capabilities =
+ RtpCapabilities video_capabilities =
factory->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_VIDEO);
const auto it = std::find_if(
video_capabilities.codecs.begin(), video_capabilities.codecs.end(),
@@ -437,7 +425,7 @@ TEST(PeerConnectionFactoryTestInternal,
}
TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverDataCapabilities) {
- webrtc::RtpCapabilities data_capabilities =
+ RtpCapabilities data_capabilities =
factory_->GetRtpReceiverCapabilities(cricket::MEDIA_TYPE_DATA);
EXPECT_TRUE(data_capabilities.codecs.empty());
EXPECT_TRUE(data_capabilities.header_extensions.empty());
@@ -447,8 +435,8 @@ TEST_F(PeerConnectionFactoryTest, CheckRtpReceiverDataCapabilities) {
// configuration. Also verifies the URL's parsed correctly as expected.
TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = kStunIceServer;
config.servers.push_back(ice_server);
ice_server.uri = kTurnIceServer;
@@ -459,7 +447,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -484,15 +472,15 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) {
// configuration. Also verifies the list of URL's parsed correctly as expected.
TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back(kStunIceServer);
ice_server.urls.push_back(kTurnIceServer);
ice_server.urls.push_back(kTurnIceServerWithTransport);
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -515,15 +503,15 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) {
TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = kStunIceServer;
config.servers.push_back(ice_server);
ice_server.uri = kTurnIceServerWithNoUsernameInUri;
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -541,13 +529,13 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingNoUsernameInUri) {
// has transport parameter in it.
TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = kTurnIceServerWithTransport;
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -563,8 +551,8 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingTurnUrlWithTransportParam) {
TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = kSecureTurnIceServer;
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
@@ -577,7 +565,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -602,8 +590,8 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingSecureTurnUrl) {
TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
PeerConnectionInterface::RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = kStunIceServerWithIPv4Address;
config.servers.push_back(ice_server);
ice_server.uri = kStunIceServerWithIPv4AddressWithoutPort;
@@ -616,7 +604,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
ice_server.username = kTurnUsername;
ice_server.password = kTurnPassword;
config.servers.push_back(ice_server);
- webrtc::PeerConnectionDependencies pc_dependencies(&observer_);
+ PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.cert_generator =
std::make_unique<FakeRTCCertificateGenerator>();
pc_dependencies.allocator = std::move(port_allocator_);
@@ -644,8 +632,8 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIPLiteralAddress) {
// This test verifies the captured stream is rendered locally using a
// local video track.
TEST_F(PeerConnectionFactoryTest, LocalRendering) {
- rtc::scoped_refptr<webrtc::FakeVideoTrackSource> source =
- webrtc::FakeVideoTrackSource::Create(/*is_screencast=*/false);
+ rtc::scoped_refptr<FakeVideoTrackSource> source =
+ FakeVideoTrackSource::Create(/*is_screencast=*/false);
cricket::FakeFrameSource frame_source(1280, 720,
rtc::kNumMicrosecsPerSec / 30);
@@ -673,7 +661,7 @@ TEST_F(PeerConnectionFactoryTest, LocalRendering) {
}
TEST(PeerConnectionFactoryDependenciesTest, UsesNetworkManager) {
- constexpr webrtc::TimeDelta kWaitTimeout = webrtc::TimeDelta::Seconds(10);
+ constexpr TimeDelta kWaitTimeout = TimeDelta::Seconds(10);
auto mock_network_manager = std::make_unique<NiceMock<MockNetworkManager>>();
rtc::Event called;
@@ -681,24 +669,24 @@ TEST(PeerConnectionFactoryDependenciesTest, UsesNetworkManager) {
.Times(AtLeast(1))
.WillRepeatedly(InvokeWithoutArgs([&] { called.Set(); }));
- webrtc::PeerConnectionFactoryDependencies pcf_dependencies;
+ PeerConnectionFactoryDependencies pcf_dependencies;
pcf_dependencies.network_manager = std::move(mock_network_manager);
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pcf =
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> pcf =
CreateModularPeerConnectionFactory(std::move(pcf_dependencies));
PeerConnectionInterface::RTCConfiguration config;
config.ice_candidate_pool_size = 2;
NullPeerConnectionObserver observer;
auto pc = pcf->CreatePeerConnectionOrError(
- config, webrtc::PeerConnectionDependencies(&observer));
+ config, PeerConnectionDependencies(&observer));
ASSERT_TRUE(pc.ok());
called.Wait(kWaitTimeout);
}
TEST(PeerConnectionFactoryDependenciesTest, UsesPacketSocketFactory) {
- constexpr webrtc::TimeDelta kWaitTimeout = webrtc::TimeDelta::Seconds(10);
+ constexpr TimeDelta kWaitTimeout = TimeDelta::Seconds(10);
auto mock_socket_factory =
std::make_unique<NiceMock<rtc::MockPacketSocketFactory>>();
@@ -710,10 +698,10 @@ TEST(PeerConnectionFactoryDependenciesTest, UsesPacketSocketFactory) {
}))
.WillRepeatedly(Return(nullptr));
- webrtc::PeerConnectionFactoryDependencies pcf_dependencies;
+ PeerConnectionFactoryDependencies pcf_dependencies;
pcf_dependencies.packet_socket_factory = std::move(mock_socket_factory);
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pcf =
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> pcf =
CreateModularPeerConnectionFactory(std::move(pcf_dependencies));
// By default, localhost addresses are ignored, which makes tests fail if test
@@ -726,7 +714,7 @@ TEST(PeerConnectionFactoryDependenciesTest, UsesPacketSocketFactory) {
config.ice_candidate_pool_size = 2;
NullPeerConnectionObserver observer;
auto pc = pcf->CreatePeerConnectionOrError(
- config, webrtc::PeerConnectionDependencies(&observer));
+ config, PeerConnectionDependencies(&observer));
ASSERT_TRUE(pc.ok());
called.Wait(kWaitTimeout);
diff --git a/pc/peer_connection_field_trial_tests.cc b/pc/peer_connection_field_trial_tests.cc
index 7799c9d6e3..4cbe24986c 100644
--- a/pc/peer_connection_field_trial_tests.cc
+++ b/pc/peer_connection_field_trial_tests.cc
@@ -16,13 +16,13 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
+#include "api/enable_media_with_defaults.h"
#include "api/peer_connection_interface.h"
#include "api/stats/rtcstats_objects.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "pc/peer_connection_wrapper.h"
#include "pc/session_description.h"
#include "pc/test/fake_audio_capture_module.h"
@@ -68,7 +68,7 @@ class PeerConnectionFieldTrialTest : public ::testing::Test {
#ifdef WEBRTC_ANDROID
InitializeAndroidObjects();
#endif
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.uri = "stun:stun.l.google.com:19302";
config_.servers.push_back(ice_server);
config_.sdp_semantics = SdpSemantics::kUnifiedPlan;
@@ -81,13 +81,8 @@ class PeerConnectionFieldTrialTest : public ::testing::Test {
pcf_deps.signaling_thread = rtc::Thread::Current();
pcf_deps.trials = std::move(field_trials);
pcf_deps.task_queue_factory = CreateDefaultTaskQueueFactory();
- pcf_deps.call_factory = webrtc::CreateCallFactory();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = pcf_deps.task_queue_factory.get();
- media_deps.adm = FakeAudioCaptureModule::Create();
- media_deps.trials = pcf_deps.trials.get();
- webrtc::SetMediaEngineDefaults(&media_deps);
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
+ pcf_deps.adm = FakeAudioCaptureModule::Create();
+ EnableMediaWithDefaults(pcf_deps);
pc_factory_ = CreateModularPeerConnectionFactory(std::move(pcf_deps));
// Allow ADAPTER_TYPE_LOOPBACK to create PeerConnections with loopback in
@@ -113,7 +108,7 @@ class PeerConnectionFieldTrialTest : public ::testing::Test {
std::unique_ptr<rtc::SocketServer> socket_server_;
rtc::AutoSocketServerThread main_thread_;
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_ = nullptr;
- webrtc::PeerConnectionInterface::RTCConfiguration config_;
+ PeerConnectionInterface::RTCConfiguration config_;
};
// Tests for the dependency descriptor field trial. The dependency descriptor
@@ -138,7 +133,7 @@ TEST_F(PeerConnectionFieldTrialTest, EnableDependencyDescriptorAdvertised) {
media_description1->rtp_header_extensions();
bool found = absl::c_find_if(rtp_header_extensions1,
- [](const webrtc::RtpExtension& rtp_extension) {
+ [](const RtpExtension& rtp_extension) {
return rtp_extension.uri ==
RtpExtension::kDependencyDescriptorUri;
}) != rtp_header_extensions1.end();
@@ -168,14 +163,14 @@ TEST_F(PeerConnectionFieldTrialTest, InjectDependencyDescriptor) {
media_description1->rtp_header_extensions();
bool found1 = absl::c_find_if(rtp_header_extensions1,
- [](const webrtc::RtpExtension& rtp_extension) {
+ [](const RtpExtension& rtp_extension) {
return rtp_extension.uri ==
RtpExtension::kDependencyDescriptorUri;
}) != rtp_header_extensions1.end();
EXPECT_FALSE(found1);
std::set<int> existing_ids;
- for (const webrtc::RtpExtension& rtp_extension : rtp_header_extensions1) {
+ for (const RtpExtension& rtp_extension : rtp_header_extensions1) {
existing_ids.insert(rtp_extension.id);
}
@@ -212,7 +207,7 @@ TEST_F(PeerConnectionFieldTrialTest, InjectDependencyDescriptor) {
media_description2->rtp_header_extensions();
bool found2 = absl::c_find_if(rtp_header_extensions2,
- [](const webrtc::RtpExtension& rtp_extension) {
+ [](const RtpExtension& rtp_extension) {
return rtp_extension.uri ==
RtpExtension::kDependencyDescriptorUri;
}) != rtp_header_extensions2.end();
diff --git a/pc/peer_connection_header_extension_unittest.cc b/pc/peer_connection_header_extension_unittest.cc
index b1c6c3cfb5..277979b330 100644
--- a/pc/peer_connection_header_extension_unittest.cc
+++ b/pc/peer_connection_header_extension_unittest.cc
@@ -16,7 +16,6 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
-#include "api/call/call_factory_interface.h"
#include "api/jsep.h"
#include "api/media_types.h"
#include "api/peer_connection_interface.h"
@@ -35,6 +34,7 @@
#include "p2p/base/port_allocator.h"
#include "pc/peer_connection_wrapper.h"
#include "pc/session_description.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/internal/default_socket_server.h"
#include "rtc_base/rtc_certificate_generator.h"
@@ -77,21 +77,18 @@ class PeerConnectionHeaderExtensionTest
std::unique_ptr<PeerConnectionWrapper> CreatePeerConnection(
cricket::MediaType media_type,
absl::optional<SdpSemantics> semantics) {
- auto voice = std::make_unique<cricket::FakeVoiceEngine>();
- auto video = std::make_unique<cricket::FakeVideoEngine>();
+ auto media_engine = std::make_unique<cricket::FakeMediaEngine>();
if (media_type == cricket::MediaType::MEDIA_TYPE_AUDIO)
- voice->SetRtpHeaderExtensions(extensions_);
+ media_engine->fake_voice_engine()->SetRtpHeaderExtensions(extensions_);
else
- video->SetRtpHeaderExtensions(extensions_);
- auto media_engine = std::make_unique<cricket::CompositeMediaEngine>(
- std::move(voice), std::move(video));
+ media_engine->fake_video_engine()->SetRtpHeaderExtensions(extensions_);
PeerConnectionFactoryDependencies factory_dependencies;
factory_dependencies.network_thread = rtc::Thread::Current();
factory_dependencies.worker_thread = rtc::Thread::Current();
factory_dependencies.signaling_thread = rtc::Thread::Current();
factory_dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
- factory_dependencies.media_engine = std::move(media_engine);
- factory_dependencies.call_factory = CreateCallFactory();
+ EnableFakeMedia(factory_dependencies, std::move(media_engine));
+
factory_dependencies.event_log_factory =
std::make_unique<RtcEventLogFactory>(
factory_dependencies.task_queue_factory.get());
@@ -117,7 +114,7 @@ class PeerConnectionHeaderExtensionTest
pc_factory, result.MoveValue(), std::move(observer));
}
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::SocketServer> socket_server_;
rtc::AutoSocketServerThread main_thread_;
std::vector<RtpHeaderExtensionCapability> extensions_;
diff --git a/pc/peer_connection_histogram_unittest.cc b/pc/peer_connection_histogram_unittest.cc
index 68a4dbc361..973744c0e8 100644
--- a/pc/peer_connection_histogram_unittest.cc
+++ b/pc/peer_connection_histogram_unittest.cc
@@ -16,7 +16,6 @@
#include "absl/types/optional.h"
#include "api/async_resolver_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/jsep.h"
#include "api/jsep_session_description.h"
#include "api/peer_connection_interface.h"
@@ -25,7 +24,6 @@
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_factory.h"
#include "api/test/mock_async_dns_resolver.h"
-#include "media/base/fake_media_engine.h"
#include "media/base/media_engine.h"
#include "p2p/base/mock_async_resolver.h"
#include "p2p/base/port_allocator.h"
@@ -35,6 +33,7 @@
#include "pc/peer_connection_proxy.h"
#include "pc/peer_connection_wrapper.h"
#include "pc/sdp_utils.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "pc/usage_pattern.h"
#include "pc/webrtc_sdp.h"
@@ -84,9 +83,7 @@ class PeerConnectionFactoryForUsageHistogramTest
dependencies.worker_thread = rtc::Thread::Current();
dependencies.signaling_thread = rtc::Thread::Current();
dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
- dependencies.media_engine =
- std::make_unique<cricket::FakeMediaEngine>();
- dependencies.call_factory = CreateCallFactory();
+ EnableFakeMedia(dependencies);
return dependencies;
}()) {}
};
@@ -97,7 +94,7 @@ typedef PeerConnectionWrapperForUsageHistogramTest* RawWrapperPtr;
class ObserverForUsageHistogramTest : public MockPeerConnectionObserver {
public:
- void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override;
+ void OnIceCandidate(const IceCandidateInterface* candidate) override;
void OnInterestingUsage(int usage_pattern) override {
interesting_usage_detected_ = usage_pattern;
@@ -160,12 +157,11 @@ class PeerConnectionWrapperForUsageHistogramTest
return static_cast<ObserverForUsageHistogramTest*>(observer())
->HaveDataChannel();
}
- void BufferIceCandidate(const webrtc::IceCandidateInterface* candidate) {
+ void BufferIceCandidate(const IceCandidateInterface* candidate) {
std::string sdp;
EXPECT_TRUE(candidate->ToString(&sdp));
- std::unique_ptr<webrtc::IceCandidateInterface> candidate_copy(
- CreateIceCandidate(candidate->sdp_mid(), candidate->sdp_mline_index(),
- sdp, nullptr));
+ std::unique_ptr<IceCandidateInterface> candidate_copy(CreateIceCandidate(
+ candidate->sdp_mid(), candidate->sdp_mline_index(), sdp, nullptr));
buffered_candidates_.push_back(std::move(candidate_copy));
}
@@ -216,19 +212,18 @@ class PeerConnectionWrapperForUsageHistogramTest
return true;
}
- webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state() {
+ PeerConnectionInterface::IceGatheringState ice_gathering_state() {
return pc()->ice_gathering_state();
}
private:
// Candidates that have been sent but not yet configured
- std::vector<std::unique_ptr<webrtc::IceCandidateInterface>>
- buffered_candidates_;
+ std::vector<std::unique_ptr<IceCandidateInterface>> buffered_candidates_;
};
// Buffers candidates until we add them via AddBufferedIceCandidates.
void ObserverForUsageHistogramTest::OnIceCandidate(
- const webrtc::IceCandidateInterface* candidate) {
+ const IceCandidateInterface* candidate) {
// If target is not set, ignore. This happens in one-ended unit tests.
if (candidate_target_) {
this->candidate_target_->BufferIceCandidate(candidate);
@@ -245,12 +240,12 @@ class PeerConnectionUsageHistogramTest : public ::testing::Test {
: vss_(new rtc::VirtualSocketServer()),
socket_factory_(new rtc::BasicPacketSocketFactory(vss_.get())),
main_(vss_.get()) {
- webrtc::metrics::Reset();
+ metrics::Reset();
}
WrapperPtr CreatePeerConnection() {
RTCConfiguration config;
- config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
+ config.sdp_semantics = SdpSemantics::kUnifiedPlan;
return CreatePeerConnection(
config, PeerConnectionFactoryInterface::Options(), nullptr);
}
@@ -262,13 +257,13 @@ class PeerConnectionUsageHistogramTest : public ::testing::Test {
WrapperPtr CreatePeerConnectionWithMdns(const RTCConfiguration& config) {
auto resolver_factory =
- std::make_unique<NiceMock<webrtc::MockAsyncDnsResolverFactory>>();
+ std::make_unique<NiceMock<MockAsyncDnsResolverFactory>>();
- webrtc::PeerConnectionDependencies deps(nullptr /* observer_in */);
+ PeerConnectionDependencies deps(nullptr /* observer_in */);
auto fake_network = NewFakeNetwork();
fake_network->set_mdns_responder(
- std::make_unique<webrtc::FakeMdnsResponder>(rtc::Thread::Current()));
+ std::make_unique<FakeMdnsResponder>(rtc::Thread::Current()));
fake_network->AddInterface(NextLocalAddress());
std::unique_ptr<cricket::BasicPortAllocator> port_allocator(
@@ -283,7 +278,7 @@ class PeerConnectionUsageHistogramTest : public ::testing::Test {
WrapperPtr CreatePeerConnectionWithImmediateReport() {
RTCConfiguration configuration;
- configuration.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan;
+ configuration.sdp_semantics = SdpSemantics::kUnifiedPlan;
configuration.report_usage_pattern_delay_ms = 0;
return CreatePeerConnection(
configuration, PeerConnectionFactoryInterface::Options(), nullptr);
@@ -364,7 +359,7 @@ class PeerConnectionUsageHistogramTest : public ::testing::Test {
// This works correctly only if there is only one sample value
// that has been counted.
// Returns -1 for "not found".
- return webrtc::metrics::MinSample(kUsagePatternMetric);
+ return metrics::MinSample(kUsagePatternMetric);
}
// The PeerConnection's port allocator is tied to the PeerConnection's
@@ -393,10 +388,10 @@ TEST_F(PeerConnectionUsageHistogramTest, UsageFingerprintHistogramFromTimeout) {
auto pc = CreatePeerConnectionWithImmediateReport();
int expected_fingerprint = MakeUsageFingerprint({});
- EXPECT_METRIC_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
+ EXPECT_METRIC_EQ_WAIT(1, metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_EQ(
- 1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
#ifndef WEBRTC_ANDROID
@@ -421,11 +416,10 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintAudioVideo) {
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
// In this case, we may or may not have PRIVATE_CANDIDATE_COLLECTED,
// depending on the machine configuration.
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
- webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) ==
- 2 ||
- webrtc::metrics::NumEvents(
+ metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) == 2 ||
+ metrics::NumEvents(
kUsagePatternMetric,
expected_fingerprint |
static_cast<int>(UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) == 2);
@@ -466,11 +460,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithMdnsCaller) {
UsageEvent::CANDIDATE_COLLECTED, UsageEvent::ADD_ICE_CANDIDATE_SUCCEEDED,
UsageEvent::REMOTE_MDNS_CANDIDATE_ADDED, UsageEvent::ICE_STATE_CONNECTED,
UsageEvent::REMOTE_CANDIDATE_ADDED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_caller));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_callee));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_caller));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_callee));
}
// Test getting the usage fingerprint when the callee collects an mDNS
@@ -507,11 +501,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithMdnsCallee) {
UsageEvent::ADD_ICE_CANDIDATE_SUCCEEDED, UsageEvent::ICE_STATE_CONNECTED,
UsageEvent::REMOTE_CANDIDATE_ADDED,
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_caller));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_callee));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_caller));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_callee));
}
#ifdef WEBRTC_HAVE_SCTP
@@ -529,11 +523,10 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintDataOnly) {
UsageEvent::CANDIDATE_COLLECTED, UsageEvent::ADD_ICE_CANDIDATE_SUCCEEDED,
UsageEvent::ICE_STATE_CONNECTED, UsageEvent::REMOTE_CANDIDATE_ADDED,
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
- webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) ==
- 2 ||
- webrtc::metrics::NumEvents(
+ metrics::NumEvents(kUsagePatternMetric, expected_fingerprint) == 2 ||
+ metrics::NumEvents(
kUsagePatternMetric,
expected_fingerprint |
static_cast<int>(UsageEvent::PRIVATE_CANDIDATE_COLLECTED)) == 2);
@@ -557,9 +550,9 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintStunTurn) {
int expected_fingerprint = MakeUsageFingerprint(
{UsageEvent::STUN_SERVER_ADDED, UsageEvent::TURN_SERVER_ADDED,
UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(1, metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(
- 1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
TEST_F(PeerConnectionUsageHistogramTest, FingerprintStunTurnInReconfiguration) {
@@ -579,9 +572,9 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintStunTurnInReconfiguration) {
int expected_fingerprint = MakeUsageFingerprint(
{UsageEvent::STUN_SERVER_ADDED, UsageEvent::TURN_SERVER_ADDED,
UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(1, metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_EQ(
- 1, webrtc::metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint));
}
TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIPCaller) {
@@ -607,11 +600,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIPCaller) {
UsageEvent::REMOTE_PRIVATE_CANDIDATE_ADDED,
UsageEvent::ICE_STATE_CONNECTED, UsageEvent::REMOTE_CANDIDATE_ADDED,
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_caller));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_callee));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_caller));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_callee));
}
TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIpv6Callee) {
@@ -639,11 +632,11 @@ TEST_F(PeerConnectionUsageHistogramTest, FingerprintWithPrivateIpv6Callee) {
UsageEvent::ADD_ICE_CANDIDATE_SUCCEEDED,
UsageEvent::REMOTE_CANDIDATE_ADDED, UsageEvent::ICE_STATE_CONNECTED,
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_caller));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_callee));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_caller));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_callee));
}
#ifndef WEBRTC_ANDROID
@@ -667,7 +660,7 @@ TEST_F(PeerConnectionUsageHistogramTest,
ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer()));
// Wait until the gathering completes so that the session description would
// have contained ICE candidates.
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringComplete,
caller->ice_gathering_state(), kDefaultTimeout);
EXPECT_TRUE(caller->observer()->candidate_gathered());
// Get the current offer that contains candidates and pass it to the callee.
@@ -716,11 +709,11 @@ TEST_F(PeerConnectionUsageHistogramTest,
UsageEvent::REMOTE_PRIVATE_CANDIDATE_ADDED,
UsageEvent::REMOTE_IPV6_CANDIDATE_ADDED, UsageEvent::ICE_STATE_CONNECTED,
UsageEvent::DIRECT_CONNECTION_SELECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(2, webrtc::metrics::NumSamples(kUsagePatternMetric));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_caller));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(kUsagePatternMetric,
- expected_fingerprint_callee));
+ EXPECT_METRIC_EQ(2, metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_caller));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents(kUsagePatternMetric, expected_fingerprint_callee));
}
TEST_F(PeerConnectionUsageHistogramTest, NotableUsageNoted) {
@@ -731,7 +724,7 @@ TEST_F(PeerConnectionUsageHistogramTest, NotableUsageNoted) {
int expected_fingerprint = MakeUsageFingerprint(
{UsageEvent::DATA_ADDED, UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
UsageEvent::CANDIDATE_COLLECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(1, metrics::NumSamples(kUsagePatternMetric));
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
(expected_fingerprint |
@@ -748,9 +741,9 @@ TEST_F(PeerConnectionUsageHistogramTest, NotableUsageOnEventFiring) {
int expected_fingerprint = MakeUsageFingerprint(
{UsageEvent::DATA_ADDED, UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
UsageEvent::CANDIDATE_COLLECTED});
- EXPECT_METRIC_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(0, metrics::NumSamples(kUsagePatternMetric));
caller->GetInternalPeerConnection()->RequestUsagePatternReportForTesting();
- EXPECT_METRIC_EQ_WAIT(1, webrtc::metrics::NumSamples(kUsagePatternMetric),
+ EXPECT_METRIC_EQ_WAIT(1, metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
@@ -769,12 +762,12 @@ TEST_F(PeerConnectionUsageHistogramTest,
int expected_fingerprint = MakeUsageFingerprint(
{UsageEvent::DATA_ADDED, UsageEvent::SET_LOCAL_DESCRIPTION_SUCCEEDED,
UsageEvent::CANDIDATE_COLLECTED, UsageEvent::CLOSE_CALLED});
- EXPECT_METRIC_EQ(0, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(0, metrics::NumSamples(kUsagePatternMetric));
caller->pc()->Close();
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumSamples(kUsagePatternMetric));
+ EXPECT_METRIC_EQ(1, metrics::NumSamples(kUsagePatternMetric));
caller->GetInternalPeerConnection()->RequestUsagePatternReportForTesting();
caller->observer()->ClearInterestingUsageDetector();
- EXPECT_METRIC_EQ_WAIT(2, webrtc::metrics::NumSamples(kUsagePatternMetric),
+ EXPECT_METRIC_EQ_WAIT(2, metrics::NumSamples(kUsagePatternMetric),
kDefaultTimeout);
EXPECT_METRIC_TRUE(
expected_fingerprint == ObservedFingerprint() ||
diff --git a/pc/peer_connection_ice_unittest.cc b/pc/peer_connection_ice_unittest.cc
index 532583f307..492e108cbc 100644
--- a/pc/peer_connection_ice_unittest.cc
+++ b/pc/peer_connection_ice_unittest.cc
@@ -342,7 +342,7 @@ class PeerConnectionIceTest
public ::testing::WithParamInterface<SdpSemantics> {
protected:
PeerConnectionIceTest() : PeerConnectionIceBaseTest(GetParam()) {
- webrtc::metrics::Reset();
+ metrics::Reset();
}
};
@@ -514,7 +514,7 @@ TEST_P(PeerConnectionIceTest, CannotAddCandidateWhenRemoteDescriptionNotSet) {
EXPECT_FALSE(caller->pc()->AddIceCandidate(jsep_candidate.get()));
EXPECT_METRIC_THAT(
- webrtc::metrics::Samples("WebRTC.PeerConnection.AddIceCandidate"),
+ metrics::Samples("WebRTC.PeerConnection.AddIceCandidate"),
ElementsAre(Pair(kAddIceCandidateFailNoRemoteDescription, 2)));
}
@@ -1457,7 +1457,7 @@ class PeerConnectionIceConfigTest : public ::testing::Test {
pc_ = result.MoveValue();
}
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::SocketServer> socket_server_;
rtc::AutoSocketServerThread main_thread_;
rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_ = nullptr;
diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc
index d76e5e27d5..1ea16a6cf9 100644
--- a/pc/peer_connection_integrationtest.cc
+++ b/pc/peer_connection_integrationtest.cc
@@ -124,7 +124,7 @@ class FakeClockForTest : public rtc::ScopedFakeClock {
// Some things use a time of "0" as a special value, so we need to start out
// the fake clock at a nonzero time.
// TODO(deadbeef): Fix this.
- AdvanceTime(webrtc::TimeDelta::Seconds(1));
+ AdvanceTime(TimeDelta::Seconds(1));
}
// Explicit handle.
@@ -324,7 +324,7 @@ TEST_P(PeerConnectionIntegrationTest,
ConnectFakeSignaling();
// Add video tracks with 16:9 aspect ratio, size 1280 x 720.
- webrtc::FakePeriodicVideoSource::Config config;
+ FakePeriodicVideoSource::Config config;
config.width = 1280;
config.height = 720;
config.timestamp_offset_ms = rtc::TimeMillis();
@@ -366,7 +366,7 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithSendOnlyVideo) {
CreateOneDirectionalPeerConnectionWrappers(/*caller_to_callee=*/true));
ConnectFakeSignaling();
// Add one-directional video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
caller()->AddTrack(caller_track);
PeerConnectionInterface::RTCOfferAnswerOptions options;
@@ -391,7 +391,7 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndCallWithReceiveOnlyVideo) {
CreateOneDirectionalPeerConnectionWrappers(/*caller_to_callee=*/false));
ConnectFakeSignaling();
// Add one-directional video, from callee to caller.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
callee()->AddTrack(callee_track);
PeerConnectionInterface::RTCOfferAnswerOptions options;
@@ -414,14 +414,14 @@ TEST_P(PeerConnectionIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
// Add one-directional video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
caller()->AddTrack(caller_track);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Add receive video.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
callee()->AddTrack(callee_track);
caller()->CreateAndSetAndSignalOffer();
@@ -438,14 +438,14 @@ TEST_P(PeerConnectionIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
// Add one-directional video, from callee to caller.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
callee()->AddTrack(callee_track);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Add send video.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
caller()->AddTrack(caller_track);
caller()->CreateAndSetAndSignalOffer();
@@ -462,15 +462,15 @@ TEST_P(PeerConnectionIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
// Add send video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> caller_sender =
+ rtc::scoped_refptr<RtpSenderInterface> caller_sender =
caller()->AddTrack(caller_track);
// Add receive video, from callee to caller.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> callee_sender =
+ rtc::scoped_refptr<RtpSenderInterface> callee_sender =
callee()->AddTrack(callee_track);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
@@ -494,15 +494,15 @@ TEST_P(PeerConnectionIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
// Add send video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> caller_sender =
+ rtc::scoped_refptr<RtpSenderInterface> caller_sender =
caller()->AddTrack(caller_track);
// Add receive video, from callee to caller.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> callee_sender =
+ rtc::scoped_refptr<RtpSenderInterface> callee_sender =
callee()->AddTrack(callee_track);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
@@ -654,9 +654,9 @@ TEST_P(PeerConnectionIntegrationTest, RotatedVideoWithCVOExtension) {
ConnectFakeSignaling();
// Add rotated video tracks.
caller()->AddTrack(
- caller()->CreateLocalVideoTrackWithRotation(webrtc::kVideoRotation_90));
+ caller()->CreateLocalVideoTrackWithRotation(kVideoRotation_90));
callee()->AddTrack(
- callee()->CreateLocalVideoTrackWithRotation(webrtc::kVideoRotation_270));
+ callee()->CreateLocalVideoTrackWithRotation(kVideoRotation_270));
// Wait for video frames to be received by both sides.
caller()->CreateAndSetAndSignalOffer();
@@ -673,8 +673,8 @@ TEST_P(PeerConnectionIntegrationTest, RotatedVideoWithCVOExtension) {
EXPECT_EQ(4.0 / 3, callee()->local_rendered_aspect_ratio());
EXPECT_EQ(4.0 / 3, callee()->rendered_aspect_ratio());
// Ensure that the CVO bits were surfaced to the renderer.
- EXPECT_EQ(webrtc::kVideoRotation_270, caller()->rendered_rotation());
- EXPECT_EQ(webrtc::kVideoRotation_90, callee()->rendered_rotation());
+ EXPECT_EQ(kVideoRotation_270, caller()->rendered_rotation());
+ EXPECT_EQ(kVideoRotation_90, callee()->rendered_rotation());
}
// Test that when the CVO extension isn't supported, video is rotated the
@@ -684,9 +684,9 @@ TEST_P(PeerConnectionIntegrationTest, RotatedVideoWithoutCVOExtension) {
ConnectFakeSignaling();
// Add rotated video tracks.
caller()->AddTrack(
- caller()->CreateLocalVideoTrackWithRotation(webrtc::kVideoRotation_90));
+ caller()->CreateLocalVideoTrackWithRotation(kVideoRotation_90));
callee()->AddTrack(
- callee()->CreateLocalVideoTrackWithRotation(webrtc::kVideoRotation_270));
+ callee()->CreateLocalVideoTrackWithRotation(kVideoRotation_270));
// Remove the CVO extension from the offered SDP.
callee()->SetReceivedSdpMunger([](cricket::SessionDescription* desc) {
@@ -710,8 +710,8 @@ TEST_P(PeerConnectionIntegrationTest, RotatedVideoWithoutCVOExtension) {
EXPECT_EQ(3.0 / 4, callee()->local_rendered_aspect_ratio());
EXPECT_EQ(3.0 / 4, callee()->rendered_aspect_ratio());
// Expect that each endpoint is unaware of the rotation of the other endpoint.
- EXPECT_EQ(webrtc::kVideoRotation_0, caller()->rendered_rotation());
- EXPECT_EQ(webrtc::kVideoRotation_0, callee()->rendered_rotation());
+ EXPECT_EQ(kVideoRotation_0, caller()->rendered_rotation());
+ EXPECT_EQ(kVideoRotation_0, callee()->rendered_rotation());
}
// Test that if the answerer rejects the audio m= section, no audio is sent or
@@ -899,9 +899,9 @@ TEST_F(PeerConnectionIntegrationTestPlanB, EnableAudioAfterRejecting) {
ConnectFakeSignaling();
// Add audio track, do normal offer/answer.
- rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
+ rtc::scoped_refptr<AudioTrackInterface> track =
caller()->CreateLocalAudioTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> sender =
+ rtc::scoped_refptr<RtpSenderInterface> sender =
caller()->pc()->AddTrack(track, {"stream"}).MoveValue();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
@@ -974,7 +974,7 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
// Add one-directional video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
+ rtc::scoped_refptr<VideoTrackInterface> track =
caller()->CreateLocalVideoTrack();
RtpTransceiverInit video_transceiver_init;
@@ -988,7 +988,7 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
// Add receive direction.
video_sender->SetDirectionWithError(RtpTransceiverDirection::kSendRecv);
- rtc::scoped_refptr<webrtc::VideoTrackInterface> callee_track =
+ rtc::scoped_refptr<VideoTrackInterface> callee_track =
callee()->CreateLocalVideoTrack();
callee()->AddTrack(callee_track);
@@ -1348,11 +1348,11 @@ TEST_P(PeerConnectionIntegrationTest, NewGetStatsManyAudioAndManyVideoStreams) {
audio_sender_1->track()->id(), video_sender_1->track()->id(),
audio_sender_2->track()->id(), video_sender_2->track()->id()};
- rtc::scoped_refptr<const webrtc::RTCStatsReport> caller_report =
+ rtc::scoped_refptr<const RTCStatsReport> caller_report =
caller()->NewGetStats();
ASSERT_TRUE(caller_report);
auto outbound_stream_stats =
- caller_report->GetStatsOfType<webrtc::RTCOutboundRtpStreamStats>();
+ caller_report->GetStatsOfType<RTCOutboundRtpStreamStats>();
ASSERT_EQ(outbound_stream_stats.size(), 4u);
std::vector<std::string> outbound_track_ids;
for (const auto& stat : outbound_stream_stats) {
@@ -1373,11 +1373,11 @@ TEST_P(PeerConnectionIntegrationTest, NewGetStatsManyAudioAndManyVideoStreams) {
}
EXPECT_THAT(outbound_track_ids, UnorderedElementsAreArray(track_ids));
- rtc::scoped_refptr<const webrtc::RTCStatsReport> callee_report =
+ rtc::scoped_refptr<const RTCStatsReport> callee_report =
callee()->NewGetStats();
ASSERT_TRUE(callee_report);
auto inbound_stream_stats =
- callee_report->GetStatsOfType<webrtc::RTCInboundRtpStreamStats>();
+ callee_report->GetStatsOfType<RTCInboundRtpStreamStats>();
ASSERT_EQ(4u, inbound_stream_stats.size());
std::vector<std::string> inbound_track_ids;
for (const auto& stat : inbound_stream_stats) {
@@ -1412,11 +1412,10 @@ TEST_P(PeerConnectionIntegrationTest,
// We received a frame, so we should have nonzero "bytes received" stats for
// the unsignaled stream, if stats are working for it.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> report =
- callee()->NewGetStats();
+ rtc::scoped_refptr<const RTCStatsReport> report = callee()->NewGetStats();
ASSERT_NE(nullptr, report);
auto inbound_stream_stats =
- report->GetStatsOfType<webrtc::RTCInboundRtpStreamStats>();
+ report->GetStatsOfType<RTCInboundRtpStreamStats>();
ASSERT_EQ(1U, inbound_stream_stats.size());
ASSERT_TRUE(inbound_stream_stats[0]->bytes_received.is_defined());
ASSERT_GT(*inbound_stream_stats[0]->bytes_received, 0U);
@@ -1459,12 +1458,10 @@ TEST_P(PeerConnectionIntegrationTest,
media_expectations.CalleeExpectsSomeVideo(1);
ASSERT_TRUE(ExpectNewFrames(media_expectations));
- rtc::scoped_refptr<const webrtc::RTCStatsReport> report =
- callee()->NewGetStats();
+ rtc::scoped_refptr<const RTCStatsReport> report = callee()->NewGetStats();
ASSERT_NE(nullptr, report);
- auto inbound_rtps =
- report->GetStatsOfType<webrtc::RTCInboundRtpStreamStats>();
+ auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>();
auto index = FindFirstMediaStatsIndexByKind("audio", inbound_rtps);
ASSERT_GE(index, 0);
EXPECT_TRUE(inbound_rtps[index]->audio_level.is_defined());
@@ -1655,18 +1652,18 @@ TEST_P(PeerConnectionIntegrationTest, IceStatesReachCompletion) {
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringComplete,
caller()->ice_gathering_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceGatheringComplete,
callee()->ice_gathering_state(), kMaxWaitForFramesMs);
// After the best candidate pair is selected and all candidates are signaled,
// the ICE connection state should reach "complete".
// TODO(deadbeef): Currently, the ICE "controlled" agent (the
// answerer/"callee" by default) only reaches "connected". When this is
// fixed, this test should be updated.
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kDefaultTimeout);
}
@@ -1679,9 +1676,9 @@ constexpr int kOnlyLocalPorts = cricket::PORTALLOCATOR_DISABLE_STUN |
TEST_P(PeerConnectionIntegrationTest,
IceStatesReachCompletionWithRemoteHostname) {
auto caller_resolver_factory =
- std::make_unique<NiceMock<webrtc::MockAsyncDnsResolverFactory>>();
+ std::make_unique<NiceMock<MockAsyncDnsResolverFactory>>();
auto callee_resolver_factory =
- std::make_unique<NiceMock<webrtc::MockAsyncDnsResolverFactory>>();
+ std::make_unique<NiceMock<MockAsyncDnsResolverFactory>>();
auto callee_async_resolver =
std::make_unique<NiceMock<MockAsyncDnsResolver>>();
auto caller_async_resolver =
@@ -1695,12 +1692,12 @@ TEST_P(PeerConnectionIntegrationTest,
// P2PTransportChannel.
EXPECT_CALL(*caller_resolver_factory, Create())
.WillOnce(Return(ByMove(std::move(caller_async_resolver))));
- webrtc::PeerConnectionDependencies caller_deps(nullptr);
+ PeerConnectionDependencies caller_deps(nullptr);
caller_deps.async_dns_resolver_factory = std::move(caller_resolver_factory);
EXPECT_CALL(*callee_resolver_factory, Create())
.WillOnce(Return(ByMove(std::move(callee_async_resolver))));
- webrtc::PeerConnectionDependencies callee_deps(nullptr);
+ PeerConnectionDependencies callee_deps(nullptr);
callee_deps.async_dns_resolver_factory = std::move(callee_resolver_factory);
PeerConnectionInterface::RTCConfiguration config;
@@ -1719,9 +1716,9 @@ TEST_P(PeerConnectionIntegrationTest,
// Enable hostname candidates with mDNS names.
caller()->SetMdnsResponder(
- std::make_unique<webrtc::FakeMdnsResponder>(network_thread()));
+ std::make_unique<FakeMdnsResponder>(network_thread()));
callee()->SetMdnsResponder(
- std::make_unique<webrtc::FakeMdnsResponder>(network_thread()));
+ std::make_unique<FakeMdnsResponder>(network_thread()));
SetPortAllocatorFlags(kOnlyLocalPorts, kOnlyLocalPorts);
@@ -1730,18 +1727,18 @@ TEST_P(PeerConnectionIntegrationTest,
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kDefaultTimeout);
// Part of reporting the stats will occur on the network thread, so flush it
// before checking NumEvents.
SendTask(network_thread(), [] {});
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.CandidatePairType_UDP",
- webrtc::kIceCandidatePairHostNameHostName));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents("WebRTC.PeerConnection.CandidatePairType_UDP",
+ kIceCandidatePairHostNameHostName));
DestroyPeerConnections();
}
@@ -1862,9 +1859,9 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, MAYBE_VerifyBestConnection) {
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kDefaultTimeout);
// Part of reporting the stats will occur on the network thread, so flush it
@@ -1872,10 +1869,10 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, MAYBE_VerifyBestConnection) {
SendTask(network_thread(), [] {});
// TODO(bugs.webrtc.org/9456): Fix it.
- const int num_best_ipv4 = webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.IPMetrics", webrtc::kBestConnections_IPv4);
- const int num_best_ipv6 = webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.IPMetrics", webrtc::kBestConnections_IPv6);
+ const int num_best_ipv4 = metrics::NumEvents(
+ "WebRTC.PeerConnection.IPMetrics", kBestConnections_IPv4);
+ const int num_best_ipv6 = metrics::NumEvents(
+ "WebRTC.PeerConnection.IPMetrics", kBestConnections_IPv6);
if (TestIPv6()) {
// When IPv6 is enabled, we should prefer an IPv6 connection over an IPv4
// connection.
@@ -1886,12 +1883,12 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, MAYBE_VerifyBestConnection) {
EXPECT_METRIC_EQ(0, num_best_ipv6);
}
- EXPECT_METRIC_EQ(0, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.CandidatePairType_UDP",
- webrtc::kIceCandidatePairHostHost));
- EXPECT_METRIC_EQ(1, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.CandidatePairType_UDP",
- webrtc::kIceCandidatePairHostPublicHostPublic));
+ EXPECT_METRIC_EQ(
+ 0, metrics::NumEvents("WebRTC.PeerConnection.CandidatePairType_UDP",
+ kIceCandidatePairHostHost));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents("WebRTC.PeerConnection.CandidatePairType_UDP",
+ kIceCandidatePairHostPublicHostPublic));
}
constexpr uint32_t kFlagsIPv4NoStun = cricket::PORTALLOCATOR_DISABLE_TCP |
@@ -1931,17 +1928,17 @@ TEST_P(PeerConnectionIntegrationTest, MediaContinuesFlowingAfterIceRestart) {
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
// To verify that the ICE restart actually occurs, get
// ufrag/password/candidates before and after restart.
// Create an SDP string of the first audio candidate for both clients.
- const webrtc::IceCandidateCollection* audio_candidates_caller =
+ const IceCandidateCollection* audio_candidates_caller =
caller()->pc()->local_description()->candidates(0);
- const webrtc::IceCandidateCollection* audio_candidates_callee =
+ const IceCandidateCollection* audio_candidates_callee =
callee()->pc()->local_description()->candidates(0);
ASSERT_GT(audio_candidates_caller->count(), 0u);
ASSERT_GT(audio_candidates_callee->count(), 0u);
@@ -1964,9 +1961,9 @@ TEST_P(PeerConnectionIntegrationTest, MediaContinuesFlowingAfterIceRestart) {
caller()->SetOfferAnswerOptions(IceRestartOfferAnswerOptions());
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
// Grab the ufrags/candidates again.
@@ -2141,9 +2138,9 @@ TEST_F(PeerConnectionIntegrationTestPlanB,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kMaxWaitForActivationMs);
// Wait for ICE to complete, without any tracks being set.
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
// Now set the tracks, and expect frames to immediately start flowing.
EXPECT_TRUE(
@@ -2182,9 +2179,9 @@ TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kMaxWaitForActivationMs);
// Wait for ICE to complete, without any tracks being set.
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionCompleted,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kMaxWaitForFramesMs);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
// Now set the tracks, and expect frames to immediately start flowing.
auto callee_audio_sender = callee()->pc()->GetSenders()[0];
@@ -2279,21 +2276,21 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock,
});
PeerConnectionInterface::RTCConfiguration client_1_config;
- webrtc::PeerConnectionInterface::IceServer ice_server_1;
+ PeerConnectionInterface::IceServer ice_server_1;
ice_server_1.urls.push_back("turn:88.88.88.0:3478");
ice_server_1.username = "test";
ice_server_1.password = "test";
client_1_config.servers.push_back(ice_server_1);
- client_1_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_1_config.type = PeerConnectionInterface::kRelay;
client_1_config.presume_writable_when_fully_relayed = true;
PeerConnectionInterface::RTCConfiguration client_2_config;
- webrtc::PeerConnectionInterface::IceServer ice_server_2;
+ PeerConnectionInterface::IceServer ice_server_2;
ice_server_2.urls.push_back("turn:99.99.99.0:3478");
ice_server_2.username = "test";
ice_server_2.password = "test";
client_2_config.servers.push_back(ice_server_2);
- client_2_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_2_config.type = PeerConnectionInterface::kRelay;
client_2_config.presume_writable_when_fully_relayed = true;
ASSERT_TRUE(
@@ -2326,22 +2323,22 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock,
caller()->AddAudioTrack();
// Call getStats, assert there are no candidates.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> first_report =
+ rtc::scoped_refptr<const RTCStatsReport> first_report =
caller()->NewGetStats();
ASSERT_TRUE(first_report);
auto first_candidate_stats =
- first_report->GetStatsOfType<webrtc::RTCLocalIceCandidateStats>();
+ first_report->GetStatsOfType<RTCLocalIceCandidateStats>();
ASSERT_EQ(first_candidate_stats.size(), 0u);
// Create an offer at the caller and set it as remote description on the
// callee.
caller()->CreateAndSetAndSignalOffer();
// Call getStats again, assert there are candidates now.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> second_report =
+ rtc::scoped_refptr<const RTCStatsReport> second_report =
caller()->NewGetStats();
ASSERT_TRUE(second_report);
auto second_candidate_stats =
- second_report->GetStatsOfType<webrtc::RTCLocalIceCandidateStats>();
+ second_report->GetStatsOfType<RTCLocalIceCandidateStats>();
ASSERT_NE(second_candidate_stats.size(), 0u);
// The fake clock ensures that no time has passed so the cache must have been
@@ -2362,17 +2359,17 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock,
kDefaultTimeout, FakeClock());
// Call getStats, assert there are no candidates.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> first_report =
+ rtc::scoped_refptr<const RTCStatsReport> first_report =
caller()->NewGetStats();
ASSERT_TRUE(first_report);
auto first_candidate_stats =
- first_report->GetStatsOfType<webrtc::RTCRemoteIceCandidateStats>();
+ first_report->GetStatsOfType<RTCRemoteIceCandidateStats>();
ASSERT_EQ(first_candidate_stats.size(), 0u);
// Add a "fake" candidate.
absl::optional<RTCError> result;
caller()->pc()->AddIceCandidate(
- absl::WrapUnique(webrtc::CreateIceCandidate(
+ absl::WrapUnique(CreateIceCandidate(
"", 0,
"candidate:2214029314 1 udp 2122260223 127.0.0.1 49152 typ host",
nullptr)),
@@ -2381,11 +2378,11 @@ TEST_P(PeerConnectionIntegrationTestWithFakeClock,
ASSERT_TRUE(result.value().ok());
// Call getStats again, assert there is a remote candidate now.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> second_report =
+ rtc::scoped_refptr<const RTCStatsReport> second_report =
caller()->NewGetStats();
ASSERT_TRUE(second_report);
auto second_candidate_stats =
- second_report->GetStatsOfType<webrtc::RTCRemoteIceCandidateStats>();
+ second_report->GetStatsOfType<RTCRemoteIceCandidateStats>();
ASSERT_EQ(second_candidate_stats.size(), 1u);
// The fake clock ensures that no time has passed so the cache must have been
@@ -2413,22 +2410,22 @@ TEST_P(PeerConnectionIntegrationTest, TurnCustomizerUsedForTurnConnections) {
turn_server_2_external_address);
PeerConnectionInterface::RTCConfiguration client_1_config;
- webrtc::PeerConnectionInterface::IceServer ice_server_1;
+ PeerConnectionInterface::IceServer ice_server_1;
ice_server_1.urls.push_back("turn:88.88.88.0:3478");
ice_server_1.username = "test";
ice_server_1.password = "test";
client_1_config.servers.push_back(ice_server_1);
- client_1_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_1_config.type = PeerConnectionInterface::kRelay;
auto* customizer1 = CreateTurnCustomizer();
client_1_config.turn_customizer = customizer1;
PeerConnectionInterface::RTCConfiguration client_2_config;
- webrtc::PeerConnectionInterface::IceServer ice_server_2;
+ PeerConnectionInterface::IceServer ice_server_2;
ice_server_2.urls.push_back("turn:99.99.99.0:3478");
ice_server_2.username = "test";
ice_server_2.password = "test";
client_2_config.servers.push_back(ice_server_2);
- client_2_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_2_config.type = PeerConnectionInterface::kRelay;
auto* customizer2 = CreateTurnCustomizer();
client_2_config.turn_customizer = customizer2;
@@ -2460,18 +2457,18 @@ TEST_P(PeerConnectionIntegrationTest, TCPUsedForTurnConnections) {
CreateTurnServer(turn_server_internal_address, turn_server_external_address,
cricket::PROTO_TCP);
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turn:88.88.88.0:3478?transport=tcp");
ice_server.username = "test";
ice_server.password = "test";
PeerConnectionInterface::RTCConfiguration client_1_config;
client_1_config.servers.push_back(ice_server);
- client_1_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_1_config.type = PeerConnectionInterface::kRelay;
PeerConnectionInterface::RTCConfiguration client_2_config;
client_2_config.servers.push_back(ice_server);
- client_2_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_2_config.type = PeerConnectionInterface::kRelay;
ASSERT_TRUE(
CreatePeerConnectionWrappersWithConfig(client_1_config, client_2_config));
@@ -2482,7 +2479,7 @@ TEST_P(PeerConnectionIntegrationTest, TCPUsedForTurnConnections) {
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kMaxWaitForFramesMs);
MediaExpectations media_expectations;
@@ -2506,20 +2503,20 @@ TEST_P(PeerConnectionIntegrationTest,
CreateTurnServer(turn_server_internal_address, turn_server_external_address,
cricket::PROTO_TLS, "88.88.88.0");
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turns:88.88.88.0:3478?transport=tcp");
ice_server.username = "test";
ice_server.password = "test";
PeerConnectionInterface::RTCConfiguration client_1_config;
client_1_config.servers.push_back(ice_server);
- client_1_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_1_config.type = PeerConnectionInterface::kRelay;
PeerConnectionInterface::RTCConfiguration client_2_config;
client_2_config.servers.push_back(ice_server);
// Setting the type to kRelay forces the connection to go through a TURN
// server.
- client_2_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_2_config.type = PeerConnectionInterface::kRelay;
// Get a copy to the pointer so we can verify calls later.
rtc::TestCertificateVerifier* client_1_cert_verifier =
@@ -2530,10 +2527,10 @@ TEST_P(PeerConnectionIntegrationTest,
client_2_cert_verifier->verify_certificate_ = true;
// Create the dependencies with the test certificate verifier.
- webrtc::PeerConnectionDependencies client_1_deps(nullptr);
+ PeerConnectionDependencies client_1_deps(nullptr);
client_1_deps.tls_cert_verifier =
std::unique_ptr<rtc::TestCertificateVerifier>(client_1_cert_verifier);
- webrtc::PeerConnectionDependencies client_2_deps(nullptr);
+ PeerConnectionDependencies client_2_deps(nullptr);
client_2_deps.tls_cert_verifier =
std::unique_ptr<rtc::TestCertificateVerifier>(client_2_cert_verifier);
@@ -2644,7 +2641,7 @@ TEST_P(PeerConnectionIntegrationTest, GetSourcesAudio) {
ASSERT_GT(receiver->GetParameters().encodings.size(), 0u);
EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
sources[0].source_id());
- EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+ EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type());
}
TEST_P(PeerConnectionIntegrationTest, GetSourcesVideo) {
@@ -2665,7 +2662,7 @@ TEST_P(PeerConnectionIntegrationTest, GetSourcesVideo) {
ASSERT_GT(sources.size(), 0u);
EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc,
sources[0].source_id());
- EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+ EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type());
}
TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetSourcesAudio) {
@@ -2684,7 +2681,7 @@ TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetSourcesAudio) {
})(),
kDefaultTimeout);
ASSERT_GT(sources.size(), 0u);
- EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+ EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type());
}
TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetSourcesVideo) {
@@ -2703,7 +2700,7 @@ TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetSourcesVideo) {
})(),
kDefaultTimeout);
ASSERT_GT(sources.size(), 0u);
- EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+ EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type());
}
// Similar to the above test, except instead of waiting until GetSources() is
@@ -2728,7 +2725,7 @@ TEST_P(PeerConnectionIntegrationTest,
std::vector<RtpSource> sources = receiver->GetSources();
// SSRC history must not be cleared since the reception of the first frame.
ASSERT_GT(sources.size(), 0u);
- EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());
+ EXPECT_EQ(RtpSourceType::SSRC, sources[0].source_type());
}
TEST_P(PeerConnectionIntegrationTest, UnsignaledSsrcGetParametersAudio) {
@@ -2791,9 +2788,9 @@ TEST_F(PeerConnectionIntegrationTestPlanB, RemoveAndAddTrackWithNewStreamId) {
ConnectFakeSignaling();
// Add track using stream 1, do offer/answer.
- rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
+ rtc::scoped_refptr<AudioTrackInterface> track =
caller()->CreateLocalAudioTrack();
- rtc::scoped_refptr<webrtc::RtpSenderInterface> sender =
+ rtc::scoped_refptr<RtpSenderInterface> sender =
caller()->AddTrack(track, {"stream_1"});
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
@@ -2825,8 +2822,8 @@ TEST_P(PeerConnectionIntegrationTest, RtcEventLogOutputWriteCalled) {
.WillByDefault(::testing::Return(true));
EXPECT_CALL(*output, Write(::testing::A<absl::string_view>()))
.Times(::testing::AtLeast(1));
- EXPECT_TRUE(caller()->pc()->StartRtcEventLog(
- std::move(output), webrtc::RtcEventLog::kImmediateOutput));
+ EXPECT_TRUE(caller()->pc()->StartRtcEventLog(std::move(output),
+ RtcEventLog::kImmediateOutput));
caller()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
@@ -2900,8 +2897,7 @@ TEST_P(PeerConnectionIntegrationTest, DisableAndEnableAudioPlayout) {
double GetAudioEnergyStat(PeerConnectionIntegrationWrapper* pc) {
auto report = pc->NewGetStats();
- auto inbound_rtps =
- report->GetStatsOfType<webrtc::RTCInboundRtpStreamStats>();
+ auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>();
RTC_CHECK(!inbound_rtps.empty());
auto* inbound_rtp = inbound_rtps[0];
if (!inbound_rtp->total_audio_energy.is_defined()) {
@@ -2974,20 +2970,20 @@ TEST_P(PeerConnectionIntegrationTest,
ASSERT_TRUE_WAIT(DtlsConnected(), kDefaultTimeout);
ASSERT_NE(nullptr, caller()->event_log_factory());
ASSERT_NE(nullptr, callee()->event_log_factory());
- webrtc::FakeRtcEventLog* caller_event_log =
+ FakeRtcEventLog* caller_event_log =
caller()->event_log_factory()->last_log_created();
- webrtc::FakeRtcEventLog* callee_event_log =
+ FakeRtcEventLog* callee_event_log =
callee()->event_log_factory()->last_log_created();
ASSERT_NE(nullptr, caller_event_log);
ASSERT_NE(nullptr, callee_event_log);
- int caller_ice_config_count = caller_event_log->GetEventCount(
- webrtc::RtcEvent::Type::IceCandidatePairConfig);
- int caller_ice_event_count = caller_event_log->GetEventCount(
- webrtc::RtcEvent::Type::IceCandidatePairEvent);
- int callee_ice_config_count = callee_event_log->GetEventCount(
- webrtc::RtcEvent::Type::IceCandidatePairConfig);
- int callee_ice_event_count = callee_event_log->GetEventCount(
- webrtc::RtcEvent::Type::IceCandidatePairEvent);
+ int caller_ice_config_count =
+ caller_event_log->GetEventCount(RtcEvent::Type::IceCandidatePairConfig);
+ int caller_ice_event_count =
+ caller_event_log->GetEventCount(RtcEvent::Type::IceCandidatePairEvent);
+ int callee_ice_config_count =
+ callee_event_log->GetEventCount(RtcEvent::Type::IceCandidatePairConfig);
+ int callee_ice_event_count =
+ callee_event_log->GetEventCount(RtcEvent::Type::IceCandidatePairEvent);
EXPECT_LT(0, caller_ice_config_count);
EXPECT_LT(0, caller_ice_event_count);
EXPECT_LT(0, callee_ice_config_count);
@@ -3001,20 +2997,20 @@ TEST_P(PeerConnectionIntegrationTest, RegatherAfterChangingIceTransportType) {
CreateTurnServer(turn_server_internal_address, turn_server_external_address);
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turn:88.88.88.0:3478");
ice_server.username = "test";
ice_server.password = "test";
PeerConnectionInterface::RTCConfiguration caller_config;
caller_config.servers.push_back(ice_server);
- caller_config.type = webrtc::PeerConnectionInterface::kRelay;
+ caller_config.type = PeerConnectionInterface::kRelay;
caller_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
caller_config.surface_ice_candidates_on_ice_transport_type_changed = true;
PeerConnectionInterface::RTCConfiguration callee_config;
callee_config.servers.push_back(ice_server);
- callee_config.type = webrtc::PeerConnectionInterface::kRelay;
+ callee_config.type = PeerConnectionInterface::kRelay;
callee_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
callee_config.surface_ice_candidates_on_ice_transport_type_changed = true;
@@ -3031,9 +3027,9 @@ TEST_P(PeerConnectionIntegrationTest, RegatherAfterChangingIceTransportType) {
// kIceGatheringComplete (see
// P2PTransportChannel::OnCandidatesAllocationDone), and consequently not
// kIceConnectionComplete.
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
caller()->ice_connection_state(), kDefaultTimeout);
- EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceConnectionConnected,
+ EXPECT_EQ_WAIT(PeerConnectionInterface::kIceConnectionConnected,
callee()->ice_connection_state(), kDefaultTimeout);
// Note that we cannot use the metric
// `WebRTC.PeerConnection.CandidatePairType_UDP` in this test since this
@@ -3046,7 +3042,7 @@ TEST_P(PeerConnectionIntegrationTest, RegatherAfterChangingIceTransportType) {
// Loosen the caller's candidate filter.
caller_config = caller()->pc()->GetConfiguration();
- caller_config.type = webrtc::PeerConnectionInterface::kAll;
+ caller_config.type = PeerConnectionInterface::kAll;
caller()->pc()->SetConfiguration(caller_config);
// We should have gathered a new host candidate.
EXPECT_EQ_WAIT(cricket::LOCAL_PORT_TYPE,
@@ -3054,7 +3050,7 @@ TEST_P(PeerConnectionIntegrationTest, RegatherAfterChangingIceTransportType) {
// Loosen the callee's candidate filter.
callee_config = callee()->pc()->GetConfiguration();
- callee_config.type = webrtc::PeerConnectionInterface::kAll;
+ callee_config.type = PeerConnectionInterface::kAll;
callee()->pc()->SetConfiguration(callee_config);
EXPECT_EQ_WAIT(cricket::LOCAL_PORT_TYPE,
callee()->last_candidate_gathered().type(), kDefaultTimeout);
@@ -3084,19 +3080,19 @@ TEST_P(PeerConnectionIntegrationTest, OnIceCandidateError) {
CreateTurnServer(turn_server_internal_address, turn_server_external_address);
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turn:88.88.88.0:3478");
ice_server.username = "test";
ice_server.password = "123";
PeerConnectionInterface::RTCConfiguration caller_config;
caller_config.servers.push_back(ice_server);
- caller_config.type = webrtc::PeerConnectionInterface::kRelay;
+ caller_config.type = PeerConnectionInterface::kRelay;
caller_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
PeerConnectionInterface::RTCConfiguration callee_config;
callee_config.servers.push_back(ice_server);
- callee_config.type = webrtc::PeerConnectionInterface::kRelay;
+ callee_config.type = PeerConnectionInterface::kRelay;
callee_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
ASSERT_TRUE(
@@ -3115,19 +3111,19 @@ TEST_P(PeerConnectionIntegrationTest, OnIceCandidateError) {
}
TEST_P(PeerConnectionIntegrationTest, OnIceCandidateErrorWithEmptyAddress) {
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turn:127.0.0.1:3478?transport=tcp");
ice_server.username = "test";
ice_server.password = "test";
PeerConnectionInterface::RTCConfiguration caller_config;
caller_config.servers.push_back(ice_server);
- caller_config.type = webrtc::PeerConnectionInterface::kRelay;
+ caller_config.type = PeerConnectionInterface::kRelay;
caller_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
PeerConnectionInterface::RTCConfiguration callee_config;
callee_config.servers.push_back(ice_server);
- callee_config.type = webrtc::PeerConnectionInterface::kRelay;
+ callee_config.type = PeerConnectionInterface::kRelay;
callee_config.continual_gathering_policy = PeerConnection::GATHER_CONTINUALLY;
ASSERT_TRUE(
@@ -3697,7 +3693,7 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndRtpSenderVideoEncoderSelector) {
CreateOneDirectionalPeerConnectionWrappers(/*caller_to_callee=*/true));
ConnectFakeSignaling();
// Add one-directional video, from caller to callee.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> caller_track =
+ rtc::scoped_refptr<VideoTrackInterface> caller_track =
caller()->CreateLocalVideoTrack();
auto sender = caller()->AddTrack(caller_track);
PeerConnectionInterface::RTCOfferAnswerOptions options;
@@ -3722,7 +3718,7 @@ TEST_P(PeerConnectionIntegrationTest, EndToEndRtpSenderVideoEncoderSelector) {
}
int NacksReceivedCount(PeerConnectionIntegrationWrapper& pc) {
- rtc::scoped_refptr<const webrtc::RTCStatsReport> report = pc.NewGetStats();
+ rtc::scoped_refptr<const RTCStatsReport> report = pc.NewGetStats();
auto sender_stats = report->GetStatsOfType<RTCOutboundRtpStreamStats>();
if (sender_stats.size() != 1) {
ADD_FAILURE();
@@ -3735,7 +3731,7 @@ int NacksReceivedCount(PeerConnectionIntegrationWrapper& pc) {
}
int NacksSentCount(PeerConnectionIntegrationWrapper& pc) {
- rtc::scoped_refptr<const webrtc::RTCStatsReport> report = pc.NewGetStats();
+ rtc::scoped_refptr<const RTCStatsReport> report = pc.NewGetStats();
auto receiver_stats = report->GetStatsOfType<RTCInboundRtpStreamStats>();
if (receiver_stats.size() != 1) {
ADD_FAILURE();
diff --git a/pc/peer_connection_interface_unittest.cc b/pc/peer_connection_interface_unittest.cc
index 3023be1493..c057e55073 100644
--- a/pc/peer_connection_interface_unittest.cc
+++ b/pc/peer_connection_interface_unittest.cc
@@ -22,9 +22,9 @@
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
-#include "api/call/call_factory_interface.h"
#include "api/create_peerconnection_factory.h"
#include "api/data_channel_interface.h"
+#include "api/enable_media_with_defaults.h"
#include "api/jsep.h"
#include "api/media_stream_interface.h"
#include "api/media_types.h"
@@ -53,7 +53,6 @@
#include "media/base/media_engine.h"
#include "media/base/stream_params.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "media/sctp/sctp_transport_internal.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
@@ -475,8 +474,7 @@ bool GetFirstSsrc(const cricket::ContentInfo* content_info, int* ssrc) {
// Get the ufrags out of an SDP blob. Useful for testing ICE restart
// behavior.
-std::vector<std::string> GetUfrags(
- const webrtc::SessionDescriptionInterface* desc) {
+std::vector<std::string> GetUfrags(const SessionDescriptionInterface* desc) {
std::vector<std::string> ufrags;
for (const cricket::TransportInfo& info :
desc->description()->transport_infos()) {
@@ -545,21 +543,19 @@ rtc::scoped_refptr<StreamCollection> CreateStreamCollection(
StreamCollection::Create());
for (int i = 0; i < number_of_streams; ++i) {
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
- webrtc::MediaStream::Create(kStreams[i]));
+ rtc::scoped_refptr<MediaStreamInterface> stream(
+ MediaStream::Create(kStreams[i]));
for (int j = 0; j < tracks_per_stream; ++j) {
// Add a local audio track.
- rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
- webrtc::AudioTrack::Create(kAudioTracks[i * tracks_per_stream + j],
- nullptr));
+ rtc::scoped_refptr<AudioTrackInterface> audio_track(
+ AudioTrack::Create(kAudioTracks[i * tracks_per_stream + j], nullptr));
stream->AddTrack(audio_track);
// Add a local video track.
- rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
- webrtc::VideoTrack::Create(kVideoTracks[i * tracks_per_stream + j],
- webrtc::FakeVideoTrackSource::Create(),
- rtc::Thread::Current()));
+ rtc::scoped_refptr<VideoTrackInterface> video_track(VideoTrack::Create(
+ kVideoTracks[i * tracks_per_stream + j],
+ FakeVideoTrackSource::Create(), rtc::Thread::Current()));
stream->AddTrack(video_track);
}
@@ -579,10 +575,10 @@ bool CompareStreamCollections(StreamCollectionInterface* s1,
if (s1->at(i)->id() != s2->at(i)->id()) {
return false;
}
- webrtc::AudioTrackVector audio_tracks1 = s1->at(i)->GetAudioTracks();
- webrtc::AudioTrackVector audio_tracks2 = s2->at(i)->GetAudioTracks();
- webrtc::VideoTrackVector video_tracks1 = s1->at(i)->GetVideoTracks();
- webrtc::VideoTrackVector video_tracks2 = s2->at(i)->GetVideoTracks();
+ AudioTrackVector audio_tracks1 = s1->at(i)->GetAudioTracks();
+ AudioTrackVector audio_tracks2 = s2->at(i)->GetAudioTracks();
+ VideoTrackVector video_tracks1 = s1->at(i)->GetVideoTracks();
+ VideoTrackVector video_tracks2 = s2->at(i)->GetVideoTracks();
if (audio_tracks1.size() != audio_tracks2.size()) {
return false;
@@ -631,7 +627,7 @@ class MockTrackObserver : public ObserverInterface {
// constraints are propagated into the PeerConnection's MediaConfig. These
// settings are intended for MediaChannel constructors, but that is not
// exercised by these unittest.
-class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory {
+class PeerConnectionFactoryForTest : public PeerConnectionFactory {
public:
static rtc::scoped_refptr<PeerConnectionFactoryForTest>
CreatePeerConnectionFactoryForTest() {
@@ -641,16 +637,10 @@ class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory {
dependencies.signaling_thread = rtc::Thread::Current();
dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
dependencies.trials = std::make_unique<FieldTrialBasedConfig>();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = dependencies.task_queue_factory.get();
// Use fake audio device module since we're only testing the interface
// level, and using a real one could make tests flaky when run in parallel.
- media_deps.adm = FakeAudioCaptureModule::Create();
- SetMediaEngineDefaults(&media_deps);
- media_deps.trials = dependencies.trials.get();
- dependencies.media_engine =
- cricket::CreateMediaEngine(std::move(media_deps));
- dependencies.call_factory = webrtc::CreateCallFactory();
+ dependencies.adm = FakeAudioCaptureModule::Create();
+ EnableMediaWithDefaults(dependencies);
dependencies.event_log_factory = std::make_unique<RtcEventLogFactory>(
dependencies.task_queue_factory.get());
@@ -672,7 +662,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
main_(vss_.get()),
sdp_semantics_(sdp_semantics) {
#ifdef WEBRTC_ANDROID
- webrtc::InitializeAndroidObjects();
+ InitializeAndroidObjects();
#endif
}
@@ -680,22 +670,16 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
// Use fake audio capture module since we're only testing the interface
// level, and using a real one could make tests flaky when run in parallel.
fake_audio_capture_module_ = FakeAudioCaptureModule::Create();
- pc_factory_ = webrtc::CreatePeerConnectionFactory(
+ pc_factory_ = CreatePeerConnectionFactory(
rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(),
- rtc::scoped_refptr<webrtc::AudioDeviceModule>(
- fake_audio_capture_module_),
- webrtc::CreateBuiltinAudioEncoderFactory(),
- webrtc::CreateBuiltinAudioDecoderFactory(),
- std::make_unique<webrtc::VideoEncoderFactoryTemplate<
- webrtc::LibvpxVp8EncoderTemplateAdapter,
- webrtc::LibvpxVp9EncoderTemplateAdapter,
- webrtc::OpenH264EncoderTemplateAdapter,
- webrtc::LibaomAv1EncoderTemplateAdapter>>(),
- std::make_unique<webrtc::VideoDecoderFactoryTemplate<
- webrtc::LibvpxVp8DecoderTemplateAdapter,
- webrtc::LibvpxVp9DecoderTemplateAdapter,
- webrtc::OpenH264DecoderTemplateAdapter,
- webrtc::Dav1dDecoderTemplateAdapter>>(),
+ rtc::scoped_refptr<AudioDeviceModule>(fake_audio_capture_module_),
+ CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(),
+ std::make_unique<VideoEncoderFactoryTemplate<
+ LibvpxVp8EncoderTemplateAdapter, LibvpxVp9EncoderTemplateAdapter,
+ OpenH264EncoderTemplateAdapter, LibaomAv1EncoderTemplateAdapter>>(),
+ std::make_unique<VideoDecoderFactoryTemplate<
+ LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter,
+ OpenH264DecoderTemplateAdapter, Dav1dDecoderTemplateAdapter>>(),
nullptr /* audio_mixer */, nullptr /* audio_processing */);
ASSERT_TRUE(pc_factory_);
}
@@ -953,8 +937,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
// Call the standards-compliant GetStats function.
bool DoGetRTCStats() {
- auto callback =
- rtc::make_ref_counted<webrtc::MockRTCStatsCollectorCallback>();
+ auto callback = rtc::make_ref_counted<MockRTCStatsCollectorCallback>();
pc_->GetStats(callback.get());
EXPECT_TRUE_WAIT(callback->called(), kTimeout);
return callback->called();
@@ -994,14 +977,14 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE(offer->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_offer)));
EXPECT_EQ(PeerConnectionInterface::kHaveRemoteOffer, observer_.state_);
}
void CreateAndSetRemoteOffer(const std::string& sdp) {
std::unique_ptr<SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_offer)));
EXPECT_EQ(PeerConnectionInterface::kHaveRemoteOffer, observer_.state_);
}
@@ -1020,7 +1003,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> new_answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
EXPECT_TRUE(DoSetLocalDescription(std::move(new_answer)));
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
}
@@ -1032,7 +1015,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE(answer->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> pr_answer(
- webrtc::CreateSessionDescription(SdpType::kPrAnswer, sdp));
+ CreateSessionDescription(SdpType::kPrAnswer, sdp));
EXPECT_TRUE(DoSetLocalDescription(std::move(pr_answer)));
EXPECT_EQ(PeerConnectionInterface::kHaveLocalPrAnswer, observer_.state_);
}
@@ -1057,7 +1040,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE(offer->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> new_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_TRUE(DoSetLocalDescription(std::move(new_offer)));
EXPECT_EQ(PeerConnectionInterface::kHaveLocalOffer, observer_.state_);
@@ -1067,7 +1050,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
void CreateAnswerAsRemoteDescription(const std::string& sdp) {
std::unique_ptr<SessionDescriptionInterface> answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
ASSERT_TRUE(answer);
EXPECT_TRUE(DoSetRemoteDescription(std::move(answer)));
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
@@ -1075,12 +1058,12 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
void CreatePrAnswerAndAnswerAsRemoteDescription(const std::string& sdp) {
std::unique_ptr<SessionDescriptionInterface> pr_answer(
- webrtc::CreateSessionDescription(SdpType::kPrAnswer, sdp));
+ CreateSessionDescription(SdpType::kPrAnswer, sdp));
ASSERT_TRUE(pr_answer);
EXPECT_TRUE(DoSetRemoteDescription(std::move(pr_answer)));
EXPECT_EQ(PeerConnectionInterface::kHaveRemotePrAnswer, observer_.state_);
std::unique_ptr<SessionDescriptionInterface> answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
ASSERT_TRUE(answer);
EXPECT_TRUE(DoSetRemoteDescription(std::move(answer)));
EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_);
@@ -1124,8 +1107,8 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string mediastream_id = kStreams[0];
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream(
- webrtc::MediaStream::Create(mediastream_id));
+ rtc::scoped_refptr<MediaStreamInterface> stream(
+ MediaStream::Create(mediastream_id));
reference_collection_->AddStream(stream);
if (number_of_audio_tracks > 0) {
@@ -1149,22 +1132,20 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
}
return std::unique_ptr<SessionDescriptionInterface>(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp_ms1));
+ CreateSessionDescription(SdpType::kOffer, sdp_ms1));
}
void AddAudioTrack(const std::string& track_id,
MediaStreamInterface* stream) {
- rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
- webrtc::AudioTrack::Create(track_id, nullptr));
+ rtc::scoped_refptr<AudioTrackInterface> audio_track(
+ AudioTrack::Create(track_id, nullptr));
ASSERT_TRUE(stream->AddTrack(audio_track));
}
void AddVideoTrack(const std::string& track_id,
MediaStreamInterface* stream) {
- rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
- webrtc::VideoTrack::Create(track_id,
- webrtc::FakeVideoTrackSource::Create(),
- rtc::Thread::Current()));
+ rtc::scoped_refptr<VideoTrackInterface> video_track(VideoTrack::Create(
+ track_id, FakeVideoTrackSource::Create(), rtc::Thread::Current()));
ASSERT_TRUE(stream->AddTrack(video_track));
}
@@ -1224,7 +1205,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE((*desc)->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_offer)));
EXPECT_EQ(PeerConnectionInterface::kHaveRemoteOffer, observer_.state_);
}
@@ -1237,7 +1218,7 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
std::string sdp;
EXPECT_TRUE((*desc)->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> new_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_TRUE(DoSetLocalDescription(std::move(new_offer)));
EXPECT_EQ(PeerConnectionInterface::kHaveLocalOffer, observer_.state_);
@@ -1273,13 +1254,13 @@ class PeerConnectionInterfaceBaseTest : public ::testing::Test {
rtc::SocketServer* socket_server() const { return vss_.get(); }
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::VirtualSocketServer> vss_;
rtc::AutoSocketServerThread main_;
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
cricket::FakePortAllocator* port_allocator_ = nullptr;
FakeRTCCertificateGenerator* fake_certificate_generator_ = nullptr;
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory_;
rtc::scoped_refptr<PeerConnectionInterface> pc_;
MockPeerConnectionObserver observer_;
rtc::scoped_refptr<StreamCollection> reference_collection_;
@@ -1399,22 +1380,19 @@ TEST_P(PeerConnectionInterfaceTest,
config.prune_turn_ports = true;
// Create the PC factory and PC with the above config.
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory(
- webrtc::CreatePeerConnectionFactory(
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory(
+ CreatePeerConnectionFactory(
rtc::Thread::Current(), rtc::Thread::Current(),
rtc::Thread::Current(), fake_audio_capture_module_,
- webrtc::CreateBuiltinAudioEncoderFactory(),
- webrtc::CreateBuiltinAudioDecoderFactory(),
- std::make_unique<webrtc::VideoEncoderFactoryTemplate<
- webrtc::LibvpxVp8EncoderTemplateAdapter,
- webrtc::LibvpxVp9EncoderTemplateAdapter,
- webrtc::OpenH264EncoderTemplateAdapter,
- webrtc::LibaomAv1EncoderTemplateAdapter>>(),
- std::make_unique<webrtc::VideoDecoderFactoryTemplate<
- webrtc::LibvpxVp8DecoderTemplateAdapter,
- webrtc::LibvpxVp9DecoderTemplateAdapter,
- webrtc::OpenH264DecoderTemplateAdapter,
- webrtc::Dav1dDecoderTemplateAdapter>>(),
+ CreateBuiltinAudioEncoderFactory(),
+ CreateBuiltinAudioDecoderFactory(),
+ std::make_unique<VideoEncoderFactoryTemplate<
+ LibvpxVp8EncoderTemplateAdapter, LibvpxVp9EncoderTemplateAdapter,
+ OpenH264EncoderTemplateAdapter,
+ LibaomAv1EncoderTemplateAdapter>>(),
+ std::make_unique<VideoDecoderFactoryTemplate<
+ LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter,
+ OpenH264DecoderTemplateAdapter, Dav1dDecoderTemplateAdapter>>(),
nullptr /* audio_mixer */, nullptr /* audio_processing */));
PeerConnectionDependencies pc_dependencies(&observer_);
pc_dependencies.allocator = std::move(port_allocator);
@@ -1431,7 +1409,7 @@ TEST_P(PeerConnectionInterfaceTest,
EXPECT_TRUE(raw_port_allocator->flags() & cricket::PORTALLOCATOR_DISABLE_TCP);
EXPECT_TRUE(raw_port_allocator->flags() &
cricket::PORTALLOCATOR_DISABLE_COSTLY_NETWORKS);
- EXPECT_EQ(webrtc::PRUNE_BASED_ON_PRIORITY,
+ EXPECT_EQ(PRUNE_BASED_ON_PRIORITY,
raw_port_allocator->turn_port_prune_policy());
}
@@ -1453,8 +1431,7 @@ TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterCreatePeerConnection) {
TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterSetConfiguration) {
PeerConnectionInterface::RTCConfiguration starting_config;
starting_config.sdp_semantics = sdp_semantics_;
- starting_config.bundle_policy =
- webrtc::PeerConnection::kBundlePolicyMaxBundle;
+ starting_config.bundle_policy = PeerConnection::kBundlePolicyMaxBundle;
CreatePeerConnection(starting_config);
PeerConnectionInterface::RTCConfiguration config = pc_->GetConfiguration();
@@ -1985,7 +1962,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
RTCConfiguration rtc_config;
CreatePeerConnection(rtc_config);
- webrtc::DataChannelInit config;
+ DataChannelInit config;
auto channel = pc_->CreateDataChannelOrError("1", &config);
EXPECT_TRUE(channel.ok());
EXPECT_TRUE(channel.value()->reliable());
@@ -2017,7 +1994,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannelWhenClosed) {
RTCConfiguration rtc_config;
CreatePeerConnection(rtc_config);
pc_->Close();
- webrtc::DataChannelInit config;
+ DataChannelInit config;
auto ret = pc_->CreateDataChannelOrError("1", &config);
ASSERT_FALSE(ret.ok());
EXPECT_EQ(ret.error().type(), RTCErrorType::INVALID_STATE);
@@ -2029,7 +2006,7 @@ TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannelWithMinusOne) {
RTCConfiguration rtc_config;
CreatePeerConnection(rtc_config);
- webrtc::DataChannelInit config;
+ DataChannelInit config;
config.maxRetransmitTime = -1;
config.maxRetransmits = -1;
auto channel = pc_->CreateDataChannelOrError("1", &config);
@@ -2044,7 +2021,7 @@ TEST_P(PeerConnectionInterfaceTest,
CreatePeerConnection(rtc_config);
std::string label = "test";
- webrtc::DataChannelInit config;
+ DataChannelInit config;
config.maxRetransmits = 0;
config.maxRetransmitTime = 0;
@@ -2059,7 +2036,7 @@ TEST_P(PeerConnectionInterfaceTest,
RTCConfiguration rtc_config;
CreatePeerConnection(rtc_config);
- webrtc::DataChannelInit config;
+ DataChannelInit config;
config.id = 1;
config.negotiated = true;
@@ -2113,7 +2090,7 @@ TEST_P(PeerConnectionInterfaceTest, DISABLED_TestRejectSctpDataChannelInAnswer)
std::string sdp;
EXPECT_TRUE(pc_->local_description()->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
ASSERT_TRUE(answer);
cricket::ContentInfo* data_info =
cricket::GetFirstDataContent(answer->description());
@@ -2132,8 +2109,7 @@ TEST_P(PeerConnectionInterfaceTest, ReceiveFireFoxOffer) {
AddAudioTrack("audio_label");
AddVideoTrack("video_label");
std::unique_ptr<SessionDescriptionInterface> desc(
- webrtc::CreateSessionDescription(SdpType::kOffer,
- webrtc::kFireFoxSdpOffer, nullptr));
+ CreateSessionDescription(SdpType::kOffer, kFireFoxSdpOffer, nullptr));
EXPECT_TRUE(DoSetSessionDescription(std::move(desc), false));
CreateAnswerAsLocalDescription();
ASSERT_TRUE(pc_->local_description() != nullptr);
@@ -2170,8 +2146,7 @@ TEST_P(PeerConnectionInterfaceTest, DtlsSdesFallbackNotSupported) {
EXPECT_EQ_WAIT(1, fake_certificate_generator_->generated_certificates(),
kTimeout);
std::unique_ptr<SessionDescriptionInterface> desc(
- webrtc::CreateSessionDescription(SdpType::kOffer, kDtlsSdesFallbackSdp,
- nullptr));
+ CreateSessionDescription(SdpType::kOffer, kDtlsSdesFallbackSdp, nullptr));
EXPECT_FALSE(DoSetSessionDescription(std::move(desc), /*local=*/false));
}
@@ -2184,18 +2159,17 @@ TEST_P(PeerConnectionInterfaceTest, ReceiveUpdatedAudioOfferWithBadCodecs) {
CreateOfferAsLocalDescription();
const char* answer_sdp = (sdp_semantics_ == SdpSemantics::kPlanB_DEPRECATED
- ? webrtc::kAudioSdpPlanB
- : webrtc::kAudioSdpUnifiedPlan);
+ ? kAudioSdpPlanB
+ : kAudioSdpUnifiedPlan);
std::unique_ptr<SessionDescriptionInterface> answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, answer_sdp, nullptr));
+ CreateSessionDescription(SdpType::kAnswer, answer_sdp, nullptr));
EXPECT_TRUE(DoSetSessionDescription(std::move(answer), false));
- const char* reoffer_sdp =
- (sdp_semantics_ == SdpSemantics::kPlanB_DEPRECATED
- ? webrtc::kAudioSdpWithUnsupportedCodecsPlanB
- : webrtc::kAudioSdpWithUnsupportedCodecsUnifiedPlan);
+ const char* reoffer_sdp = (sdp_semantics_ == SdpSemantics::kPlanB_DEPRECATED
+ ? kAudioSdpWithUnsupportedCodecsPlanB
+ : kAudioSdpWithUnsupportedCodecsUnifiedPlan);
std::unique_ptr<SessionDescriptionInterface> updated_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, reoffer_sdp, nullptr));
+ CreateSessionDescription(SdpType::kOffer, reoffer_sdp, nullptr));
EXPECT_TRUE(DoSetSessionDescription(std::move(updated_offer), false));
CreateAnswerAsLocalDescription();
}
@@ -2282,12 +2256,11 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
config.prune_turn_ports = false;
CreatePeerConnection(config);
config = pc_->GetConfiguration();
- EXPECT_EQ(webrtc::NO_PRUNE, port_allocator_->turn_port_prune_policy());
+ EXPECT_EQ(NO_PRUNE, port_allocator_->turn_port_prune_policy());
config.prune_turn_ports = true;
EXPECT_TRUE(pc_->SetConfiguration(config).ok());
- EXPECT_EQ(webrtc::PRUNE_BASED_ON_PRIORITY,
- port_allocator_->turn_port_prune_policy());
+ EXPECT_EQ(PRUNE_BASED_ON_PRIORITY, port_allocator_->turn_port_prune_policy());
}
// Test that the ice check interval can be changed. This does not verify that
@@ -2556,12 +2529,12 @@ TEST_F(PeerConnectionInterfaceTestPlanB, CloseAndTestMethods) {
std::string sdp;
ASSERT_TRUE(pc_->remote_description()->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_FALSE(DoSetRemoteDescription(std::move(remote_offer)));
ASSERT_TRUE(pc_->local_description()->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> local_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
EXPECT_FALSE(DoSetLocalDescription(std::move(local_offer)));
}
@@ -2621,10 +2594,10 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
reference_collection_.get()));
rtc::scoped_refptr<AudioTrackInterface> audio_track2 =
observer_.remote_streams()->at(0)->GetAudioTracks()[1];
- EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, audio_track2->state());
+ EXPECT_EQ(MediaStreamTrackInterface::kLive, audio_track2->state());
rtc::scoped_refptr<VideoTrackInterface> video_track2 =
observer_.remote_streams()->at(0)->GetVideoTracks()[1];
- EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track2->state());
+ EXPECT_EQ(MediaStreamTrackInterface::kLive, video_track2->state());
// Remove the extra audio and video tracks.
std::unique_ptr<SessionDescriptionInterface> desc_ms2 =
@@ -2638,10 +2611,10 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
EXPECT_TRUE(CompareStreamCollections(observer_.remote_streams(),
reference_collection_.get()));
// Track state may be updated asynchronously.
- EXPECT_EQ_WAIT(webrtc::MediaStreamTrackInterface::kEnded,
- audio_track2->state(), kTimeout);
- EXPECT_EQ_WAIT(webrtc::MediaStreamTrackInterface::kEnded,
- video_track2->state(), kTimeout);
+ EXPECT_EQ_WAIT(MediaStreamTrackInterface::kEnded, audio_track2->state(),
+ kTimeout);
+ EXPECT_EQ_WAIT(MediaStreamTrackInterface::kEnded, video_track2->state(),
+ kTimeout);
}
// This tests that remote tracks are ended if a local session description is set
@@ -2659,7 +2632,7 @@ TEST_P(PeerConnectionInterfaceTest, RejectMediaContent) {
rtc::scoped_refptr<MediaStreamTrackInterface> remote_audio =
audio_receiver->track();
- EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, remote_audio->state());
+ EXPECT_EQ(MediaStreamTrackInterface::kLive, remote_audio->state());
rtc::scoped_refptr<MediaStreamTrackInterface> remote_video =
video_receiver->track();
EXPECT_EQ(MediaStreamTrackInterface::kLive, remote_video->state());
@@ -2703,8 +2676,8 @@ TEST_F(PeerConnectionInterfaceTestPlanB, RemoveTrackThenRejectMediaContent) {
remote_stream->RemoveTrack(remote_stream->GetAudioTracks()[0]);
std::unique_ptr<SessionDescriptionInterface> local_answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer,
- GetSdpStringWithStream1(), nullptr));
+ CreateSessionDescription(SdpType::kAnswer, GetSdpStringWithStream1(),
+ nullptr));
cricket::ContentInfo* video_info =
local_answer->description()->GetContentByName("video");
video_info->rejected = true;
@@ -2993,9 +2966,9 @@ TEST_P(PeerConnectionInterfaceTest,
ASSERT_TRUE(DoCreateOffer(&offer, nullptr));
// Grab a copy of the offer before it gets passed into the PC.
std::unique_ptr<SessionDescriptionInterface> modified_offer =
- webrtc::CreateSessionDescription(
- webrtc::SdpType::kOffer, offer->session_id(),
- offer->session_version(), offer->description()->Clone());
+ CreateSessionDescription(SdpType::kOffer, offer->session_id(),
+ offer->session_version(),
+ offer->description()->Clone());
EXPECT_TRUE(DoSetLocalDescription(std::move(offer)));
auto senders = pc_->GetSenders();
@@ -3004,21 +2977,20 @@ TEST_P(PeerConnectionInterfaceTest,
EXPECT_TRUE(ContainsSender(senders, kVideoTracks[0]));
// Change the ssrc of the audio and video track.
- cricket::MediaContentDescription* desc =
- cricket::GetFirstAudioContentDescription(modified_offer->description());
- ASSERT_TRUE(desc != nullptr);
- for (StreamParams& stream : desc->mutable_streams()) {
- for (unsigned int& ssrc : stream.ssrcs) {
- ++ssrc;
- }
- }
-
- desc =
- cricket::GetFirstVideoContentDescription(modified_offer->description());
- ASSERT_TRUE(desc != nullptr);
- for (StreamParams& stream : desc->mutable_streams()) {
- for (unsigned int& ssrc : stream.ssrcs) {
- ++ssrc;
+ for (auto content : modified_offer->description()->contents()) {
+ cricket::MediaContentDescription* desc = content.media_description();
+ ASSERT_TRUE(desc);
+ for (StreamParams& stream : desc->mutable_streams()) {
+ for (unsigned int& ssrc : stream.ssrcs) {
+ unsigned int old_ssrc = ssrc++;
+ for (auto& group : stream.ssrc_groups) {
+ for (unsigned int& secondary_ssrc : group.ssrcs) {
+ if (secondary_ssrc == old_ssrc) {
+ secondary_ssrc = ssrc;
+ }
+ }
+ }
+ }
}
}
@@ -3052,8 +3024,8 @@ TEST_F(PeerConnectionInterfaceTestPlanB,
EXPECT_TRUE(ContainsSender(senders, kVideoTracks[0], kStreams[0]));
// Add a new MediaStream but with the same tracks as in the first stream.
- rtc::scoped_refptr<webrtc::MediaStreamInterface> stream_1(
- webrtc::MediaStream::Create(kStreams[1]));
+ rtc::scoped_refptr<MediaStreamInterface> stream_1(
+ MediaStream::Create(kStreams[1]));
stream_1->AddTrack(stream_collection->at(0)->GetVideoTracks()[0]);
stream_1->AddTrack(stream_collection->at(0)->GetAudioTracks()[0]);
pc_->AddStream(stream_1.get());
@@ -3174,9 +3146,9 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationCausingPartialIceRestart) {
EXPECT_TRUE(pc_->SetConfiguration(config).ok());
// Do ICE restart for the first m= section, initiated by remote peer.
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer,
- GetSdpStringWithStream1(), nullptr));
+ std::unique_ptr<SessionDescriptionInterface> remote_offer(
+ CreateSessionDescription(SdpType::kOffer, GetSdpStringWithStream1(),
+ nullptr));
ASSERT_TRUE(remote_offer);
remote_offer->description()->transport_infos()[0].description.ice_ufrag =
"modified";
@@ -3222,7 +3194,7 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
// Set remote pranswer.
std::unique_ptr<SessionDescriptionInterface> remote_pranswer(
- webrtc::CreateSessionDescription(SdpType::kPrAnswer, sdp));
+ CreateSessionDescription(SdpType::kPrAnswer, sdp));
SessionDescriptionInterface* remote_pranswer_ptr = remote_pranswer.get();
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_pranswer)));
EXPECT_EQ(local_offer_ptr, pc_->pending_local_description());
@@ -3232,7 +3204,7 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
// Set remote answer.
std::unique_ptr<SessionDescriptionInterface> remote_answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
SessionDescriptionInterface* remote_answer_ptr = remote_answer.get();
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_answer)));
EXPECT_EQ(nullptr, pc_->pending_local_description());
@@ -3242,7 +3214,7 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
// Set remote offer.
std::unique_ptr<SessionDescriptionInterface> remote_offer(
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp));
+ CreateSessionDescription(SdpType::kOffer, sdp));
SessionDescriptionInterface* remote_offer_ptr = remote_offer.get();
EXPECT_TRUE(DoSetRemoteDescription(std::move(remote_offer)));
EXPECT_EQ(remote_offer_ptr, pc_->pending_remote_description());
@@ -3252,7 +3224,7 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
// Set local pranswer.
std::unique_ptr<SessionDescriptionInterface> local_pranswer(
- webrtc::CreateSessionDescription(SdpType::kPrAnswer, sdp));
+ CreateSessionDescription(SdpType::kPrAnswer, sdp));
SessionDescriptionInterface* local_pranswer_ptr = local_pranswer.get();
EXPECT_TRUE(DoSetLocalDescription(std::move(local_pranswer)));
EXPECT_EQ(remote_offer_ptr, pc_->pending_remote_description());
@@ -3262,7 +3234,7 @@ TEST_P(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
// Set local answer.
std::unique_ptr<SessionDescriptionInterface> local_answer(
- webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
+ CreateSessionDescription(SdpType::kAnswer, sdp));
SessionDescriptionInterface* local_answer_ptr = local_answer.get();
EXPECT_TRUE(DoSetLocalDescription(std::move(local_answer)));
EXPECT_EQ(nullptr, pc_->pending_remote_description());
@@ -3281,9 +3253,8 @@ TEST_P(PeerConnectionInterfaceTest,
// The RtcEventLog will be reset when the PeerConnection is closed.
pc_->Close();
- EXPECT_FALSE(
- pc_->StartRtcEventLog(std::make_unique<webrtc::RtcEventLogOutputNull>(),
- webrtc::RtcEventLog::kImmediateOutput));
+ EXPECT_FALSE(pc_->StartRtcEventLog(std::make_unique<RtcEventLogOutputNull>(),
+ RtcEventLog::kImmediateOutput));
pc_->StopRtcEventLog();
}
diff --git a/pc/peer_connection_internal.h b/pc/peer_connection_internal.h
index c91a44a148..6fc1222804 100644
--- a/pc/peer_connection_internal.h
+++ b/pc/peer_connection_internal.h
@@ -95,7 +95,6 @@ class PeerConnectionSdpMethods {
const std::map<std::string, const cricket::ContentGroup*>&
bundle_groups_by_mid) = 0;
- virtual absl::optional<std::string> GetDataMid() const = 0;
// Internal implementation for AddTransceiver family of methods. If
// `fire_callback` is set, fires OnRenegotiationNeeded callback if successful.
virtual RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
@@ -117,17 +116,14 @@ class PeerConnectionSdpMethods {
// Returns true if SRTP (either using DTLS-SRTP or SDES) is required by
// this session.
virtual bool SrtpRequired() const = 0;
- // Configures the data channel transport on the network thread.
- // The return value will be unset if an error occurs. If the setup succeeded
- // the return value will be set and contain the name of the transport
- // (empty string if a name isn't available).
- virtual absl::optional<std::string> SetupDataChannelTransport_n(
- absl::string_view mid) = 0;
- virtual void TeardownDataChannelTransport_n(RTCError error) = 0;
- virtual void SetSctpDataInfo(absl::string_view mid,
- absl::string_view transport_name) = 0;
- virtual void ResetSctpDataInfo() = 0;
-
+ // Initializes the data channel transport for the peerconnection instance.
+ // This will have the effect that `sctp_mid()` and `sctp_transport_name()`
+ // will return a set value (even though it might be an empty string) and the
+ // dc transport will be initialized on the network thread.
+ virtual bool CreateDataChannelTransport(absl::string_view mid) = 0;
+ // Tears down the data channel transport state and clears the `sctp_mid()` and
+ // `sctp_transport_name()` properties.
+ virtual void DestroyDataChannelTransport(RTCError error) = 0;
virtual const FieldTrialsView& trials() const = 0;
virtual void ClearStatsCache() = 0;
diff --git a/pc/peer_connection_jsep_unittest.cc b/pc/peer_connection_jsep_unittest.cc
index 1369253ad6..786b519a93 100644
--- a/pc/peer_connection_jsep_unittest.cc
+++ b/pc/peer_connection_jsep_unittest.cc
@@ -20,7 +20,7 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
-#include "api/call/call_factory_interface.h"
+#include "api/enable_media_with_defaults.h"
#include "api/field_trials_view.h"
#include "api/jsep.h"
#include "api/media_stream_interface.h"
@@ -40,7 +40,6 @@
#include "media/base/media_engine.h"
#include "media/base/stream_params.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "modules/audio_device/include/audio_device.h"
#include "p2p/base/p2p_constants.h"
#include "p2p/base/port_allocator.h"
@@ -84,13 +83,8 @@ PeerConnectionFactoryDependencies CreatePeerConnectionFactoryDependencies() {
dependencies.signaling_thread = rtc::Thread::Current();
dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
dependencies.trials = std::make_unique<FieldTrialBasedConfig>();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = dependencies.task_queue_factory.get();
- media_deps.adm = FakeAudioCaptureModule::Create();
- media_deps.trials = dependencies.trials.get();
- SetMediaEngineDefaults(&media_deps);
- dependencies.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
- dependencies.call_factory = CreateCallFactory();
+ dependencies.adm = FakeAudioCaptureModule::Create();
+ EnableMediaWithDefaults(dependencies);
dependencies.sctp_factory = std::make_unique<FakeSctpTransportFactory>();
return dependencies;
}
diff --git a/pc/peer_connection_media_unittest.cc b/pc/peer_connection_media_unittest.cc
index 485541981e..796520f9bc 100644
--- a/pc/peer_connection_media_unittest.cc
+++ b/pc/peer_connection_media_unittest.cc
@@ -27,7 +27,6 @@
#include "absl/algorithm/container.h"
#include "absl/types/optional.h"
#include "api/audio_options.h"
-#include "api/call/call_factory_interface.h"
#include "api/jsep.h"
#include "api/media_types.h"
#include "api/peer_connection_interface.h"
@@ -57,6 +56,7 @@
#include "pc/rtp_media_utils.h"
#include "pc/rtp_transceiver.h"
#include "pc/session_description.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/checks.h"
#include "rtc_base/rtc_certificate_generator.h"
@@ -82,9 +82,9 @@ using ::testing::NotNull;
using ::testing::Values;
cricket::MediaSendChannelInterface* SendChannelInternal(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
- auto transceiver_with_internal = static_cast<rtc::RefCountedObject<
- webrtc::RtpTransceiverProxyWithInternal<webrtc::RtpTransceiver>>*>(
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
+ auto transceiver_with_internal = static_cast<
+ rtc::RefCountedObject<RtpTransceiverProxyWithInternal<RtpTransceiver>>*>(
transceiver.get());
auto transceiver_internal =
static_cast<RtpTransceiver*>(transceiver_with_internal->internal());
@@ -92,9 +92,9 @@ cricket::MediaSendChannelInterface* SendChannelInternal(
}
cricket::MediaReceiveChannelInterface* ReceiveChannelInternal(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
- auto transceiver_with_internal = static_cast<rtc::RefCountedObject<
- webrtc::RtpTransceiverProxyWithInternal<webrtc::RtpTransceiver>>*>(
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
+ auto transceiver_with_internal = static_cast<
+ rtc::RefCountedObject<RtpTransceiverProxyWithInternal<RtpTransceiver>>*>(
transceiver.get());
auto transceiver_internal =
static_cast<RtpTransceiver*>(transceiver_with_internal->internal());
@@ -102,22 +102,22 @@ cricket::MediaReceiveChannelInterface* ReceiveChannelInternal(
}
cricket::FakeVideoMediaSendChannel* VideoMediaSendChannel(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
return static_cast<cricket::FakeVideoMediaSendChannel*>(
SendChannelInternal(transceiver));
}
cricket::FakeVideoMediaReceiveChannel* VideoMediaReceiveChannel(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
return static_cast<cricket::FakeVideoMediaReceiveChannel*>(
ReceiveChannelInternal(transceiver));
}
cricket::FakeVoiceMediaSendChannel* VoiceMediaSendChannel(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
return static_cast<cricket::FakeVoiceMediaSendChannel*>(
SendChannelInternal(transceiver));
}
cricket::FakeVoiceMediaReceiveChannel* VoiceMediaReceiveChannel(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver) {
return static_cast<cricket::FakeVoiceMediaReceiveChannel*>(
ReceiveChannelInternal(transceiver));
}
@@ -173,8 +173,7 @@ class PeerConnectionMediaBaseTest : public ::testing::Test {
factory_dependencies.worker_thread = rtc::Thread::Current();
factory_dependencies.signaling_thread = rtc::Thread::Current();
factory_dependencies.task_queue_factory = CreateDefaultTaskQueueFactory();
- factory_dependencies.media_engine = std::move(media_engine);
- factory_dependencies.call_factory = CreateCallFactory();
+ EnableFakeMedia(factory_dependencies, std::move(media_engine));
factory_dependencies.event_log_factory =
std::make_unique<RtcEventLogFactory>(
factory_dependencies.task_queue_factory.get());
@@ -255,7 +254,7 @@ class PeerConnectionMediaBaseTest : public ::testing::Test {
return sdp_semantics_ == SdpSemantics::kUnifiedPlan;
}
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<rtc::VirtualSocketServer> vss_;
rtc::AutoSocketServerThread main_;
const SdpSemantics sdp_semantics_;
@@ -1496,10 +1495,10 @@ TEST_P(PeerConnectionMediaTest, RedFmtpPayloadDifferentRedundancy) {
}
template <typename C>
-bool CompareCodecs(const std::vector<webrtc::RtpCodecCapability>& capabilities,
+bool CompareCodecs(const std::vector<RtpCodecCapability>& capabilities,
const std::vector<C>& codecs) {
bool capability_has_rtx =
- absl::c_any_of(capabilities, [](const webrtc::RtpCodecCapability& codec) {
+ absl::c_any_of(capabilities, [](const RtpCodecCapability& codec) {
return codec.name == cricket::kRtxCodecName;
});
bool codecs_has_rtx = absl::c_any_of(codecs, [](const C& codec) {
@@ -1511,16 +1510,16 @@ bool CompareCodecs(const std::vector<webrtc::RtpCodecCapability>& capabilities,
codecs, std::back_inserter(codecs_no_rtx),
[](const C& codec) { return codec.name != cricket::kRtxCodecName; });
- std::vector<webrtc::RtpCodecCapability> capabilities_no_rtx;
+ std::vector<RtpCodecCapability> capabilities_no_rtx;
absl::c_copy_if(capabilities, std::back_inserter(capabilities_no_rtx),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name != cricket::kRtxCodecName;
});
return capability_has_rtx == codecs_has_rtx &&
absl::c_equal(
capabilities_no_rtx, codecs_no_rtx,
- [](const webrtc::RtpCodecCapability& capability, const C& codec) {
+ [](const RtpCodecCapability& capability, const C& codec) {
return codec.MatchesRtpCodec(capability);
});
}
@@ -1539,9 +1538,9 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto capabilities = caller->pc_factory()->GetRtpSenderCapabilities(
cricket::MediaType::MEDIA_TYPE_AUDIO);
- std::vector<webrtc::RtpCodecCapability> codecs;
+ std::vector<RtpCodecCapability> codecs;
absl::c_copy_if(capabilities.codecs, std::back_inserter(codecs),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name.find("_only_") != std::string::npos;
});
@@ -1562,9 +1561,9 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto capabilities = caller->pc_factory()->GetRtpReceiverCapabilities(
cricket::MediaType::MEDIA_TYPE_AUDIO);
- std::vector<webrtc::RtpCodecCapability> codecs;
+ std::vector<RtpCodecCapability> codecs;
absl::c_copy_if(capabilities.codecs, std::back_inserter(codecs),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name.find("_only_") != std::string::npos;
});
@@ -1612,7 +1611,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto codecs_only_rtx_red_fec = codecs;
auto it = std::remove_if(codecs_only_rtx_red_fec.begin(),
codecs_only_rtx_red_fec.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return !(codec.name == cricket::kRtxCodecName ||
codec.name == cricket::kRedCodecName ||
codec.name == cricket::kUlpfecCodecName);
@@ -1652,7 +1651,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
caller->pc_factory()
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_AUDIO)
.codecs;
- std::vector<webrtc::RtpCodecCapability> empty_codecs = {};
+ std::vector<RtpCodecCapability> empty_codecs = {};
auto audio_transceiver = caller->pc()->GetTransceivers().front();
@@ -1707,7 +1706,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto codecs_only_rtx_red_fec = codecs;
auto it = std::remove_if(codecs_only_rtx_red_fec.begin(),
codecs_only_rtx_red_fec.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return !(codec.name == cricket::kRtxCodecName ||
codec.name == cricket::kRedCodecName ||
codec.name == cricket::kUlpfecCodecName);
@@ -1748,7 +1747,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
->GetRtpSenderCapabilities(cricket::MEDIA_TYPE_VIDEO)
.codecs;
- std::vector<webrtc::RtpCodecCapability> empty_codecs = {};
+ std::vector<RtpCodecCapability> empty_codecs = {};
auto video_transceiver = caller->pc()->GetTransceivers().front();
@@ -1818,7 +1817,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan, SetCodecPreferencesVideoWithRtx) {
auto video_codecs_vpx_rtx = sender_video_codecs;
auto it =
std::remove_if(video_codecs_vpx_rtx.begin(), video_codecs_vpx_rtx.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name != cricket::kRtxCodecName &&
codec.name != cricket::kVp8CodecName &&
codec.name != cricket::kVp9CodecName;
@@ -1867,7 +1866,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto video_codecs_vpx = video_codecs;
auto it = std::remove_if(video_codecs_vpx.begin(), video_codecs_vpx.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name != cricket::kVp8CodecName &&
codec.name != cricket::kVp9CodecName;
});
@@ -1890,7 +1889,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto recv_transceiver = callee->pc()->GetTransceivers().front();
auto video_codecs_vp8_rtx = video_codecs;
it = std::remove_if(video_codecs_vp8_rtx.begin(), video_codecs_vp8_rtx.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
bool r = codec.name != cricket::kVp8CodecName &&
codec.name != cricket::kRtxCodecName;
return r;
@@ -1937,7 +1936,7 @@ TEST_F(PeerConnectionMediaTestUnifiedPlan,
auto video_codecs_vpx = video_codecs;
auto it = std::remove_if(video_codecs_vpx.begin(), video_codecs_vpx.end(),
- [](const webrtc::RtpCodecCapability& codec) {
+ [](const RtpCodecCapability& codec) {
return codec.name != cricket::kVp8CodecName &&
codec.name != cricket::kVp9CodecName;
});
diff --git a/pc/peer_connection_rampup_tests.cc b/pc/peer_connection_rampup_tests.cc
index 545a1d53d0..0fd3c27f7d 100644
--- a/pc/peer_connection_rampup_tests.cc
+++ b/pc/peer_connection_rampup_tests.cc
@@ -201,7 +201,7 @@ class PeerConnectionRampUpTest : public ::testing::Test {
fake_network_managers_.emplace_back(fake_network_manager);
auto observer = std::make_unique<MockPeerConnectionObserver>();
- webrtc::PeerConnectionDependencies dependencies(observer.get());
+ PeerConnectionDependencies dependencies(observer.get());
cricket::BasicPortAllocator* port_allocator =
new cricket::BasicPortAllocator(fake_network_manager,
firewall_socket_factory_.get());
diff --git a/pc/peer_connection_rtp_unittest.cc b/pc/peer_connection_rtp_unittest.cc
index 4bdb7f1ea6..1a97a4bb44 100644
--- a/pc/peer_connection_rtp_unittest.cc
+++ b/pc/peer_connection_rtp_unittest.cc
@@ -53,6 +53,7 @@
#include "pc/sdp_utils.h"
#include "pc/session_description.h"
#include "pc/test/fake_audio_capture_module.h"
+#include "pc/test/integration_test_helpers.h"
#include "pc/test/mock_peer_connection_observers.h"
#include "rtc_base/checks.h"
#include "rtc_base/gunit.h"
@@ -73,16 +74,14 @@ using ::testing::Pair;
using ::testing::UnorderedElementsAre;
using ::testing::Values;
-const uint32_t kDefaultTimeout = 10000u;
-
template <typename MethodFunctor>
-class OnSuccessObserver : public webrtc::SetRemoteDescriptionObserverInterface {
+class OnSuccessObserver : public SetRemoteDescriptionObserverInterface {
public:
explicit OnSuccessObserver(MethodFunctor on_success)
: on_success_(std::move(on_success)) {}
- // webrtc::SetRemoteDescriptionObserverInterface implementation.
- void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override {
+ // SetRemoteDescriptionObserverInterface implementation.
+ void OnSetRemoteDescriptionComplete(RTCError error) override {
RTC_CHECK(error.ok());
on_success_();
}
@@ -114,7 +113,7 @@ class PeerConnectionRtpBaseTest : public ::testing::Test {
Dav1dDecoderTemplateAdapter>>(),
nullptr /* audio_mixer */,
nullptr /* audio_processing */)) {
- webrtc::metrics::Reset();
+ metrics::Reset();
}
std::unique_ptr<PeerConnectionWrapper> CreatePeerConnection() {
@@ -202,7 +201,7 @@ class PeerConnectionRtpTestUnifiedPlan : public PeerConnectionRtpBaseTest {
}
};
-// These tests cover `webrtc::PeerConnectionObserver` callbacks firing upon
+// These tests cover `PeerConnectionObserver` callbacks firing upon
// setting the remote description.
TEST_P(PeerConnectionRtpTest, AddTrackWithoutStreamFiresOnAddTrack) {
@@ -826,7 +825,8 @@ TEST_F(PeerConnectionRtpTestUnifiedPlan, TracksDoNotEndWhenSsrcChanges) {
for (size_t i = 0; i < contents.size(); ++i) {
auto& mutable_streams = contents[i].media_description()->mutable_streams();
ASSERT_EQ(mutable_streams.size(), 1u);
- mutable_streams[0].ssrcs[0] = kFirstMungedSsrc + static_cast<uint32_t>(i);
+ ReplaceFirstSsrc(mutable_streams[0],
+ kFirstMungedSsrc + static_cast<uint32_t>(i));
}
ASSERT_TRUE(
callee->SetLocalDescription(CloneSessionDescription(answer.get())));
@@ -934,8 +934,8 @@ TEST_P(PeerConnectionRtpTest,
auto caller = CreatePeerConnection();
auto callee = CreatePeerConnection();
- rtc::scoped_refptr<webrtc::MockSetSessionDescriptionObserver> observer =
- rtc::make_ref_counted<webrtc::MockSetSessionDescriptionObserver>();
+ rtc::scoped_refptr<MockSetSessionDescriptionObserver> observer =
+ rtc::make_ref_counted<MockSetSessionDescriptionObserver>();
auto offer = caller->CreateOfferAndSetAsLocal();
callee->pc()->SetRemoteDescription(observer.get(), offer.release());
diff --git a/pc/peer_connection_signaling_unittest.cc b/pc/peer_connection_signaling_unittest.cc
index 8ca59fc20c..aeba7efecd 100644
--- a/pc/peer_connection_signaling_unittest.cc
+++ b/pc/peer_connection_signaling_unittest.cc
@@ -896,8 +896,8 @@ TEST_P(PeerConnectionSignalingTest, UnsupportedContentType) {
"m=bogus 9 FOO 0 8\r\n"
"c=IN IP4 0.0.0.0\r\n"
"a=mid:bogusmid\r\n";
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_description =
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
+ std::unique_ptr<SessionDescriptionInterface> remote_description =
+ CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description)));
@@ -977,8 +977,8 @@ TEST_P(PeerConnectionSignalingTest, ReceiveFlexFec) {
"a=ssrc-group:FEC-FR 1224551896 1953032773\r\n"
"a=ssrc:1224551896 cname:/exJcmhSLpyu9FgV\r\n"
"a=ssrc:1953032773 cname:/exJcmhSLpyu9FgV\r\n";
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_description =
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
+ std::unique_ptr<SessionDescriptionInterface> remote_description =
+ CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description)));
@@ -1033,8 +1033,8 @@ TEST_P(PeerConnectionSignalingTest, ReceiveFlexFecReoffer) {
"a=ssrc-group:FEC-FR 1224551896 1953032773\r\n"
"a=ssrc:1224551896 cname:/exJcmhSLpyu9FgV\r\n"
"a=ssrc:1953032773 cname:/exJcmhSLpyu9FgV\r\n";
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_description =
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
+ std::unique_ptr<SessionDescriptionInterface> remote_description =
+ CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
EXPECT_TRUE(caller->SetRemoteDescription(std::move(remote_description)));
@@ -1104,8 +1104,8 @@ TEST_P(PeerConnectionSignalingTest, MidAttributeMaxLength) {
"a=rtcp-fb:102 nack\r\n"
"a=rtcp-fb:102 nack pli\r\n"
"a=ssrc:1224551896 cname:/exJcmhSLpyu9FgV\r\n";
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_description =
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
+ std::unique_ptr<SessionDescriptionInterface> remote_description =
+ CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
EXPECT_FALSE(caller->SetRemoteDescription(std::move(remote_description)));
}
@@ -1339,8 +1339,8 @@ TEST_F(PeerConnectionSignalingUnifiedPlanTest, RtxReofferApt) {
"a=rtcp-fb:102 nack\r\n"
"a=rtcp-fb:102 nack pli\r\n"
"a=ssrc:1224551896 cname:/exJcmhSLpyu9FgV\r\n";
- std::unique_ptr<webrtc::SessionDescriptionInterface> remote_description =
- webrtc::CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
+ std::unique_ptr<SessionDescriptionInterface> remote_description =
+ CreateSessionDescription(SdpType::kOffer, sdp, nullptr);
EXPECT_TRUE(callee->SetRemoteDescription(std::move(remote_description)));
diff --git a/pc/peer_connection_simulcast_unittest.cc b/pc/peer_connection_simulcast_unittest.cc
index 6b6a96c473..bffb5d9e9f 100644
--- a/pc/peer_connection_simulcast_unittest.cc
+++ b/pc/peer_connection_simulcast_unittest.cc
@@ -220,7 +220,7 @@ class PeerConnectionSimulcastMetricsTests
: public PeerConnectionSimulcastTests,
public ::testing::WithParamInterface<int> {
protected:
- PeerConnectionSimulcastMetricsTests() { webrtc::metrics::Reset(); }
+ PeerConnectionSimulcastMetricsTests() { metrics::Reset(); }
};
#endif
diff --git a/pc/peer_connection_svc_integrationtest.cc b/pc/peer_connection_svc_integrationtest.cc
index 672f3eef99..32ca451866 100644
--- a/pc/peer_connection_svc_integrationtest.cc
+++ b/pc/peer_connection_svc_integrationtest.cc
@@ -37,14 +37,13 @@ class PeerConnectionSVCIntegrationTest
: PeerConnectionIntegrationBaseTest(SdpSemantics::kUnifiedPlan) {}
RTCError SetCodecPreferences(
- rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver,
+ rtc::scoped_refptr<RtpTransceiverInterface> transceiver,
absl::string_view codec_name) {
- webrtc::RtpCapabilities capabilities =
+ RtpCapabilities capabilities =
caller()->pc_factory()->GetRtpSenderCapabilities(
cricket::MEDIA_TYPE_VIDEO);
std::vector<RtpCodecCapability> codecs;
- for (const webrtc::RtpCodecCapability& codec_capability :
- capabilities.codecs) {
+ for (const RtpCodecCapability& codec_capability : capabilities.codecs) {
if (codec_capability.name == codec_name)
codecs.push_back(codec_capability);
}
@@ -55,8 +54,8 @@ class PeerConnectionSVCIntegrationTest
TEST_F(PeerConnectionSVCIntegrationTest, AddTransceiverAcceptsL1T1) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.scalability_mode = "L1T1";
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
@@ -67,8 +66,8 @@ TEST_F(PeerConnectionSVCIntegrationTest, AddTransceiverAcceptsL1T1) {
TEST_F(PeerConnectionSVCIntegrationTest, AddTransceiverAcceptsL3T3) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.scalability_mode = "L3T3";
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
@@ -80,33 +79,32 @@ TEST_F(PeerConnectionSVCIntegrationTest,
AddTransceiverRejectsUnknownScalabilityMode) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
encoding_parameters.scalability_mode = "FOOBAR";
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
EXPECT_FALSE(transceiver_or_error.ok());
EXPECT_EQ(transceiver_or_error.error().type(),
- webrtc::RTCErrorType::UNSUPPORTED_OPERATION);
+ RTCErrorType::UNSUPPORTED_OPERATION);
}
TEST_F(PeerConnectionSVCIntegrationTest, SetParametersAcceptsL1T3WithVP8) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpCapabilities capabilities =
+ RtpCapabilities capabilities =
caller()->pc_factory()->GetRtpSenderCapabilities(
cricket::MEDIA_TYPE_VIDEO);
std::vector<RtpCodecCapability> vp8_codec;
- for (const webrtc::RtpCodecCapability& codec_capability :
- capabilities.codecs) {
+ for (const RtpCodecCapability& codec_capability : capabilities.codecs) {
if (codec_capability.name == cricket::kVp8CodecName)
vp8_codec.push_back(codec_capability);
}
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -114,7 +112,7 @@ TEST_F(PeerConnectionSVCIntegrationTest, SetParametersAcceptsL1T3WithVP8) {
auto transceiver = transceiver_or_error.MoveValue();
EXPECT_TRUE(transceiver->SetCodecPreferences(vp8_codec).ok());
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L1T3";
auto result = transceiver->sender()->SetParameters(parameters);
@@ -125,8 +123,8 @@ TEST_F(PeerConnectionSVCIntegrationTest, SetParametersRejectsL3T3WithVP8) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -134,12 +132,12 @@ TEST_F(PeerConnectionSVCIntegrationTest, SetParametersRejectsL3T3WithVP8) {
auto transceiver = transceiver_or_error.MoveValue();
EXPECT_TRUE(SetCodecPreferences(transceiver, cricket::kVp8CodecName).ok());
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L3T3";
auto result = transceiver->sender()->SetParameters(parameters);
EXPECT_FALSE(result.ok());
- EXPECT_EQ(result.type(), webrtc::RTCErrorType::INVALID_MODIFICATION);
+ EXPECT_EQ(result.type(), RTCErrorType::INVALID_MODIFICATION);
}
TEST_F(PeerConnectionSVCIntegrationTest,
@@ -147,8 +145,8 @@ TEST_F(PeerConnectionSVCIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -159,7 +157,7 @@ TEST_F(PeerConnectionSVCIntegrationTest,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L1T3";
auto result = transceiver->sender()->SetParameters(parameters);
@@ -171,8 +169,8 @@ TEST_F(PeerConnectionSVCIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -183,7 +181,7 @@ TEST_F(PeerConnectionSVCIntegrationTest,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L3T3";
auto result = transceiver->sender()->SetParameters(parameters);
@@ -195,8 +193,8 @@ TEST_F(PeerConnectionSVCIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -207,12 +205,12 @@ TEST_F(PeerConnectionSVCIntegrationTest,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L3T3";
auto result = transceiver->sender()->SetParameters(parameters);
EXPECT_FALSE(result.ok());
- EXPECT_EQ(result.type(), webrtc::RTCErrorType::INVALID_MODIFICATION);
+ EXPECT_EQ(result.type(), RTCErrorType::INVALID_MODIFICATION);
}
TEST_F(PeerConnectionSVCIntegrationTest,
@@ -220,8 +218,8 @@ TEST_F(PeerConnectionSVCIntegrationTest,
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
@@ -232,27 +230,27 @@ TEST_F(PeerConnectionSVCIntegrationTest,
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
- webrtc::RtpParameters parameters = transceiver->sender()->GetParameters();
+ RtpParameters parameters = transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "FOOBAR";
auto result = transceiver->sender()->SetParameters(parameters);
EXPECT_FALSE(result.ok());
- EXPECT_EQ(result.type(), webrtc::RTCErrorType::INVALID_MODIFICATION);
+ EXPECT_EQ(result.type(), RTCErrorType::INVALID_MODIFICATION);
}
TEST_F(PeerConnectionSVCIntegrationTest, FallbackToL1Tx) {
ASSERT_TRUE(CreatePeerConnectionWrappers());
ConnectFakeSignaling();
- webrtc::RtpTransceiverInit init;
- webrtc::RtpEncodingParameters encoding_parameters;
+ RtpTransceiverInit init;
+ RtpEncodingParameters encoding_parameters;
init.send_encodings.push_back(encoding_parameters);
auto transceiver_or_error =
caller()->pc()->AddTransceiver(caller()->CreateLocalVideoTrack(), init);
ASSERT_TRUE(transceiver_or_error.ok());
auto caller_transceiver = transceiver_or_error.MoveValue();
- webrtc::RtpCapabilities capabilities =
+ RtpCapabilities capabilities =
caller()->pc_factory()->GetRtpSenderCapabilities(
cricket::MEDIA_TYPE_VIDEO);
std::vector<RtpCodecCapability> send_codecs = capabilities.codecs;
@@ -267,8 +265,7 @@ TEST_F(PeerConnectionSVCIntegrationTest, FallbackToL1Tx) {
caller_transceiver->SetCodecPreferences(send_codecs);
// L3T3 should be supported by VP9
- webrtc::RtpParameters parameters =
- caller_transceiver->sender()->GetParameters();
+ RtpParameters parameters = caller_transceiver->sender()->GetParameters();
ASSERT_EQ(parameters.encodings.size(), 1u);
parameters.encodings[0].scalability_mode = "L3T3";
auto result = caller_transceiver->sender()->SetParameters(parameters);
diff --git a/pc/peer_connection_wrapper.cc b/pc/peer_connection_wrapper.cc
index 44f4256b10..557d0c8422 100644
--- a/pc/peer_connection_wrapper.cc
+++ b/pc/peer_connection_wrapper.cc
@@ -339,8 +339,7 @@ bool PeerConnectionWrapper::IsIceConnected() {
return observer()->ice_connected_;
}
-rtc::scoped_refptr<const webrtc::RTCStatsReport>
-PeerConnectionWrapper::GetStats() {
+rtc::scoped_refptr<const RTCStatsReport> PeerConnectionWrapper::GetStats() {
auto callback = rtc::make_ref_counted<MockRTCStatsCollectorCallback>();
pc()->GetStats(callback.get());
EXPECT_TRUE_WAIT(callback->called(), kDefaultTimeout);
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index c191f4d65e..2bac176aac 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -336,7 +336,7 @@ const char* QualityLimitationReasonToRTCQualityLimitationReason(
std::map<std::string, double>
QualityLimitationDurationToRTCQualityLimitationDuration(
- std::map<webrtc::QualityLimitationReason, int64_t> durations_ms) {
+ std::map<QualityLimitationReason, int64_t> durations_ms) {
std::map<std::string, double> result;
// The internal duration is defined in milliseconds while the spec defines
// the value in seconds:
@@ -513,7 +513,7 @@ std::unique_ptr<RTCInboundRtpStreamStats> CreateInboundAudioStreamStats(
std::unique_ptr<RTCAudioPlayoutStats> CreateAudioPlayoutStats(
const AudioDeviceModule::Stats& audio_device_stats,
- webrtc::Timestamp timestamp) {
+ Timestamp timestamp) {
auto stats = std::make_unique<RTCAudioPlayoutStats>(
/*id=*/kAudioPlayoutSingletonId, timestamp);
stats->synthesized_samples_duration =
@@ -839,7 +839,8 @@ CreateOutboundRTPStreamStatsFromVideoSenderInfo(
}
for (const auto& ssrc_group : video_sender_info.ssrc_groups) {
if (ssrc_group.semantics == cricket::kFidSsrcGroupSemantics &&
- ssrc_group.ssrcs.size() == 2) {
+ ssrc_group.ssrcs.size() == 2 &&
+ video_sender_info.ssrc() == ssrc_group.ssrcs[0]) {
outbound_video->rtx_ssrc = ssrc_group.ssrcs[1];
}
}
diff --git a/pc/rtc_stats_collector.h b/pc/rtc_stats_collector.h
index e94d23944c..4c68e77086 100644
--- a/pc/rtc_stats_collector.h
+++ b/pc/rtc_stats_collector.h
@@ -317,7 +317,7 @@ class RTCStatsCollector : public rtc::RefCountInterface {
uint32_t data_channels_closed;
// Identifies channels that have been opened, whose internal id is stored in
// the set until they have been fully closed.
- webrtc::flat_set<int> opened_data_channels;
+ flat_set<int> opened_data_channels;
};
InternalRecord internal_record_;
};
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 37821ac829..055be6fe99 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -263,9 +263,9 @@ class FakeAudioTrackForStats : public MediaStreamTrack<AudioTrackInterface> {
std::string kind() const override {
return MediaStreamTrackInterface::kAudioKind;
}
- webrtc::AudioSourceInterface* GetSource() const override { return nullptr; }
- void AddSink(webrtc::AudioTrackSinkInterface* sink) override {}
- void RemoveSink(webrtc::AudioTrackSinkInterface* sink) override {}
+ AudioSourceInterface* GetSource() const override { return nullptr; }
+ void AddSink(AudioTrackSinkInterface* sink) override {}
+ void RemoveSink(AudioTrackSinkInterface* sink) override {}
bool GetSignalLevel(int* level) override { return false; }
rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor() override {
return processor_;
@@ -2030,7 +2030,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
EXPECT_TRUE(report->Get(*expected_pair.transport_id));
// Set bandwidth and "GetStats" again.
- webrtc::Call::Stats call_stats;
+ Call::Stats call_stats;
const int kSendBandwidth = 888;
call_stats.send_bandwidth_bps = kSendBandwidth;
const int kRecvBandwidth = 999;
@@ -2339,12 +2339,9 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRtpStreamStats_Video) {
video_media_info.receivers[0].key_frames_decoded = 3;
video_media_info.receivers[0].frames_dropped = 13;
video_media_info.receivers[0].qp_sum = absl::nullopt;
- video_media_info.receivers[0].total_decode_time =
- webrtc::TimeDelta::Seconds(9);
- video_media_info.receivers[0].total_processing_delay =
- webrtc::TimeDelta::Millis(600);
- video_media_info.receivers[0].total_assembly_time =
- webrtc::TimeDelta::Millis(500);
+ video_media_info.receivers[0].total_decode_time = TimeDelta::Seconds(9);
+ video_media_info.receivers[0].total_processing_delay = TimeDelta::Millis(600);
+ video_media_info.receivers[0].total_assembly_time = TimeDelta::Millis(500);
video_media_info.receivers[0].frames_assembled_from_multiple_packets = 23;
video_media_info.receivers[0].total_inter_frame_delay = 0.123;
video_media_info.receivers[0].total_squared_inter_frame_delay = 0.00456;
@@ -2617,12 +2614,12 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRtpStreamStats_Video) {
video_media_info.senders[0].key_frames_encoded = 3;
video_media_info.senders[0].total_encode_time_ms = 9000;
video_media_info.senders[0].total_encoded_bytes_target = 1234;
- video_media_info.senders[0].total_packet_send_delay =
- webrtc::TimeDelta::Seconds(10);
+ video_media_info.senders[0].total_packet_send_delay = TimeDelta::Seconds(10);
video_media_info.senders[0].quality_limitation_reason =
QualityLimitationReason::kBandwidth;
- video_media_info.senders[0].quality_limitation_durations_ms
- [webrtc::QualityLimitationReason::kBandwidth] = 300;
+ video_media_info.senders[0]
+ .quality_limitation_durations_ms[QualityLimitationReason::kBandwidth] =
+ 300;
video_media_info.senders[0].quality_limitation_resolution_changes = 56u;
video_media_info.senders[0].qp_sum = absl::nullopt;
video_media_info.senders[0].content_type = VideoContentType::UNSPECIFIED;
diff --git a/pc/rtc_stats_traversal_unittest.cc b/pc/rtc_stats_traversal_unittest.cc
index 72ad255564..8205ebedc0 100644
--- a/pc/rtc_stats_traversal_unittest.cc
+++ b/pc/rtc_stats_traversal_unittest.cc
@@ -47,7 +47,7 @@ class RTCStatsTraversalTest : public ::testing::Test {
for (const RTCStats* start_node : start_nodes) {
start_ids.push_back(start_node->id());
}
- result_ = webrtc::TakeReferencedStats(initial_report_, start_ids);
+ result_ = ::webrtc::TakeReferencedStats(initial_report_, start_ids);
}
void EXPECT_VISITED(const RTCStats* stats) {
diff --git a/pc/rtp_sender.cc b/pc/rtp_sender.cc
index cdae1595b3..b0c32eff85 100644
--- a/pc/rtp_sender.cc
+++ b/pc/rtp_sender.cc
@@ -115,13 +115,13 @@ class SignalingThreadCallback {
if (!signaling_thread_->IsCurrent()) {
signaling_thread_->PostTask(
[callback = std::move(callback_), error]() mutable {
- webrtc::InvokeSetParametersCallback(callback, error);
+ InvokeSetParametersCallback(callback, error);
});
callback_ = nullptr;
return;
}
- webrtc::InvokeSetParametersCallback(callback_, error);
+ InvokeSetParametersCallback(callback_, error);
callback_ = nullptr;
}
@@ -243,7 +243,7 @@ void RtpSenderBase::SetParametersInternal(const RtpParameters& parameters,
"Attempted to set an unimplemented parameter of RtpParameters.");
RTC_LOG(LS_ERROR) << error.message() << " ("
<< ::webrtc::ToString(error.type()) << ")";
- webrtc::InvokeSetParametersCallback(callback, error);
+ InvokeSetParametersCallback(callback, error);
return;
}
if (!media_channel_ || !ssrc_) {
@@ -252,7 +252,7 @@ void RtpSenderBase::SetParametersInternal(const RtpParameters& parameters,
if (result.ok()) {
init_parameters_ = parameters;
}
- webrtc::InvokeSetParametersCallback(callback, result);
+ InvokeSetParametersCallback(callback, result);
return;
}
auto task = [&, callback = std::move(callback),
@@ -268,13 +268,13 @@ void RtpSenderBase::SetParametersInternal(const RtpParameters& parameters,
RTCError result = cricket::CheckRtpParametersInvalidModificationAndValues(
old_parameters, rtp_parameters);
if (!result.ok()) {
- webrtc::InvokeSetParametersCallback(callback, result);
+ InvokeSetParametersCallback(callback, result);
return;
}
result = CheckCodecParameters(rtp_parameters);
if (!result.ok()) {
- webrtc::InvokeSetParametersCallback(callback, result);
+ InvokeSetParametersCallback(callback, result);
return;
}
@@ -389,7 +389,7 @@ void RtpSenderBase::SetParametersAsync(const RtpParameters& parameters,
TRACE_EVENT0("webrtc", "RtpSenderBase::SetParametersAsync");
RTCError result = CheckSetParameters(parameters);
if (!result.ok()) {
- webrtc::InvokeSetParametersCallback(callback, result);
+ InvokeSetParametersCallback(callback, result);
return;
}
@@ -399,7 +399,7 @@ void RtpSenderBase::SetParametersAsync(const RtpParameters& parameters,
signaling_thread_,
[this, callback = std::move(callback)](RTCError error) mutable {
last_transaction_id_.reset();
- webrtc::InvokeSetParametersCallback(callback, error);
+ InvokeSetParametersCallback(callback, error);
}),
false);
}
diff --git a/pc/rtp_sender.h b/pc/rtp_sender.h
index d29c3760e6..8925230636 100644
--- a/pc/rtp_sender.h
+++ b/pc/rtp_sender.h
@@ -86,9 +86,7 @@ class RtpSenderInternal : public RtpSenderInterface {
const RtpParameters& parameters) = 0;
// Additional checks that are specific to the current codec settings
- virtual RTCError CheckCodecParameters(const RtpParameters& parameters) {
- return webrtc::RTCError::OK();
- }
+ virtual RTCError CheckCodecParameters(const RtpParameters& parameters) = 0;
// Returns an ID that changes every time SetTrack() is called, but
// otherwise remains constant. Used to generate IDs for stats.
diff --git a/pc/rtp_sender_receiver_unittest.cc b/pc/rtp_sender_receiver_unittest.cc
index 3092e53c2d..4387aedf53 100644
--- a/pc/rtp_sender_receiver_unittest.cc
+++ b/pc/rtp_sender_receiver_unittest.cc
@@ -105,7 +105,7 @@ class RtpSenderReceiverTest
: network_thread_(rtc::Thread::Current()),
worker_thread_(rtc::Thread::Current()),
video_bitrate_allocator_factory_(
- webrtc::CreateBuiltinVideoBitrateAllocatorFactory()),
+ CreateBuiltinVideoBitrateAllocatorFactory()),
// Create fake media engine/etc. so we can create channels to use to
// test RtpSenders/RtpReceivers.
media_engine_(std::make_unique<cricket::FakeMediaEngine>()),
@@ -119,16 +119,16 @@ class RtpSenderReceiverTest
// Fake media channels are owned by the media engine.
voice_media_send_channel_ = media_engine_->voice().CreateSendChannel(
&fake_call_, cricket::MediaConfig(), cricket::AudioOptions(),
- webrtc::CryptoOptions(), webrtc::AudioCodecPairId::Create());
+ CryptoOptions(), AudioCodecPairId::Create());
video_media_send_channel_ = media_engine_->video().CreateSendChannel(
&fake_call_, cricket::MediaConfig(), cricket::VideoOptions(),
- webrtc::CryptoOptions(), video_bitrate_allocator_factory_.get());
+ CryptoOptions(), video_bitrate_allocator_factory_.get());
voice_media_receive_channel_ = media_engine_->voice().CreateReceiveChannel(
&fake_call_, cricket::MediaConfig(), cricket::AudioOptions(),
- webrtc::CryptoOptions(), webrtc::AudioCodecPairId::Create());
+ CryptoOptions(), AudioCodecPairId::Create());
video_media_receive_channel_ = media_engine_->video().CreateReceiveChannel(
&fake_call_, cricket::MediaConfig(), cricket::VideoOptions(),
- webrtc::CryptoOptions());
+ CryptoOptions());
// Create streams for predefined SSRCs. Streams need to exist in order
// for the senders and receievers to apply parameters to them.
@@ -162,8 +162,8 @@ class RtpSenderReceiverTest
audio_track_ = nullptr;
}
- std::unique_ptr<webrtc::RtpTransportInternal> CreateDtlsSrtpTransport() {
- auto dtls_srtp_transport = std::make_unique<webrtc::DtlsSrtpTransport>(
+ std::unique_ptr<RtpTransportInternal> CreateDtlsSrtpTransport() {
+ auto dtls_srtp_transport = std::make_unique<DtlsSrtpTransport>(
/*rtcp_mux_required=*/true, field_trials_);
dtls_srtp_transport->SetDtlsTransports(rtp_dtls_transport_.get(),
/*rtcp_dtls_transport=*/nullptr);
@@ -515,12 +515,12 @@ class RtpSenderReceiverTest
test::RunLoop run_loop_;
rtc::Thread* const network_thread_;
rtc::Thread* const worker_thread_;
- webrtc::RtcEventLogNull event_log_;
+ RtcEventLogNull event_log_;
// The `rtp_dtls_transport_` and `rtp_transport_` should be destroyed after
// the `channel_manager`.
std::unique_ptr<cricket::DtlsTransportInternal> rtp_dtls_transport_;
- std::unique_ptr<webrtc::RtpTransportInternal> rtp_transport_;
- std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
+ std::unique_ptr<RtpTransportInternal> rtp_transport_;
+ std::unique_ptr<VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
std::unique_ptr<cricket::FakeMediaEngine> media_engine_;
rtc::UniqueRandomIdGenerator ssrc_generator_;
@@ -540,7 +540,7 @@ class RtpSenderReceiverTest
rtc::scoped_refptr<MediaStreamInterface> local_stream_;
rtc::scoped_refptr<VideoTrackInterface> video_track_;
rtc::scoped_refptr<AudioTrackInterface> audio_track_;
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
};
// Test that `voice_channel_` is updated when an audio track is associated
@@ -651,15 +651,13 @@ TEST_F(RtpSenderReceiverTest, LocalVideoTrackDisable) {
TEST_F(RtpSenderReceiverTest, RemoteVideoTrackState) {
CreateVideoRtpReceiver();
- EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track_->state());
- EXPECT_EQ(webrtc::MediaSourceInterface::kLive,
- video_track_->GetSource()->state());
+ EXPECT_EQ(MediaStreamTrackInterface::kLive, video_track_->state());
+ EXPECT_EQ(MediaSourceInterface::kLive, video_track_->GetSource()->state());
DestroyVideoRtpReceiver();
- EXPECT_EQ(webrtc::MediaStreamTrackInterface::kEnded, video_track_->state());
- EXPECT_EQ(webrtc::MediaSourceInterface::kEnded,
- video_track_->GetSource()->state());
+ EXPECT_EQ(MediaStreamTrackInterface::kEnded, video_track_->state());
+ EXPECT_EQ(MediaSourceInterface::kEnded, video_track_->GetSource()->state());
DestroyVideoRtpReceiver();
}
@@ -888,9 +886,9 @@ TEST_F(RtpSenderReceiverTest, AudioSenderCanSetParametersAsync) {
RtpParameters params = audio_rtp_sender_->GetParameters();
EXPECT_EQ(1u, params.encodings.size());
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
audio_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
@@ -918,13 +916,13 @@ TEST_F(RtpSenderReceiverTest,
audio_rtp_sender_ =
AudioRtpSender::Create(worker_thread_, /*id=*/"", nullptr, nullptr);
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
RtpParameters params = audio_rtp_sender_->GetParameters();
ASSERT_EQ(1u, params.encodings.size());
params.encodings[0].max_bitrate_bps = 90000;
audio_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
@@ -932,7 +930,7 @@ TEST_F(RtpSenderReceiverTest,
EXPECT_EQ(params.encodings[0].max_bitrate_bps, 90000);
audio_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
@@ -1016,13 +1014,13 @@ TEST_F(RtpSenderReceiverTest,
RtpParameters params = audio_rtp_sender_->GetParameters();
EXPECT_EQ(1u, params.encodings.size());
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
audio_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
audio_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_EQ(RTCErrorType::INVALID_STATE, result->type());
@@ -1081,7 +1079,7 @@ TEST_F(RtpSenderReceiverTest, SetAudioMaxSendBitrate) {
CreateAudioRtpSender();
EXPECT_EQ(-1, voice_media_send_channel()->max_bps());
- webrtc::RtpParameters params = audio_rtp_sender_->GetParameters();
+ RtpParameters params = audio_rtp_sender_->GetParameters();
EXPECT_EQ(1U, params.encodings.size());
EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
params.encodings[0].max_bitrate_bps = 1000;
@@ -1106,10 +1104,9 @@ TEST_F(RtpSenderReceiverTest, SetAudioMaxSendBitrate) {
TEST_F(RtpSenderReceiverTest, SetAudioBitratePriority) {
CreateAudioRtpSender();
- webrtc::RtpParameters params = audio_rtp_sender_->GetParameters();
+ RtpParameters params = audio_rtp_sender_->GetParameters();
EXPECT_EQ(1U, params.encodings.size());
- EXPECT_EQ(webrtc::kDefaultBitratePriority,
- params.encodings[0].bitrate_priority);
+ EXPECT_EQ(kDefaultBitratePriority, params.encodings[0].bitrate_priority);
double new_bitrate_priority = 2.0;
params.encodings[0].bitrate_priority = new_bitrate_priority;
EXPECT_TRUE(audio_rtp_sender_->SetParameters(params).ok());
@@ -1140,9 +1137,9 @@ TEST_F(RtpSenderReceiverTest, VideoSenderCanSetParametersAsync) {
RtpParameters params = video_rtp_sender_->GetParameters();
EXPECT_EQ(1u, params.encodings.size());
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
video_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
@@ -1170,19 +1167,19 @@ TEST_F(RtpSenderReceiverTest,
video_rtp_sender_ =
VideoRtpSender::Create(worker_thread_, /*id=*/"", nullptr);
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
RtpParameters params = video_rtp_sender_->GetParameters();
ASSERT_EQ(1u, params.encodings.size());
params.encodings[0].max_bitrate_bps = 90000;
video_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
params = video_rtp_sender_->GetParameters();
EXPECT_EQ(params.encodings[0].max_bitrate_bps, 90000);
video_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
@@ -1350,13 +1347,13 @@ TEST_F(RtpSenderReceiverTest,
RtpParameters params = video_rtp_sender_->GetParameters();
EXPECT_EQ(1u, params.encodings.size());
- absl::optional<webrtc::RTCError> result;
+ absl::optional<RTCError> result;
video_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_TRUE(result->ok());
video_rtp_sender_->SetParametersAsync(
- params, [&result](webrtc::RTCError error) { result = error; });
+ params, [&result](RTCError error) { result = error; });
run_loop_.Flush();
EXPECT_EQ(RTCErrorType::INVALID_STATE, result->type());
@@ -1453,7 +1450,7 @@ TEST_F(RtpSenderReceiverTest, VideoSenderDetectInvalidNumTemporalLayers) {
CreateVideoRtpSender();
RtpParameters params = video_rtp_sender_->GetParameters();
- params.encodings[0].num_temporal_layers = webrtc::kMaxTemporalStreams + 1;
+ params.encodings[0].num_temporal_layers = kMaxTemporalStreams + 1;
RTCError result = video_rtp_sender_->SetParameters(params);
EXPECT_EQ(RTCErrorType::INVALID_RANGE, result.type());
@@ -1536,7 +1533,7 @@ TEST_F(RtpSenderReceiverTest, SetVideoMinMaxSendBitrate) {
CreateVideoRtpSender();
EXPECT_EQ(-1, video_media_send_channel()->max_bps());
- webrtc::RtpParameters params = video_rtp_sender_->GetParameters();
+ RtpParameters params = video_rtp_sender_->GetParameters();
EXPECT_EQ(1U, params.encodings.size());
EXPECT_FALSE(params.encodings[0].min_bitrate_bps);
EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
@@ -1589,10 +1586,9 @@ TEST_F(RtpSenderReceiverTest, SetVideoMinMaxSendBitrateSimulcast) {
TEST_F(RtpSenderReceiverTest, SetVideoBitratePriority) {
CreateVideoRtpSender();
- webrtc::RtpParameters params = video_rtp_sender_->GetParameters();
+ RtpParameters params = video_rtp_sender_->GetParameters();
EXPECT_EQ(1U, params.encodings.size());
- EXPECT_EQ(webrtc::kDefaultBitratePriority,
- params.encodings[0].bitrate_priority);
+ EXPECT_EQ(kDefaultBitratePriority, params.encodings[0].bitrate_priority);
double new_bitrate_priority = 2.0;
params.encodings[0].bitrate_priority = new_bitrate_priority;
EXPECT_TRUE(video_rtp_sender_->SetParameters(params).ok());
diff --git a/pc/rtp_transceiver.cc b/pc/rtp_transceiver.cc
index 815ec9dece..ca626cc94b 100644
--- a/pc/rtp_transceiver.cc
+++ b/pc/rtp_transceiver.cc
@@ -542,7 +542,7 @@ bool RtpTransceiver::stopping() const {
RtpTransceiverDirection RtpTransceiver::direction() const {
if (unified_plan_ && stopping())
- return webrtc::RtpTransceiverDirection::kStopped;
+ return RtpTransceiverDirection::kStopped;
return direction_;
}
@@ -570,7 +570,7 @@ RTCError RtpTransceiver::SetDirectionWithError(
absl::optional<RtpTransceiverDirection> RtpTransceiver::current_direction()
const {
if (unified_plan_ && stopped())
- return webrtc::RtpTransceiverDirection::kStopped;
+ return RtpTransceiverDirection::kStopped;
return current_direction_;
}
@@ -604,7 +604,7 @@ void RtpTransceiver::StopSendingAndReceiving() {
});
stopping_ = true;
- direction_ = webrtc::RtpTransceiverDirection::kInactive;
+ direction_ = RtpTransceiverDirection::kInactive;
}
RTCError RtpTransceiver::StopStandard() {
diff --git a/pc/rtp_transceiver.h b/pc/rtp_transceiver.h
index deda5d7d61..88febb9429 100644
--- a/pc/rtp_transceiver.h
+++ b/pc/rtp_transceiver.h
@@ -358,20 +358,18 @@ PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpReceiverInterface>, receiver)
PROXY_CONSTMETHOD0(bool, stopped)
PROXY_CONSTMETHOD0(bool, stopping)
PROXY_CONSTMETHOD0(RtpTransceiverDirection, direction)
-PROXY_METHOD1(webrtc::RTCError, SetDirectionWithError, RtpTransceiverDirection)
+PROXY_METHOD1(RTCError, SetDirectionWithError, RtpTransceiverDirection)
PROXY_CONSTMETHOD0(absl::optional<RtpTransceiverDirection>, current_direction)
PROXY_CONSTMETHOD0(absl::optional<RtpTransceiverDirection>, fired_direction)
-PROXY_METHOD0(webrtc::RTCError, StopStandard)
+PROXY_METHOD0(RTCError, StopStandard)
PROXY_METHOD0(void, StopInternal)
-PROXY_METHOD1(webrtc::RTCError,
- SetCodecPreferences,
- rtc::ArrayView<RtpCodecCapability>)
+PROXY_METHOD1(RTCError, SetCodecPreferences, rtc::ArrayView<RtpCodecCapability>)
PROXY_CONSTMETHOD0(std::vector<RtpCodecCapability>, codec_preferences)
PROXY_CONSTMETHOD0(std::vector<RtpHeaderExtensionCapability>,
GetHeaderExtensionsToNegotiate)
PROXY_CONSTMETHOD0(std::vector<RtpHeaderExtensionCapability>,
GetNegotiatedHeaderExtensions)
-PROXY_METHOD1(webrtc::RTCError,
+PROXY_METHOD1(RTCError,
SetHeaderExtensionsToNegotiate,
rtc::ArrayView<const RtpHeaderExtensionCapability>)
END_PROXY_MAP(RtpTransceiver)
diff --git a/pc/rtp_transceiver_unittest.cc b/pc/rtp_transceiver_unittest.cc
index 8b4a2389ce..bd711f1a95 100644
--- a/pc/rtp_transceiver_unittest.cc
+++ b/pc/rtp_transceiver_unittest.cc
@@ -19,8 +19,8 @@
#include "absl/types/optional.h"
#include "api/peer_connection_interface.h"
#include "api/rtp_parameters.h"
-#include "media/base/fake_media_engine.h"
#include "media/base/media_engine.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/mock_channel_interface.h"
#include "pc/test/mock_rtp_receiver_internal.h"
#include "pc/test/mock_rtp_sender_internal.h"
@@ -60,7 +60,7 @@ class RtpTransceiverTest : public testing::Test {
d.network_thread = rtc::Thread::Current();
d.worker_thread = rtc::Thread::Current();
d.signaling_thread = rtc::Thread::Current();
- d.media_engine = std::make_unique<cricket::FakeMediaEngine>();
+ EnableFakeMedia(d);
return d;
}
@@ -420,8 +420,8 @@ TEST_F(RtpTransceiverTestForHeaderExtensions, ReturnsNegotiatedHdrExts) {
EXPECT_CALL(*mock_channel, mid()).WillRepeatedly(ReturnRef(content_name));
EXPECT_CALL(*mock_channel, SetRtpTransport(_)).WillRepeatedly(Return(true));
- cricket::RtpHeaderExtensions extensions = {webrtc::RtpExtension("uri1", 1),
- webrtc::RtpExtension("uri2", 2)};
+ cricket::RtpHeaderExtensions extensions = {RtpExtension("uri1", 1),
+ RtpExtension("uri2", 2)};
cricket::AudioContentDescription description;
description.set_rtp_header_extensions(extensions);
transceiver_->OnNegotiationUpdate(SdpType::kAnswer, &description);
@@ -449,8 +449,8 @@ TEST_F(RtpTransceiverTestForHeaderExtensions,
EXPECT_CALL(*sender_.get(), SetTransceiverAsStopped());
EXPECT_CALL(*sender_.get(), Stop());
- cricket::RtpHeaderExtensions extensions = {webrtc::RtpExtension("uri1", 1),
- webrtc::RtpExtension("uri2", 2)};
+ cricket::RtpHeaderExtensions extensions = {RtpExtension("uri1", 1),
+ RtpExtension("uri2", 2)};
cricket::AudioContentDescription description;
description.set_rtp_header_extensions(extensions);
transceiver_->OnNegotiationUpdate(SdpType::kAnswer, &description);
@@ -464,8 +464,7 @@ TEST_F(RtpTransceiverTestForHeaderExtensions,
RtpTransceiverDirection::kStopped),
Field(&RtpHeaderExtensionCapability::direction,
RtpTransceiverDirection::kStopped)));
- extensions = {webrtc::RtpExtension("uri3", 4),
- webrtc::RtpExtension("uri5", 6)};
+ extensions = {RtpExtension("uri3", 4), RtpExtension("uri5", 6)};
description.set_rtp_header_extensions(extensions);
transceiver_->OnNegotiationUpdate(SdpType::kAnswer, &description);
diff --git a/pc/rtp_transport.cc b/pc/rtp_transport.cc
index 653b51fd9e..7cf9fe0ace 100644
--- a/pc/rtp_transport.cc
+++ b/pc/rtp_transport.cc
@@ -180,12 +180,16 @@ bool RtpTransport::UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) {
return true;
}
+flat_set<uint32_t> RtpTransport::GetSsrcsForSink(RtpPacketSinkInterface* sink) {
+ return rtp_demuxer_.GetSsrcsForSink(sink);
+}
+
void RtpTransport::DemuxPacket(rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) {
- webrtc::RtpPacketReceived parsed_packet(
- &header_extension_map_, packet_time_us == -1
- ? Timestamp::MinusInfinity()
- : Timestamp::Micros(packet_time_us));
+ RtpPacketReceived parsed_packet(&header_extension_map_,
+ packet_time_us == -1
+ ? Timestamp::MinusInfinity()
+ : Timestamp::Micros(packet_time_us));
if (!parsed_packet.Parse(std::move(packet))) {
RTC_LOG(LS_ERROR)
<< "Failed to parse the incoming RTP packet before demuxing. Drop it.";
@@ -226,7 +230,14 @@ void RtpTransport::OnSentPacket(rtc::PacketTransportInternal* packet_transport,
const rtc::SentPacket& sent_packet) {
RTC_DCHECK(packet_transport == rtp_packet_transport_ ||
packet_transport == rtcp_packet_transport_);
+ if (processing_sent_packet_) {
+ TaskQueueBase::Current()->PostTask(SafeTask(
+ safety_.flag(), [this, sent_packet] { SendSentPacket(sent_packet); }));
+ return;
+ }
+ processing_sent_packet_ = true;
SendSentPacket(sent_packet);
+ processing_sent_packet_ = false;
}
void RtpTransport::OnRtpPacketReceived(rtc::CopyOnWriteBuffer packet,
diff --git a/pc/rtp_transport.h b/pc/rtp_transport.h
index 456c91c370..6d5d4bff57 100644
--- a/pc/rtp_transport.h
+++ b/pc/rtp_transport.h
@@ -96,6 +96,7 @@ class RtpTransport : public RtpTransportInternal {
rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags);
+ flat_set<uint32_t> GetSsrcsForSink(RtpPacketSinkInterface* sink);
// Overridden by SrtpTransport.
virtual void OnNetworkRouteChanged(
@@ -140,6 +141,7 @@ class RtpTransport : public RtpTransportInternal {
RtpHeaderExtensionMap header_extension_map_;
// Guard against recursive "ready to send" signals
bool processing_ready_to_send_ = false;
+ bool processing_sent_packet_ = false;
ScopedTaskSafety safety_;
};
diff --git a/pc/rtp_transport_internal.h b/pc/rtp_transport_internal.h
index 4114fa9340..483a1cee38 100644
--- a/pc/rtp_transport_internal.h
+++ b/pc/rtp_transport_internal.h
@@ -72,7 +72,7 @@ class RtpTransportInternal : public sigslot::has_slots<> {
// Called whenever a RTP packet that can not be demuxed by the transport is
// received.
void SetUnDemuxableRtpPacketReceivedHandler(
- absl::AnyInvocable<void(webrtc::RtpPacketReceived&)> callback) {
+ absl::AnyInvocable<void(RtpPacketReceived&)> callback) {
callback_undemuxable_rtp_packet_received_ = std::move(callback);
}
@@ -160,7 +160,7 @@ class RtpTransportInternal : public sigslot::has_slots<> {
CallbackList<bool> callback_list_ready_to_send_;
CallbackList<rtc::CopyOnWriteBuffer*, int64_t>
callback_list_rtcp_packet_received_;
- absl::AnyInvocable<void(webrtc::RtpPacketReceived&)>
+ absl::AnyInvocable<void(RtpPacketReceived&)>
callback_undemuxable_rtp_packet_received_ =
[](RtpPacketReceived& packet) {};
CallbackList<absl::optional<rtc::NetworkRoute>>
diff --git a/pc/rtp_transport_unittest.cc b/pc/rtp_transport_unittest.cc
index 5b6a8309e0..6b8e616799 100644
--- a/pc/rtp_transport_unittest.cc
+++ b/pc/rtp_transport_unittest.cc
@@ -349,4 +349,28 @@ TEST(RtpTransportTest, RecursiveSetSendDoesNotCrash) {
EXPECT_FALSE(observer.ready_to_send());
}
+TEST(RtpTransportTest, RecursiveOnSentPacketDoesNotCrash) {
+ const int kShortTimeout = 100;
+ test::RunLoop loop;
+ RtpTransport transport(kMuxEnabled);
+ rtc::FakePacketTransport fake_rtp("fake_rtp");
+ transport.SetRtpPacketTransport(&fake_rtp);
+ fake_rtp.SetDestination(&fake_rtp, true);
+ TransportObserver observer(&transport);
+ const rtc::PacketOptions options;
+ const int flags = 0;
+
+ fake_rtp.SetWritable(true);
+ observer.SetActionOnSentPacket([&]() {
+ rtc::CopyOnWriteBuffer rtp_data(kRtpData, kRtpLen);
+ if (observer.sent_packet_count() < 2) {
+ transport.SendRtpPacket(&rtp_data, options, flags);
+ }
+ });
+ rtc::CopyOnWriteBuffer rtp_data(kRtpData, kRtpLen);
+ transport.SendRtpPacket(&rtp_data, options, flags);
+ EXPECT_EQ(observer.sent_packet_count(), 1);
+ EXPECT_EQ_WAIT(observer.sent_packet_count(), 2, kShortTimeout);
+}
+
} // namespace webrtc
diff --git a/pc/sctp_transport.h b/pc/sctp_transport.h
index 35e7656100..076dee5318 100644
--- a/pc/sctp_transport.h
+++ b/pc/sctp_transport.h
@@ -61,7 +61,7 @@ class SctpTransport : public SctpTransportInterface,
void Start(int local_port, int remote_port, int max_message_size);
// TODO(https://bugs.webrtc.org/10629): Move functions that need
- // internal() to be functions on the webrtc::SctpTransport interface,
+ // internal() to be functions on the SctpTransport interface,
// and make the internal() function private.
cricket::SctpTransportInternal* internal() {
RTC_DCHECK_RUN_ON(owner_thread_);
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc
index 1ed5c80c29..04d1aff789 100644
--- a/pc/sdp_offer_answer.cc
+++ b/pc/sdp_offer_answer.cc
@@ -86,8 +86,7 @@ namespace webrtc {
namespace {
-typedef webrtc::PeerConnectionInterface::RTCOfferAnswerOptions
- RTCOfferAnswerOptions;
+typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
// Error messages
const char kInvalidSdp[] = "Invalid session description.";
@@ -834,8 +833,8 @@ std::string GenerateRtcpCname() {
}
// Check if we can send `new_stream` on a PeerConnection.
-bool CanAddLocalMediaStream(webrtc::StreamCollectionInterface* current_streams,
- webrtc::MediaStreamInterface* new_stream) {
+bool CanAddLocalMediaStream(StreamCollectionInterface* current_streams,
+ MediaStreamInterface* new_stream) {
if (!new_stream || !current_streams) {
return false;
}
@@ -847,7 +846,7 @@ bool CanAddLocalMediaStream(webrtc::StreamCollectionInterface* current_streams,
return true;
}
-rtc::scoped_refptr<webrtc::DtlsTransport> LookupDtlsTransportByMid(
+rtc::scoped_refptr<DtlsTransport> LookupDtlsTransportByMid(
rtc::Thread* network_thread,
JsepTransportController* controller,
const std::string& mid) {
@@ -2364,7 +2363,7 @@ void SdpOfferAnswerHandler::DoSetLocalDescription(
cricket::CS_LOCAL, desc->GetType(), error);
RTC_LOG(LS_ERROR) << error_message;
observer->OnSetLocalDescriptionComplete(
- RTCError(RTCErrorType::INTERNAL_ERROR, std::move(error_message)));
+ RTCError(error.type(), std::move(error_message)));
return;
}
@@ -3791,13 +3790,15 @@ RTCError SdpOfferAnswerHandler::UpdateTransceiversAndDataChannels(
return error;
}
} else if (media_type == cricket::MEDIA_TYPE_DATA) {
- if (pc_->GetDataMid() && new_content.name != *(pc_->GetDataMid())) {
+ const auto data_mid = pc_->sctp_mid();
+ if (data_mid && new_content.name != data_mid.value()) {
// Ignore all but the first data section.
RTC_LOG(LS_INFO) << "Ignoring data media section with MID="
<< new_content.name;
continue;
}
- RTCError error = UpdateDataChannel(source, new_content, bundle_group);
+ RTCError error =
+ UpdateDataChannelTransport(source, new_content, bundle_group);
if (!error.ok()) {
return error;
}
@@ -3979,7 +3980,7 @@ RTCError SdpOfferAnswerHandler::UpdateTransceiverChannel(
return RTCError::OK();
}
-RTCError SdpOfferAnswerHandler::UpdateDataChannel(
+RTCError SdpOfferAnswerHandler::UpdateDataChannelTransport(
cricket::ContentSource source,
const cricket::ContentInfo& content,
const cricket::ContentGroup* bundle_group) {
@@ -3991,8 +3992,8 @@ RTCError SdpOfferAnswerHandler::UpdateDataChannel(
sb << "Rejected data channel transport with mid=" << content.mid();
RTCError error(RTCErrorType::OPERATION_ERROR_WITH_DATA, sb.Release());
error.set_error_detail(RTCErrorDetailType::DATA_CHANNEL_FAILURE);
- DestroyDataChannelTransport(error);
- } else if (!CreateDataChannel(content.name)) {
+ pc_->DestroyDataChannelTransport(error);
+ } else if (!pc_->CreateDataChannelTransport(content.name)) {
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to create data channel.");
}
@@ -4323,8 +4324,9 @@ void SdpOfferAnswerHandler::GetOptionsForUnifiedPlanOffer(
session_options->media_description_options.push_back(
GetMediaDescriptionOptionsForRejectedData(mid));
} else {
- RTC_CHECK(pc_->GetDataMid());
- if (mid == *(pc_->GetDataMid())) {
+ const auto data_mid = pc_->sctp_mid();
+ RTC_CHECK(data_mid);
+ if (mid == data_mid.value()) {
session_options->media_description_options.push_back(
GetMediaDescriptionOptionsForActiveData(mid));
} else {
@@ -4365,9 +4367,9 @@ void SdpOfferAnswerHandler::GetOptionsForUnifiedPlanOffer(
}
// Lastly, add a m-section if we have requested local data channels and an
// m section does not already exist.
- if (!pc_->GetDataMid() && data_channel_controller()->HasDataChannels()) {
+ if (!pc_->sctp_mid() && data_channel_controller()->HasDataChannels()) {
// Attempt to recycle a stopped m-line.
- // TODO(crbug.com/1442604): GetDataMid() should return the mid if one was
+ // TODO(crbug.com/1442604): sctp_mid() should return the mid if one was
// ever created but rejected.
bool recycled = false;
for (size_t i = 0; i < session_options->media_description_options.size();
@@ -4510,7 +4512,7 @@ void SdpOfferAnswerHandler::GetOptionsForUnifiedPlanAnswer(
// Reject all data sections if data channels are disabled.
// Reject a data section if it has already been rejected.
// Reject all data sections except for the first one.
- if (content.rejected || content.name != *(pc_->GetDataMid())) {
+ if (content.rejected || content.name != *(pc_->sctp_mid())) {
session_options->media_description_options.push_back(
GetMediaDescriptionOptionsForRejectedData(content.name));
} else {
@@ -5003,14 +5005,14 @@ void SdpOfferAnswerHandler::RemoveUnusedChannels(
RTCError error(RTCErrorType::OPERATION_ERROR_WITH_DATA,
"No data channel section in the description.");
error.set_error_detail(RTCErrorDetailType::DATA_CHANNEL_FAILURE);
- DestroyDataChannelTransport(error);
+ pc_->DestroyDataChannelTransport(error);
} else if (data_info->rejected) {
rtc::StringBuilder sb;
sb << "Rejected data channel with mid=" << data_info->name << ".";
RTCError error(RTCErrorType::OPERATION_ERROR_WITH_DATA, sb.Release());
error.set_error_detail(RTCErrorDetailType::DATA_CHANNEL_FAILURE);
- DestroyDataChannelTransport(error);
+ pc_->DestroyDataChannelTransport(error);
}
}
@@ -5193,7 +5195,7 @@ RTCError SdpOfferAnswerHandler::CreateChannels(const SessionDescription& desc) {
}
const cricket::ContentInfo* data = cricket::GetFirstDataContent(&desc);
- if (data && !data->rejected && !CreateDataChannel(data->name)) {
+ if (data && !data->rejected && !pc_->CreateDataChannelTransport(data->name)) {
LOG_AND_RETURN_ERROR(RTCErrorType::INTERNAL_ERROR,
"Failed to create data channel.");
}
@@ -5201,34 +5203,7 @@ RTCError SdpOfferAnswerHandler::CreateChannels(const SessionDescription& desc) {
return RTCError::OK();
}
-bool SdpOfferAnswerHandler::CreateDataChannel(const std::string& mid) {
- RTC_DCHECK_RUN_ON(signaling_thread());
- RTC_DCHECK(!pc_->sctp_mid().has_value() || mid == pc_->sctp_mid().value());
- RTC_LOG(LS_INFO) << "Creating data channel, mid=" << mid;
-
- absl::optional<std::string> transport_name =
- context_->network_thread()->BlockingCall([&] {
- RTC_DCHECK_RUN_ON(context_->network_thread());
- return pc_->SetupDataChannelTransport_n(mid);
- });
- if (!transport_name)
- return false;
-
- pc_->SetSctpDataInfo(mid, *transport_name);
- return true;
-}
-
-void SdpOfferAnswerHandler::DestroyDataChannelTransport(RTCError error) {
- RTC_DCHECK_RUN_ON(signaling_thread());
- context_->network_thread()->BlockingCall(
- [&, data_channel_controller = data_channel_controller()] {
- RTC_DCHECK_RUN_ON(context_->network_thread());
- pc_->TeardownDataChannelTransport_n(error);
- });
- pc_->ResetSctpDataInfo();
-}
-
-void SdpOfferAnswerHandler::DestroyAllChannels() {
+void SdpOfferAnswerHandler::DestroyMediaChannels() {
RTC_DCHECK_RUN_ON(signaling_thread());
if (!transceivers()) {
return;
@@ -5251,8 +5226,6 @@ void SdpOfferAnswerHandler::DestroyAllChannels() {
transceiver->internal()->ClearChannel();
}
}
-
- DestroyDataChannelTransport({});
}
void SdpOfferAnswerHandler::GenerateMediaDescriptionOptions(
diff --git a/pc/sdp_offer_answer.h b/pc/sdp_offer_answer.h
index 80a21391b9..88ddfe0332 100644
--- a/pc/sdp_offer_answer.h
+++ b/pc/sdp_offer_answer.h
@@ -166,8 +166,8 @@ class SdpOfferAnswerHandler : public SdpStateProvider {
// See also `InternalDataChannelInit::fallback_ssl_role`.
absl::optional<rtc::SSLRole> GuessSslRole() const;
- // Destroys all BaseChannels and destroys the SCTP data channel, if present.
- void DestroyAllChannels();
+ // Destroys all media BaseChannels.
+ void DestroyMediaChannels();
rtc::scoped_refptr<StreamCollectionInterface> local_streams();
rtc::scoped_refptr<StreamCollectionInterface> remote_streams();
@@ -359,9 +359,9 @@ class SdpOfferAnswerHandler : public SdpStateProvider {
// Either creates or destroys the local data channel according to the given
// media section.
- RTCError UpdateDataChannel(cricket::ContentSource source,
- const cricket::ContentInfo& content,
- const cricket::ContentGroup* bundle_group)
+ RTCError UpdateDataChannelTransport(cricket::ContentSource source,
+ const cricket::ContentInfo& content,
+ const cricket::ContentGroup* bundle_group)
RTC_RUN_ON(signaling_thread());
// Check if a call to SetLocalDescription is acceptable with a session
// description of the given type.
@@ -526,12 +526,6 @@ class SdpOfferAnswerHandler : public SdpStateProvider {
// This method will also delete any existing media channels before creating.
RTCError CreateChannels(const cricket::SessionDescription& desc);
- bool CreateDataChannel(const std::string& mid);
-
- // Destroys the RTP data channel transport and/or the SCTP data channel
- // transport and clears it.
- void DestroyDataChannelTransport(RTCError error);
-
// Generates MediaDescriptionOptions for the `session_opts` based on existing
// local description or remote description.
void GenerateMediaDescriptionOptions(
@@ -680,8 +674,8 @@ class SdpOfferAnswerHandler : public SdpStateProvider {
// or else the CreateBuiltinVideoBitrateAllocatorFactory() will be called.
// Note that one can still choose to override this in a MediaEngine
// if one wants too.
- std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
- video_bitrate_allocator_factory_ RTC_GUARDED_BY(signaling_thread());
+ std::unique_ptr<VideoBitrateAllocatorFactory> video_bitrate_allocator_factory_
+ RTC_GUARDED_BY(signaling_thread());
// Whether we are the initial offerer on the association. This
// determines the SSL role.
diff --git a/pc/sdp_offer_answer_unittest.cc b/pc/sdp_offer_answer_unittest.cc
index 448f85a3e2..9a44360e8f 100644
--- a/pc/sdp_offer_answer_unittest.cc
+++ b/pc/sdp_offer_answer_unittest.cc
@@ -88,7 +88,7 @@ class SdpOfferAnswerTest : public ::testing::Test {
Dav1dDecoderTemplateAdapter>>(),
nullptr /* audio_mixer */,
nullptr /* audio_processing */)) {
- webrtc::metrics::Reset();
+ metrics::Reset();
}
std::unique_ptr<PeerConnectionWrapper> CreatePeerConnection() {
@@ -168,8 +168,8 @@ TEST_F(SdpOfferAnswerTest, BundleRejectsCodecCollisionsAudioVideo) {
// There is no error yet but the metrics counter will increase.
EXPECT_TRUE(error.ok());
EXPECT_METRIC_EQ(
- 1, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.ValidBundledPayloadTypes", false));
+ 1, metrics::NumEvents("WebRTC.PeerConnection.ValidBundledPayloadTypes",
+ false));
// Tolerate codec collisions in rejected m-lines.
pc = CreatePeerConnection();
@@ -178,9 +178,9 @@ TEST_F(SdpOfferAnswerTest, BundleRejectsCodecCollisionsAudioVideo) {
absl::StrReplaceAll(sdp, {{"m=video 9 ", "m=video 0 "}}));
pc->SetRemoteDescription(std::move(rejected_offer), &error);
EXPECT_TRUE(error.ok());
- EXPECT_METRIC_EQ(1,
- webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.ValidBundledPayloadTypes", true));
+ EXPECT_METRIC_EQ(
+ 1, metrics::NumEvents("WebRTC.PeerConnection.ValidBundledPayloadTypes",
+ true));
}
TEST_F(SdpOfferAnswerTest, BundleRejectsCodecCollisionsVideoFmtp) {
@@ -221,8 +221,8 @@ TEST_F(SdpOfferAnswerTest, BundleRejectsCodecCollisionsVideoFmtp) {
pc->SetRemoteDescription(std::move(desc), &error);
EXPECT_TRUE(error.ok());
EXPECT_METRIC_EQ(
- 1, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.ValidBundledPayloadTypes", false));
+ 1, metrics::NumEvents("WebRTC.PeerConnection.ValidBundledPayloadTypes",
+ false));
}
TEST_F(SdpOfferAnswerTest, BundleCodecCollisionInDifferentBundlesAllowed) {
@@ -264,8 +264,8 @@ TEST_F(SdpOfferAnswerTest, BundleCodecCollisionInDifferentBundlesAllowed) {
pc->SetRemoteDescription(std::move(desc), &error);
EXPECT_TRUE(error.ok());
EXPECT_METRIC_EQ(
- 0, webrtc::metrics::NumEvents(
- "WebRTC.PeerConnection.ValidBundledPayloadTypes", false));
+ 0, metrics::NumEvents("WebRTC.PeerConnection.ValidBundledPayloadTypes",
+ false));
}
TEST_F(SdpOfferAnswerTest, BundleMeasuresHeaderExtensionIdCollision) {
@@ -1015,7 +1015,7 @@ class SdpOfferAnswerShuffleMediaTypes
};
TEST_P(SdpOfferAnswerShuffleMediaTypes,
- RecyclingWithDifferentKindAndSameMidFails) {
+ RecyclingWithDifferentKindAndSameMidFailsAnswer) {
bool audio_first = GetParam();
auto pc1 = CreatePeerConnection();
auto pc2 = CreatePeerConnection();
@@ -1053,6 +1053,46 @@ TEST_P(SdpOfferAnswerShuffleMediaTypes,
EXPECT_FALSE(pc1->SetLocalDescription(std::move(answer)));
}
+// Similar to the previous test but with implicit rollback and creating
+// an offer, triggering a different codepath.
+TEST_P(SdpOfferAnswerShuffleMediaTypes,
+ RecyclingWithDifferentKindAndSameMidFailsOffer) {
+ bool audio_first = GetParam();
+ auto pc1 = CreatePeerConnection();
+ auto pc2 = CreatePeerConnection();
+ if (audio_first) {
+ pc1->AddAudioTrack("audio_track", {});
+ pc2->AddVideoTrack("video_track", {});
+ } else {
+ pc2->AddAudioTrack("audio_track", {});
+ pc1->AddVideoTrack("video_track", {});
+ }
+
+ auto initial_offer = pc1->CreateOfferAndSetAsLocal();
+ ASSERT_EQ(initial_offer->description()->contents().size(), 1u);
+ auto mid1 = initial_offer->description()->contents()[0].mid();
+ std::string rejected_answer_sdp =
+ "v=0\r\n"
+ "o=- 8621259572628890423 2 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "m=" +
+ std::string(audio_first ? "audio" : "video") +
+ " 0 UDP/TLS/RTP/SAVPF 111\r\n"
+ "c=IN IP4 0.0.0.0\r\n";
+ auto rejected_answer =
+ CreateSessionDescription(SdpType::kAnswer, rejected_answer_sdp);
+ EXPECT_TRUE(pc1->SetRemoteDescription(std::move(rejected_answer)));
+
+ auto offer =
+ pc2->CreateOfferAndSetAsLocal(); // This will generate a mid=0 too
+ ASSERT_EQ(offer->description()->contents().size(), 1u);
+ auto mid2 = offer->description()->contents()[0].mid();
+ EXPECT_EQ(mid1, mid2); // Check that the mids collided.
+ EXPECT_TRUE(pc1->SetRemoteDescription(std::move(offer)));
+ EXPECT_FALSE(pc1->CreateOffer());
+}
+
INSTANTIATE_TEST_SUITE_P(SdpOfferAnswerShuffleMediaTypes,
SdpOfferAnswerShuffleMediaTypes,
::testing::Values(true, false));
diff --git a/pc/session_description.h b/pc/session_description.h
index 52e891e433..403e46529f 100644
--- a/pc/session_description.h
+++ b/pc/session_description.h
@@ -43,10 +43,8 @@
namespace cricket {
-typedef std::vector<AudioCodec> AudioCodecs;
-typedef std::vector<VideoCodec> VideoCodecs;
-typedef std::vector<CryptoParams> CryptoParamsVec;
-typedef std::vector<webrtc::RtpExtension> RtpHeaderExtensions;
+using CryptoParamsVec = std::vector<CryptoParams>;
+using RtpHeaderExtensions = std::vector<webrtc::RtpExtension>;
// Options to control how session descriptions are generated.
const int kAutoBandwidth = -1;
@@ -258,8 +256,9 @@ class MediaContentDescription {
}
protected:
- // TODO(bugs.webrtc.org/15214): move all RTP related things to a subclass that
- // the SCTP content description does not inherit from.
+ // TODO(bugs.webrtc.org/15214): move all RTP related things to
+ // RtpMediaDescription that the SCTP content description does
+ // not inherit from.
std::string protocol_;
private:
@@ -290,37 +289,36 @@ class MediaContentDescription {
std::vector<Codec> codecs_;
};
-template <class C>
-class MediaContentDescriptionImpl : public MediaContentDescription {
+class RtpMediaContentDescription : public MediaContentDescription {};
+
+class AudioContentDescription : public RtpMediaContentDescription {
public:
void set_protocol(absl::string_view protocol) override {
RTC_DCHECK(IsRtpProtocol(protocol));
protocol_ = std::string(protocol);
}
-};
-
-class AudioContentDescription : public MediaContentDescriptionImpl<Codec> {
- public:
- AudioContentDescription() {}
-
- virtual MediaType type() const { return MEDIA_TYPE_AUDIO; }
- virtual AudioContentDescription* as_audio() { return this; }
- virtual const AudioContentDescription* as_audio() const { return this; }
+ MediaType type() const override { return MEDIA_TYPE_AUDIO; }
+ AudioContentDescription* as_audio() override { return this; }
+ const AudioContentDescription* as_audio() const override { return this; }
private:
- virtual AudioContentDescription* CloneInternal() const {
+ AudioContentDescription* CloneInternal() const override {
return new AudioContentDescription(*this);
}
};
-class VideoContentDescription : public MediaContentDescriptionImpl<Codec> {
+class VideoContentDescription : public RtpMediaContentDescription {
public:
- virtual MediaType type() const { return MEDIA_TYPE_VIDEO; }
- virtual VideoContentDescription* as_video() { return this; }
- virtual const VideoContentDescription* as_video() const { return this; }
+ void set_protocol(absl::string_view protocol) override {
+ RTC_DCHECK(IsRtpProtocol(protocol));
+ protocol_ = std::string(protocol);
+ }
+ MediaType type() const override { return MEDIA_TYPE_VIDEO; }
+ VideoContentDescription* as_video() override { return this; }
+ const VideoContentDescription* as_video() const override { return this; }
private:
- virtual VideoContentDescription* CloneInternal() const {
+ VideoContentDescription* CloneInternal() const override {
return new VideoContentDescription(*this);
}
};
diff --git a/pc/slow_peer_connection_integration_test.cc b/pc/slow_peer_connection_integration_test.cc
index fd9d3417df..4e26283395 100644
--- a/pc/slow_peer_connection_integration_test.cc
+++ b/pc/slow_peer_connection_integration_test.cc
@@ -67,7 +67,7 @@ class FakeClockForTest : public rtc::ScopedFakeClock {
// Some things use a time of "0" as a special value, so we need to start out
// the fake clock at a nonzero time.
// TODO(deadbeef): Fix this.
- AdvanceTime(webrtc::TimeDelta::Seconds(1000));
+ AdvanceTime(TimeDelta::Seconds(1000));
}
// Explicit handle.
@@ -170,20 +170,20 @@ TEST_P(PeerConnectionIntegrationTest,
CreateTurnServer(turn_server_internal_address, turn_server_external_address,
cricket::PROTO_TLS, "88.88.88.0");
- webrtc::PeerConnectionInterface::IceServer ice_server;
+ PeerConnectionInterface::IceServer ice_server;
ice_server.urls.push_back("turns:88.88.88.0:3478?transport=tcp");
ice_server.username = "test";
ice_server.password = "test";
PeerConnectionInterface::RTCConfiguration client_1_config;
client_1_config.servers.push_back(ice_server);
- client_1_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_1_config.type = PeerConnectionInterface::kRelay;
PeerConnectionInterface::RTCConfiguration client_2_config;
client_2_config.servers.push_back(ice_server);
// Setting the type to kRelay forces the connection to go through a TURN
// server.
- client_2_config.type = webrtc::PeerConnectionInterface::kRelay;
+ client_2_config.type = PeerConnectionInterface::kRelay;
// Get a copy to the pointer so we can verify calls later.
rtc::TestCertificateVerifier* client_1_cert_verifier =
@@ -194,10 +194,10 @@ TEST_P(PeerConnectionIntegrationTest,
client_2_cert_verifier->verify_certificate_ = false;
// Create the dependencies with the test certificate verifier.
- webrtc::PeerConnectionDependencies client_1_deps(nullptr);
+ PeerConnectionDependencies client_1_deps(nullptr);
client_1_deps.tls_cert_verifier =
std::unique_ptr<rtc::TestCertificateVerifier>(client_1_cert_verifier);
- webrtc::PeerConnectionDependencies client_2_deps(nullptr);
+ PeerConnectionDependencies client_2_deps(nullptr);
client_2_deps.tls_cert_verifier =
std::unique_ptr<rtc::TestCertificateVerifier>(client_2_cert_verifier);
diff --git a/pc/srtp_session.cc b/pc/srtp_session.cc
index 5408d3e0da..f16679cef1 100644
--- a/pc/srtp_session.cc
+++ b/pc/srtp_session.cc
@@ -332,6 +332,12 @@ bool SrtpSession::IsExternalAuthActive() const {
return external_auth_active_;
}
+bool SrtpSession::RemoveSsrcFromSession(uint32_t ssrc) {
+ RTC_DCHECK(session_);
+ // libSRTP expects the SSRC to be in network byte order.
+ return srtp_remove_stream(session_, htonl(ssrc)) == srtp_err_status_ok;
+}
+
bool SrtpSession::GetSendStreamPacketIndex(void* p,
int in_len,
int64_t* index) {
diff --git a/pc/srtp_session.h b/pc/srtp_session.h
index 60f1860ada..f8fd3e3123 100644
--- a/pc/srtp_session.h
+++ b/pc/srtp_session.h
@@ -97,6 +97,14 @@ class SrtpSession {
// been set.
bool IsExternalAuthActive() const;
+ // Removes a SSRC from the underlying libSRTP session.
+ // Note: this should only be done for SSRCs that are received.
+ // Removing SSRCs that were sent and then reusing them leads to
+ // cryptographic weaknesses described in
+ // https://www.rfc-editor.org/rfc/rfc3711#section-8
+ // https://www.rfc-editor.org/rfc/rfc7714#section-8.4
+ bool RemoveSsrcFromSession(uint32_t ssrc);
+
private:
bool DoSetKey(int type,
int crypto_suite,
diff --git a/pc/srtp_session_unittest.cc b/pc/srtp_session_unittest.cc
index 16a840a307..7adfee86fd 100644
--- a/pc/srtp_session_unittest.cc
+++ b/pc/srtp_session_unittest.cc
@@ -251,4 +251,36 @@ TEST_F(SrtpSessionTest, TestReplay) {
s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_), &out_len));
}
+TEST_F(SrtpSessionTest, RemoveSsrc) {
+ EXPECT_TRUE(s1_.SetSend(kSrtpAes128CmSha1_80, kTestKey1, kTestKeyLen,
+ kEncryptedHeaderExtensionIds));
+ EXPECT_TRUE(s2_.SetRecv(kSrtpAes128CmSha1_80, kTestKey1, kTestKeyLen,
+ kEncryptedHeaderExtensionIds));
+ int out_len;
+ // Encrypt and decrypt the packet once.
+ EXPECT_TRUE(
+ s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_), &out_len));
+ EXPECT_TRUE(s2_.UnprotectRtp(rtp_packet_, out_len, &out_len));
+ EXPECT_EQ(rtp_len_, out_len);
+ EXPECT_EQ(0, memcmp(rtp_packet_, kPcmuFrame, out_len));
+
+ // Recreate the original packet and encrypt again.
+ memcpy(rtp_packet_, kPcmuFrame, rtp_len_);
+ EXPECT_TRUE(
+ s1_.ProtectRtp(rtp_packet_, rtp_len_, sizeof(rtp_packet_), &out_len));
+ // Attempting to decrypt will fail as a replay attack.
+ // (srtp_err_status_replay_fail) since the sequence number was already seen.
+ EXPECT_FALSE(s2_.UnprotectRtp(rtp_packet_, out_len, &out_len));
+
+ // Remove the fake packet SSRC 1 from the session.
+ EXPECT_TRUE(s2_.RemoveSsrcFromSession(1));
+ EXPECT_FALSE(s2_.RemoveSsrcFromSession(1));
+
+ // Since the SRTP state was discarded, this is no longer a replay attack.
+ EXPECT_TRUE(s2_.UnprotectRtp(rtp_packet_, out_len, &out_len));
+ EXPECT_EQ(rtp_len_, out_len);
+ EXPECT_EQ(0, memcmp(rtp_packet_, kPcmuFrame, out_len));
+ EXPECT_TRUE(s2_.RemoveSsrcFromSession(1));
+}
+
} // namespace rtc
diff --git a/pc/srtp_transport.cc b/pc/srtp_transport.cc
index cc20216672..c82839ca82 100644
--- a/pc/srtp_transport.cc
+++ b/pc/srtp_transport.cc
@@ -37,86 +37,6 @@ SrtpTransport::SrtpTransport(bool rtcp_mux_enabled,
const FieldTrialsView& field_trials)
: RtpTransport(rtcp_mux_enabled), field_trials_(field_trials) {}
-RTCError SrtpTransport::SetSrtpSendKey(const cricket::CryptoParams& params) {
- if (send_params_) {
- LOG_AND_RETURN_ERROR(
- webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
- "Setting the SRTP send key twice is currently unsupported.");
- }
- if (recv_params_ && recv_params_->crypto_suite != params.crypto_suite) {
- LOG_AND_RETURN_ERROR(
- webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
- "The send key and receive key must have the same cipher suite.");
- }
-
- send_crypto_suite_ = rtc::SrtpCryptoSuiteFromName(params.crypto_suite);
- if (*send_crypto_suite_ == rtc::kSrtpInvalidCryptoSuite) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Invalid SRTP crypto suite");
- }
-
- int send_key_len, send_salt_len;
- if (!rtc::GetSrtpKeyAndSaltLengths(*send_crypto_suite_, &send_key_len,
- &send_salt_len)) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Could not get lengths for crypto suite(s):"
- " send crypto_suite ");
- }
-
- send_key_ = rtc::ZeroOnFreeBuffer<uint8_t>(send_key_len + send_salt_len);
- if (!ParseKeyParams(params.key_params, send_key_.data(), send_key_.size())) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Failed to parse the crypto key params");
- }
-
- if (!MaybeSetKeyParams()) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Failed to set the crypto key params");
- }
- send_params_ = params;
- return RTCError::OK();
-}
-
-RTCError SrtpTransport::SetSrtpReceiveKey(const cricket::CryptoParams& params) {
- if (recv_params_) {
- LOG_AND_RETURN_ERROR(
- webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
- "Setting the SRTP send key twice is currently unsupported.");
- }
- if (send_params_ && send_params_->crypto_suite != params.crypto_suite) {
- LOG_AND_RETURN_ERROR(
- webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
- "The send key and receive key must have the same cipher suite.");
- }
-
- recv_crypto_suite_ = rtc::SrtpCryptoSuiteFromName(params.crypto_suite);
- if (*recv_crypto_suite_ == rtc::kSrtpInvalidCryptoSuite) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Invalid SRTP crypto suite");
- }
-
- int recv_key_len, recv_salt_len;
- if (!rtc::GetSrtpKeyAndSaltLengths(*recv_crypto_suite_, &recv_key_len,
- &recv_salt_len)) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Could not get lengths for crypto suite(s):"
- " recv crypto_suite ");
- }
-
- recv_key_ = rtc::ZeroOnFreeBuffer<uint8_t>(recv_key_len + recv_salt_len);
- if (!ParseKeyParams(params.key_params, recv_key_.data(), recv_key_.size())) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Failed to parse the crypto key params");
- }
-
- if (!MaybeSetKeyParams()) {
- return RTCError(RTCErrorType::INVALID_PARAMETER,
- "Failed to set the crypto key params");
- }
- recv_params_ = params;
- return RTCError::OK();
-}
-
bool SrtpTransport::SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) {
@@ -519,4 +439,19 @@ void SrtpTransport::MaybeUpdateWritableState() {
}
}
+bool SrtpTransport::UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) {
+ if (recv_session_ &&
+ field_trials_.IsEnabled("WebRTC-SrtpRemoveReceiveStream")) {
+ // Remove the SSRCs explicitly registered with the demuxer
+ // (via SDP negotiation) from the SRTP session.
+ for (const auto ssrc : GetSsrcsForSink(sink)) {
+ if (!recv_session_->RemoveSsrcFromSession(ssrc)) {
+ RTC_LOG(LS_WARNING)
+ << "Could not remove SSRC " << ssrc << " from SRTP session.";
+ }
+ }
+ }
+ return RtpTransport::UnregisterRtpDemuxerSink(sink);
+}
+
} // namespace webrtc
diff --git a/pc/srtp_transport.h b/pc/srtp_transport.h
index 46c11ed56d..29721f3b68 100644
--- a/pc/srtp_transport.h
+++ b/pc/srtp_transport.h
@@ -41,9 +41,6 @@ class SrtpTransport : public RtpTransport {
virtual ~SrtpTransport() = default;
- virtual RTCError SetSrtpSendKey(const cricket::CryptoParams& params);
- virtual RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params);
-
bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) override;
@@ -109,6 +106,10 @@ class SrtpTransport : public RtpTransport {
rtp_abs_sendtime_extn_id_ = rtp_abs_sendtime_extn_id;
}
+ // In addition to unregistering the sink, the SRTP transport
+ // disassociates all SSRCs of the sink from libSRTP.
+ bool UnregisterRtpDemuxerSink(RtpPacketSinkInterface* sink) override;
+
protected:
// If the writable state changed, fire the SignalWritableState.
void MaybeUpdateWritableState();
diff --git a/pc/srtp_transport_unittest.cc b/pc/srtp_transport_unittest.cc
index ac8be8762b..de4ff03179 100644
--- a/pc/srtp_transport_unittest.cc
+++ b/pc/srtp_transport_unittest.cc
@@ -342,7 +342,7 @@ class SrtpTransportTest : public ::testing::Test, public sigslot::has_slots<> {
TransportObserver rtp_sink2_;
int sequence_number_ = 0;
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
};
class SrtpTransportTestWithExternalAuth
@@ -425,4 +425,66 @@ TEST_F(SrtpTransportTest, TestSetParamsKeyTooShort) {
rtc::kSrtpAes128CmSha1_80, kTestKey1, kTestKeyLen - 1, extension_ids));
}
+TEST_F(SrtpTransportTest, RemoveSrtpReceiveStream) {
+ test::ScopedKeyValueConfig field_trials(
+ "WebRTC-SrtpRemoveReceiveStream/Enabled/");
+ auto srtp_transport =
+ std::make_unique<SrtpTransport>(/*rtcp_mux_enabled=*/true, field_trials);
+ auto rtp_packet_transport = std::make_unique<rtc::FakePacketTransport>(
+ "fake_packet_transport_loopback");
+
+ bool asymmetric = false;
+ rtp_packet_transport->SetDestination(rtp_packet_transport.get(), asymmetric);
+ srtp_transport->SetRtpPacketTransport(rtp_packet_transport.get());
+
+ TransportObserver rtp_sink;
+
+ std::vector<int> extension_ids;
+ EXPECT_TRUE(srtp_transport->SetRtpParams(
+ rtc::kSrtpAeadAes128Gcm, kTestKeyGcm128_1, kTestKeyGcm128Len,
+ extension_ids, rtc::kSrtpAeadAes128Gcm, kTestKeyGcm128_1,
+ kTestKeyGcm128Len, extension_ids));
+
+ RtpDemuxerCriteria demuxer_criteria;
+ uint32_t ssrc = 0x1; // SSRC of kPcmuFrame
+ demuxer_criteria.ssrcs().insert(ssrc);
+ EXPECT_TRUE(
+ srtp_transport->RegisterRtpDemuxerSink(demuxer_criteria, &rtp_sink));
+
+ // Create a packet and try to send it three times.
+ size_t rtp_len = sizeof(kPcmuFrame);
+ size_t packet_size = rtp_len + rtc::rtp_auth_tag_len(rtc::kCsAeadAes128Gcm);
+ rtc::Buffer rtp_packet_buffer(packet_size);
+ char* rtp_packet_data = rtp_packet_buffer.data<char>();
+ memcpy(rtp_packet_data, kPcmuFrame, rtp_len);
+
+ // First attempt will succeed.
+ rtc::CopyOnWriteBuffer first_try(rtp_packet_data, rtp_len, packet_size);
+ EXPECT_TRUE(srtp_transport->SendRtpPacket(&first_try, rtc::PacketOptions(),
+ cricket::PF_SRTP_BYPASS));
+ EXPECT_EQ(rtp_sink.rtp_count(), 1);
+
+ // Second attempt will be rejected by libSRTP as a replay attack
+ // (srtp_err_status_replay_fail) since the sequence number was already seen.
+ // Hence the packet never reaches the sink.
+ rtc::CopyOnWriteBuffer second_try(rtp_packet_data, rtp_len, packet_size);
+ EXPECT_TRUE(srtp_transport->SendRtpPacket(&second_try, rtc::PacketOptions(),
+ cricket::PF_SRTP_BYPASS));
+ EXPECT_EQ(rtp_sink.rtp_count(), 1);
+
+ // Reset the sink.
+ EXPECT_TRUE(srtp_transport->UnregisterRtpDemuxerSink(&rtp_sink));
+ EXPECT_TRUE(
+ srtp_transport->RegisterRtpDemuxerSink(demuxer_criteria, &rtp_sink));
+
+ // Third attempt will succeed again since libSRTP does not remember seeing
+ // the sequence number after the reset.
+ rtc::CopyOnWriteBuffer third_try(rtp_packet_data, rtp_len, packet_size);
+ EXPECT_TRUE(srtp_transport->SendRtpPacket(&third_try, rtc::PacketOptions(),
+ cricket::PF_SRTP_BYPASS));
+ EXPECT_EQ(rtp_sink.rtp_count(), 2);
+ // Clear the sink to clean up.
+ srtp_transport->UnregisterRtpDemuxerSink(&rtp_sink);
+}
+
} // namespace webrtc
diff --git a/pc/test/android_test_initializer.cc b/pc/test/android_test_initializer.cc
index 963544cb4b..88b4587789 100644
--- a/pc/test/android_test_initializer.cc
+++ b/pc/test/android_test_initializer.cc
@@ -39,7 +39,7 @@ void EnsureInitializedOnce() {
RTC_CHECK(rtc::InitializeSSL()) << "Failed to InitializeSSL()";
- webrtc::JVM::Initialize(jvm);
+ JVM::Initialize(jvm);
}
} // anonymous namespace
diff --git a/pc/test/enable_fake_media.cc b/pc/test/enable_fake_media.cc
new file mode 100644
index 0000000000..5a849553ec
--- /dev/null
+++ b/pc/test/enable_fake_media.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "pc/test/enable_fake_media.h"
+
+#include <memory>
+#include <utility>
+
+#include "absl/base/nullability.h"
+#include "api/peer_connection_interface.h"
+#include "call/call.h"
+#include "call/call_config.h"
+#include "media/base/fake_media_engine.h"
+#include "pc/media_factory.h"
+#include "rtc_base/checks.h"
+
+namespace webrtc {
+
+using ::cricket::FakeMediaEngine;
+using ::cricket::MediaEngineInterface;
+
+void EnableFakeMedia(
+ PeerConnectionFactoryDependencies& deps,
+ absl::Nonnull<std::unique_ptr<FakeMediaEngine>> fake_media_engine) {
+ class FakeMediaFactory : public MediaFactory {
+ public:
+ explicit FakeMediaFactory(
+ absl::Nonnull<std::unique_ptr<FakeMediaEngine>> fake)
+ : fake_(std::move(fake)) {}
+
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
+ return Call::Create(config);
+ }
+
+ std::unique_ptr<MediaEngineInterface> CreateMediaEngine(
+ PeerConnectionFactoryDependencies& /*dependencies*/) {
+ RTC_CHECK(fake_ != nullptr)
+ << "CreateMediaEngine can be called at most once.";
+ return std::move(fake_);
+ }
+
+ private:
+ absl::Nullable<std::unique_ptr<FakeMediaEngine>> fake_;
+ };
+
+ deps.media_factory =
+ std::make_unique<FakeMediaFactory>(std::move(fake_media_engine));
+}
+
+void EnableFakeMedia(PeerConnectionFactoryDependencies& deps) {
+ EnableFakeMedia(deps, std::make_unique<cricket::FakeMediaEngine>());
+}
+
+} // namespace webrtc
diff --git a/pc/test/enable_fake_media.h b/pc/test/enable_fake_media.h
new file mode 100644
index 0000000000..82c55ad08b
--- /dev/null
+++ b/pc/test/enable_fake_media.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// Enables fake media support for PeerConnnectionFactory created from `deps` for
+// testing purposes. Such fake media support ignores media dependencies in the
+// `PeerConnectionFactoryDependencies`. Allows to test PeerConnection and
+// PeerConnectionFactory in the presence of the media, but doesn't test media
+// support itself.
+
+#ifndef PC_TEST_ENABLE_FAKE_MEDIA_H_
+#define PC_TEST_ENABLE_FAKE_MEDIA_H_
+
+#include <memory>
+
+#include "absl/base/nullability.h"
+#include "api/peer_connection_interface.h"
+#include "media/base/fake_media_engine.h"
+
+namespace webrtc {
+
+// Enables media support backed by the 'fake_media_engine'.
+void EnableFakeMedia(
+ PeerConnectionFactoryDependencies& deps,
+ absl::Nonnull<std::unique_ptr<cricket::FakeMediaEngine>> fake_media_engine);
+
+// Enables media support backed by unspecified lightweight fake implementation.
+void EnableFakeMedia(PeerConnectionFactoryDependencies& deps);
+
+} // namespace webrtc
+
+#endif // PC_TEST_ENABLE_FAKE_MEDIA_H_
diff --git a/pc/test/fake_peer_connection_base.h b/pc/test/fake_peer_connection_base.h
index 743c18122a..1615088e99 100644
--- a/pc/test/fake_peer_connection_base.h
+++ b/pc/test/fake_peer_connection_base.h
@@ -339,9 +339,6 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
return false;
}
- absl::optional<std::string> GetDataMid() const override {
- return absl::nullopt;
- }
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver(
cricket::MediaType media_type,
rtc::scoped_refptr<MediaStreamTrackInterface> track,
@@ -358,19 +355,15 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
Call* call_ptr() override { return nullptr; }
bool SrtpRequired() const override { return false; }
- absl::optional<std::string> SetupDataChannelTransport_n(
- absl::string_view mid) override {
- return absl::nullopt;
+ bool CreateDataChannelTransport(absl::string_view mid) override {
+ return false;
}
- void TeardownDataChannelTransport_n(RTCError error) override {}
- void SetSctpDataInfo(absl::string_view mid,
- absl::string_view transport_name) override {}
- void ResetSctpDataInfo() override {}
+ void DestroyDataChannelTransport(RTCError error) override {}
const FieldTrialsView& trials() const override { return field_trials_; }
protected:
- webrtc::test::ScopedKeyValueConfig field_trials_;
+ test::ScopedKeyValueConfig field_trials_;
};
} // namespace webrtc
diff --git a/pc/test/fake_peer_connection_for_stats.h b/pc/test/fake_peer_connection_for_stats.h
index 7302182912..33a5361394 100644
--- a/pc/test/fake_peer_connection_for_stats.h
+++ b/pc/test/fake_peer_connection_for_stats.h
@@ -18,10 +18,10 @@
#include <utility>
#include <vector>
-#include "media/base/fake_media_engine.h"
#include "media/base/media_channel.h"
#include "pc/channel.h"
#include "pc/stream_collection.h"
+#include "pc/test/enable_fake_media.h"
#include "pc/test/fake_data_channel_controller.h"
#include "pc/test/fake_peer_connection_base.h"
@@ -150,7 +150,7 @@ class VoiceChannelForTesting : public cricket::VoiceChannel {
receive_channel,
const std::string& content_name,
bool srtp_required,
- webrtc::CryptoOptions crypto_options,
+ CryptoOptions crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator,
std::string transport_name)
: VoiceChannel(worker_thread,
@@ -183,7 +183,7 @@ class VideoChannelForTesting : public cricket::VideoChannel {
receive_channel,
const std::string& content_name,
bool srtp_required,
- webrtc::CryptoOptions crypto_options,
+ CryptoOptions crypto_options,
rtc::UniqueRandomIdGenerator* ssrc_generator,
std::string transport_name)
: VideoChannel(worker_thread,
@@ -235,7 +235,7 @@ class FakePeerConnectionForStats : public FakePeerConnectionBase {
dependencies.network_thread = rtc::Thread::Current();
dependencies.worker_thread = rtc::Thread::Current();
dependencies.signaling_thread = rtc::Thread::Current();
- dependencies.media_engine = std::make_unique<cricket::FakeMediaEngine>();
+ EnableFakeMedia(dependencies);
return dependencies;
}
@@ -298,7 +298,7 @@ class FakePeerConnectionForStats : public FakePeerConnectionBase {
worker_thread_, network_thread_, signaling_thread_,
std::move(voice_media_send_channel),
std::move(voice_media_receive_channel), mid, kDefaultSrtpRequired,
- webrtc::CryptoOptions(), context_->ssrc_generator(), transport_name);
+ CryptoOptions(), context_->ssrc_generator(), transport_name);
auto transceiver =
GetOrCreateFirstTransceiverOfType(cricket::MEDIA_TYPE_AUDIO)
->internal();
@@ -332,7 +332,7 @@ class FakePeerConnectionForStats : public FakePeerConnectionBase {
worker_thread_, network_thread_, signaling_thread_,
std::move(video_media_send_channel),
std::move(video_media_receive_channel), mid, kDefaultSrtpRequired,
- webrtc::CryptoOptions(), context_->ssrc_generator(), transport_name);
+ CryptoOptions(), context_->ssrc_generator(), transport_name);
auto transceiver =
GetOrCreateFirstTransceiverOfType(cricket::MEDIA_TYPE_VIDEO)
->internal();
diff --git a/pc/test/fake_periodic_video_source.h b/pc/test/fake_periodic_video_source.h
index 452a8f6c30..65652bdf0d 100644
--- a/pc/test/fake_periodic_video_source.h
+++ b/pc/test/fake_periodic_video_source.h
@@ -65,12 +65,12 @@ class FakePeriodicVideoSource final
return wants_;
}
- void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override {
+ void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {
RTC_DCHECK(thread_checker_.IsCurrent());
broadcaster_.RemoveSink(sink);
}
- void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
+ void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
RTC_DCHECK(thread_checker_.IsCurrent());
{
diff --git a/pc/test/integration_test_helpers.cc b/pc/test/integration_test_helpers.cc
index 3f07c9e826..64d8debc09 100644
--- a/pc/test/integration_test_helpers.cc
+++ b/pc/test/integration_test_helpers.cc
@@ -46,7 +46,7 @@ void RemoveSsrcsAndKeepMsids(cricket::SessionDescription* desc) {
int FindFirstMediaStatsIndexByKind(
const std::string& kind,
- const std::vector<const webrtc::RTCInboundRtpStreamStats*>& inbound_rtps) {
+ const std::vector<const RTCInboundRtpStreamStats*>& inbound_rtps) {
for (size_t i = 0; i < inbound_rtps.size(); i++) {
if (*inbound_rtps[i]->kind == kind) {
return i;
@@ -55,6 +55,13 @@ int FindFirstMediaStatsIndexByKind(
return -1;
}
+void ReplaceFirstSsrc(StreamParams& stream, uint32_t ssrc) {
+ stream.ssrcs[0] = ssrc;
+ for (auto& group : stream.ssrc_groups) {
+ group.ssrcs[0] = ssrc;
+ }
+}
+
TaskQueueMetronome::TaskQueueMetronome(TimeDelta tick_period)
: tick_period_(tick_period) {}
diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h
index 43033d2a5c..1ba332643d 100644
--- a/pc/test/integration_test_helpers.h
+++ b/pc/test/integration_test_helpers.h
@@ -31,10 +31,10 @@
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/audio_options.h"
-#include "api/call/call_factory_interface.h"
#include "api/candidate.h"
#include "api/crypto/crypto_options.h"
#include "api/data_channel_interface.h"
+#include "api/enable_media_with_defaults.h"
#include "api/field_trials_view.h"
#include "api/ice_transport_interface.h"
#include "api/jsep.h"
@@ -68,8 +68,6 @@
#include "media/base/media_engine.h"
#include "media/base/stream_params.h"
#include "media/engine/fake_webrtc_video_engine.h"
-#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
@@ -173,16 +171,20 @@ void RemoveSsrcsAndMsids(cricket::SessionDescription* desc);
// endpoint that only signals a=msid lines to convey stream_ids.
void RemoveSsrcsAndKeepMsids(cricket::SessionDescription* desc);
+// Replaces the stream's primary SSRC and updates the first SSRC of all
+// ssrc-groups.
+void ReplaceFirstSsrc(StreamParams& stream, uint32_t ssrc);
+
int FindFirstMediaStatsIndexByKind(
const std::string& kind,
- const std::vector<const webrtc::RTCInboundRtpStreamStats*>& inbound_rtps);
+ const std::vector<const RTCInboundRtpStreamStats*>& inbound_rtps);
-class TaskQueueMetronome : public webrtc::Metronome {
+class TaskQueueMetronome : public Metronome {
public:
explicit TaskQueueMetronome(TimeDelta tick_period);
~TaskQueueMetronome() override;
- // webrtc::Metronome implementation.
+ // Metronome implementation.
void RequestCallOnNextTick(absl::AnyInvocable<void() &&> callback) override;
TimeDelta TickPeriod() const override;
@@ -205,7 +207,7 @@ class SignalingMessageReceiver {
virtual ~SignalingMessageReceiver() {}
};
-class MockRtpReceiverObserver : public webrtc::RtpReceiverObserverInterface {
+class MockRtpReceiverObserver : public RtpReceiverObserverInterface {
public:
explicit MockRtpReceiverObserver(cricket::MediaType media_type)
: expected_media_type_(media_type) {}
@@ -232,14 +234,14 @@ class MockRtpReceiverObserver : public webrtc::RtpReceiverObserverInterface {
// advertise support of any codecs.
// TODO(steveanton): See how this could become a subclass of
// PeerConnectionWrapper defined in peerconnectionwrapper.h.
-class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
+class PeerConnectionIntegrationWrapper : public PeerConnectionObserver,
public SignalingMessageReceiver {
public:
- webrtc::PeerConnectionFactoryInterface* pc_factory() const {
+ PeerConnectionFactoryInterface* pc_factory() const {
return peer_connection_factory_.get();
}
- webrtc::PeerConnectionInterface* pc() const { return peer_connection_.get(); }
+ PeerConnectionInterface* pc() const { return peer_connection_.get(); }
// If a signaling message receiver is set (via ConnectFakeSignaling), this
// will set the whole offer/answer exchange in motion. Just need to wait for
@@ -337,11 +339,11 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
return AddTrack(CreateLocalVideoTrack());
}
- rtc::scoped_refptr<webrtc::AudioTrackInterface> CreateLocalAudioTrack() {
+ rtc::scoped_refptr<AudioTrackInterface> CreateLocalAudioTrack() {
cricket::AudioOptions options;
// Disable highpass filter so that we can get all the test audio frames.
options.highpass_filter = false;
- rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
+ rtc::scoped_refptr<AudioSourceInterface> source =
peer_connection_factory_->CreateAudioSource(options);
// TODO(perkj): Test audio source when it is implemented. Currently audio
// always use the default input.
@@ -349,21 +351,20 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
source.get());
}
- rtc::scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack() {
- webrtc::FakePeriodicVideoSource::Config config;
+ rtc::scoped_refptr<VideoTrackInterface> CreateLocalVideoTrack() {
+ FakePeriodicVideoSource::Config config;
config.timestamp_offset_ms = rtc::TimeMillis();
return CreateLocalVideoTrackInternal(config);
}
- rtc::scoped_refptr<webrtc::VideoTrackInterface>
- CreateLocalVideoTrackWithConfig(
- webrtc::FakePeriodicVideoSource::Config config) {
+ rtc::scoped_refptr<VideoTrackInterface> CreateLocalVideoTrackWithConfig(
+ FakePeriodicVideoSource::Config config) {
return CreateLocalVideoTrackInternal(config);
}
- rtc::scoped_refptr<webrtc::VideoTrackInterface>
- CreateLocalVideoTrackWithRotation(webrtc::VideoRotation rotation) {
- webrtc::FakePeriodicVideoSource::Config config;
+ rtc::scoped_refptr<VideoTrackInterface> CreateLocalVideoTrackWithRotation(
+ VideoRotation rotation) {
+ FakePeriodicVideoSource::Config config;
config.rotation = rotation;
config.timestamp_offset_ms = rtc::TimeMillis();
return CreateLocalVideoTrackInternal(config);
@@ -407,22 +408,22 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
}
bool SignalingStateStable() {
- return pc()->signaling_state() == webrtc::PeerConnectionInterface::kStable;
+ return pc()->signaling_state() == PeerConnectionInterface::kStable;
}
bool IceGatheringStateComplete() {
return pc()->ice_gathering_state() ==
- webrtc::PeerConnectionInterface::kIceGatheringComplete;
+ PeerConnectionInterface::kIceGatheringComplete;
}
void CreateDataChannel() { CreateDataChannel(nullptr); }
- void CreateDataChannel(const webrtc::DataChannelInit* init) {
+ void CreateDataChannel(const DataChannelInit* init) {
CreateDataChannel(kDataChannelLabel, init);
}
void CreateDataChannel(const std::string& label,
- const webrtc::DataChannelInit* init) {
+ const DataChannelInit* init) {
auto data_channel_or_error = pc()->CreateDataChannelOrError(label, init);
ASSERT_TRUE(data_channel_or_error.ok());
data_channels_.push_back(data_channel_or_error.MoveValue());
@@ -480,7 +481,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// Returns a MockStatsObserver in a state after stats gathering finished,
// which can be used to access the gathered stats.
rtc::scoped_refptr<MockStatsObserver> OldGetStatsForTrack(
- webrtc::MediaStreamTrackInterface* track) {
+ MediaStreamTrackInterface* track) {
auto observer = rtc::make_ref_counted<MockStatsObserver>();
EXPECT_TRUE(peer_connection_->GetStats(
observer.get(), nullptr,
@@ -496,9 +497,8 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// Synchronously gets stats and returns them. If it times out, fails the test
// and returns null.
- rtc::scoped_refptr<const webrtc::RTCStatsReport> NewGetStats() {
- auto callback =
- rtc::make_ref_counted<webrtc::MockRTCStatsCollectorCallback>();
+ rtc::scoped_refptr<const RTCStatsReport> NewGetStats() {
+ auto callback = rtc::make_ref_counted<MockRTCStatsCollectorCallback>();
peer_connection_->GetStats(callback.get());
EXPECT_TRUE_WAIT(callback->called(), kDefaultTimeout);
return callback->report();
@@ -525,10 +525,10 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
return static_cast<double>(rendered_width()) / rendered_height();
}
- webrtc::VideoRotation rendered_rotation() {
+ VideoRotation rendered_rotation() {
EXPECT_FALSE(fake_video_renderers_.empty());
return fake_video_renderers_.empty()
- ? webrtc::kVideoRotation_0
+ ? kVideoRotation_0
: fake_video_renderers_.begin()->second->rotation();
}
@@ -571,20 +571,20 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
return pc()->local_streams().get();
}
- webrtc::PeerConnectionInterface::SignalingState signaling_state() {
+ PeerConnectionInterface::SignalingState signaling_state() {
return pc()->signaling_state();
}
- webrtc::PeerConnectionInterface::IceConnectionState ice_connection_state() {
+ PeerConnectionInterface::IceConnectionState ice_connection_state() {
return pc()->ice_connection_state();
}
- webrtc::PeerConnectionInterface::IceConnectionState
+ PeerConnectionInterface::IceConnectionState
standardized_ice_connection_state() {
return pc()->standardized_ice_connection_state();
}
- webrtc::PeerConnectionInterface::IceGatheringState ice_gathering_state() {
+ PeerConnectionInterface::IceGatheringState ice_gathering_state() {
return pc()->ice_gathering_state();
}
@@ -613,7 +613,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
}
cricket::PortAllocator* port_allocator() const { return port_allocator_; }
- webrtc::FakeRtcEventLogFactory* event_log_factory() const {
+ FakeRtcEventLogFactory* event_log_factory() const {
return event_log_factory_;
}
@@ -626,8 +626,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// Sets the mDNS responder for the owned fake network manager and keeps a
// reference to the responder.
- void SetMdnsResponder(
- std::unique_ptr<webrtc::FakeMdnsResponder> mdns_responder) {
+ void SetMdnsResponder(std::unique_ptr<FakeMdnsResponder> mdns_responder) {
RTC_DCHECK(mdns_responder != nullptr);
mdns_responder_ = mdns_responder.get();
network_manager()->set_mdns_responder(std::move(mdns_responder));
@@ -642,7 +641,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
}
bool Rollback() {
return SetRemoteDescription(
- webrtc::CreateSessionDescription(SdpType::kRollback, ""));
+ CreateSessionDescription(SdpType::kRollback, ""));
}
// Functions for querying stats.
@@ -650,7 +649,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// Get the baseline numbers for audio_packets and audio_delay.
auto received_stats = NewGetStats();
auto rtp_stats =
- received_stats->GetStatsOfType<webrtc::RTCInboundRtpStreamStats>()[0];
+ received_stats->GetStatsOfType<RTCInboundRtpStreamStats>()[0];
ASSERT_TRUE(rtp_stats->relative_packet_arrival_delay.is_defined());
ASSERT_TRUE(rtp_stats->packets_received.is_defined());
rtp_stats_id_ = rtp_stats->id();
@@ -662,8 +661,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
void UpdateDelayStats(std::string tag, int desc_size) {
auto report = NewGetStats();
- auto rtp_stats =
- report->GetAs<webrtc::RTCInboundRtpStreamStats>(rtp_stats_id_);
+ auto rtp_stats = report->GetAs<RTCInboundRtpStreamStats>(rtp_stats_id_);
ASSERT_TRUE(rtp_stats);
auto delta_packets = *rtp_stats->packets_received - audio_packets_stat_;
auto delta_rpad =
@@ -742,11 +740,11 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
bool Init(const PeerConnectionFactory::Options* options,
const PeerConnectionInterface::RTCConfiguration* config,
- webrtc::PeerConnectionDependencies dependencies,
+ PeerConnectionDependencies dependencies,
rtc::SocketServer* socket_server,
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
- std::unique_ptr<webrtc::FakeRtcEventLogFactory> event_log_factory,
+ std::unique_ptr<FakeRtcEventLogFactory> event_log_factory,
bool reset_encoder_factory,
bool reset_decoder_factory,
bool create_media_engine) {
@@ -769,51 +767,45 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
}
rtc::Thread* const signaling_thread = rtc::Thread::Current();
- webrtc::PeerConnectionFactoryDependencies pc_factory_dependencies;
+ PeerConnectionFactoryDependencies pc_factory_dependencies;
pc_factory_dependencies.network_thread = network_thread;
pc_factory_dependencies.worker_thread = worker_thread;
pc_factory_dependencies.signaling_thread = signaling_thread;
pc_factory_dependencies.task_queue_factory =
- webrtc::CreateDefaultTaskQueueFactory();
+ CreateDefaultTaskQueueFactory();
pc_factory_dependencies.trials = std::make_unique<FieldTrialBasedConfig>();
pc_factory_dependencies.metronome =
std::make_unique<TaskQueueMetronome>(TimeDelta::Millis(8));
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory =
- pc_factory_dependencies.task_queue_factory.get();
- media_deps.adm = fake_audio_capture_module_;
- webrtc::SetMediaEngineDefaults(&media_deps);
+
+ pc_factory_dependencies.adm = fake_audio_capture_module_;
+ if (create_media_engine) {
+ EnableMediaWithDefaults(pc_factory_dependencies);
+ }
if (reset_encoder_factory) {
- media_deps.video_encoder_factory.reset();
+ pc_factory_dependencies.video_encoder_factory.reset();
}
if (reset_decoder_factory) {
- media_deps.video_decoder_factory.reset();
+ pc_factory_dependencies.video_decoder_factory.reset();
}
- if (!media_deps.audio_processing) {
+ if (!pc_factory_dependencies.audio_processing) {
// If the standard Creation method for APM returns a null pointer, instead
// use the builder for testing to create an APM object.
- media_deps.audio_processing = AudioProcessingBuilderForTesting().Create();
+ pc_factory_dependencies.audio_processing =
+ AudioProcessingBuilderForTesting().Create();
}
- media_deps.trials = pc_factory_dependencies.trials.get();
-
- if (create_media_engine) {
- pc_factory_dependencies.media_engine =
- cricket::CreateMediaEngine(std::move(media_deps));
- }
- pc_factory_dependencies.call_factory = webrtc::CreateCallFactory();
if (event_log_factory) {
event_log_factory_ = event_log_factory.get();
pc_factory_dependencies.event_log_factory = std::move(event_log_factory);
} else {
pc_factory_dependencies.event_log_factory =
- std::make_unique<webrtc::RtcEventLogFactory>(
+ std::make_unique<RtcEventLogFactory>(
pc_factory_dependencies.task_queue_factory.get());
}
- peer_connection_factory_ = webrtc::CreateModularPeerConnectionFactory(
- std::move(pc_factory_dependencies));
+ peer_connection_factory_ =
+ CreateModularPeerConnectionFactory(std::move(pc_factory_dependencies));
if (!peer_connection_factory_) {
return false;
@@ -830,9 +822,9 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
return peer_connection_.get() != nullptr;
}
- rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
+ rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
const PeerConnectionInterface::RTCConfiguration* config,
- webrtc::PeerConnectionDependencies dependencies) {
+ PeerConnectionDependencies dependencies) {
PeerConnectionInterface::RTCConfiguration modified_config;
modified_config.sdp_semantics = sdp_semantics_;
// If `config` is null, this will result in a default configuration being
@@ -865,21 +857,20 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
signal_ice_candidates_ = signal;
}
- rtc::scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrackInternal(
- webrtc::FakePeriodicVideoSource::Config config) {
+ rtc::scoped_refptr<VideoTrackInterface> CreateLocalVideoTrackInternal(
+ FakePeriodicVideoSource::Config config) {
// Set max frame rate to 10fps to reduce the risk of test flakiness.
// TODO(deadbeef): Do something more robust.
config.frame_interval_ms = 100;
video_track_sources_.emplace_back(
- rtc::make_ref_counted<webrtc::FakePeriodicVideoTrackSource>(
+ rtc::make_ref_counted<FakePeriodicVideoTrackSource>(
config, false /* remote */));
- rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
+ rtc::scoped_refptr<VideoTrackInterface> track =
peer_connection_factory_->CreateVideoTrack(video_track_sources_.back(),
rtc::CreateRandomUuid());
if (!local_video_renderer_) {
- local_video_renderer_.reset(
- new webrtc::FakeVideoTrackRenderer(track.get()));
+ local_video_renderer_.reset(new FakeVideoTrackRenderer(track.get()));
}
return track;
}
@@ -887,7 +878,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
void HandleIncomingOffer(const std::string& msg) {
RTC_LOG(LS_INFO) << debug_name_ << ": HandleIncomingOffer";
std::unique_ptr<SessionDescriptionInterface> desc =
- webrtc::CreateSessionDescription(SdpType::kOffer, msg);
+ CreateSessionDescription(SdpType::kOffer, msg);
if (received_sdp_munger_) {
received_sdp_munger_(desc->description());
}
@@ -907,7 +898,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
void HandleIncomingAnswer(const std::string& msg) {
RTC_LOG(LS_INFO) << debug_name_ << ": HandleIncomingAnswer";
std::unique_ptr<SessionDescriptionInterface> desc =
- webrtc::CreateSessionDescription(SdpType::kAnswer, msg);
+ CreateSessionDescription(SdpType::kAnswer, msg);
if (received_sdp_munger_) {
received_sdp_munger_(desc->description());
}
@@ -1058,7 +1049,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
const std::string& msg) override {
RTC_LOG(LS_INFO) << debug_name_ << ": ReceiveIceMessage";
absl::optional<RTCError> result;
- pc()->AddIceCandidate(absl::WrapUnique(webrtc::CreateIceCandidate(
+ pc()->AddIceCandidate(absl::WrapUnique(CreateIceCandidate(
sdp_mid, sdp_mline_index, msg, nullptr)),
[&result](RTCError r) { result = r; });
EXPECT_TRUE_WAIT(result.has_value(), kDefaultTimeout);
@@ -1067,7 +1058,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// PeerConnectionObserver callbacks.
void OnSignalingChange(
- webrtc::PeerConnectionInterface::SignalingState new_state) override {
+ PeerConnectionInterface::SignalingState new_state) override {
EXPECT_EQ(pc()->signaling_state(), new_state);
peer_connection_signaling_state_history_.push_back(new_state);
}
@@ -1096,21 +1087,21 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
}
void OnRenegotiationNeeded() override {}
void OnIceConnectionChange(
- webrtc::PeerConnectionInterface::IceConnectionState new_state) override {
+ PeerConnectionInterface::IceConnectionState new_state) override {
EXPECT_EQ(pc()->ice_connection_state(), new_state);
ice_connection_state_history_.push_back(new_state);
}
void OnStandardizedIceConnectionChange(
- webrtc::PeerConnectionInterface::IceConnectionState new_state) override {
+ PeerConnectionInterface::IceConnectionState new_state) override {
standardized_ice_connection_state_history_.push_back(new_state);
}
void OnConnectionChange(
- webrtc::PeerConnectionInterface::PeerConnectionState new_state) override {
+ PeerConnectionInterface::PeerConnectionState new_state) override {
peer_connection_state_history_.push_back(new_state);
}
void OnIceGatheringChange(
- webrtc::PeerConnectionInterface::IceGatheringState new_state) override {
+ PeerConnectionInterface::IceGatheringState new_state) override {
EXPECT_EQ(pc()->ice_gathering_state(), new_state);
ice_gathering_state_history_.push_back(new_state);
}
@@ -1120,7 +1111,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
ice_candidate_pair_change_history_.push_back(event);
}
- void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override {
+ void OnIceCandidate(const IceCandidateInterface* candidate) override {
RTC_LOG(LS_INFO) << debug_name_ << ": OnIceCandidate";
if (remote_async_dns_resolver_) {
@@ -1176,20 +1167,19 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
std::unique_ptr<rtc::FakeNetworkManager> fake_network_manager_;
std::unique_ptr<rtc::BasicPacketSocketFactory> socket_factory_;
// Reference to the mDNS responder owned by `fake_network_manager_` after set.
- webrtc::FakeMdnsResponder* mdns_responder_ = nullptr;
+ FakeMdnsResponder* mdns_responder_ = nullptr;
- rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
- rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
- peer_connection_factory_;
+ rtc::scoped_refptr<PeerConnectionInterface> peer_connection_;
+ rtc::scoped_refptr<PeerConnectionFactoryInterface> peer_connection_factory_;
cricket::PortAllocator* port_allocator_;
// Needed to keep track of number of frames sent.
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
// Needed to keep track of number of frames received.
- std::map<std::string, std::unique_ptr<webrtc::FakeVideoTrackRenderer>>
+ std::map<std::string, std::unique_ptr<FakeVideoTrackRenderer>>
fake_video_renderers_;
// Needed to ensure frames aren't received for removed tracks.
- std::vector<std::unique_ptr<webrtc::FakeVideoTrackRenderer>>
+ std::vector<std::unique_ptr<FakeVideoTrackRenderer>>
removed_fake_video_renderers_;
// For remote peer communication.
@@ -1201,10 +1191,9 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
// Store references to the video sources we've created, so that we can stop
// them, if required.
- std::vector<rtc::scoped_refptr<webrtc::VideoTrackSource>>
- video_track_sources_;
+ std::vector<rtc::scoped_refptr<VideoTrackSource>> video_track_sources_;
// `local_video_renderer_` attached to the first created local video track.
- std::unique_ptr<webrtc::FakeVideoTrackRenderer> local_video_renderer_;
+ std::unique_ptr<FakeVideoTrackRenderer> local_video_renderer_;
SdpSemantics sdp_semantics_;
PeerConnectionInterface::RTCOfferAnswerOptions offer_answer_options_;
@@ -1234,7 +1223,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
ice_candidate_pair_change_history_;
std::vector<PeerConnectionInterface::SignalingState>
peer_connection_signaling_state_history_;
- webrtc::FakeRtcEventLogFactory* event_log_factory_;
+ FakeRtcEventLogFactory* event_log_factory_;
// Number of ICE candidates expected. The default is no limit.
int candidates_expected_ = std::numeric_limits<int>::max();
@@ -1251,7 +1240,7 @@ class PeerConnectionIntegrationWrapper : public webrtc::PeerConnectionObserver,
friend class PeerConnectionIntegrationBaseTest;
};
-class MockRtcEventLogOutput : public webrtc::RtcEventLogOutput {
+class MockRtcEventLogOutput : public RtcEventLogOutput {
public:
virtual ~MockRtcEventLogOutput() = default;
MOCK_METHOD(bool, IsActive, (), (const, override));
@@ -1363,7 +1352,7 @@ class MediaExpectations {
int callee_video_frames_expected_ = 0;
};
-class MockIceTransport : public webrtc::IceTransportInterface {
+class MockIceTransport : public IceTransportInterface {
public:
MockIceTransport(const std::string& name, int component)
: internal_(std::make_unique<cricket::FakeIceTransport>(
@@ -1411,7 +1400,7 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
worker_thread_->SetName("PCWorkerThread", this);
RTC_CHECK(network_thread_->Start());
RTC_CHECK(worker_thread_->Start());
- webrtc::metrics::Reset();
+ metrics::Reset();
}
~PeerConnectionIntegrationBaseTest() {
@@ -1448,13 +1437,13 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
// are connected. This is an important distinction. Once we have separate
// ICE and DTLS state, this check needs to use the DTLS state.
return (callee()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionConnected ||
+ PeerConnectionInterface::kIceConnectionConnected ||
callee()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionCompleted) &&
+ PeerConnectionInterface::kIceConnectionCompleted) &&
(caller()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionConnected ||
+ PeerConnectionInterface::kIceConnectionConnected ||
caller()->ice_connection_state() ==
- webrtc::PeerConnectionInterface::kIceConnectionCompleted);
+ PeerConnectionInterface::kIceConnectionCompleted);
}
// When `event_log_factory` is null, the default implementation of the event
@@ -1463,8 +1452,8 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
const std::string& debug_name,
const PeerConnectionFactory::Options* options,
const RTCConfiguration* config,
- webrtc::PeerConnectionDependencies dependencies,
- std::unique_ptr<webrtc::FakeRtcEventLogFactory> event_log_factory,
+ PeerConnectionDependencies dependencies,
+ std::unique_ptr<FakeRtcEventLogFactory> event_log_factory,
bool reset_encoder_factory,
bool reset_decoder_factory,
bool create_media_engine = true) {
@@ -1494,10 +1483,10 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
const std::string& debug_name,
const PeerConnectionFactory::Options* options,
const RTCConfiguration* config,
- webrtc::PeerConnectionDependencies dependencies) {
+ PeerConnectionDependencies dependencies) {
return CreatePeerConnectionWrapper(
debug_name, options, config, std::move(dependencies),
- std::make_unique<webrtc::FakeRtcEventLogFactory>(),
+ std::make_unique<FakeRtcEventLogFactory>(),
/*reset_encoder_factory=*/false,
/*reset_decoder_factory=*/false);
}
@@ -1518,17 +1507,17 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
// callee PeerConnections.
SdpSemantics original_semantics = sdp_semantics_;
sdp_semantics_ = caller_semantics;
- caller_ = CreatePeerConnectionWrapper(
- "Caller", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
- nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
+ caller_ = CreatePeerConnectionWrapper("Caller", nullptr, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
sdp_semantics_ = callee_semantics;
- callee_ = CreatePeerConnectionWrapper(
- "Callee", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
- nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
+ callee_ = CreatePeerConnectionWrapper("Callee", nullptr, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
sdp_semantics_ = original_semantics;
return caller_ && callee_;
}
@@ -1536,24 +1525,24 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
bool CreatePeerConnectionWrappersWithConfig(
const PeerConnectionInterface::RTCConfiguration& caller_config,
const PeerConnectionInterface::RTCConfiguration& callee_config) {
- caller_ = CreatePeerConnectionWrapper(
- "Caller", nullptr, &caller_config,
- webrtc::PeerConnectionDependencies(nullptr), nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
- callee_ = CreatePeerConnectionWrapper(
- "Callee", nullptr, &callee_config,
- webrtc::PeerConnectionDependencies(nullptr), nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
+ caller_ = CreatePeerConnectionWrapper("Caller", nullptr, &caller_config,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
+ callee_ = CreatePeerConnectionWrapper("Callee", nullptr, &callee_config,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
return caller_ && callee_;
}
bool CreatePeerConnectionWrappersWithConfigAndDeps(
const PeerConnectionInterface::RTCConfiguration& caller_config,
- webrtc::PeerConnectionDependencies caller_dependencies,
+ PeerConnectionDependencies caller_dependencies,
const PeerConnectionInterface::RTCConfiguration& callee_config,
- webrtc::PeerConnectionDependencies callee_dependencies) {
+ PeerConnectionDependencies callee_dependencies) {
caller_ =
CreatePeerConnectionWrapper("Caller", nullptr, &caller_config,
std::move(caller_dependencies), nullptr,
@@ -1570,16 +1559,16 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
bool CreatePeerConnectionWrappersWithOptions(
const PeerConnectionFactory::Options& caller_options,
const PeerConnectionFactory::Options& callee_options) {
- caller_ = CreatePeerConnectionWrapper(
- "Caller", &caller_options, nullptr,
- webrtc::PeerConnectionDependencies(nullptr), nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
- callee_ = CreatePeerConnectionWrapper(
- "Callee", &callee_options, nullptr,
- webrtc::PeerConnectionDependencies(nullptr), nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false);
+ caller_ = CreatePeerConnectionWrapper("Caller", &caller_options, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
+ callee_ = CreatePeerConnectionWrapper("Callee", &callee_options, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false);
return caller_ && callee_;
}
@@ -1587,10 +1576,10 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
PeerConnectionInterface::RTCConfiguration default_config;
caller_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
"Caller", nullptr, &default_config,
- webrtc::PeerConnectionDependencies(nullptr));
+ PeerConnectionDependencies(nullptr));
callee_ = CreatePeerConnectionWrapperWithFakeRtcEventLog(
"Callee", nullptr, &default_config,
- webrtc::PeerConnectionDependencies(nullptr));
+ PeerConnectionDependencies(nullptr));
return caller_ && callee_;
}
@@ -1600,7 +1589,7 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
new FakeRTCCertificateGenerator());
cert_generator->use_alternate_key();
- webrtc::PeerConnectionDependencies dependencies(nullptr);
+ PeerConnectionDependencies dependencies(nullptr);
dependencies.cert_generator = std::move(cert_generator);
return CreatePeerConnectionWrapper("New Peer", nullptr, nullptr,
std::move(dependencies), nullptr,
@@ -1610,12 +1599,12 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
bool CreateOneDirectionalPeerConnectionWrappers(bool caller_to_callee) {
caller_ = CreatePeerConnectionWrapper(
- "Caller", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
+ "Caller", nullptr, nullptr, PeerConnectionDependencies(nullptr),
nullptr,
/*reset_encoder_factory=*/!caller_to_callee,
/*reset_decoder_factory=*/caller_to_callee);
callee_ = CreatePeerConnectionWrapper(
- "Callee", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
+ "Callee", nullptr, nullptr, PeerConnectionDependencies(nullptr),
nullptr,
/*reset_encoder_factory=*/caller_to_callee,
/*reset_decoder_factory=*/!caller_to_callee);
@@ -1623,18 +1612,18 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
}
bool CreatePeerConnectionWrappersWithoutMediaEngine() {
- caller_ = CreatePeerConnectionWrapper(
- "Caller", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
- nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false,
- /*create_media_engine=*/false);
- callee_ = CreatePeerConnectionWrapper(
- "Callee", nullptr, nullptr, webrtc::PeerConnectionDependencies(nullptr),
- nullptr,
- /*reset_encoder_factory=*/false,
- /*reset_decoder_factory=*/false,
- /*create_media_engine=*/false);
+ caller_ = CreatePeerConnectionWrapper("Caller", nullptr, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false,
+ /*create_media_engine=*/false);
+ callee_ = CreatePeerConnectionWrapper("Callee", nullptr, nullptr,
+ PeerConnectionDependencies(nullptr),
+ nullptr,
+ /*reset_encoder_factory=*/false,
+ /*reset_decoder_factory=*/false,
+ /*create_media_engine=*/false);
return caller_ && callee_;
}
@@ -1704,7 +1693,7 @@ class PeerConnectionIntegrationBaseTest : public ::testing::Test {
// Messages may get lost on the unreliable DataChannel, so we send multiple
// times to avoid test flakiness.
- void SendRtpDataWithRetries(webrtc::DataChannelInterface* dc,
+ void SendRtpDataWithRetries(DataChannelInterface* dc,
const std::string& data,
int retries) {
for (int i = 0; i < retries; ++i) {
diff --git a/pc/test/mock_peer_connection_internal.h b/pc/test/mock_peer_connection_internal.h
index 58d13ede2f..5fd7a50b4f 100644
--- a/pc/test/mock_peer_connection_internal.h
+++ b/pc/test/mock_peer_connection_internal.h
@@ -248,7 +248,6 @@ class MockPeerConnectionInternal : public PeerConnectionInternal {
(const cricket::SessionDescription*,
(const std::map<std::string, const cricket::ContentGroup*>&)),
(override));
- MOCK_METHOD(absl::optional<std::string>, GetDataMid, (), (const, override));
MOCK_METHOD(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
AddTransceiver,
(cricket::MediaType,
@@ -263,16 +262,11 @@ class MockPeerConnectionInternal : public PeerConnectionInternal {
(override));
MOCK_METHOD(Call*, call_ptr, (), (override));
MOCK_METHOD(bool, SrtpRequired, (), (const, override));
- MOCK_METHOD(absl::optional<std::string>,
- SetupDataChannelTransport_n,
- (absl::string_view mid),
- (override));
- MOCK_METHOD(void, TeardownDataChannelTransport_n, (RTCError), (override));
- MOCK_METHOD(void,
- SetSctpDataInfo,
- (absl::string_view, absl::string_view),
+ MOCK_METHOD(bool,
+ CreateDataChannelTransport,
+ (absl::string_view),
(override));
- MOCK_METHOD(void, ResetSctpDataInfo, (), (override));
+ MOCK_METHOD(void, DestroyDataChannelTransport, (RTCError error), (override));
MOCK_METHOD(const FieldTrialsView&, trials, (), (const, override));
// PeerConnectionInternal
diff --git a/pc/test/mock_peer_connection_observers.h b/pc/test/mock_peer_connection_observers.h
index e9d97a97f6..6222ef7719 100644
--- a/pc/test/mock_peer_connection_observers.h
+++ b/pc/test/mock_peer_connection_observers.h
@@ -254,7 +254,7 @@ class MockPeerConnectionObserver : public PeerConnectionObserver {
};
class MockCreateSessionDescriptionObserver
- : public webrtc::CreateSessionDescriptionObserver {
+ : public CreateSessionDescriptionObserver {
public:
MockCreateSessionDescriptionObserver()
: called_(false),
@@ -266,7 +266,7 @@ class MockCreateSessionDescriptionObserver
error_ = "";
desc_.reset(desc);
}
- void OnFailure(webrtc::RTCError error) override {
+ void OnFailure(RTCError error) override {
MutexLock lock(&mutex_);
called_ = true;
error_ = error.message();
@@ -295,8 +295,7 @@ class MockCreateSessionDescriptionObserver
std::unique_ptr<SessionDescriptionInterface> desc_ RTC_GUARDED_BY(mutex_);
};
-class MockSetSessionDescriptionObserver
- : public webrtc::SetSessionDescriptionObserver {
+class MockSetSessionDescriptionObserver : public SetSessionDescriptionObserver {
public:
static rtc::scoped_refptr<MockSetSessionDescriptionObserver> Create() {
return rtc::make_ref_counted<MockSetSessionDescriptionObserver>();
@@ -312,7 +311,7 @@ class MockSetSessionDescriptionObserver
called_ = true;
error_ = "";
}
- void OnFailure(webrtc::RTCError error) override {
+ void OnFailure(RTCError error) override {
MutexLock lock(&mutex_);
called_ = true;
error_ = error.message();
@@ -375,14 +374,14 @@ class FakeSetRemoteDescriptionObserver
absl::optional<RTCError> error_;
};
-class MockDataChannelObserver : public webrtc::DataChannelObserver {
+class MockDataChannelObserver : public DataChannelObserver {
public:
struct Message {
std::string data;
bool binary;
};
- explicit MockDataChannelObserver(webrtc::DataChannelInterface* channel)
+ explicit MockDataChannelObserver(DataChannelInterface* channel)
: channel_(channel) {
channel_->RegisterObserver(this);
states_.push_back(channel_->state());
@@ -419,12 +418,12 @@ class MockDataChannelObserver : public webrtc::DataChannelObserver {
}
private:
- rtc::scoped_refptr<webrtc::DataChannelInterface> channel_;
+ rtc::scoped_refptr<DataChannelInterface> channel_;
std::vector<DataChannelInterface::DataState> states_;
std::vector<Message> messages_;
};
-class MockStatsObserver : public webrtc::StatsObserver {
+class MockStatsObserver : public StatsObserver {
public:
MockStatsObserver() : called_(false), stats_() {}
virtual ~MockStatsObserver() {}
@@ -576,7 +575,7 @@ class MockStatsObserver : public webrtc::StatsObserver {
};
// Helper class that just stores the report from the callback.
-class MockRTCStatsCollectorCallback : public webrtc::RTCStatsCollectorCallback {
+class MockRTCStatsCollectorCallback : public RTCStatsCollectorCallback {
public:
rtc::scoped_refptr<const RTCStatsReport> report() { return report_; }
diff --git a/pc/test/rtp_transport_test_util.h b/pc/test/rtp_transport_test_util.h
index 593ee002c9..563014f94a 100644
--- a/pc/test/rtp_transport_test_util.h
+++ b/pc/test/rtp_transport_test_util.h
@@ -33,9 +33,14 @@ class TransportObserver : public RtpPacketSinkInterface {
rtp_transport->SubscribeReadyToSend(
this, [this](bool arg) { OnReadyToSend(arg); });
rtp_transport->SetUnDemuxableRtpPacketReceivedHandler(
- [this](webrtc::RtpPacketReceived& packet) {
- OnUndemuxableRtpPacket(packet);
- });
+ [this](RtpPacketReceived& packet) { OnUndemuxableRtpPacket(packet); });
+ rtp_transport->SubscribeSentPacket(this,
+ [this](const rtc::SentPacket& packet) {
+ sent_packet_count_++;
+ if (action_on_sent_packet_) {
+ action_on_sent_packet_();
+ }
+ });
}
// RtpPacketInterface override.
@@ -57,6 +62,7 @@ class TransportObserver : public RtpPacketSinkInterface {
int rtp_count() const { return rtp_count_; }
int un_demuxable_rtp_count() const { return un_demuxable_rtp_count_; }
int rtcp_count() const { return rtcp_count_; }
+ int sent_packet_count() const { return sent_packet_count_; }
rtc::CopyOnWriteBuffer last_recv_rtp_packet() {
return last_recv_rtp_packet_;
@@ -81,16 +87,21 @@ class TransportObserver : public RtpPacketSinkInterface {
void SetActionOnReadyToSend(absl::AnyInvocable<void(bool)> action) {
action_on_ready_to_send_ = std::move(action);
}
+ void SetActionOnSentPacket(absl::AnyInvocable<void()> action) {
+ action_on_sent_packet_ = std::move(action);
+ }
private:
bool ready_to_send_ = false;
int rtp_count_ = 0;
int un_demuxable_rtp_count_ = 0;
int rtcp_count_ = 0;
+ int sent_packet_count_ = 0;
int ready_to_send_signal_count_ = 0;
rtc::CopyOnWriteBuffer last_recv_rtp_packet_;
rtc::CopyOnWriteBuffer last_recv_rtcp_packet_;
absl::AnyInvocable<void(bool)> action_on_ready_to_send_;
+ absl::AnyInvocable<void()> action_on_sent_packet_;
};
} // namespace webrtc
diff --git a/pc/test/svc_e2e_tests.cc b/pc/test/svc_e2e_tests.cc
index ae35c7f676..412027bba1 100644
--- a/pc/test/svc_e2e_tests.cc
+++ b/pc/test/svc_e2e_tests.cc
@@ -160,10 +160,9 @@ std::string SvcTestNameGenerator(
// encoder and decoder level.
class SvcVideoQualityAnalyzer : public DefaultVideoQualityAnalyzer {
public:
- using SpatialTemporalLayerCounts =
- webrtc::flat_map<int, webrtc::flat_map<int, int>>;
+ using SpatialTemporalLayerCounts = flat_map<int, flat_map<int, int>>;
- explicit SvcVideoQualityAnalyzer(webrtc::Clock* clock)
+ explicit SvcVideoQualityAnalyzer(Clock* clock)
: DefaultVideoQualityAnalyzer(clock,
test::GetGlobalMetricsLogger(),
DefaultVideoQualityAnalyzerOptions{
@@ -315,9 +314,9 @@ TEST_P(SvcTest, ScalabilityModeSupported) {
if (UseDependencyDescriptor()) {
trials += "WebRTC-DependencyDescriptorAdvertised/Enabled/";
}
- webrtc::test::ScopedFieldTrials override_trials(AppendFieldTrials(trials));
+ test::ScopedFieldTrials override_trials(AppendFieldTrials(trials));
std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
- CreateNetworkEmulationManager(webrtc::TimeMode::kSimulated);
+ CreateNetworkEmulationManager(TimeMode::kSimulated);
auto analyzer = std::make_unique<SvcVideoQualityAnalyzer>(
network_emulation_manager->time_controller()->GetClock());
SvcVideoQualityAnalyzer* analyzer_ptr = analyzer.get();
diff --git a/pc/transport_stats.h b/pc/transport_stats.h
index e554385954..46dccc97f8 100644
--- a/pc/transport_stats.h
+++ b/pc/transport_stats.h
@@ -34,6 +34,7 @@ struct TransportChannelStats {
absl::optional<rtc::SSLRole> dtls_role;
webrtc::DtlsTransportState dtls_state = webrtc::DtlsTransportState::kNew;
IceTransportStats ice_transport_stats;
+ uint16_t ssl_peer_signature_algorithm = rtc::kSslSignatureAlgorithmUnknown;
};
// Information about all the channels of a transport.
diff --git a/pc/video_rtp_receiver_unittest.cc b/pc/video_rtp_receiver_unittest.cc
index 5ff736084f..e9729170b7 100644
--- a/pc/video_rtp_receiver_unittest.cc
+++ b/pc/video_rtp_receiver_unittest.cc
@@ -94,7 +94,7 @@ class VideoRtpReceiverTest : public testing::Test {
[&]() { receiver_->SetMediaChannel(media_channel); });
}
- webrtc::VideoTrackSourceInterface* Source() {
+ VideoTrackSourceInterface* Source() {
return receiver_->streams()[0]->FindVideoTrack("receiver")->GetSource();
}
diff --git a/pc/video_rtp_track_source_unittest.cc b/pc/video_rtp_track_source_unittest.cc
index 13728c7eff..55632cea42 100644
--- a/pc/video_rtp_track_source_unittest.cc
+++ b/pc/video_rtp_track_source_unittest.cc
@@ -109,11 +109,11 @@ TEST(VideoRtpTrackSourceTest, NoCallbacksAfterClearedCallback) {
class TestFrame : public RecordableEncodedFrame {
public:
- rtc::scoped_refptr<const webrtc::EncodedImageBufferInterface> encoded_buffer()
+ rtc::scoped_refptr<const EncodedImageBufferInterface> encoded_buffer()
const override {
return nullptr;
}
- absl::optional<webrtc::ColorSpace> color_space() const override {
+ absl::optional<ColorSpace> color_space() const override {
return absl::nullopt;
}
VideoCodecType codec() const override { return kVideoCodecGeneric; }
diff --git a/pc/video_track.h b/pc/video_track.h
index 13a51c454b..e504182c82 100644
--- a/pc/video_track.h
+++ b/pc/video_track.h
@@ -70,7 +70,7 @@ class VideoTrack : public MediaStreamTrack<VideoTrackInterface>,
// Implements ObserverInterface. Observes `video_source_` state.
void OnChanged() override;
- RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker signaling_thread_;
+ RTC_NO_UNIQUE_ADDRESS SequenceChecker signaling_thread_;
rtc::Thread* const worker_thread_;
const rtc::scoped_refptr<
VideoTrackSourceProxyWithInternal<VideoTrackSourceInterface>>
diff --git a/pc/video_track_source_proxy.h b/pc/video_track_source_proxy.h
index 8500a98766..40d24234ad 100644
--- a/pc/video_track_source_proxy.h
+++ b/pc/video_track_source_proxy.h
@@ -52,7 +52,7 @@ PROXY_SECONDARY_METHOD1(void,
rtc::VideoSinkInterface<RecordableEncodedFrame>*)
PROXY_SECONDARY_METHOD1(void,
ProcessConstraints,
- const webrtc::VideoTrackSourceConstraints&)
+ const VideoTrackSourceConstraints&)
END_PROXY_MAP(VideoTrackSource)
} // namespace webrtc
diff --git a/pc/webrtc_sdp.cc b/pc/webrtc_sdp.cc
index 80fef12702..da024eab81 100644
--- a/pc/webrtc_sdp.cc
+++ b/pc/webrtc_sdp.cc
@@ -267,11 +267,9 @@ struct SsrcInfo {
std::string stream_id;
std::string track_id;
};
-typedef std::vector<SsrcInfo> SsrcInfoVec;
-typedef std::vector<SsrcGroup> SsrcGroupVec;
+using SsrcInfoVec = std::vector<SsrcInfo>;
+using SsrcGroupVec = std::vector<SsrcGroup>;
-template <class T>
-static void AddFmtpLine(const T& codec, std::string* message);
static void BuildMediaDescription(const ContentInfo* content_info,
const TransportInfo* transport_info,
const cricket::MediaType media_type,
@@ -1442,7 +1440,7 @@ void BuildMediaLine(const cricket::MediaType media_type,
media_type == cricket::MEDIA_TYPE_VIDEO) {
type = media_type == cricket::MEDIA_TYPE_AUDIO ? kMediaTypeAudio
: kMediaTypeVideo;
- for (const cricket::VideoCodec& codec : media_desc->codecs()) {
+ for (const cricket::Codec& codec : media_desc->codecs()) {
fmt.append(" ");
fmt.append(rtc::ToString(codec.id));
}
@@ -2598,7 +2596,7 @@ static const StaticPayloadAudioCodec kStaticPayloadAudioCodecs[] = {
};
void MaybeCreateStaticPayloadAudioCodecs(const std::vector<int>& fmts,
- AudioContentDescription* media_desc) {
+ MediaContentDescription* media_desc) {
if (!media_desc) {
return;
}
@@ -2616,8 +2614,7 @@ void MaybeCreateStaticPayloadAudioCodecs(const std::vector<int>& fmts,
}
}
-template <class C>
-static std::unique_ptr<C> ParseContentDescription(
+static std::unique_ptr<MediaContentDescription> ParseContentDescription(
absl::string_view message,
const cricket::MediaType media_type,
int mline_index,
@@ -2629,8 +2626,17 @@ static std::unique_ptr<C> ParseContentDescription(
int* msid_signaling,
TransportDescription* transport,
std::vector<std::unique_ptr<JsepIceCandidate>>* candidates,
- webrtc::SdpParseError* error) {
- auto media_desc = std::make_unique<C>();
+ SdpParseError* error) {
+ std::unique_ptr<MediaContentDescription> media_desc;
+ if (media_type == cricket::MediaType::MEDIA_TYPE_AUDIO) {
+ media_desc = std::make_unique<AudioContentDescription>();
+ } else if (media_type == cricket::MediaType::MEDIA_TYPE_VIDEO) {
+ media_desc = std::make_unique<VideoContentDescription>();
+ } else {
+ RTC_DCHECK_NOTREACHED();
+ return nullptr;
+ }
+
media_desc->set_extmap_allow_mixed_enum(MediaContentDescription::kNo);
if (!ParseContent(message, media_type, mline_index, protocol, payload_types,
pos, content_name, bundle_only, msid_signaling,
@@ -2725,12 +2731,12 @@ bool ParseMediaDescription(
return ParseFailed(*mline, "Unsupported protocol for media type", error);
}
if (media_type == kMediaTypeVideo) {
- content = ParseContentDescription<VideoContentDescription>(
+ content = ParseContentDescription(
message, cricket::MEDIA_TYPE_VIDEO, mline_index, protocol,
payload_types, pos, &content_name, &bundle_only,
&section_msid_signaling, &transport, candidates, error);
} else if (media_type == kMediaTypeAudio) {
- content = ParseContentDescription<AudioContentDescription>(
+ content = ParseContentDescription(
message, cricket::MEDIA_TYPE_AUDIO, mline_index, protocol,
payload_types, pos, &content_name, &bundle_only,
&section_msid_signaling, &transport, candidates, error);
@@ -2933,7 +2939,7 @@ void UpdateCodec(MediaContentDescription* content_desc,
// Adds or updates existing video codec corresponding to `payload_type`
// according to `packetization`.
-void UpdateVideoCodecPacketization(VideoContentDescription* video_desc,
+void UpdateVideoCodecPacketization(MediaContentDescription* desc,
int payload_type,
absl::string_view packetization) {
if (packetization != cricket::kPacketizationParamRaw) {
@@ -2942,10 +2948,10 @@ void UpdateVideoCodecPacketization(VideoContentDescription* video_desc,
}
// Codec might already have been populated (from rtpmap).
- cricket::VideoCodec codec = GetCodecWithPayloadType(
- video_desc->type(), video_desc->codecs(), payload_type);
+ cricket::Codec codec =
+ GetCodecWithPayloadType(desc->type(), desc->codecs(), payload_type);
codec.packetization = std::string(packetization);
- AddOrReplaceCodec(video_desc, codec);
+ AddOrReplaceCodec(desc, codec);
}
absl::optional<cricket::Codec> PopWildcardCodec(
@@ -2976,16 +2982,16 @@ void UpdateFromWildcardCodecs(cricket::MediaContentDescription* desc) {
void AddAudioAttribute(const std::string& name,
absl::string_view value,
- AudioContentDescription* audio_desc) {
- RTC_DCHECK(audio_desc);
+ MediaContentDescription* desc) {
+ RTC_DCHECK(desc);
if (value.empty()) {
return;
}
- std::vector<cricket::AudioCodec> codecs = audio_desc->codecs();
- for (cricket::AudioCodec& codec : codecs) {
+ std::vector<cricket::Codec> codecs = desc->codecs();
+ for (cricket::Codec& codec : codecs) {
codec.params[name] = std::string(value);
}
- audio_desc->set_codecs(codecs);
+ desc->set_codecs(codecs);
}
bool ParseContent(absl::string_view message,
@@ -3006,7 +3012,7 @@ bool ParseContent(absl::string_view message,
RTC_DCHECK(transport != NULL);
if (media_type == cricket::MEDIA_TYPE_AUDIO) {
- MaybeCreateStaticPayloadAudioCodecs(payload_types, media_desc->as_audio());
+ MaybeCreateStaticPayloadAudioCodecs(payload_types, media_desc);
}
// The media level "ice-ufrag" and "ice-pwd".
@@ -3397,10 +3403,8 @@ bool ParseContent(absl::string_view message,
return ParseFailed("Failed to parse codecs correctly.", error);
}
if (media_type == cricket::MEDIA_TYPE_AUDIO) {
- AddAudioAttribute(kCodecParamMaxPTime, maxptime_as_string,
- media_desc->as_audio());
- AddAudioAttribute(kCodecParamPTime, ptime_as_string,
- media_desc->as_audio());
+ AddAudioAttribute(kCodecParamMaxPTime, maxptime_as_string, media_desc);
+ AddAudioAttribute(kCodecParamPTime, ptime_as_string, media_desc);
}
// RFC 5245
@@ -3563,29 +3567,29 @@ void UpdateCodec(int payload_type,
int clockrate,
int bitrate,
size_t channels,
- AudioContentDescription* audio_desc) {
+ MediaContentDescription* desc) {
// Codec may already be populated with (only) optional parameters
// (from an fmtp).
- cricket::Codec codec = GetCodecWithPayloadType(
- audio_desc->type(), audio_desc->codecs(), payload_type);
+ cricket::Codec codec =
+ GetCodecWithPayloadType(desc->type(), desc->codecs(), payload_type);
codec.name = std::string(name);
codec.clockrate = clockrate;
codec.bitrate = bitrate;
codec.channels = channels;
- AddOrReplaceCodec(audio_desc, codec);
+ AddOrReplaceCodec(desc, codec);
}
// Updates or creates a new codec entry in the video description according to
// `name`, `width`, `height`, and `framerate`.
void UpdateCodec(int payload_type,
absl::string_view name,
- VideoContentDescription* video_desc) {
+ MediaContentDescription* desc) {
// Codec may already be populated with (only) optional parameters
// (from an fmtp).
- cricket::Codec codec = GetCodecWithPayloadType(
- video_desc->type(), video_desc->codecs(), payload_type);
+ cricket::Codec codec =
+ GetCodecWithPayloadType(desc->type(), desc->codecs(), payload_type);
codec.name = std::string(name);
- AddOrReplaceCodec(video_desc, codec);
+ AddOrReplaceCodec(desc, codec);
}
bool ParseRtpmapAttribute(absl::string_view line,
@@ -3648,7 +3652,7 @@ bool ParseRtpmapAttribute(absl::string_view line,
return ParseFailed(line, description.Release(), error);
}
}
- UpdateCodec(payload_type, encoding_name, media_desc->as_video());
+ UpdateCodec(payload_type, encoding_name, media_desc);
} else if (media_type == cricket::MEDIA_TYPE_AUDIO) {
// RFC 4566
// For audio streams, <encoding parameters> indicates the number
@@ -3681,7 +3685,7 @@ bool ParseRtpmapAttribute(absl::string_view line,
}
}
UpdateCodec(payload_type, encoding_name, clock_rate, 0, channels,
- media_desc->as_audio());
+ media_desc);
}
return true;
}
@@ -3782,8 +3786,7 @@ bool ParsePacketizationAttribute(absl::string_view line,
return false;
}
absl::string_view packetization = packetization_fields[1];
- UpdateVideoCodecPacketization(media_desc->as_video(), payload_type,
- packetization);
+ UpdateVideoCodecPacketization(media_desc, payload_type, packetization);
return true;
}
diff --git a/pc/webrtc_sdp_unittest.cc b/pc/webrtc_sdp_unittest.cc
index 1c0c4dde94..2c43c35d15 100644
--- a/pc/webrtc_sdp_unittest.cc
+++ b/pc/webrtc_sdp_unittest.cc
@@ -55,7 +55,6 @@
#endif
#include "pc/webrtc_sdp.h"
-using cricket::AudioCodec;
using cricket::AudioContentDescription;
using cricket::Candidate;
using cricket::ContentGroup;
@@ -77,7 +76,6 @@ using cricket::StreamParams;
using cricket::STUN_PORT_TYPE;
using cricket::TransportDescription;
using cricket::TransportInfo;
-using cricket::VideoCodec;
using cricket::VideoContentDescription;
using ::testing::ElementsAre;
using ::testing::Field;
@@ -91,9 +89,6 @@ using webrtc::SdpParseError;
using webrtc::SdpType;
using webrtc::SessionDescriptionInterface;
-typedef std::vector<AudioCodec> AudioCodecs;
-typedef std::vector<Candidate> Candidates;
-
static const uint32_t kDefaultSctpPort = 5000;
static const uint16_t kUnusualSctpPort = 9556;
static const char kSessionTime[] = "t=0 0\r\n";
@@ -1885,7 +1880,7 @@ class WebRtcSdpTest : public ::testing::Test {
GetFirstAudioContentDescription(jdesc_output->description());
ASSERT_TRUE(acd);
ASSERT_FALSE(acd->codecs().empty());
- cricket::AudioCodec opus = acd->codecs()[0];
+ cricket::Codec opus = acd->codecs()[0];
EXPECT_EQ("opus", opus.name);
EXPECT_EQ(111, opus.id);
VerifyCodecParameter(opus.params, "minptime", params.min_ptime);
@@ -1894,13 +1889,12 @@ class WebRtcSdpTest : public ::testing::Test {
VerifyCodecParameter(opus.params, "useinbandfec", params.useinband);
VerifyCodecParameter(opus.params, "maxaveragebitrate",
params.maxaveragebitrate);
- for (size_t i = 0; i < acd->codecs().size(); ++i) {
- cricket::AudioCodec codec = acd->codecs()[i];
+ for (const auto& codec : acd->codecs()) {
VerifyCodecParameter(codec.params, "ptime", params.ptime);
VerifyCodecParameter(codec.params, "maxptime", params.max_ptime);
}
- cricket::AudioCodec dtmf = acd->codecs()[3];
+ cricket::Codec dtmf = acd->codecs()[3];
EXPECT_EQ("telephone-event", dtmf.name);
EXPECT_EQ(105, dtmf.id);
EXPECT_EQ(3u,
@@ -1958,7 +1952,7 @@ class WebRtcSdpTest : public ::testing::Test {
GetFirstAudioContentDescription(jdesc_output->description());
ASSERT_TRUE(acd);
ASSERT_FALSE(acd->codecs().empty());
- cricket::AudioCodec opus = acd->codecs()[0];
+ cricket::Codec opus = acd->codecs()[0];
EXPECT_EQ(111, opus.id);
EXPECT_TRUE(opus.HasFeedbackParam(cricket::FeedbackParam(
cricket::kRtcpFbParamNack, cricket::kParamValueEmpty)));
@@ -2013,7 +2007,7 @@ class WebRtcSdpTest : public ::testing::Test {
AudioContentDescription* audio_desc_;
VideoContentDescription* video_desc_;
SctpDataContentDescription* sctp_desc_;
- Candidates candidates_;
+ std::vector<Candidate> candidates_;
std::unique_ptr<IceCandidateInterface> jcandidate_;
JsepSessionDescription jdesc_;
};
@@ -2432,7 +2426,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmap) {
EXPECT_TRUE(SdpDeserialize(kSdpNoRtpmapString, &jdesc));
cricket::AudioContentDescription* audio =
cricket::GetFirstAudioContentDescription(jdesc.description());
- AudioCodecs ref_codecs;
+ cricket::AudioCodecs ref_codecs;
// The codecs in the AudioContentDescription should be in the same order as
// the payload types (<fmt>s) on the m= line.
ref_codecs.push_back(cricket::CreateAudioCodec(0, "PCMU", 8000, 1));
@@ -2456,7 +2450,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmapButWithFmtp) {
cricket::AudioContentDescription* audio =
cricket::GetFirstAudioContentDescription(jdesc.description());
- cricket::AudioCodec g729 = audio->codecs()[0];
+ cricket::Codec g729 = audio->codecs()[0];
EXPECT_EQ("G729", g729.name);
EXPECT_EQ(8000, g729.clockrate);
EXPECT_EQ(18, g729.id);
@@ -2464,7 +2458,7 @@ TEST_F(WebRtcSdpTest, DeserializeSessionDescriptionWithoutRtpmapButWithFmtp) {
ASSERT_TRUE(found != g729.params.end());
EXPECT_EQ(found->second, "yes");
- cricket::AudioCodec isac = audio->codecs()[1];
+ cricket::Codec isac = audio->codecs()[1];
EXPECT_EQ("ISAC", isac.name);
EXPECT_EQ(103, isac.id);
EXPECT_EQ(16000, isac.clockrate);
@@ -3405,7 +3399,7 @@ TEST_F(WebRtcSdpTest, DeserializePacketizationAttributeWithIllegalValue) {
GetFirstAudioContentDescription(jdesc_output.description());
ASSERT_TRUE(acd);
ASSERT_THAT(acd->codecs(), testing::SizeIs(1));
- cricket::AudioCodec opus = acd->codecs()[0];
+ cricket::Codec opus = acd->codecs()[0];
EXPECT_EQ(opus.name, "opus");
EXPECT_EQ(opus.id, 111);
@@ -3483,7 +3477,7 @@ TEST_F(WebRtcSdpTest, SerializeAudioFmtpWithTelephoneEvent) {
AudioContentDescription* acd = GetFirstAudioContentDescription(&desc_);
cricket::AudioCodecs codecs = acd->codecs();
- cricket::AudioCodec dtmf =
+ cricket::Codec dtmf =
cricket::CreateAudioCodec(105, "telephone-event", 8000, 1);
dtmf.params[""] = "0-15";
codecs.push_back(dtmf);
@@ -5083,3 +5077,27 @@ TEST_F(WebRtcSdpTest, RejectDuplicateSsrcInSsrcGroup) {
JsepSessionDescription jdesc(kDummyType);
EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
}
+
+TEST_F(WebRtcSdpTest, ExpectsTLineBeforeAttributeLine) {
+ // https://www.rfc-editor.org/rfc/rfc4566#page-9
+ // says a= attributes must come last.
+ std::string sdp =
+ "v=0\r\n"
+ "o=- 0 3 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "a=thisisnottherightplace\r\n"
+ "t=0 0\r\n";
+ JsepSessionDescription jdesc(kDummyType);
+ EXPECT_FALSE(SdpDeserialize(sdp, &jdesc));
+}
+
+TEST_F(WebRtcSdpTest, IgnoresUnknownAttributeLines) {
+ std::string sdp =
+ "v=0\r\n"
+ "o=- 0 3 IN IP4 127.0.0.1\r\n"
+ "s=-\r\n"
+ "t=0 0\r\n"
+ "a=somethingthatisnotunderstood\r\n";
+ JsepSessionDescription jdesc(kDummyType);
+ EXPECT_TRUE(SdpDeserialize(sdp, &jdesc));
+}
diff --git a/pylintrc_old_style b/pylintrc_old_style
new file mode 100644
index 0000000000..69b599b2f6
--- /dev/null
+++ b/pylintrc_old_style
@@ -0,0 +1,216 @@
+# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+# This file is mostly based on the contents of
+# https://cs.chromium.org/chromium/tools/depot_tools/pylintrc
+# and (since the above doesn't properly support naming style checks)
+# https://cs.chromium.org/chromium/src/third_party/chromite/pylintrc
+
+[MESSAGES CONTROL]
+
+# Disable the message, report, category or checker with the given id(s).
+# TODO(kjellander): Reduce this list to as small as possible.
+disable=
+ E0611,
+ I0010,
+ I0011,
+ W0232,
+ C0413,
+ bad-continuation,
+ broad-except,
+ duplicate-code,
+ eval-used,
+ exec-used,
+ fixme,
+ import-error,
+ import-outside-toplevel,
+ missing-docstring,
+ no-init,
+ no-member,
+ too-few-public-methods,
+ too-many-ancestors,
+ too-many-arguments,
+ too-many-branches,
+ too-many-function-args,
+ too-many-instance-attributes,
+ too-many-lines,
+ too-many-locals,
+ too-many-public-methods,
+ too-many-return-statements,
+ too-many-statements,
+
+
+[REPORTS]
+
+# Don't write out full reports, just messages.
+reports=no
+
+
+[VARIABLES]
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching the beginning of the name of dummy variables
+# (i.e. not used).
+dummy-variables-rgx=_|dummy
+
+
+[TYPECHECK]
+
+# Tells whether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+# List of classes names for which member attributes should not be checked
+# (useful for classes with attributes dynamically set).
+ignored-classes=hashlib,numpy
+
+
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,XXX,TODO
+
+
+[SIMILARITIES]
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+# Ignore comments when computing similarities.
+ignore-comments=yes
+
+# Ignore docstrings when computing similarities.
+ignore-docstrings=yes
+
+
+[FORMAT]
+
+# Maximum number of characters on a single line.
+max-line-length=80
+
+# Maximum number of lines in a module
+max-module-lines=1000
+
+# Use four spaces for indents.
+# indent-string=' '
+
+
+[BASIC]
+
+# List of builtins function names that should not be used, separated by a comma
+bad-functions=map,filter,apply,input
+
+# Regular expression which should only match correct module names
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
+
+# Regular expression which should only match correct module level names
+# (CAPS_WITH_UNDER)
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
+
+# Regular expression which should only match correct class names
+# (CapWords)
+class-rgx=[A-Z_][a-zA-Z0-9]+$
+
+# Regular expression which should only match correct function names
+# The Chromium standard is different than PEP-8, so we need to redefine this to
+# only allow:
+# - CapWords
+# - main: Standard for main function.
+function-rgx=([A-Z_][a-zA-Z0-9]{2,60}|main)$
+
+# Regular expression which should only match correct method names
+# The Chromium standard is different than PEP-8, so we need to redefine this to
+# only allow:
+# - CapWords, starting with a capital letter. No underscores in function
+# names. Can also have a "_" prefix (private method) or a "test" prefix
+# (unit test).
+# - Methods that look like __xyz__, which are used to do things like
+# __init__, __del__, etc.
+# - setUp, tearDown: For unit tests.
+method-rgx=((_|test)?[A-Z][a-zA-Z0-9]{2,60}|__[a-z]+__|setUp|tearDown)$
+
+# Regular expression which should only match correct instance attribute names
+attr-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct argument names
+argument-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct variable names
+variable-rgx=[a-z_][a-z0-9_]{0,30}$
+
+# Regular expression which should only match correct list comprehension /
+# generator expression variable names
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
+
+# Good variable names which should always be accepted, separated by a comma
+good-names=i,j,k,ex,Run,_
+
+# Bad variable names which should always be refused, separated by a comma
+bad-names=foo,bar,baz,toto,tutu,tata
+
+# Regular expression which should only match functions or classes name which do
+# not require a docstring
+no-docstring-rgx=__.*__
+
+
+[DESIGN]
+
+# Maximum number of arguments for function / method
+max-args=5
+
+# Argument names that match this expression will be ignored. Default to name
+# with leading underscore
+ignored-argument-names=_.*
+
+# Maximum number of locals for function / method body
+max-locals=15
+
+# Maximum number of return / yield for function / method body
+max-returns=6
+
+# Maximum number of branch for function / method body
+max-branchs=12
+
+# Maximum number of statements in function / method body
+max-statements=50
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+
+[CLASSES]
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,__new__,setUp
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+
+[IMPORTS]
+
+# Deprecated modules which should not be used, separated by a comma
+deprecated-modules=regsub,TERMIOS,Bastion,rexec
+
+
+[EXCEPTIONS]
+
+# Exceptions that will emit a warning when being caught. Defaults to
+# "Exception"
+overgeneral-exceptions=Exception
diff --git a/resources/.gitignore b/resources/.gitignore
index 1f729ae457..80580705f9 100644
--- a/resources/.gitignore
+++ b/resources/.gitignore
@@ -1,5 +1,6 @@
**/*.aecdump
**/*.bin
+**/*.binarypb
**/*.byte
**/*.chn
**/*.dat
diff --git a/resources/rtc_event_log/rtc_event_log_500kbps.binarypb.sha1 b/resources/rtc_event_log/rtc_event_log_500kbps.binarypb.sha1
new file mode 100644
index 0000000000..b190e48733
--- /dev/null
+++ b/resources/rtc_event_log/rtc_event_log_500kbps.binarypb.sha1
@@ -0,0 +1 @@
+56e4ff9ea2b0fb92e88c7126f1df1283787ae0e5 \ No newline at end of file
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index fdc2adf639..51e15b57f7 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -156,8 +156,12 @@ rtc_library("byte_buffer") {
deps = [
":buffer",
":byte_order",
+ "../api:array_view",
+ ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/base:core_headers",
+ "//third_party/abseil-cpp/absl/strings",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
rtc_library("buffer_queue") {
@@ -369,6 +373,7 @@ rtc_source_set("refcount") {
]
deps = [
":macromagic",
+ "../api:ref_count",
"../api:scoped_refptr",
]
}
@@ -525,7 +530,6 @@ rtc_library("rate_limiter") {
":macromagic",
":rate_statistics",
"../system_wrappers",
- "../system_wrappers:field_trial",
"synchronization:mutex",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
@@ -606,6 +610,7 @@ rtc_library("stringutils") {
"string_to_number.h",
"string_utils.cc",
"string_utils.h",
+ "strings/str_join.h",
"strings/string_builder.cc",
"strings/string_builder.h",
"strings/string_format.cc",
@@ -856,8 +861,8 @@ config("rtc_json_suppressions") {
}
rtc_library("rtc_json") {
+ testonly = true
public_configs = [ ":rtc_json_suppressions" ]
- poisonous = [ "rtc_json" ]
defines = []
sources = [
"strings/json.cc",
@@ -940,6 +945,7 @@ rtc_library("async_dns_resolver") {
"../api:make_ref_counted",
"../api:sequence_checker",
"../api/task_queue:pending_task_safety_flag",
+ "system:rtc_export",
]
}
@@ -1045,6 +1051,7 @@ rtc_library("threading") {
"//third_party/abseil-cpp/absl/strings",
]
deps = [
+ ":async_dns_resolver",
":async_resolver_interface",
":byte_order",
":checks",
@@ -1060,9 +1067,11 @@ rtc_library("threading") {
":refcount",
":rtc_event",
":rtc_task_queue",
+ ":socket",
":socket_address",
":socket_server",
":timeutils",
+ "../api:async_dns_resolver",
"../api:function_view",
"../api:location",
"../api:refcountedbase",
@@ -1365,10 +1374,12 @@ rtc_library("async_packet_socket") {
]
deps = [
":callback_list",
+ ":checks",
":dscp",
":socket",
":timeutils",
"../api:sequence_checker",
+ "network:received_packet",
"network:sent_packet",
"system:no_unique_address",
"system:rtc_export",
@@ -1376,6 +1387,21 @@ rtc_library("async_packet_socket") {
]
}
+if (rtc_include_tests) {
+ rtc_library("async_packet_socket_unittest") {
+ testonly = true
+ visibility = [ "*" ]
+ sources = [ "async_packet_socket_unittest.cc" ]
+ deps = [
+ ":async_packet_socket",
+ ":gunit_helpers",
+ "../test:test_support",
+ "network:received_packet",
+ "third_party/sigslot",
+ ]
+ }
+}
+
rtc_library("mdns_responder_interface") {
sources = [ "mdns_responder_interface.h" ]
deps = [ ":ip_address" ]
@@ -1639,10 +1665,13 @@ rtc_library("testclient") {
]
deps = [
":async_udp_socket",
+ ":buffer",
":gunit_helpers",
":rtc_base_tests_utils",
":threading",
":timeutils",
+ "../api/units:timestamp",
+ "network:received_packet",
"synchronization:mutex",
]
}
@@ -1888,6 +1917,7 @@ if (rtc_include_tests) {
"string_encode_unittest.cc",
"string_to_number_unittest.cc",
"string_utils_unittest.cc",
+ "strings/str_join_unittest.cc",
"strings/string_builder_unittest.cc",
"strings/string_format_unittest.cc",
"strong_alias_unittest.cc",
@@ -1952,6 +1982,7 @@ if (rtc_include_tests) {
":zero_memory",
"../api:array_view",
"../api:make_ref_counted",
+ "../api:ref_count",
"../api:scoped_refptr",
"../api/numerics",
"../api/units:data_rate",
@@ -1960,7 +1991,6 @@ if (rtc_include_tests) {
"../api/units:time_delta",
"../api/units:timestamp",
"../system_wrappers",
- "../test:field_trial",
"../test:fileutils",
"../test:test_main",
"../test:test_support",
diff --git a/rtc_base/async_dns_resolver.h b/rtc_base/async_dns_resolver.h
index c15af7a1cb..288751efa4 100644
--- a/rtc_base/async_dns_resolver.h
+++ b/rtc_base/async_dns_resolver.h
@@ -16,6 +16,7 @@
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "rtc_base/ref_counted_object.h"
+#include "rtc_base/system/rtc_export.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
@@ -37,7 +38,7 @@ class AsyncDnsResolverResultImpl : public AsyncDnsResolverResult {
int error_ RTC_GUARDED_BY(sequence_checker_);
};
-class AsyncDnsResolver : public AsyncDnsResolverInterface {
+class RTC_EXPORT AsyncDnsResolver : public AsyncDnsResolverInterface {
public:
AsyncDnsResolver();
~AsyncDnsResolver();
diff --git a/rtc_base/async_packet_socket.cc b/rtc_base/async_packet_socket.cc
index f50138cb62..3721366099 100644
--- a/rtc_base/async_packet_socket.cc
+++ b/rtc_base/async_packet_socket.cc
@@ -10,6 +10,8 @@
#include "rtc_base/async_packet_socket.h"
+#include "rtc_base/checks.h"
+
namespace rtc {
PacketTimeUpdateParams::PacketTimeUpdateParams() = default;
@@ -38,6 +40,41 @@ void AsyncPacketSocket::UnsubscribeCloseEvent(const void* removal_tag) {
on_close_.RemoveReceivers(removal_tag);
}
+void AsyncPacketSocket::RegisterReceivedPacketCallback(
+ absl::AnyInvocable<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet_callback) {
+ RTC_DCHECK_RUN_ON(&network_checker_);
+ RTC_CHECK(!received_packet_callback_);
+ SignalReadPacket.connect(this, &AsyncPacketSocket::NotifyPacketReceived);
+ received_packet_callback_ = std::move(received_packet_callback);
+}
+
+void AsyncPacketSocket::DeregisterReceivedPacketCallback() {
+ RTC_DCHECK_RUN_ON(&network_checker_);
+ SignalReadPacket.disconnect(this);
+ received_packet_callback_ = nullptr;
+}
+
+void AsyncPacketSocket::NotifyPacketReceived(
+ const rtc::ReceivedPacket& packet) {
+ RTC_DCHECK_RUN_ON(&network_checker_);
+ if (received_packet_callback_) {
+ received_packet_callback_(this, packet);
+ return;
+ }
+ if (SignalReadPacket.is_empty()) {
+ RTC_DCHECK_NOTREACHED() << " No listener registered";
+ return;
+ }
+ // TODO(bugs.webrtc.org:15368): Remove. This code path is only used if
+ // SignalReadyPacket is used by clients to get notification of received
+ // packets but actual socket implementation use NotifyPacketReceived to
+ // trigger the notification.
+ SignalReadPacket(this, reinterpret_cast<const char*>(packet.payload().data()),
+ packet.payload().size(), packet.source_address(),
+ packet.arrival_time() ? packet.arrival_time()->us() : -1);
+}
+
void CopySocketInformationToPacketInfo(size_t packet_size_bytes,
const AsyncPacketSocket& socket_from,
bool is_connectionless,
diff --git a/rtc_base/async_packet_socket.h b/rtc_base/async_packet_socket.h
index 0d3ceb94e7..768fcd446b 100644
--- a/rtc_base/async_packet_socket.h
+++ b/rtc_base/async_packet_socket.h
@@ -11,11 +11,13 @@
#ifndef RTC_BASE_ASYNC_PACKET_SOCKET_H_
#define RTC_BASE_ASYNC_PACKET_SOCKET_H_
+#include <cstdint>
#include <vector>
#include "api/sequence_checker.h"
#include "rtc_base/callback_list.h"
#include "rtc_base/dscp.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/socket.h"
#include "rtc_base/system/no_unique_address.h"
@@ -115,8 +117,14 @@ class RTC_EXPORT AsyncPacketSocket : public sigslot::has_slots<> {
std::function<void(AsyncPacketSocket*, int)> callback);
void UnsubscribeCloseEvent(const void* removal_tag);
+ void RegisterReceivedPacketCallback(
+ absl::AnyInvocable<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet_callback);
+ void DeregisterReceivedPacketCallback();
+
// Emitted each time a packet is read. Used only for UDP and
// connected TCP sockets.
+ // TODO(bugs.webrtc.org:15368): Deprecate and remove.
sigslot::signal5<AsyncPacketSocket*,
const char*,
size_t,
@@ -155,12 +163,26 @@ class RTC_EXPORT AsyncPacketSocket : public sigslot::has_slots<> {
on_close_.Send(this, err);
}
+ // TODO(bugs.webrtc.org:15368): Deprecate and remove.
+ void NotifyPacketReceived(AsyncPacketSocket*,
+ const char* data,
+ size_t size,
+ const SocketAddress& address,
+ const int64_t& packet_time_us) {
+ NotifyPacketReceived(
+ ReceivedPacket::CreateFromLegacy(data, size, packet_time_us, address));
+ }
+
+ void NotifyPacketReceived(const rtc::ReceivedPacket& packet);
+
RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker network_checker_{
webrtc::SequenceChecker::kDetached};
private:
webrtc::CallbackList<AsyncPacketSocket*, int> on_close_
RTC_GUARDED_BY(&network_checker_);
+ absl::AnyInvocable<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet_callback_ RTC_GUARDED_BY(&network_checker_);
};
// Listen socket, producing an AsyncPacketSocket when a peer connects.
diff --git a/rtc_base/async_packet_socket_unittest.cc b/rtc_base/async_packet_socket_unittest.cc
new file mode 100644
index 0000000000..6cd4f09459
--- /dev/null
+++ b/rtc_base/async_packet_socket_unittest.cc
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "rtc_base/async_packet_socket.h"
+
+#include "rtc_base/third_party/sigslot/sigslot.h"
+#include "test/gmock.h"
+#include "test/gtest.h"
+
+namespace rtc {
+namespace {
+
+using ::testing::MockFunction;
+
+class MockAsyncPacketSocket : public rtc::AsyncPacketSocket {
+ public:
+ ~MockAsyncPacketSocket() = default;
+
+ MOCK_METHOD(SocketAddress, GetLocalAddress, (), (const, override));
+ MOCK_METHOD(SocketAddress, GetRemoteAddress, (), (const, override));
+ MOCK_METHOD(int,
+ Send,
+ (const void* pv, size_t cb, const rtc::PacketOptions& options),
+ (override));
+
+ MOCK_METHOD(int,
+ SendTo,
+ (const void* pv,
+ size_t cb,
+ const SocketAddress& addr,
+ const rtc::PacketOptions& options),
+ (override));
+ MOCK_METHOD(int, Close, (), (override));
+ MOCK_METHOD(State, GetState, (), (const, override));
+ MOCK_METHOD(int,
+ GetOption,
+ (rtc::Socket::Option opt, int* value),
+ (override));
+ MOCK_METHOD(int, SetOption, (rtc::Socket::Option opt, int value), (override));
+ MOCK_METHOD(int, GetError, (), (const, override));
+ MOCK_METHOD(void, SetError, (int error), (override));
+
+ void NotifyPacketReceived() {
+ char data[1] = {'a'};
+ AsyncPacketSocket::NotifyPacketReceived(this, data, 1, SocketAddress(), -1);
+ }
+};
+
+TEST(AsyncPacketSocket, RegisteredCallbackReceivePacketsFromNotify) {
+ MockAsyncPacketSocket mock_socket;
+ MockFunction<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet;
+
+ EXPECT_CALL(received_packet, Call);
+ mock_socket.RegisterReceivedPacketCallback(received_packet.AsStdFunction());
+ mock_socket.NotifyPacketReceived();
+}
+
+TEST(AsyncPacketSocket, RegisteredCallbackReceivePacketsFromSignalReadPacket) {
+ MockAsyncPacketSocket mock_socket;
+ MockFunction<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet;
+
+ EXPECT_CALL(received_packet, Call);
+ mock_socket.RegisterReceivedPacketCallback(received_packet.AsStdFunction());
+ char data[1] = {'a'};
+ mock_socket.SignalReadPacket(&mock_socket, data, 1, SocketAddress(), -1);
+}
+
+TEST(AsyncPacketSocket, SignalReadPacketTriggeredByNotifyPacketReceived) {
+ class SigslotPacketReceiver : public sigslot::has_slots<> {
+ public:
+ explicit SigslotPacketReceiver(rtc::AsyncPacketSocket& socket) {
+ socket.SignalReadPacket.connect(this,
+ &SigslotPacketReceiver::OnPacketReceived);
+ }
+
+ bool packet_received() const { return packet_received_; }
+
+ private:
+ void OnPacketReceived(AsyncPacketSocket*,
+ const char*,
+ size_t,
+ const SocketAddress&,
+ // TODO(bugs.webrtc.org/9584): Change to passing the
+ // int64_t timestamp by value.
+ const int64_t&) {
+ packet_received_ = true;
+ }
+
+ bool packet_received_ = false;
+ };
+
+ MockAsyncPacketSocket mock_socket;
+ SigslotPacketReceiver receiver(mock_socket);
+ ASSERT_FALSE(receiver.packet_received());
+
+ mock_socket.NotifyPacketReceived();
+ EXPECT_TRUE(receiver.packet_received());
+}
+
+} // namespace
+} // namespace rtc
diff --git a/rtc_base/async_resolver.h b/rtc_base/async_resolver.h
index 46be43860e..9de4d12fed 100644
--- a/rtc_base/async_resolver.h
+++ b/rtc_base/async_resolver.h
@@ -39,7 +39,12 @@ namespace rtc {
// happen from the same rtc::Thread, except for Destroy which is allowed to
// happen on another context provided it's not happening concurrently to another
// public API call, and is the last access to the object.
-class RTC_EXPORT AsyncResolver : public AsyncResolverInterface {
+// TODO(bugs.webrtc.org/12598): Deprecate and remove
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wstrict-aliasing"
+class [[deprecated("Use AsyncDnsResolver")]] RTC_EXPORT AsyncResolver
+ : public AsyncResolverInterface {
+#pragma clang diagnostic pop
public:
AsyncResolver();
~AsyncResolver() override;
diff --git a/rtc_base/async_resolver_interface.h b/rtc_base/async_resolver_interface.h
index 851fa38ce1..a0bda2774a 100644
--- a/rtc_base/async_resolver_interface.h
+++ b/rtc_base/async_resolver_interface.h
@@ -20,7 +20,7 @@ namespace rtc {
// This interface defines the methods to resolve the address asynchronously.
// TODO(bugs.webrtc.org/12598): Deprecate and remove.
-class RTC_EXPORT AsyncResolverInterface {
+class [[deprecated("Use AsyncDnsResolver")]] RTC_EXPORT AsyncResolverInterface {
public:
AsyncResolverInterface();
virtual ~AsyncResolverInterface();
diff --git a/rtc_base/async_tcp_socket.cc b/rtc_base/async_tcp_socket.cc
index 367c5b04e7..eed4a31c38 100644
--- a/rtc_base/async_tcp_socket.cc
+++ b/rtc_base/async_tcp_socket.cc
@@ -294,8 +294,8 @@ void AsyncTCPSocket::ProcessInput(char* data, size_t* len) {
if (*len < kPacketLenSize + pkt_len)
return;
- SignalReadPacket(this, data + kPacketLenSize, pkt_len, remote_addr,
- TimeMicros());
+ NotifyPacketReceived(rtc::ReceivedPacket::CreateFromLegacy(
+ data + kPacketLenSize, pkt_len, rtc::TimeMicros(), remote_addr));
*len -= kPacketLenSize + pkt_len;
if (*len > 0) {
diff --git a/rtc_base/async_tcp_socket.h b/rtc_base/async_tcp_socket.h
index 541080fba7..90f77d618e 100644
--- a/rtc_base/async_tcp_socket.h
+++ b/rtc_base/async_tcp_socket.h
@@ -13,6 +13,7 @@
#include <stddef.h>
+#include <cstdint>
#include <memory>
#include "rtc_base/async_packet_socket.h"
diff --git a/rtc_base/async_udp_socket.cc b/rtc_base/async_udp_socket.cc
index af7ae56fb6..358420a5de 100644
--- a/rtc_base/async_udp_socket.cc
+++ b/rtc_base/async_udp_socket.cc
@@ -136,8 +136,8 @@ void AsyncUDPSocket::OnReadEvent(Socket* socket) {
// TODO: Make sure that we got all of the packet.
// If we did not, then we should resize our buffer to be large enough.
- SignalReadPacket(this, buf_, static_cast<size_t>(len), remote_addr,
- timestamp);
+ NotifyPacketReceived(
+ rtc::ReceivedPacket::CreateFromLegacy(buf_, len, timestamp, remote_addr));
}
void AsyncUDPSocket::OnWriteEvent(Socket* socket) {
diff --git a/rtc_base/byte_buffer.cc b/rtc_base/byte_buffer.cc
index e1278337a4..3f0e61e59c 100644
--- a/rtc_base/byte_buffer.cc
+++ b/rtc_base/byte_buffer.cc
@@ -19,23 +19,23 @@ ByteBufferWriter::ByteBufferWriter() : ByteBufferWriterT() {}
ByteBufferWriter::ByteBufferWriter(const char* bytes, size_t len)
: ByteBufferWriterT(bytes, len) {}
-ByteBufferReader::ByteBufferReader(const char* bytes, size_t len) {
- Construct(bytes, len);
+ByteBufferReader::ByteBufferReader(rtc::ArrayView<const uint8_t> bytes) {
+ Construct(bytes.data(), bytes.size());
}
-ByteBufferReader::ByteBufferReader(const char* bytes) {
- Construct(bytes, strlen(bytes));
+ByteBufferReader::ByteBufferReader(const char* bytes, size_t len) {
+ Construct(reinterpret_cast<const uint8_t*>(bytes), len);
}
-ByteBufferReader::ByteBufferReader(const Buffer& buf) {
- Construct(buf.data<char>(), buf.size());
+ByteBufferReader::ByteBufferReader(const char* bytes) {
+ Construct(reinterpret_cast<const uint8_t*>(bytes), strlen(bytes));
}
ByteBufferReader::ByteBufferReader(const ByteBufferWriter& buf) {
- Construct(buf.Data(), buf.Length());
+ Construct(reinterpret_cast<const uint8_t*>(buf.Data()), buf.Length());
}
-void ByteBufferReader::Construct(const char* bytes, size_t len) {
+void ByteBufferReader::Construct(const uint8_t* bytes, size_t len) {
bytes_ = bytes;
size_ = len;
start_ = 0;
@@ -134,7 +134,7 @@ bool ByteBufferReader::ReadString(std::string* val, size_t len) {
if (len > Length()) {
return false;
} else {
- val->append(bytes_ + start_, len);
+ val->append(reinterpret_cast<const char*>(bytes_ + start_), len);
start_ += len;
return true;
}
diff --git a/rtc_base/byte_buffer.h b/rtc_base/byte_buffer.h
index 9bcbb838aa..fe17da20c8 100644
--- a/rtc_base/byte_buffer.h
+++ b/rtc_base/byte_buffer.h
@@ -16,7 +16,9 @@
#include <string>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
+#include "api/array_view.h"
#include "rtc_base/buffer.h"
#include "rtc_base/byte_order.h"
@@ -124,20 +126,28 @@ class ByteBufferReader {
public:
ByteBufferReader(const char* bytes, size_t len);
+ explicit ByteBufferReader(
+ rtc::ArrayView<const uint8_t> bytes ABSL_ATTRIBUTE_LIFETIME_BOUND);
+
// Initializes buffer from a zero-terminated string.
explicit ByteBufferReader(const char* bytes);
- explicit ByteBufferReader(const Buffer& buf);
-
explicit ByteBufferReader(const ByteBufferWriter& buf);
ByteBufferReader(const ByteBufferReader&) = delete;
ByteBufferReader& operator=(const ByteBufferReader&) = delete;
// Returns start of unprocessed data.
- const char* Data() const { return bytes_ + start_; }
+ // TODO(bugs.webrtc.org/15661): Deprecate and remove.
+ const char* Data() const {
+ return reinterpret_cast<const char*>(bytes_ + start_);
+ }
// Returns number of unprocessed bytes.
size_t Length() const { return end_ - start_; }
+ // Returns a view of the unprocessed data.
+ rtc::ArrayView<const uint8_t> DataView() {
+ return rtc::ArrayView<const uint8_t>(bytes_ + start_, end_ - start_);
+ }
// Read a next value from the buffer. Return false if there isn't
// enough data left for the specified type.
@@ -160,9 +170,9 @@ class ByteBufferReader {
bool Consume(size_t size);
protected:
- void Construct(const char* bytes, size_t size);
+ void Construct(const uint8_t* bytes, size_t size);
- const char* bytes_;
+ const uint8_t* bytes_;
size_t size_;
size_t start_;
size_t end_;
diff --git a/rtc_base/byte_buffer_unittest.cc b/rtc_base/byte_buffer_unittest.cc
index 4f8043c98f..615237c1e6 100644
--- a/rtc_base/byte_buffer_unittest.cc
+++ b/rtc_base/byte_buffer_unittest.cc
@@ -12,6 +12,8 @@
#include <string.h>
+#include <cstdint>
+
#include "rtc_base/arraysize.h"
#include "rtc_base/byte_order.h"
#include "test/gtest.h"
@@ -247,4 +249,19 @@ TEST(ByteBufferTest, TestReadWriteUVarint) {
EXPECT_EQ(size, read_buffer.Length());
}
+TEST(ByteBufferTest, ReadFromArrayView) {
+ const uint8_t buf[] = {'a', 'b', 'c'};
+ ArrayView<const uint8_t> view(buf, 3);
+
+ ByteBufferReader read_buffer(view);
+ uint8_t val;
+ EXPECT_TRUE(read_buffer.ReadUInt8(&val));
+ EXPECT_EQ(val, 'a');
+ EXPECT_TRUE(read_buffer.ReadUInt8(&val));
+ EXPECT_EQ(val, 'b');
+ EXPECT_TRUE(read_buffer.ReadUInt8(&val));
+ EXPECT_EQ(val, 'c');
+ EXPECT_FALSE(read_buffer.ReadUInt8(&val));
+}
+
} // namespace rtc
diff --git a/rtc_base/experiments/BUILD.gn b/rtc_base/experiments/BUILD.gn
index ac542cc301..185d5931f7 100644
--- a/rtc_base/experiments/BUILD.gn
+++ b/rtc_base/experiments/BUILD.gn
@@ -75,8 +75,6 @@ rtc_library("quality_scaler_settings") {
":field_trial_parser",
"..:logging",
"../../api:field_trials_view",
- "../../api/transport:field_trial_based_config",
- "../../system_wrappers:field_trial",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
@@ -103,10 +101,14 @@ rtc_library("quality_scaling_experiment") {
]
deps = [
"..:logging",
+ "../../api:field_trials_view",
+ "../../api/transport:field_trial_based_config",
"../../api/video_codecs:video_codecs_api",
- "../../system_wrappers:field_trial",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/strings:strings",
+ "//third_party/abseil-cpp/absl/types:optional",
+ ]
}
rtc_library("normalize_simulcast_size_experiment") {
diff --git a/rtc_base/experiments/quality_scaler_settings.cc b/rtc_base/experiments/quality_scaler_settings.cc
index 85c99255ab..24da211d89 100644
--- a/rtc_base/experiments/quality_scaler_settings.cc
+++ b/rtc_base/experiments/quality_scaler_settings.cc
@@ -10,7 +10,7 @@
#include "rtc_base/experiments/quality_scaler_settings.h"
-#include "api/transport/field_trial_based_config.h"
+#include "api/field_trials_view.h"
#include "rtc_base/logging.h"
namespace webrtc {
@@ -20,7 +20,7 @@ const double kMinScaleFactor = 0.01;
} // namespace
QualityScalerSettings::QualityScalerSettings(
- const FieldTrialsView* const key_value_config)
+ const FieldTrialsView& field_trials)
: sampling_period_ms_("sampling_period_ms"),
average_qp_window_("average_qp_window"),
min_frames_("min_frames"),
@@ -28,16 +28,10 @@ QualityScalerSettings::QualityScalerSettings(
scale_factor_("scale_factor"),
initial_bitrate_interval_ms_("initial_bitrate_interval_ms"),
initial_bitrate_factor_("initial_bitrate_factor") {
- ParseFieldTrial(
- {&sampling_period_ms_, &average_qp_window_, &min_frames_,
- &initial_scale_factor_, &scale_factor_, &initial_bitrate_interval_ms_,
- &initial_bitrate_factor_},
- key_value_config->Lookup("WebRTC-Video-QualityScalerSettings"));
-}
-
-QualityScalerSettings QualityScalerSettings::ParseFromFieldTrials() {
- FieldTrialBasedConfig field_trial_config;
- return QualityScalerSettings(&field_trial_config);
+ ParseFieldTrial({&sampling_period_ms_, &average_qp_window_, &min_frames_,
+ &initial_scale_factor_, &scale_factor_,
+ &initial_bitrate_interval_ms_, &initial_bitrate_factor_},
+ field_trials.Lookup("WebRTC-Video-QualityScalerSettings"));
}
absl::optional<int> QualityScalerSettings::SamplingPeriodMs() const {
diff --git a/rtc_base/experiments/quality_scaler_settings.h b/rtc_base/experiments/quality_scaler_settings.h
index 99827aac6b..1085816697 100644
--- a/rtc_base/experiments/quality_scaler_settings.h
+++ b/rtc_base/experiments/quality_scaler_settings.h
@@ -19,7 +19,7 @@ namespace webrtc {
class QualityScalerSettings final {
public:
- static QualityScalerSettings ParseFromFieldTrials();
+ explicit QualityScalerSettings(const FieldTrialsView& field_trials);
absl::optional<int> SamplingPeriodMs() const;
absl::optional<int> AverageQpWindow() const;
@@ -30,8 +30,6 @@ class QualityScalerSettings final {
absl::optional<double> InitialBitrateFactor() const;
private:
- explicit QualityScalerSettings(const FieldTrialsView* const key_value_config);
-
FieldTrialOptional<int> sampling_period_ms_;
FieldTrialOptional<int> average_qp_window_;
FieldTrialOptional<int> min_frames_;
diff --git a/rtc_base/experiments/quality_scaler_settings_unittest.cc b/rtc_base/experiments/quality_scaler_settings_unittest.cc
index 9da770c1b5..578fe97b03 100644
--- a/rtc_base/experiments/quality_scaler_settings_unittest.cc
+++ b/rtc_base/experiments/quality_scaler_settings_unittest.cc
@@ -10,14 +10,15 @@
#include "rtc_base/experiments/quality_scaler_settings.h"
-#include "test/field_trial.h"
#include "test/gtest.h"
+#include "test/scoped_key_value_config.h"
namespace webrtc {
namespace {
TEST(QualityScalerSettingsTest, ValuesNotSetByDefault) {
- const auto settings = QualityScalerSettings::ParseFromFieldTrials();
+ webrtc::test::ScopedKeyValueConfig field_trials("");
+ const auto settings = QualityScalerSettings(field_trials);
EXPECT_FALSE(settings.MinFrames());
EXPECT_FALSE(settings.InitialScaleFactor());
EXPECT_FALSE(settings.ScaleFactor());
@@ -26,46 +27,42 @@ TEST(QualityScalerSettingsTest, ValuesNotSetByDefault) {
}
TEST(QualityScalerSettingsTest, ParseMinFrames) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/min_frames:100/");
- EXPECT_EQ(100, QualityScalerSettings::ParseFromFieldTrials().MinFrames());
+ EXPECT_EQ(100, QualityScalerSettings(field_trials).MinFrames());
}
TEST(QualityScalerSettingsTest, ParseInitialScaleFactor) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/initial_scale_factor:1.5/");
- EXPECT_EQ(1.5,
- QualityScalerSettings::ParseFromFieldTrials().InitialScaleFactor());
+ EXPECT_EQ(1.5, QualityScalerSettings(field_trials).InitialScaleFactor());
}
TEST(QualityScalerSettingsTest, ParseScaleFactor) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/scale_factor:1.1/");
- EXPECT_EQ(1.1, QualityScalerSettings::ParseFromFieldTrials().ScaleFactor());
+ EXPECT_EQ(1.1, QualityScalerSettings(field_trials).ScaleFactor());
}
TEST(QualityScalerSettingsTest, ParseInitialBitrateInterval) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/initial_bitrate_interval_ms:1000/");
- EXPECT_EQ(
- 1000,
- QualityScalerSettings::ParseFromFieldTrials().InitialBitrateIntervalMs());
+ EXPECT_EQ(1000,
+ QualityScalerSettings(field_trials).InitialBitrateIntervalMs());
}
TEST(QualityScalerSettingsTest, ParseInitialBitrateFactor) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/initial_bitrate_factor:0.75/");
- EXPECT_EQ(
- 0.75,
- QualityScalerSettings::ParseFromFieldTrials().InitialBitrateFactor());
+ EXPECT_EQ(0.75, QualityScalerSettings(field_trials).InitialBitrateFactor());
}
TEST(QualityScalerSettingsTest, ParseAll) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/"
"min_frames:100,initial_scale_factor:1.5,scale_factor:0.9,"
"initial_bitrate_interval_ms:5500,initial_bitrate_factor:0.7/");
- const auto settings = QualityScalerSettings::ParseFromFieldTrials();
+ const auto settings = QualityScalerSettings(field_trials);
EXPECT_EQ(100, settings.MinFrames());
EXPECT_EQ(1.5, settings.InitialScaleFactor());
EXPECT_EQ(0.9, settings.ScaleFactor());
@@ -74,11 +71,11 @@ TEST(QualityScalerSettingsTest, ParseAll) {
}
TEST(QualityScalerSettingsTest, DoesNotParseIncorrectValue) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/"
"min_frames:a,initial_scale_factor:b,scale_factor:c,"
"initial_bitrate_interval_ms:d,initial_bitrate_factor:e/");
- const auto settings = QualityScalerSettings::ParseFromFieldTrials();
+ const auto settings = QualityScalerSettings(field_trials);
EXPECT_FALSE(settings.MinFrames());
EXPECT_FALSE(settings.InitialScaleFactor());
EXPECT_FALSE(settings.ScaleFactor());
@@ -87,11 +84,11 @@ TEST(QualityScalerSettingsTest, DoesNotParseIncorrectValue) {
}
TEST(QualityScalerSettingsTest, DoesNotReturnTooSmallValue) {
- test::ScopedFieldTrials field_trials(
+ test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScalerSettings/"
"min_frames:0,initial_scale_factor:0.0,scale_factor:0.0,"
"initial_bitrate_interval_ms:-1,initial_bitrate_factor:0.0/");
- const auto settings = QualityScalerSettings::ParseFromFieldTrials();
+ const auto settings = QualityScalerSettings(field_trials);
EXPECT_FALSE(settings.MinFrames());
EXPECT_FALSE(settings.InitialScaleFactor());
EXPECT_FALSE(settings.ScaleFactor());
diff --git a/rtc_base/experiments/quality_scaling_experiment.cc b/rtc_base/experiments/quality_scaling_experiment.cc
index 0c4ec22d71..ee3d7c0320 100644
--- a/rtc_base/experiments/quality_scaling_experiment.cc
+++ b/rtc_base/experiments/quality_scaling_experiment.cc
@@ -13,8 +13,10 @@
#include <string>
+#include "absl/strings/match.h"
+#include "api/field_trials_view.h"
+#include "api/transport/field_trial_based_config.h"
#include "rtc_base/logging.h"
-#include "system_wrappers/include/field_trial.h"
namespace webrtc {
namespace {
@@ -42,17 +44,17 @@ absl::optional<VideoEncoder::QpThresholds> GetThresholds(int low,
}
} // namespace
-bool QualityScalingExperiment::Enabled() {
+bool QualityScalingExperiment::Enabled(const FieldTrialsView& field_trials) {
#if defined(WEBRTC_IOS)
- return webrtc::field_trial::IsEnabled(kFieldTrial);
+ return absl::StartsWith(field_trials.Lookup(kFieldTrial), "Enabled");
#else
- return !webrtc::field_trial::IsDisabled(kFieldTrial);
+ return !absl::StartsWith(field_trials.Lookup(kFieldTrial), "Disabled");
#endif
}
absl::optional<QualityScalingExperiment::Settings>
-QualityScalingExperiment::ParseSettings() {
- std::string group = webrtc::field_trial::FindFullName(kFieldTrial);
+QualityScalingExperiment::ParseSettings(const FieldTrialsView& field_trials) {
+ std::string group = field_trials.Lookup(kFieldTrial);
// TODO(http://crbug.com/webrtc/12401): Completely remove the experiment code
// after few releases.
#if !defined(WEBRTC_IOS)
@@ -71,8 +73,9 @@ QualityScalingExperiment::ParseSettings() {
}
absl::optional<VideoEncoder::QpThresholds>
-QualityScalingExperiment::GetQpThresholds(VideoCodecType codec_type) {
- const auto settings = ParseSettings();
+QualityScalingExperiment::GetQpThresholds(VideoCodecType codec_type,
+ const FieldTrialsView& field_trials) {
+ const auto settings = ParseSettings(field_trials);
if (!settings)
return absl::nullopt;
@@ -93,8 +96,9 @@ QualityScalingExperiment::GetQpThresholds(VideoCodecType codec_type) {
}
}
-QualityScalingExperiment::Config QualityScalingExperiment::GetConfig() {
- const auto settings = ParseSettings();
+QualityScalingExperiment::Config QualityScalingExperiment::GetConfig(
+ const FieldTrialsView& field_trials) {
+ const auto settings = ParseSettings(field_trials);
if (!settings)
return Config();
diff --git a/rtc_base/experiments/quality_scaling_experiment.h b/rtc_base/experiments/quality_scaling_experiment.h
index 31d8292b5c..bd24c06e55 100644
--- a/rtc_base/experiments/quality_scaling_experiment.h
+++ b/rtc_base/experiments/quality_scaling_experiment.h
@@ -11,6 +11,7 @@
#define RTC_BASE_EXPERIMENTS_QUALITY_SCALING_EXPERIMENT_H_
#include "absl/types/optional.h"
+#include "api/field_trials_view.h"
#include "api/video_codecs/video_encoder.h"
namespace webrtc {
@@ -40,17 +41,19 @@ class QualityScalingExperiment {
};
// Returns true if the experiment is enabled.
- static bool Enabled();
+ static bool Enabled(const FieldTrialsView& field_trials);
// Returns settings from field trial.
- static absl::optional<Settings> ParseSettings();
+ static absl::optional<Settings> ParseSettings(
+ const FieldTrialsView& field_trials);
// Returns QpThresholds for the `codec_type`.
static absl::optional<VideoEncoder::QpThresholds> GetQpThresholds(
- VideoCodecType codec_type);
+ VideoCodecType codec_type,
+ const FieldTrialsView& field_trials);
// Returns parsed values. If the parsing fails, default values are returned.
- static Config GetConfig();
+ static Config GetConfig(const FieldTrialsView& field_trials);
};
} // namespace webrtc
diff --git a/rtc_base/experiments/quality_scaling_experiment_unittest.cc b/rtc_base/experiments/quality_scaling_experiment_unittest.cc
index 4507f1514f..0c1450557a 100644
--- a/rtc_base/experiments/quality_scaling_experiment_unittest.cc
+++ b/rtc_base/experiments/quality_scaling_experiment_unittest.cc
@@ -10,8 +10,8 @@
#include "rtc_base/experiments/quality_scaling_experiment.h"
-#include "test/field_trial.h"
#include "test/gtest.h"
+#include "test/scoped_key_value_config.h"
namespace webrtc {
namespace {
@@ -41,28 +41,28 @@ void ExpectEqualConfig(QualityScalingExperiment::Config a,
#if !defined(WEBRTC_IOS)
// TODO(bugs.webrtc.org/12401): investigate why QualityScaler kicks in on iOS.
TEST(QualityScalingExperimentTest, DefaultEnabledWithoutFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials("");
- EXPECT_TRUE(QualityScalingExperiment::Enabled());
+ webrtc::test::ScopedKeyValueConfig field_trials("");
+ EXPECT_TRUE(QualityScalingExperiment::Enabled(field_trials));
}
#else
TEST(QualityScalingExperimentTest, DefaultDisabledWithoutFieldTrialIOS) {
- webrtc::test::ScopedFieldTrials field_trials("");
- EXPECT_FALSE(QualityScalingExperiment::Enabled());
+ webrtc::test::ScopedKeyValueConfig field_trials("");
+ EXPECT_FALSE(QualityScalingExperiment::Enabled(field_trials));
}
#endif
TEST(QualityScalingExperimentTest, EnabledWithFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled/");
- EXPECT_TRUE(QualityScalingExperiment::Enabled());
+ EXPECT_TRUE(QualityScalingExperiment::Enabled(field_trials));
}
TEST(QualityScalingExperimentTest, ParseSettings) {
const QualityScalingExperiment::Settings kExpected = {1, 2, 3, 4, 5, 6,
7, 8, 0.9f, 0.99f, 1};
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,7,8,0.9,0.99,1/");
- const auto settings = QualityScalingExperiment::ParseSettings();
+ const auto settings = QualityScalingExperiment::ParseSettings(field_trials);
EXPECT_TRUE(settings);
ExpectEqualSettings(kExpected, *settings);
}
@@ -70,117 +70,117 @@ TEST(QualityScalingExperimentTest, ParseSettings) {
#if !defined(WEBRTC_IOS)
// TODO(bugs.webrtc.org/12401): investigate why QualityScaler kicks in on iOS.
TEST(QualityScalingExperimentTest, ParseSettingsUsesDefaultsWithoutFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials("");
+ webrtc::test::ScopedKeyValueConfig field_trials("");
// Uses some default hard coded values.
- EXPECT_TRUE(QualityScalingExperiment::ParseSettings());
+ EXPECT_TRUE(QualityScalingExperiment::ParseSettings(field_trials));
}
#else
TEST(QualityScalingExperimentTest, ParseSettingsFailsWithoutFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials("");
- EXPECT_FALSE(QualityScalingExperiment::ParseSettings());
+ webrtc::test::ScopedKeyValueConfig field_trials("");
+ EXPECT_FALSE(QualityScalingExperiment::ParseSettings(field_trials));
}
#endif
TEST(QualityScalingExperimentTest, ParseSettingsFailsWithInvalidFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-invalid/");
- EXPECT_FALSE(QualityScalingExperiment::ParseSettings());
+ EXPECT_FALSE(QualityScalingExperiment::ParseSettings(field_trials));
}
TEST(QualityScalingExperimentTest, GetConfig) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,7,8,0.9,0.99,0/");
- const auto config = QualityScalingExperiment::GetConfig();
+ const auto config = QualityScalingExperiment::GetConfig(field_trials);
EXPECT_EQ(0.9f, config.alpha_high);
EXPECT_EQ(0.99f, config.alpha_low);
EXPECT_FALSE(config.use_all_drop_reasons);
}
TEST(QualityScalingExperimentTest, GetsDefaultConfigForInvalidFieldTrial) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-invalid/");
- const auto config = QualityScalingExperiment::GetConfig();
+ const auto config = QualityScalingExperiment::GetConfig(field_trials);
ExpectEqualConfig(config, QualityScalingExperiment::Config());
}
TEST(QualityScalingExperimentTest, GetsDefaultAlphaForInvalidValue) {
QualityScalingExperiment::Config expected_config;
expected_config.use_all_drop_reasons = true;
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,7,8,0.99,0.9,1/");
- const auto config = QualityScalingExperiment::GetConfig();
+ const auto config = QualityScalingExperiment::GetConfig(field_trials);
ExpectEqualConfig(config, expected_config);
}
TEST(QualityScalingExperimentTest, GetVp8Thresholds) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,0,0,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecVP8);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecVP8, field_trials);
EXPECT_TRUE(thresholds);
EXPECT_EQ(1, thresholds->low);
EXPECT_EQ(2, thresholds->high);
}
TEST(QualityScalingExperimentTest, GetThresholdsFailsForInvalidVp8Value) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-0,0,3,4,5,6,7,8,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecVP8);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecVP8, field_trials);
EXPECT_FALSE(thresholds);
}
TEST(QualityScalingExperimentTest, GetVp9Thresholds) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,0,0,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecVP9);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecVP9, field_trials);
EXPECT_TRUE(thresholds);
EXPECT_EQ(3, thresholds->low);
EXPECT_EQ(4, thresholds->high);
}
TEST(QualityScalingExperimentTest, GetThresholdsFailsForInvalidVp9Value) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,0,0,5,6,7,8,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecVP9);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecVP9, field_trials);
EXPECT_FALSE(thresholds);
}
TEST(QualityScalingExperimentTest, GetH264Thresholds) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,0,0,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecH264);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecH264, field_trials);
EXPECT_TRUE(thresholds);
EXPECT_EQ(5, thresholds->low);
EXPECT_EQ(6, thresholds->high);
}
TEST(QualityScalingExperimentTest, GetThresholdsFailsForInvalidH264Value) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,0,0,7,8,0.9,0.99,1/");
const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecH264);
+ QualityScalingExperiment::GetQpThresholds(kVideoCodecH264, field_trials);
EXPECT_FALSE(thresholds);
}
TEST(QualityScalingExperimentTest, GetGenericThresholds) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,0,0,7,8,0.9,0.99,1/");
- const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecGeneric);
+ const auto thresholds = QualityScalingExperiment::GetQpThresholds(
+ kVideoCodecGeneric, field_trials);
EXPECT_TRUE(thresholds);
EXPECT_EQ(7, thresholds->low);
EXPECT_EQ(8, thresholds->high);
}
TEST(QualityScalingExperimentTest, GetThresholdsFailsForInvalidGenericValue) {
- webrtc::test::ScopedFieldTrials field_trials(
+ webrtc::test::ScopedKeyValueConfig field_trials(
"WebRTC-Video-QualityScaling/Enabled-1,2,3,4,5,6,0,0,0.9,0.99,1/");
- const auto thresholds =
- QualityScalingExperiment::GetQpThresholds(kVideoCodecGeneric);
+ const auto thresholds = QualityScalingExperiment::GetQpThresholds(
+ kVideoCodecGeneric, field_trials);
EXPECT_FALSE(thresholds);
}
} // namespace webrtc
diff --git a/rtc_base/ip_address_unittest.cc b/rtc_base/ip_address_unittest.cc
index 9ca05c95fe..aee9b93dd9 100644
--- a/rtc_base/ip_address_unittest.cc
+++ b/rtc_base/ip_address_unittest.cc
@@ -61,10 +61,6 @@ static const std::string kIPv6PublicAddrAnonymizedString =
"2401:fa00:4:x:x:x:x:x";
static const std::string kIPv6PublicAddr2AnonymizedString =
"2401:0:0:x:x:x:x:x";
-static const std::string kIPv4MappedAnyAddrString = "::ffff:0:0";
-static const std::string kIPv4MappedRFC1918AddrString = "::ffff:c0a8:701";
-static const std::string kIPv4MappedLoopbackAddrString = "::ffff:7f00:1";
-static const std::string kIPv4MappedPublicAddrString = "::ffff:102:0304";
static const std::string kIPv4MappedV4StyleAddrString = "::ffff:192.168.7.1";
static const std::string kIPv4BrokenString1 = "192.168.7.";
diff --git a/rtc_base/nat_unittest.cc b/rtc_base/nat_unittest.cc
index 19e53543ba..432985d283 100644
--- a/rtc_base/nat_unittest.cc
+++ b/rtc_base/nat_unittest.cc
@@ -11,14 +11,17 @@
#include <string.h>
#include <algorithm>
+#include <cstddef>
#include <memory>
#include <string>
#include <vector>
#include "absl/memory/memory.h"
+#include "api/units/time_delta.h"
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/async_tcp_socket.h"
#include "rtc_base/async_udp_socket.h"
+#include "rtc_base/event.h"
#include "rtc_base/gunit.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/logging.h"
@@ -80,29 +83,36 @@ void TestSend(SocketServer* internal,
NATSocketFactory* natsf = new NATSocketFactory(
internal, nat->internal_udp_address(), nat->internal_tcp_address());
- TestClient* in = CreateTestClient(natsf, internal_addr);
- TestClient* out[4];
- for (int i = 0; i < 4; i++)
- out[i] = CreateTestClient(external, external_addrs[i]);
-
th_int.Start();
th_ext.Start();
+ TestClient* in;
+ th_int.BlockingCall([&] { in = CreateTestClient(natsf, internal_addr); });
+
+ TestClient* out[4];
+ th_ext.BlockingCall([&] {
+ for (int i = 0; i < 4; i++)
+ out[i] = CreateTestClient(external, external_addrs[i]);
+ });
+
const char* buf = "filter_test";
size_t len = strlen(buf);
- in->SendTo(buf, len, out[0]->address());
+ th_int.BlockingCall([&] { in->SendTo(buf, len, out[0]->address()); });
SocketAddress trans_addr;
- EXPECT_TRUE(out[0]->CheckNextPacket(buf, len, &trans_addr));
+ th_ext.BlockingCall(
+ [&] { EXPECT_TRUE(out[0]->CheckNextPacket(buf, len, &trans_addr)); });
for (int i = 1; i < 4; i++) {
- in->SendTo(buf, len, out[i]->address());
+ th_int.BlockingCall([&] { in->SendTo(buf, len, out[i]->address()); });
SocketAddress trans_addr2;
- EXPECT_TRUE(out[i]->CheckNextPacket(buf, len, &trans_addr2));
- bool are_same = (trans_addr == trans_addr2);
- ASSERT_EQ(are_same, exp_same) << "same translated address";
- ASSERT_NE(AF_UNSPEC, trans_addr.family());
- ASSERT_NE(AF_UNSPEC, trans_addr2.family());
+ th_ext.BlockingCall([&] {
+ EXPECT_TRUE(out[i]->CheckNextPacket(buf, len, &trans_addr2));
+ bool are_same = (trans_addr == trans_addr2);
+ ASSERT_EQ(are_same, exp_same) << "same translated address";
+ ASSERT_NE(AF_UNSPEC, trans_addr.family());
+ ASSERT_NE(AF_UNSPEC, trans_addr2.family());
+ });
}
th_int.Stop();
@@ -134,29 +144,39 @@ void TestRecv(SocketServer* internal,
NATSocketFactory* natsf = new NATSocketFactory(
internal, nat->internal_udp_address(), nat->internal_tcp_address());
- TestClient* in = CreateTestClient(natsf, internal_addr);
- TestClient* out[4];
- for (int i = 0; i < 4; i++)
- out[i] = CreateTestClient(external, external_addrs[i]);
-
th_int.Start();
th_ext.Start();
+ TestClient* in = nullptr;
+ th_int.BlockingCall([&] { in = CreateTestClient(natsf, internal_addr); });
+
+ TestClient* out[4];
+ th_ext.BlockingCall([&] {
+ for (int i = 0; i < 4; i++)
+ out[i] = CreateTestClient(external, external_addrs[i]);
+ });
+
const char* buf = "filter_test";
size_t len = strlen(buf);
- in->SendTo(buf, len, out[0]->address());
+ th_int.BlockingCall([&] { in->SendTo(buf, len, out[0]->address()); });
SocketAddress trans_addr;
- EXPECT_TRUE(out[0]->CheckNextPacket(buf, len, &trans_addr));
+ th_ext.BlockingCall(
+ [&] { EXPECT_TRUE(out[0]->CheckNextPacket(buf, len, &trans_addr)); });
+
+ th_ext.BlockingCall([&] { out[1]->SendTo(buf, len, trans_addr); });
+ th_int.BlockingCall(
+ [&] { EXPECT_TRUE(CheckReceive(in, !filter_ip, buf, len)); });
+ th_ext.BlockingCall([&] { out[2]->SendTo(buf, len, trans_addr); });
- out[1]->SendTo(buf, len, trans_addr);
- EXPECT_TRUE(CheckReceive(in, !filter_ip, buf, len));
+ th_int.BlockingCall(
+ [&] { EXPECT_TRUE(CheckReceive(in, !filter_port, buf, len)); });
- out[2]->SendTo(buf, len, trans_addr);
- EXPECT_TRUE(CheckReceive(in, !filter_port, buf, len));
+ th_ext.BlockingCall([&] { out[3]->SendTo(buf, len, trans_addr); });
- out[3]->SendTo(buf, len, trans_addr);
- EXPECT_TRUE(CheckReceive(in, !filter_ip && !filter_port, buf, len));
+ th_int.BlockingCall([&] {
+ EXPECT_TRUE(CheckReceive(in, !filter_ip && !filter_port, buf, len));
+ });
th_int.Stop();
th_ext.Stop();
diff --git a/rtc_base/network/BUILD.gn b/rtc_base/network/BUILD.gn
index 35ae3d45f7..263bfcc282 100644
--- a/rtc_base/network/BUILD.gn
+++ b/rtc_base/network/BUILD.gn
@@ -16,3 +16,19 @@ rtc_library("sent_packet") {
deps = [ "../system:rtc_export" ]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+
+rtc_library("received_packet") {
+ sources = [
+ "received_packet.cc",
+ "received_packet.h",
+ ]
+ deps = [
+ "..:socket_address",
+ "../../api:array_view",
+ "../../api/units:timestamp",
+ ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/functional:any_invocable",
+ "//third_party/abseil-cpp/absl/types:optional",
+ ]
+}
diff --git a/rtc_base/network/received_packet.cc b/rtc_base/network/received_packet.cc
new file mode 100644
index 0000000000..40d6e1142c
--- /dev/null
+++ b/rtc_base/network/received_packet.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "rtc_base/network/received_packet.h"
+
+#include <utility>
+
+#include "absl/types/optional.h"
+
+namespace rtc {
+
+ReceivedPacket::ReceivedPacket(rtc::ArrayView<const uint8_t> payload,
+ const SocketAddress& source_address,
+ absl::optional<webrtc::Timestamp> arrival_time)
+ : payload_(payload),
+ arrival_time_(std::move(arrival_time)),
+ source_address_(source_address) {}
+
+// static
+ReceivedPacket ReceivedPacket::CreateFromLegacy(
+ const char* data,
+ size_t size,
+ int64_t packet_time_us,
+ const rtc::SocketAddress& source_address) {
+ RTC_DCHECK(packet_time_us == -1 || packet_time_us >= 0);
+ return ReceivedPacket(rtc::reinterpret_array_view<const uint8_t>(
+ rtc::MakeArrayView(data, size)),
+ source_address,
+ (packet_time_us >= 0)
+ ? absl::optional<webrtc::Timestamp>(
+ webrtc::Timestamp::Micros(packet_time_us))
+ : absl::nullopt);
+}
+
+} // namespace rtc
diff --git a/rtc_base/network/received_packet.h b/rtc_base/network/received_packet.h
new file mode 100644
index 0000000000..9b10099e9d
--- /dev/null
+++ b/rtc_base/network/received_packet.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2023 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef RTC_BASE_NETWORK_RECEIVED_PACKET_H_
+#define RTC_BASE_NETWORK_RECEIVED_PACKET_H_
+
+#include <cstdint>
+
+#include "absl/types/optional.h"
+#include "api/array_view.h"
+#include "api/units/timestamp.h"
+#include "rtc_base/socket_address.h"
+
+namespace rtc {
+
+// ReceivedPacket repressent a received IP packet.
+// It contains a payload and metadata.
+// ReceivedPacket itself does not put constraints on what payload contains. For
+// example it may contains STUN, SCTP, SRTP, RTP, RTCP.... etc.
+class ReceivedPacket {
+ public:
+ // Caller must keep memory pointed to by payload and address valid for the
+ // lifetime of this ReceivedPacket.
+ ReceivedPacket(
+ rtc::ArrayView<const uint8_t> payload,
+ const SocketAddress& source_address,
+ absl::optional<webrtc::Timestamp> arrival_time = absl::nullopt);
+
+ // Address/port of the packet sender.
+ const SocketAddress& source_address() const { return source_address_; }
+ rtc::ArrayView<const uint8_t> payload() const { return payload_; }
+
+ // Timestamp when this packet was received. Not available on all socket
+ // implementations.
+ absl::optional<webrtc::Timestamp> arrival_time() const {
+ return arrival_time_;
+ }
+
+ static ReceivedPacket CreateFromLegacy(
+ const char* data,
+ size_t size,
+ int64_t packet_time_us,
+ const rtc::SocketAddress& = rtc::SocketAddress());
+
+ private:
+ rtc::ArrayView<const uint8_t> payload_;
+ absl::optional<webrtc::Timestamp> arrival_time_;
+ const SocketAddress& source_address_;
+};
+
+} // namespace rtc
+#endif // RTC_BASE_NETWORK_RECEIVED_PACKET_H_
diff --git a/rtc_base/numerics/sample_counter.cc b/rtc_base/numerics/sample_counter.cc
index 16a8e25098..78e35fdb5b 100644
--- a/rtc_base/numerics/sample_counter.cc
+++ b/rtc_base/numerics/sample_counter.cc
@@ -31,6 +31,9 @@ void SampleCounter::Add(int sample) {
if (!max_ || sample > *max_) {
max_ = sample;
}
+ if (!min_ || sample < *min_) {
+ min_ = sample;
+ }
}
void SampleCounter::Add(const SampleCounter& other) {
@@ -45,6 +48,8 @@ void SampleCounter::Add(const SampleCounter& other) {
num_samples_ += other.num_samples_;
if (other.max_ && (!max_ || *max_ < *other.max_))
max_ = other.max_;
+ if (other.min_ && (!min_ || *min_ > *other.min_))
+ min_ = other.min_;
}
absl::optional<int> SampleCounter::Avg(int64_t min_required_samples) const {
@@ -58,6 +63,10 @@ absl::optional<int> SampleCounter::Max() const {
return max_;
}
+absl::optional<int> SampleCounter::Min() const {
+ return min_;
+}
+
absl::optional<int64_t> SampleCounter::Sum(int64_t min_required_samples) const {
RTC_DCHECK_GT(min_required_samples, 0);
if (num_samples_ < min_required_samples)
diff --git a/rtc_base/numerics/sample_counter.h b/rtc_base/numerics/sample_counter.h
index 717a1afbcf..2b41f95fc0 100644
--- a/rtc_base/numerics/sample_counter.h
+++ b/rtc_base/numerics/sample_counter.h
@@ -26,6 +26,7 @@ class SampleCounter {
void Add(int sample);
absl::optional<int> Avg(int64_t min_required_samples) const;
absl::optional<int> Max() const;
+ absl::optional<int> Min() const;
absl::optional<int64_t> Sum(int64_t min_required_samples) const;
int64_t NumSamples() const;
void Reset();
@@ -37,6 +38,7 @@ class SampleCounter {
int64_t sum_ = 0;
int64_t num_samples_ = 0;
absl::optional<int> max_;
+ absl::optional<int> min_;
};
class SampleCounterWithVariance : public SampleCounter {
diff --git a/rtc_base/numerics/sample_counter_unittest.cc b/rtc_base/numerics/sample_counter_unittest.cc
index 14b0573de9..ffc8b89f6f 100644
--- a/rtc_base/numerics/sample_counter_unittest.cc
+++ b/rtc_base/numerics/sample_counter_unittest.cc
@@ -24,6 +24,7 @@ TEST(SampleCounterTest, ProcessesNoSamples) {
SampleCounter counter;
EXPECT_THAT(counter.Avg(kMinSamples), Eq(absl::nullopt));
EXPECT_THAT(counter.Max(), Eq(absl::nullopt));
+ EXPECT_THAT(counter.Min(), Eq(absl::nullopt));
}
TEST(SampleCounterTest, NotEnoughSamples) {
@@ -35,6 +36,7 @@ TEST(SampleCounterTest, NotEnoughSamples) {
EXPECT_THAT(counter.Avg(kMinSamples), Eq(absl::nullopt));
EXPECT_THAT(counter.Sum(kMinSamples), Eq(absl::nullopt));
EXPECT_THAT(counter.Max(), Eq(5));
+ EXPECT_THAT(counter.Min(), Eq(1));
}
TEST(SampleCounterTest, EnoughSamples) {
@@ -46,6 +48,7 @@ TEST(SampleCounterTest, EnoughSamples) {
EXPECT_THAT(counter.Avg(kMinSamples), Eq(3));
EXPECT_THAT(counter.Sum(kMinSamples), Eq(15));
EXPECT_THAT(counter.Max(), Eq(5));
+ EXPECT_THAT(counter.Min(), Eq(1));
}
TEST(SampleCounterTest, ComputesVariance) {
@@ -74,6 +77,7 @@ TEST(SampleCounterTest, AggregatesTwoCounters) {
counter1.Add(counter2);
EXPECT_THAT(counter1.Avg(kMinSamples), Eq(3));
EXPECT_THAT(counter1.Max(), Eq(5));
+ EXPECT_THAT(counter1.Min(), Eq(1));
EXPECT_THAT(counter1.Variance(kMinSamples), Eq(2));
}
diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc
index c68eb22f5c..e48cdf43bd 100644
--- a/rtc_base/openssl_adapter.cc
+++ b/rtc_base/openssl_adapter.cc
@@ -44,6 +44,7 @@
#include "rtc_base/openssl_identity.h"
#endif
#include "rtc_base/openssl_utility.h"
+#include "rtc_base/strings/str_join.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/thread.h"
@@ -168,23 +169,6 @@ namespace rtc {
using ::webrtc::TimeDelta;
-namespace webrtc_openssl_adapter_internal {
-
-// Simple O(n^2) implementation is sufficient for current use case.
-std::string StrJoin(const std::vector<std::string>& list, char delimiter) {
- RTC_CHECK(!list.empty());
- StringBuilder sb;
- sb << list[0];
- for (size_t i = 1; i < list.size(); i++) {
- sb.AppendFormat("%c", delimiter);
- sb << list[i];
- }
- return sb.Release();
-}
-} // namespace webrtc_openssl_adapter_internal
-
-using webrtc_openssl_adapter_internal::StrJoin;
-
bool OpenSSLAdapter::InitializeSSL() {
if (!SSL_library_init())
return false;
@@ -373,7 +357,7 @@ int OpenSSLAdapter::BeginSSL() {
}
if (!elliptic_curves_.empty()) {
- SSL_set1_curves_list(ssl_, StrJoin(elliptic_curves_, ':').c_str());
+ SSL_set1_curves_list(ssl_, webrtc::StrJoin(elliptic_curves_, ":").c_str());
}
// Now that the initial config is done, transfer ownership of `bio` to the
diff --git a/rtc_base/openssl_adapter.h b/rtc_base/openssl_adapter.h
index 558a04077a..4c05471b2b 100644
--- a/rtc_base/openssl_adapter.h
+++ b/rtc_base/openssl_adapter.h
@@ -37,14 +37,6 @@
namespace rtc {
-namespace webrtc_openssl_adapter_internal {
-
-// Local definition, since absl::StrJoin is not allow-listed. Declared in header
-// file only for unittests.
-std::string StrJoin(const std::vector<std::string>& list, char delimiter);
-
-} // namespace webrtc_openssl_adapter_internal
-
class OpenSSLAdapter final : public SSLAdapter {
public:
static bool InitializeSSL();
diff --git a/rtc_base/openssl_adapter_unittest.cc b/rtc_base/openssl_adapter_unittest.cc
index ce351dc98e..5b59a8019e 100644
--- a/rtc_base/openssl_adapter_unittest.cc
+++ b/rtc_base/openssl_adapter_unittest.cc
@@ -116,19 +116,4 @@ TEST(OpenSSLAdapterFactoryTest, CreateWorksWithCustomVerifier) {
EXPECT_NE(simple_adapter, nullptr);
}
-TEST(StrJoinTest, SingleElement) {
- EXPECT_EQ(webrtc_openssl_adapter_internal::StrJoin({"a"}, ','), "a");
-}
-
-TEST(StrJoinTest, TwoElements) {
- EXPECT_EQ(webrtc_openssl_adapter_internal::StrJoin({"first", "second"}, ':'),
- "first:second");
-}
-
-TEST(StrJoinTest, WithEmptyElement) {
- EXPECT_EQ(
- webrtc_openssl_adapter_internal::StrJoin({"first", "", "second"}, ':'),
- "first::second");
-}
-
} // namespace rtc
diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc
index cbbb8e96ab..9642674d45 100644
--- a/rtc_base/openssl_stream_adapter.cc
+++ b/rtc_base/openssl_stream_adapter.cc
@@ -278,21 +278,6 @@ static long stream_ctrl(BIO* b, int cmd, long num, void* ptr) {
// OpenSSLStreamAdapter
/////////////////////////////////////////////////////////////////////////////
-static std::atomic<bool> g_use_legacy_tls_protocols_override(false);
-static std::atomic<bool> g_allow_legacy_tls_protocols(false);
-
-void SetAllowLegacyTLSProtocols(const absl::optional<bool>& allow) {
- g_use_legacy_tls_protocols_override.store(allow.has_value());
- if (allow.has_value())
- g_allow_legacy_tls_protocols.store(allow.value());
-}
-
-bool ShouldAllowLegacyTLSProtocols() {
- return g_use_legacy_tls_protocols_override.load()
- ? g_allow_legacy_tls_protocols.load()
- : webrtc::field_trial::IsEnabled("WebRTC-LegacyTlsProtocols");
-}
-
OpenSSLStreamAdapter::OpenSSLStreamAdapter(
std::unique_ptr<StreamInterface> stream,
absl::AnyInvocable<void(SSLHandshakeError)> handshake_error)
@@ -306,10 +291,7 @@ OpenSSLStreamAdapter::OpenSSLStreamAdapter(
ssl_(nullptr),
ssl_ctx_(nullptr),
ssl_mode_(SSL_MODE_TLS),
- ssl_max_version_(SSL_PROTOCOL_TLS_12),
- // Default is to support legacy TLS protocols.
- // This will be changed to default non-support in M82 or M83.
- support_legacy_tls_protocols_flag_(ShouldAllowLegacyTLSProtocols()) {
+ ssl_max_version_(SSL_PROTOCOL_TLS_12) {
stream_->SignalEvent.connect(this, &OpenSSLStreamAdapter::OnEvent);
}
@@ -469,6 +451,17 @@ bool OpenSSLStreamAdapter::ExportKeyingMaterial(absl::string_view label,
return true;
}
+uint16_t OpenSSLStreamAdapter::GetPeerSignatureAlgorithm() const {
+ if (state_ != SSL_CONNECTED) {
+ return 0;
+ }
+#ifdef OPENSSL_IS_BORINGSSL
+ return SSL_get_peer_signature_algorithm(ssl_);
+#else
+ return kSslSignatureAlgorithmUnknown;
+#endif
+}
+
bool OpenSSLStreamAdapter::SetDtlsSrtpCryptoSuites(
const std::vector<int>& ciphers) {
if (state_ != SSL_NONE) {
@@ -1020,33 +1013,10 @@ SSL_CTX* OpenSSLStreamAdapter::SetupSSLContext() {
return nullptr;
}
- if (support_legacy_tls_protocols_flag_) {
- // TODO(https://bugs.webrtc.org/10261): Completely remove this branch in
- // M84.
- SSL_CTX_set_min_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION);
- switch (ssl_max_version_) {
- case SSL_PROTOCOL_TLS_10:
- SSL_CTX_set_max_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_VERSION);
- break;
- case SSL_PROTOCOL_TLS_11:
- SSL_CTX_set_max_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_VERSION : TLS1_1_VERSION);
- break;
- case SSL_PROTOCOL_TLS_12:
- default:
- SSL_CTX_set_max_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION);
- break;
- }
- } else {
- // TODO(https://bugs.webrtc.org/10261): Make this the default in M84.
- SSL_CTX_set_min_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION);
- SSL_CTX_set_max_proto_version(
- ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION);
- }
+ SSL_CTX_set_min_proto_version(
+ ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION);
+ SSL_CTX_set_max_proto_version(
+ ctx, ssl_mode_ == SSL_MODE_DTLS ? DTLS1_2_VERSION : TLS1_2_VERSION);
#ifdef OPENSSL_IS_BORINGSSL
// SSL_CTX_set_current_time_cb is only supported in BoringSSL.
diff --git a/rtc_base/openssl_stream_adapter.h b/rtc_base/openssl_stream_adapter.h
index 579ca2a1f8..34cadeb06c 100644
--- a/rtc_base/openssl_stream_adapter.h
+++ b/rtc_base/openssl_stream_adapter.h
@@ -66,12 +66,6 @@ class SSLCertChain;
///////////////////////////////////////////////////////////////////////////////
-// If `allow` has a value, its value determines if legacy TLS protocols are
-// allowed, overriding the default configuration.
-// If `allow` has no value, any previous override is removed and the default
-// configuration is restored.
-RTC_EXPORT void SetAllowLegacyTLSProtocols(const absl::optional<bool>& allow);
-
class OpenSSLStreamAdapter final : public SSLStreamAdapter,
public sigslot::has_slots<> {
public:
@@ -124,6 +118,8 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter,
uint8_t* result,
size_t result_len) override;
+ uint16_t GetPeerSignatureAlgorithm() const override;
+
// DTLS-SRTP interface
bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites) override;
bool GetDtlsSrtpCryptoSuite(int* crypto_suite) override;
@@ -250,9 +246,6 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter,
// A 50-ms initial timeout ensures rapid setup on fast connections, but may
// be too aggressive for low bandwidth links.
int dtls_handshake_timeout_ms_ = 50;
-
- // TODO(https://bugs.webrtc.org/10261): Completely remove this option in M84.
- const bool support_legacy_tls_protocols_flag_;
};
/////////////////////////////////////////////////////////////////////////////
diff --git a/rtc_base/physical_socket_server.cc b/rtc_base/physical_socket_server.cc
index d42168249a..b0af1c20ce 100644
--- a/rtc_base/physical_socket_server.cc
+++ b/rtc_base/physical_socket_server.cc
@@ -10,6 +10,7 @@
#include "rtc_base/physical_socket_server.h"
#include <cstdint>
+#include <utility>
#if defined(_MSC_VER) && _MSC_VER < 1300
#pragma warning(disable : 4786)
@@ -21,7 +22,6 @@
#if defined(WEBRTC_POSIX)
#include <fcntl.h>
-#include <string.h>
#if defined(WEBRTC_USE_EPOLL)
// "poll" will be used to wait for the signal dispatcher.
#include <poll.h>
@@ -30,7 +30,6 @@
#endif
#include <sys/ioctl.h>
#include <sys/select.h>
-#include <sys/time.h>
#include <unistd.h>
#endif
@@ -38,20 +37,18 @@
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
+
#undef SetPort
#endif
#include <errno.h>
-#include <algorithm>
-#include <map>
-
-#include "rtc_base/arraysize.h"
-#include "rtc_base/byte_order.h"
+#include "rtc_base/async_dns_resolver.h"
#include "rtc_base/checks.h"
+#include "rtc_base/event.h"
+#include "rtc_base/ip_address.h"
#include "rtc_base/logging.h"
#include "rtc_base/network_monitor.h"
-#include "rtc_base/null_socket_server.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/time_utils.h"
#include "system_wrappers/include/field_trial.h"
@@ -70,6 +67,7 @@
#if defined(WEBRTC_POSIX)
#include <netinet/tcp.h> // for TCP_NODELAY
+
#define IP_MTU 14 // Until this is integrated from linux/in.h to netinet/in.h
typedef void* SockOptArg;
@@ -252,9 +250,8 @@ int PhysicalSocket::Connect(const SocketAddress& addr) {
}
if (addr.IsUnresolvedIP()) {
RTC_LOG(LS_VERBOSE) << "Resolving addr in PhysicalSocket::Connect";
- resolver_ = new AsyncResolver();
- resolver_->SignalDone.connect(this, &PhysicalSocket::OnResolveResult);
- resolver_->Start(addr);
+ resolver_ = std::make_unique<webrtc::AsyncDnsResolver>();
+ resolver_->Start(addr, [this] { OnResolveResult(resolver_->result()); });
state_ = CS_CONNECTING;
return 0;
}
@@ -564,8 +561,7 @@ int PhysicalSocket::Close() {
state_ = CS_CLOSED;
SetEnabledEvents(0);
if (resolver_) {
- resolver_->Destroy(false);
- resolver_ = nullptr;
+ resolver_.reset();
}
return err;
}
@@ -589,14 +585,16 @@ int PhysicalSocket::DoSendTo(SOCKET socket,
return ::sendto(socket, buf, len, flags, dest_addr, addrlen);
}
-void PhysicalSocket::OnResolveResult(AsyncResolverInterface* resolver) {
- if (resolver != resolver_) {
- return;
- }
-
- int error = resolver_->GetError();
+void PhysicalSocket::OnResolveResult(
+ const webrtc::AsyncDnsResolverResult& result) {
+ int error = result.GetError();
if (error == 0) {
- error = DoConnect(resolver_->address());
+ SocketAddress address;
+ if (result.GetResolvedAddress(AF_INET, &address)) {
+ error = DoConnect(address);
+ } else {
+ Close();
+ }
} else {
Close();
}
diff --git a/rtc_base/physical_socket_server.h b/rtc_base/physical_socket_server.h
index 650db80931..ea449ff121 100644
--- a/rtc_base/physical_socket_server.h
+++ b/rtc_base/physical_socket_server.h
@@ -11,17 +11,23 @@
#ifndef RTC_BASE_PHYSICAL_SOCKET_SERVER_H_
#define RTC_BASE_PHYSICAL_SOCKET_SERVER_H_
+#include "api/async_dns_resolver.h"
#include "api/units/time_delta.h"
+#include "rtc_base/socket.h"
+#include "rtc_base/socket_address.h"
+#include "rtc_base/third_party/sigslot/sigslot.h"
#if defined(WEBRTC_POSIX)
#if defined(WEBRTC_LINUX)
// On Linux, use epoll.
#include <sys/epoll.h>
+
#define WEBRTC_USE_EPOLL 1
#elif defined(WEBRTC_FUCHSIA)
// Fuchsia implements select and poll but not epoll, and testing shows that poll
// is faster than select.
#include <poll.h>
+
#define WEBRTC_USE_POLL 1
#else
// On other POSIX systems, use select by default.
@@ -29,7 +35,9 @@
#endif // WEBRTC_POSIX
#include <array>
+#include <cstdint>
#include <memory>
+#include <string>
#include <unordered_map>
#include <vector>
@@ -218,7 +226,7 @@ class PhysicalSocket : public Socket, public sigslot::has_slots<> {
SocketAddress* out_addr,
int64_t* timestamp);
- void OnResolveResult(AsyncResolverInterface* resolver);
+ void OnResolveResult(const webrtc::AsyncDnsResolverResult& resolver);
void UpdateLastError();
void MaybeRemapSendError();
@@ -237,7 +245,7 @@ class PhysicalSocket : public Socket, public sigslot::has_slots<> {
mutable webrtc::Mutex mutex_;
int error_ RTC_GUARDED_BY(mutex_);
ConnState state_;
- AsyncResolver* resolver_;
+ std::unique_ptr<webrtc::AsyncDnsResolverInterface> resolver_;
#if !defined(NDEBUG)
std::string dbg_addr_;
diff --git a/rtc_base/rate_limiter.cc b/rtc_base/rate_limiter.cc
index 4740b26f81..0f3f343aed 100644
--- a/rtc_base/rate_limiter.cc
+++ b/rtc_base/rate_limiter.cc
@@ -14,7 +14,6 @@
#include "absl/types/optional.h"
#include "system_wrappers/include/clock.h"
-#include "system_wrappers/include/field_trial.h"
namespace webrtc {
@@ -35,8 +34,7 @@ bool RateLimiter::TryUseRate(size_t packet_size_bytes) {
MutexLock lock(&lock_);
int64_t now_ms = clock_->TimeInMilliseconds();
absl::optional<uint32_t> current_rate = current_rate_.Rate(now_ms);
- if (!webrtc::field_trial::IsEnabled("WebRTC-DisableRtxRateLimiter") &&
- current_rate) {
+ if (current_rate) {
// If there is a current rate, check if adding bytes would cause maximum
// bitrate target to be exceeded. If there is NOT a valid current rate,
// allow allocating rate even if target is exceeded. This prevents
diff --git a/rtc_base/rate_limiter_unittest.cc b/rtc_base/rate_limiter_unittest.cc
index a830446d60..07dda5609e 100644
--- a/rtc_base/rate_limiter_unittest.cc
+++ b/rtc_base/rate_limiter_unittest.cc
@@ -15,7 +15,6 @@
#include "rtc_base/event.h"
#include "rtc_base/platform_thread.h"
#include "system_wrappers/include/clock.h"
-#include "test/field_trial.h"
#include "test/gtest.h"
namespace webrtc {
@@ -107,19 +106,6 @@ TEST_F(RateLimitTest, WindowSizeLimits) {
EXPECT_FALSE(rate_limiter->SetWindowSize(kWindowSizeMs + 1));
}
-TEST_F(RateLimitTest, DiablesRtxRateLimiterByFieldTrial) {
- webrtc::test::ScopedFieldTrials trial(
- "WebRTC-DisableRtxRateLimiter/Enabled/");
-
- // Fill rate, extend window to full size.
- EXPECT_TRUE(rate_limiter->TryUseRate(kRateFillingBytes / 2));
- clock_.AdvanceTimeMilliseconds(kWindowSizeMs - 1);
- EXPECT_TRUE(rate_limiter->TryUseRate(kRateFillingBytes / 2));
-
- // Does not limit rate even when all rate consumed.
- EXPECT_TRUE(rate_limiter->TryUseRate(1));
-}
-
static constexpr TimeDelta kMaxTimeout = TimeDelta::Seconds(30);
class ThreadTask {
diff --git a/rtc_base/ref_count.h b/rtc_base/ref_count.h
index d8d652abd8..60a11fa5c7 100644
--- a/rtc_base/ref_count.h
+++ b/rtc_base/ref_count.h
@@ -10,57 +10,16 @@
#ifndef RTC_BASE_REF_COUNT_H_
#define RTC_BASE_REF_COUNT_H_
-namespace rtc {
-
-// Refcounted objects should implement the following informal interface:
-//
-// void AddRef() const ;
-// RefCountReleaseStatus Release() const;
-//
-// You may access members of a reference-counted object, including the AddRef()
-// and Release() methods, only if you already own a reference to it, or if
-// you're borrowing someone else's reference. (A newly created object is a
-// special case: the reference count is zero on construction, and the code that
-// creates the object should immediately call AddRef(), bringing the reference
-// count from zero to one, e.g., by constructing an rtc::scoped_refptr).
-//
-// AddRef() creates a new reference to the object.
-//
-// Release() releases a reference to the object; the caller now has one less
-// reference than before the call. Returns kDroppedLastRef if the number of
-// references dropped to zero because of this (in which case the object destroys
-// itself). Otherwise, returns kOtherRefsRemained, to signal that at the precise
-// time the caller's reference was dropped, other references still remained (but
-// if other threads own references, this may of course have changed by the time
-// Release() returns).
-//
-// The caller of Release() must treat it in the same way as a delete operation:
-// Regardless of the return value from Release(), the caller mustn't access the
-// object. The object might still be alive, due to references held by other
-// users of the object, but the object can go away at any time, e.g., as the
-// result of another thread calling Release().
-//
-// Calling AddRef() and Release() manually is discouraged. It's recommended to
-// use rtc::scoped_refptr to manage all pointers to reference counted objects.
-// Note that rtc::scoped_refptr depends on compile-time duck-typing; formally
-// implementing the below RefCountInterface is not required.
+// Transition file for backwards compatibility with source code
+// that includes the non-API file.
-enum class RefCountReleaseStatus { kDroppedLastRef, kOtherRefsRemained };
+#include "api/ref_count.h"
-// Interfaces where refcounting is part of the public api should
-// inherit this abstract interface. The implementation of these
-// methods is usually provided by the RefCountedObject template class,
-// applied as a leaf in the inheritance tree.
-class RefCountInterface {
- public:
- virtual void AddRef() const = 0;
- virtual RefCountReleaseStatus Release() const = 0;
+namespace rtc {
- // Non-public destructor, because Release() has exclusive responsibility for
- // destroying the object.
- protected:
- virtual ~RefCountInterface() {}
-};
+// TODO(bugs.webrtc.org/15622): Deprecate and remove these aliases.
+using webrtc::RefCountInterface;
+using webrtc::RefCountReleaseStatus;
} // namespace rtc
diff --git a/rtc_base/socket_unittest.cc b/rtc_base/socket_unittest.cc
index 0a41a776ac..f5ef2a33fc 100644
--- a/rtc_base/socket_unittest.cc
+++ b/rtc_base/socket_unittest.cc
@@ -1132,13 +1132,13 @@ void SocketTest::UdpSocketRecvTimestampUseRtcEpoch(const IPAddress& loopback) {
client2->SendTo("foo", 3, address);
std::unique_ptr<TestClient::Packet> packet_1 = client1->NextPacket(10000);
ASSERT_TRUE(packet_1 != nullptr);
- EXPECT_NEAR(packet_1->packet_time_us, rtc::TimeMicros(), 1000'000);
+ EXPECT_NEAR(packet_1->packet_time->us(), rtc::TimeMicros(), 1000'000);
Thread::SleepMs(100);
client2->SendTo("bar", 3, address);
std::unique_ptr<TestClient::Packet> packet_2 = client1->NextPacket(10000);
ASSERT_TRUE(packet_2 != nullptr);
- EXPECT_GT(packet_2->packet_time_us, packet_1->packet_time_us);
- EXPECT_NEAR(packet_2->packet_time_us, rtc::TimeMicros(), 1000'000);
+ EXPECT_GT(packet_2->packet_time->us(), packet_1->packet_time->us());
+ EXPECT_NEAR(packet_2->packet_time->us(), rtc::TimeMicros(), 1000'000);
}
} // namespace rtc
diff --git a/rtc_base/ssl_stream_adapter.h b/rtc_base/ssl_stream_adapter.h
index d8b66f11e8..701cc4437b 100644
--- a/rtc_base/ssl_stream_adapter.h
+++ b/rtc_base/ssl_stream_adapter.h
@@ -39,6 +39,10 @@ constexpr int kSrtpAeadAes128Gcm = 0x0007;
constexpr int kSrtpAeadAes256Gcm = 0x0008;
constexpr int kSrtpCryptoSuiteMaxValue = 0xFFFF;
+// Constants for SSL signature algorithms.
+constexpr int kSslSignatureAlgorithmUnknown = 0;
+constexpr int kSslSignatureAlgorithmMaxValue = 0xFFFF;
+
// Names of SRTP profiles listed above.
// 128-bit AES with 80-bit SHA-1 HMAC.
extern const char kCsAesCm128HmacSha1_80[];
@@ -218,6 +222,9 @@ class SSLStreamAdapter : public StreamInterface {
uint8_t* result,
size_t result_len);
+ // Returns the signature algorithm or 0 if not applicable.
+ virtual uint16_t GetPeerSignatureAlgorithm() const = 0;
+
// DTLS-SRTP interface
virtual bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites);
virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite);
diff --git a/rtc_base/ssl_stream_adapter_unittest.cc b/rtc_base/ssl_stream_adapter_unittest.cc
index 0a99d9b1f0..def4c47c0d 100644
--- a/rtc_base/ssl_stream_adapter_unittest.cc
+++ b/rtc_base/ssl_stream_adapter_unittest.cc
@@ -31,8 +31,11 @@
#include "rtc_base/ssl_identity.h"
#include "rtc_base/stream.h"
#include "test/field_trial.h"
+#include "test/gmock.h"
+#include "test/gtest.h"
using ::testing::Combine;
+using ::testing::NotNull;
using ::testing::tuple;
using ::testing::Values;
using ::testing::WithParamInterface;
@@ -593,9 +596,12 @@ class SSLStreamAdapterTestBase : public ::testing::Test,
size_t client_digest_len;
bool rv;
+ ASSERT_THAT(server_identity(), NotNull());
rv = server_identity()->certificate().ComputeDigest(
rtc::DIGEST_SHA_1, server_digest, 20, &server_digest_len);
ASSERT_TRUE(rv);
+
+ ASSERT_THAT(client_identity(), NotNull());
rv = client_identity()->certificate().ComputeDigest(
rtc::DIGEST_SHA_1, client_digest, 20, &client_digest_len);
ASSERT_TRUE(rv);
@@ -1607,11 +1613,14 @@ INSTANTIATE_TEST_SUITE_P(
rtc::KeyParams::RSA(1152, 65537),
rtc::KeyParams::ECDSA(rtc::EC_NIST_P256))));
-// Tests for enabling / disabling legacy TLS protocols in DTLS.
-class SSLStreamAdapterTestDTLSLegacyProtocols
+// Tests for enabling the (D)TLS extension permutation which randomizes the
+// order of extensions in the client hello.
+// These tests are a no-op under OpenSSL.
+#ifdef OPENSSL_IS_BORINGSSL
+class SSLStreamAdapterTestDTLSExtensionPermutation
: public SSLStreamAdapterTestDTLSBase {
public:
- SSLStreamAdapterTestDTLSLegacyProtocols()
+ SSLStreamAdapterTestDTLSExtensionPermutation()
: SSLStreamAdapterTestDTLSBase(rtc::KeyParams::ECDSA(rtc::EC_NIST_P256),
rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)) {
}
@@ -1650,179 +1659,6 @@ class SSLStreamAdapterTestDTLSLegacyProtocols
}
};
-// Test getting the used DTLS ciphers.
-// DTLS 1.2 enabled for neither client nor server -> DTLS 1.0 will be used.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols, TestGetSslCipherSuite) {
- ConfigureClient("WebRTC-LegacyTlsProtocols/Enabled/");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake();
-
- int client_cipher;
- ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher));
- int server_cipher;
- ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher));
-
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(true));
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(false));
-
- ASSERT_EQ(client_cipher, server_cipher);
-}
-
-// Test getting the used DTLS 1.2 ciphers.
-// DTLS 1.2 enabled for client and server -> DTLS 1.2 will be used.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslCipherSuiteDtls12Both) {
- ConfigureClient("");
- ConfigureServer("");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12);
- TestHandshake();
-
- int client_cipher;
- ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher));
- int server_cipher;
- ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher));
-
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_12, GetSslVersion(true));
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_12, GetSslVersion(false));
-
- ASSERT_EQ(client_cipher, server_cipher);
-}
-
-// DTLS 1.2 enabled for client only -> DTLS 1.0 will be used.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslCipherSuiteDtls12Client) {
- ConfigureClient("WebRTC-LegacyTlsProtocols/Enabled/");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12);
- TestHandshake();
-
- int client_cipher;
- ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher));
- int server_cipher;
- ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher));
-
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(true));
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(false));
-
- ASSERT_EQ(client_cipher, server_cipher);
-}
-
-// DTLS 1.2 enabled for server only -> DTLS 1.0 will be used.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslCipherSuiteDtls12Server) {
- ConfigureClient("WebRTC-LegacyTlsProtocols/Enabled/");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake();
-
- int client_cipher;
- ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher));
- int server_cipher;
- ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher));
-
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(true));
- ASSERT_EQ(rtc::SSL_PROTOCOL_DTLS_10, GetSslVersion(false));
-
- ASSERT_EQ(client_cipher, server_cipher);
-}
-
-// Client has legacy TLS versions disabled, server has DTLS 1.0 only.
-// This is meant to cause a failure.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyDisabledServer10) {
- ConfigureClient("");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12);
- // Handshake should fail.
- TestHandshake(false);
-}
-
-// Both client and server have legacy TLS versions disabled and support
-// DTLS 1.2. This should work.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyDisabledServer12) {
- ConfigureClient("");
- ConfigureServer("");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12);
- TestHandshake();
-}
-
-// Both client and server have legacy TLS versions enabled and support DTLS 1.0.
-// This should work.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyEnabledClient10Server10) {
- ConfigureClient("WebRTC-LegacyTlsProtocols/Enabled/");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake();
-}
-
-// Legacy protocols are disabled in the client, max TLS version is 1.0
-// This should be a configuration error, and handshake should fail.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyDisabledClient10Server10) {
- ConfigureClient("");
- ConfigureServer("WebRTC-LegacyTlsProtocols/Enabled/");
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake(false);
-}
-
-// Both client and server have legacy TLS versions enabled and support DTLS 1.0.
-// This should work.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyOverrideEnabledClient10Server10) {
- rtc::SetAllowLegacyTLSProtocols(true);
- ConfigureClient("");
- ConfigureServer("");
- // Remove override.
- rtc::SetAllowLegacyTLSProtocols(absl::nullopt);
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake();
-}
-
-// Client has legacy TLS disabled and server has legacy TLS enabled via
-// override. Handshake for DTLS 1.0 should fail.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyOverrideDisabledClient10EnabledServer10) {
- rtc::SetAllowLegacyTLSProtocols(false);
- ConfigureClient("");
- rtc::SetAllowLegacyTLSProtocols(true);
- ConfigureServer("");
- // Remove override.
- rtc::SetAllowLegacyTLSProtocols(absl::nullopt);
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake(false);
-}
-
-// Client has legacy TLS enabled and server has legacy TLS disabled via
-// override. Handshake for DTLS 1.0 should fail.
-TEST_F(SSLStreamAdapterTestDTLSLegacyProtocols,
- TestGetSslVersionLegacyOverrideEnabledClient10DisabledServer10) {
- rtc::SetAllowLegacyTLSProtocols(true);
- ConfigureClient("");
- rtc::SetAllowLegacyTLSProtocols(false);
- ConfigureServer("");
- // Remove override.
- rtc::SetAllowLegacyTLSProtocols(absl::nullopt);
- SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
- TestHandshake(false);
-}
-
-// These tests are a no-op under OpenSSL.
-#ifdef OPENSSL_IS_BORINGSSL
-// TODO(https://bugs.webrtc.org/10261): when removing
-// SSLStreamAdapterTestDTLSLegacyProtocols that this class
-// inherits from move the code to this class.
-class SSLStreamAdapterTestDTLSExtensionPermutation
- : public SSLStreamAdapterTestDTLSLegacyProtocols {
- public:
- SSLStreamAdapterTestDTLSExtensionPermutation()
- : SSLStreamAdapterTestDTLSLegacyProtocols() {}
-};
-
-// Tests for enabling the (D)TLS extension permutation which randomizes the
-// order of extensions in the client hello.
TEST_F(SSLStreamAdapterTestDTLSExtensionPermutation,
ClientDefaultServerDefault) {
ConfigureClient("");
diff --git a/net/dcsctp/common/str_join.h b/rtc_base/strings/str_join.h
index 04517827b7..762e63ae2a 100644
--- a/net/dcsctp/common/str_join.h
+++ b/rtc_base/strings/str_join.h
@@ -7,15 +7,15 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef NET_DCSCTP_COMMON_STR_JOIN_H_
-#define NET_DCSCTP_COMMON_STR_JOIN_H_
+#ifndef RTC_BASE_STRINGS_STR_JOIN_H_
+#define RTC_BASE_STRINGS_STR_JOIN_H_
#include <string>
#include "absl/strings/string_view.h"
#include "rtc_base/strings/string_builder.h"
-namespace dcsctp {
+namespace webrtc {
template <typename Range>
std::string StrJoin(const Range& seq, absl::string_view delimiter) {
@@ -51,6 +51,6 @@ std::string StrJoin(const Range& seq,
return sb.Release();
}
-} // namespace dcsctp
+} // namespace webrtc
-#endif // NET_DCSCTP_COMMON_STR_JOIN_H_
+#endif // RTC_BASE_STRINGS_STR_JOIN_H_
diff --git a/net/dcsctp/common/str_join_test.cc b/rtc_base/strings/str_join_unittest.cc
index dbfd92c1cf..a4ac02125f 100644
--- a/net/dcsctp/common/str_join_test.cc
+++ b/rtc_base/strings/str_join_unittest.cc
@@ -7,15 +7,15 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "net/dcsctp/common/str_join.h"
+#include "rtc_base/strings/str_join.h"
#include <string>
#include <utility>
#include <vector>
-#include "test/gmock.h"
+#include "test/gtest.h"
-namespace dcsctp {
+namespace webrtc {
namespace {
TEST(StrJoinTest, CanJoinStringsFromVector) {
@@ -42,4 +42,4 @@ TEST(StrJoinTest, CanFormatElementsWhileJoining) {
}
} // namespace
-} // namespace dcsctp
+} // namespace webrtc
diff --git a/rtc_base/synchronization/sequence_checker_internal.cc b/rtc_base/synchronization/sequence_checker_internal.cc
index 3e205b91d5..4b9583deb2 100644
--- a/rtc_base/synchronization/sequence_checker_internal.cc
+++ b/rtc_base/synchronization/sequence_checker_internal.cc
@@ -22,6 +22,11 @@ SequenceCheckerImpl::SequenceCheckerImpl(bool attach_to_current_thread)
valid_thread_(rtc::CurrentThreadRef()),
valid_queue_(TaskQueueBase::Current()) {}
+SequenceCheckerImpl::SequenceCheckerImpl(TaskQueueBase* attached_queue)
+ : attached_(attached_queue != nullptr),
+ valid_thread_(rtc::PlatformThreadRef()),
+ valid_queue_(attached_queue) {}
+
bool SequenceCheckerImpl::IsCurrent() const {
const TaskQueueBase* const current_queue = TaskQueueBase::Current();
const rtc::PlatformThreadRef current_thread = rtc::CurrentThreadRef();
diff --git a/rtc_base/synchronization/sequence_checker_internal.h b/rtc_base/synchronization/sequence_checker_internal.h
index 22503027a5..a23ac08885 100644
--- a/rtc_base/synchronization/sequence_checker_internal.h
+++ b/rtc_base/synchronization/sequence_checker_internal.h
@@ -31,6 +31,7 @@ namespace webrtc_sequence_checker_internal {
class RTC_EXPORT SequenceCheckerImpl {
public:
explicit SequenceCheckerImpl(bool attach_to_current_thread);
+ explicit SequenceCheckerImpl(TaskQueueBase* attached_queue);
~SequenceCheckerImpl() = default;
bool IsCurrent() const;
@@ -59,6 +60,7 @@ class RTC_EXPORT SequenceCheckerImpl {
class SequenceCheckerDoNothing {
public:
explicit SequenceCheckerDoNothing(bool attach_to_current_thread) {}
+ explicit SequenceCheckerDoNothing(TaskQueueBase* attached_queue) {}
bool IsCurrent() const { return true; }
void Detach() {}
};
diff --git a/rtc_base/system/file_wrapper.cc b/rtc_base/system/file_wrapper.cc
index f7befc6dc5..af34d0e411 100644
--- a/rtc_base/system/file_wrapper.cc
+++ b/rtc_base/system/file_wrapper.cc
@@ -10,15 +10,19 @@
#include "rtc_base/system/file_wrapper.h"
+#include <stddef.h>
+
#include <cerrno>
+#include <cstdint>
+#include <string>
#include "absl/strings/string_view.h"
+#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_conversions.h"
#ifdef _WIN32
#include <Windows.h>
#else
-#include <string.h>
#endif
#include <utility>
diff --git a/rtc_base/system/file_wrapper.h b/rtc_base/system/file_wrapper.h
index 5e1e3d6a16..92a552cfd9 100644
--- a/rtc_base/system/file_wrapper.h
+++ b/rtc_base/system/file_wrapper.h
@@ -12,6 +12,7 @@
#define RTC_BASE_SYSTEM_FILE_WRAPPER_H_
#include <stddef.h>
+#include <stdint.h>
#include <stdio.h>
#include <string>
diff --git a/rtc_base/test_client.cc b/rtc_base/test_client.cc
index f23ac2aec0..87c946529e 100644
--- a/rtc_base/test_client.cc
+++ b/rtc_base/test_client.cc
@@ -15,7 +15,9 @@
#include <memory>
#include <utility>
+#include "api/units/timestamp.h"
#include "rtc_base/gunit.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
@@ -30,10 +32,11 @@ TestClient::TestClient(std::unique_ptr<AsyncPacketSocket> socket)
TestClient::TestClient(std::unique_ptr<AsyncPacketSocket> socket,
ThreadProcessingFakeClock* fake_clock)
- : fake_clock_(fake_clock),
- socket_(std::move(socket)),
- prev_packet_timestamp_(-1) {
- socket_->SignalReadPacket.connect(this, &TestClient::OnPacket);
+ : fake_clock_(fake_clock), socket_(std::move(socket)) {
+ socket_->RegisterReceivedPacketCallback(
+ [&](rtc::AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) {
+ OnPacket(socket, packet);
+ });
socket_->SignalReadyToSend.connect(this, &TestClient::OnReadyToSend);
}
@@ -100,20 +103,22 @@ bool TestClient::CheckNextPacket(const char* buf,
bool res = false;
std::unique_ptr<Packet> packet = NextPacket(kTimeoutMs);
if (packet) {
- res = (packet->size == size && memcmp(packet->buf, buf, size) == 0 &&
- CheckTimestamp(packet->packet_time_us));
+ res = (packet->buf.size() == size &&
+ memcmp(packet->buf.data(), buf, size) == 0 &&
+ CheckTimestamp(packet->packet_time));
if (addr)
*addr = packet->addr;
}
return res;
}
-bool TestClient::CheckTimestamp(int64_t packet_timestamp) {
+bool TestClient::CheckTimestamp(
+ absl::optional<webrtc::Timestamp> packet_timestamp) {
bool res = true;
- if (packet_timestamp == -1) {
+ if (!packet_timestamp) {
res = false;
}
- if (prev_packet_timestamp_ != -1) {
+ if (prev_packet_timestamp_) {
if (packet_timestamp < prev_packet_timestamp_) {
res = false;
}
@@ -145,36 +150,24 @@ int TestClient::SetOption(Socket::Option opt, int value) {
}
void TestClient::OnPacket(AsyncPacketSocket* socket,
- const char* buf,
- size_t size,
- const SocketAddress& remote_addr,
- const int64_t& packet_time_us) {
+ const rtc::ReceivedPacket& received_packet) {
webrtc::MutexLock lock(&mutex_);
- packets_.push_back(
- std::make_unique<Packet>(remote_addr, buf, size, packet_time_us));
+ packets_.push_back(std::make_unique<Packet>(received_packet));
}
void TestClient::OnReadyToSend(AsyncPacketSocket* socket) {
++ready_to_send_count_;
}
-TestClient::Packet::Packet(const SocketAddress& a,
- const char* b,
- size_t s,
- int64_t packet_time_us)
- : addr(a), buf(0), size(s), packet_time_us(packet_time_us) {
- buf = new char[size];
- memcpy(buf, b, size);
-}
+TestClient::Packet::Packet(const rtc::ReceivedPacket& received_packet)
+ : addr(received_packet.source_address()),
+ // Copy received_packet payload to a buffer owned by Packet.
+ buf(received_packet.payload().data(), received_packet.payload().size()),
+ packet_time(received_packet.arrival_time()) {}
TestClient::Packet::Packet(const Packet& p)
- : addr(p.addr), buf(0), size(p.size), packet_time_us(p.packet_time_us) {
- buf = new char[size];
- memcpy(buf, p.buf, size);
-}
-
-TestClient::Packet::~Packet() {
- delete[] buf;
-}
+ : addr(p.addr),
+ buf(p.buf.data(), p.buf.size()),
+ packet_time(p.packet_time) {}
} // namespace rtc
diff --git a/rtc_base/test_client.h b/rtc_base/test_client.h
index dd91d37ab9..6fe6fd5b83 100644
--- a/rtc_base/test_client.h
+++ b/rtc_base/test_client.h
@@ -14,8 +14,11 @@
#include <memory>
#include <vector>
+#include "api/units/timestamp.h"
#include "rtc_base/async_udp_socket.h"
+#include "rtc_base/buffer.h"
#include "rtc_base/fake_clock.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/synchronization/mutex.h"
namespace rtc {
@@ -26,17 +29,12 @@ class TestClient : public sigslot::has_slots<> {
public:
// Records the contents of a packet that was received.
struct Packet {
- Packet(const SocketAddress& a,
- const char* b,
- size_t s,
- int64_t packet_time_us);
+ Packet(const rtc::ReceivedPacket& received_packet);
Packet(const Packet& p);
- virtual ~Packet();
SocketAddress addr;
- char* buf;
- size_t size;
- int64_t packet_time_us;
+ Buffer buf;
+ absl::optional<webrtc::Timestamp> packet_time;
};
// Default timeout for NextPacket reads.
@@ -96,14 +94,11 @@ class TestClient : public sigslot::has_slots<> {
static const int kNoPacketTimeoutMs = 1000;
// Workaround for the fact that AsyncPacketSocket::GetConnState doesn't exist.
Socket::ConnState GetState();
- // Slot for packets read on the socket.
+
void OnPacket(AsyncPacketSocket* socket,
- const char* buf,
- size_t len,
- const SocketAddress& remote_addr,
- const int64_t& packet_time_us);
+ const rtc::ReceivedPacket& received_packet);
void OnReadyToSend(AsyncPacketSocket* socket);
- bool CheckTimestamp(int64_t packet_timestamp);
+ bool CheckTimestamp(absl::optional<webrtc::Timestamp> packet_timestamp);
void AdvanceTime(int ms);
ThreadProcessingFakeClock* fake_clock_ = nullptr;
@@ -111,7 +106,7 @@ class TestClient : public sigslot::has_slots<> {
std::unique_ptr<AsyncPacketSocket> socket_;
std::vector<std::unique_ptr<Packet>> packets_;
int ready_to_send_count_ = 0;
- int64_t prev_packet_timestamp_;
+ absl::optional<webrtc::Timestamp> prev_packet_timestamp_;
};
} // namespace rtc
diff --git a/rtc_tools/BUILD.gn b/rtc_tools/BUILD.gn
index 5ead8a0506..1ab7a98936 100644
--- a/rtc_tools/BUILD.gn
+++ b/rtc_tools/BUILD.gn
@@ -54,6 +54,7 @@ rtc_library("video_file_reader") {
]
deps = [
"../api:make_ref_counted",
+ "../api:ref_count",
"../api:scoped_refptr",
"../api/video:video_frame",
"../api/video:video_rtp_headers",
@@ -379,28 +380,38 @@ if (!build_with_chromium) {
]
deps = [
":chart_proto",
+ "../api:dtls_transport_interface",
"../api:function_view",
+ "../api:make_ref_counted",
"../api:network_state_predictor_api",
- "../modules/audio_coding:neteq_input_audio_tools",
- "../modules/audio_coding:neteq_tools_minimal",
- "../rtc_base:ignore_wundef",
- "../rtc_base:logging",
- "../rtc_base:macromagic",
- "../rtc_base:rate_statistics",
- "../rtc_base:refcount",
-
- # TODO(kwiberg): Remove this dependency.
- "../api/audio_codecs:audio_codecs_api",
+ "../api:rtp_headers",
+ "../api:rtp_parameters",
+ "../api:scoped_refptr",
+ "../api/audio_codecs:audio_codecs_api", # TODO(kwiberg): Remove this
+ # dependency.
+ "../api/neteq:neteq_api",
+ "../api/rtc_event_log:rtc_event_log",
"../api/transport:field_trial_based_config",
"../api/transport:goog_cc",
"../api/transport:network_control",
+ "../api/units:data_rate",
+ "../api/units:time_delta",
+ "../api/units:timestamp",
"../call:call_interfaces",
"../call:video_stream_api",
+ "../logging:ice_log",
+ "../logging:rtc_event_audio",
+ "../logging:rtc_event_audio",
+ "../logging:rtc_event_bwe",
+ "../logging:rtc_event_generic_packet_events",
"../logging:rtc_event_log_parser",
+ "../logging:rtc_event_rtp_rtcp",
"../logging:rtc_stream_config",
"../modules/audio_coding:ana_debug_dump_proto",
"../modules/audio_coding:audio_network_adaptor",
+ "../modules/audio_coding:neteq_input_audio_tools",
"../modules/audio_coding:neteq_tools",
+ "../modules/audio_coding:neteq_tools_minimal",
"../modules/congestion_controller",
"../modules/congestion_controller/goog_cc:delay_based_bwe",
"../modules/congestion_controller/goog_cc:estimators",
@@ -410,8 +421,13 @@ if (!build_with_chromium) {
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:checks",
+ "../rtc_base:logging",
+ "../rtc_base:macromagic",
+ "../rtc_base:rate_statistics",
+ "../rtc_base:refcount",
"../rtc_base:rtc_numerics",
"../rtc_base:stringutils",
+ "../rtc_base/network:sent_packet",
"../system_wrappers",
"../test:explicit_key_value_config",
]
@@ -423,6 +439,36 @@ if (!build_with_chromium) {
"//third_party/abseil-cpp/absl/types:optional",
]
}
+
+ rtc_library("event_log_visualizer_bindings") {
+ visibility = [ "*" ]
+ sources = [
+ "rtc_event_log_visualizer/analyzer_bindings.cc",
+ "rtc_event_log_visualizer/analyzer_bindings.h",
+ ]
+ deps = [
+ ":chart_proto",
+ ":event_log_visualizer_utils",
+ "//api/units:time_delta",
+ "//logging:rtc_event_log_parser",
+ "//rtc_base:protobuf_utils",
+ "//rtc_base:safe_conversions",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
+ }
+
+ rtc_library("event_log_visualizer_bindings_unittest") {
+ testonly = true
+ sources = [ "rtc_event_log_visualizer/analyzer_bindings_unittest.cc" ]
+ deps = [
+ ":chart_proto",
+ ":event_log_visualizer_bindings",
+ "//rtc_base:protobuf_utils",
+ "//rtc_base/system:file_wrapper",
+ "//test:fileutils",
+ "//test:test_support",
+ ]
+ }
}
rtc_executable("video_encoder") {
@@ -439,6 +485,7 @@ if (!build_with_chromium) {
"//api/video:builtin_video_bitrate_allocator_factory",
"//api/video_codecs:builtin_video_encoder_factory",
"//api/video_codecs:video_codecs_api",
+ "//media:media_constants",
"//modules/video_coding:video_codec_interface",
"//modules/video_coding:video_coding_utility",
"//modules/video_coding/codecs/av1:av1_svc_config",
@@ -521,6 +568,7 @@ if (rtc_include_tests) {
"../resources/foreman_128x96.yuv",
"../resources/foreman_cif.yuv",
"../resources/reference_less_video_test_file.y4m",
+ "../resources/rtc_event_log/rtc_event_log_500kbps.binarypb",
]
if (is_ios) {
@@ -572,7 +620,10 @@ if (rtc_include_tests) {
}
if (rtc_enable_protobuf) {
- deps += [ "network_tester:network_tester_unittests" ]
+ deps += [
+ ":event_log_visualizer_bindings_unittest",
+ "network_tester:network_tester_unittests",
+ ]
}
data = tools_unittests_resources
@@ -608,7 +659,6 @@ if (rtc_include_tests) {
"../modules/audio_processing:audioproc_debug_proto",
"../modules/audio_processing:audioproc_protobuf_utils",
"../rtc_base:checks",
- "../rtc_base:ignore_wundef",
"../rtc_base:macromagic",
"../rtc_base:protobuf_utils",
"../rtc_base:stringutils",
diff --git a/rtc_tools/network_tester/BUILD.gn b/rtc_tools/network_tester/BUILD.gn
index e33a3c000f..8fcfa98440 100644
--- a/rtc_tools/network_tester/BUILD.gn
+++ b/rtc_tools/network_tester/BUILD.gn
@@ -46,7 +46,6 @@ if (rtc_enable_protobuf) {
"../../p2p:rtc_p2p",
"../../rtc_base:async_packet_socket",
"../../rtc_base:checks",
- "../../rtc_base:ignore_wundef",
"../../rtc_base:ip_address",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
@@ -86,6 +85,7 @@ if (rtc_enable_protobuf) {
deps = [
":network_tester",
"../../rtc_base:gunit_helpers",
+ "../../rtc_base:random",
"../../rtc_base:threading",
"../../test:fileutils",
"../../test:test_support",
diff --git a/rtc_tools/network_tester/config_reader.h b/rtc_tools/network_tester/config_reader.h
index 3735555d51..3903613b5b 100644
--- a/rtc_tools/network_tester/config_reader.h
+++ b/rtc_tools/network_tester/config_reader.h
@@ -15,12 +15,9 @@
#include <string>
#include "absl/types/optional.h"
-#include "rtc_base/ignore_wundef.h"
#ifdef WEBRTC_NETWORK_TESTER_PROTO
-RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/network_tester/network_tester_config.pb.h"
-RTC_POP_IGNORING_WUNDEF()
using webrtc::network_tester::config::NetworkTesterAllConfigs;
#else
class NetworkTesterConfigs;
diff --git a/rtc_tools/network_tester/network_tester_unittest.cc b/rtc_tools/network_tester/network_tester_unittest.cc
index 60b34e4e9f..ea0ebf98f8 100644
--- a/rtc_tools/network_tester/network_tester_unittest.cc
+++ b/rtc_tools/network_tester/network_tester_unittest.cc
@@ -13,6 +13,7 @@
#include <string>
#include "rtc_base/gunit.h"
+#include "rtc_base/random.h"
#include "rtc_tools/network_tester/test_controller.h"
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
@@ -20,15 +21,22 @@
namespace webrtc {
TEST(NetworkTesterTest, ServerClient) {
+ // Use a unique port rather than a hard-coded one to avoid collision when
+ // running the test in parallel in stress runs. Skipping all reserved ports.
+ const int MIN_PORT = 49152;
+ const int MAX_PORT = 65535;
+ int port = webrtc::Random(rtc::TimeMicros()).Rand(MIN_PORT, MAX_PORT);
+
rtc::AutoThread main_thread;
+
TestController client(
0, 0, webrtc::test::ResourcePath("network_tester/client_config", "dat"),
webrtc::test::OutputPath() + "client_packet_log.dat");
TestController server(
- 9090, 9090,
+ port, port,
webrtc::test::ResourcePath("network_tester/server_config", "dat"),
webrtc::test::OutputPath() + "server_packet_log.dat");
- client.SendConnectTo("127.0.0.1", 9090);
+ client.SendConnectTo("127.0.0.1", port);
EXPECT_TRUE_WAIT(server.IsTestDone() && client.IsTestDone(), 2000);
}
diff --git a/rtc_tools/network_tester/packet_logger.h b/rtc_tools/network_tester/packet_logger.h
index c3ac309cf7..c8bfccba10 100644
--- a/rtc_tools/network_tester/packet_logger.h
+++ b/rtc_tools/network_tester/packet_logger.h
@@ -14,12 +14,8 @@
#include <fstream>
#include <string>
-#include "rtc_base/ignore_wundef.h"
-
#ifdef WEBRTC_NETWORK_TESTER_PROTO
-RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/network_tester/network_tester_packet.pb.h"
-RTC_POP_IGNORING_WUNDEF()
using webrtc::network_tester::packet::NetworkTesterPacket;
#else
class NetworkTesterPacket;
diff --git a/rtc_tools/network_tester/packet_sender.h b/rtc_tools/network_tester/packet_sender.h
index 7fd500f27c..caa92499f3 100644
--- a/rtc_tools/network_tester/packet_sender.h
+++ b/rtc_tools/network_tester/packet_sender.h
@@ -17,13 +17,10 @@
#include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/task_queue_factory.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/system/no_unique_address.h"
#ifdef WEBRTC_NETWORK_TESTER_PROTO
-RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/network_tester/network_tester_packet.pb.h"
-RTC_POP_IGNORING_WUNDEF()
using webrtc::network_tester::packet::NetworkTesterPacket;
#else
class NetworkTesterPacket;
diff --git a/rtc_tools/network_tester/test_controller.cc b/rtc_tools/network_tester/test_controller.cc
index 6fe83fd430..3d9af380f1 100644
--- a/rtc_tools/network_tester/test_controller.cc
+++ b/rtc_tools/network_tester/test_controller.cc
@@ -43,6 +43,7 @@ TestController::TestController(int min_port,
udp_socket_ =
std::unique_ptr<rtc::AsyncPacketSocket>(socket_factory_.CreateUdpSocket(
rtc::SocketAddress(rtc::GetAnyIP(AF_INET), 0), min_port, max_port));
+ RTC_CHECK(udp_socket_ != nullptr);
udp_socket_->SignalReadPacket.connect(this, &TestController::OnReadPacket);
});
}
diff --git a/rtc_tools/network_tester/test_controller.h b/rtc_tools/network_tester/test_controller.h
index b08fbd5dd8..d09e033c25 100644
--- a/rtc_tools/network_tester/test_controller.h
+++ b/rtc_tools/network_tester/test_controller.h
@@ -22,7 +22,6 @@
#include "api/sequence_checker.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "rtc_base/async_packet_socket.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/system/no_unique_address.h"
@@ -32,9 +31,7 @@
#include "rtc_tools/network_tester/packet_sender.h"
#ifdef WEBRTC_NETWORK_TESTER_PROTO
-RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/network_tester/network_tester_packet.pb.h"
-RTC_POP_IGNORING_WUNDEF()
using webrtc::network_tester::packet::NetworkTesterPacket;
#else
class NetworkTesterPacket;
diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.cc b/rtc_tools/rtc_event_log_visualizer/alerts.cc
index a9f50cdd5c..98ffbd372e 100644
--- a/rtc_tools/rtc_event_log_visualizer/alerts.cc
+++ b/rtc_tools/rtc_event_log_visualizer/alerts.cc
@@ -13,15 +13,18 @@
#include <stdio.h>
#include <algorithm>
-#include <limits>
+#include <cstdint>
+#include <cstdlib>
+#include <functional>
#include <map>
#include <string>
-#include "logging/rtc_event_log/rtc_event_processor.h"
-#include "rtc_base/checks.h"
-#include "rtc_base/logging.h"
+#include "absl/types/optional.h"
+#include "api/units/timestamp.h"
+#include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "rtc_base/numerics/sequence_number_unwrapper.h"
-#include "rtc_base/strings/string_builder.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
namespace webrtc {
diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.h b/rtc_tools/rtc_event_log_visualizer/alerts.h
index 72f1241d50..d421ceb95f 100644
--- a/rtc_tools/rtc_event_log_visualizer/alerts.h
+++ b/rtc_tools/rtc_event_log_visualizer/alerts.h
@@ -13,6 +13,7 @@
#include <stdio.h>
+#include <functional>
#include <map>
#include <string>
#include <utility>
diff --git a/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc b/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
index 29dc26c22f..af6e2ee124 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyze_audio.cc
@@ -10,18 +10,39 @@
#include "rtc_tools/rtc_event_log_visualizer/analyze_audio.h"
+#include <cstdint>
+#include <map>
#include <memory>
#include <set>
+#include <string>
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
+#include "api/audio_codecs/audio_codec_pair_id.h"
+#include "api/audio_codecs/audio_decoder.h"
+#include "api/audio_codecs/audio_decoder_factory.h"
+#include "api/audio_codecs/audio_format.h"
+#include "api/function_view.h"
+#include "api/make_ref_counted.h"
+#include "api/neteq/neteq.h"
+#include "api/scoped_refptr.h"
+#include "api/units/timestamp.h"
+#include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h"
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/neteq/tools/audio_sink.h"
#include "modules/audio_coding/neteq/tools/fake_decode_from_file.h"
#include "modules/audio_coding/neteq/tools/neteq_delay_analyzer.h"
#include "modules/audio_coding/neteq/tools/neteq_event_log_input.h"
+#include "modules/audio_coding/neteq/tools/neteq_input.h"
#include "modules/audio_coding/neteq/tools/neteq_replacement_input.h"
+#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
#include "modules/audio_coding/neteq/tools/neteq_test.h"
#include "modules/audio_coding/neteq/tools/resample_input_audio_file.h"
+#include "rtc_base/checks.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
+#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
namespace webrtc {
diff --git a/rtc_tools/rtc_event_log_visualizer/analyze_audio.h b/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
index 726e84492d..586d6ce0ea 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyze_audio.h
@@ -17,6 +17,7 @@
#include <string>
#include "api/function_view.h"
+#include "api/neteq/neteq.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
index d78fea4899..1d8d5f12c0 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
@@ -12,48 +12,64 @@
#include <algorithm>
#include <cmath>
+#include <cstddef>
+#include <cstdint>
+#include <deque>
#include <limits>
#include <map>
#include <memory>
#include <string>
+#include <tuple>
#include <utility>
+#include <vector>
#include "absl/algorithm/container.h"
#include "absl/functional/bind_front.h"
#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
+#include "api/dtls_transport_interface.h"
#include "api/function_view.h"
+#include "api/media_types.h"
#include "api/network_state_predictor.h"
-#include "api/transport/field_trial_based_config.h"
+#include "api/rtc_event_log/rtc_event_log.h"
+#include "api/rtp_headers.h"
#include "api/transport/goog_cc_factory.h"
-#include "call/audio_receive_stream.h"
-#include "call/audio_send_stream.h"
-#include "call/call.h"
-#include "call/video_receive_stream.h"
-#include "call/video_send_stream.h"
+#include "api/transport/network_control.h"
+#include "api/transport/network_types.h"
+#include "api/units/data_rate.h"
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
+#include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
+#include "logging/rtc_event_log/events/rtc_event_generic_packet_received.h"
+#include "logging/rtc_event_log/events/rtc_event_generic_packet_sent.h"
+#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
+#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "logging/rtc_event_log/rtc_event_processor.h"
-#include "logging/rtc_event_log/rtc_stream_config.h"
-#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
-#include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.h"
-#include "modules/congestion_controller/goog_cc/bitrate_estimator.h"
-#include "modules/congestion_controller/goog_cc/delay_based_bwe.h"
+#include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator_interface.h"
#include "modules/congestion_controller/include/receive_side_congestion_controller.h"
#include "modules/congestion_controller/rtp/transport_feedback_adapter.h"
+#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
+#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "modules/rtp_rtcp/source/rtcp_packet.h"
-#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remb.h"
+#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
+#include "modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h"
#include "modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
-#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/network/sent_packet.h"
#include "rtc_base/numerics/sequence_number_unwrapper.h"
#include "rtc_base/rate_statistics.h"
#include "rtc_base/strings/string_builder.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
#include "rtc_tools/rtc_event_log_visualizer/log_simulation.h"
+#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
+#include "system_wrappers/include/clock.h"
#include "test/explicit_key_value_config.h"
namespace webrtc {
@@ -406,6 +422,12 @@ RtpPacketReceived RtpPacketForBWEFromHeader(const RTPHeader& header) {
return rtp_packet;
}
+struct PacketLossSummary {
+ size_t num_packets = 0;
+ size_t num_lost_packets = 0;
+ Timestamp base_time = Timestamp::MinusInfinity();
+};
+
} // namespace
EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log,
@@ -1298,6 +1320,100 @@ void EventLogAnalyzer::CreateGoogCcSimulationGraph(Plot* plot) {
plot->SetTitle("Simulated BWE behavior");
}
+void EventLogAnalyzer::CreateOutgoingTWCCLossRateGraph(Plot* plot) {
+ TimeSeries loss_rate_series("Loss rate (from packet feedback)",
+ LineStyle::kLine, PointStyle::kHighlight);
+ TimeSeries average_loss_rate_series("Average loss rate last 5s",
+ LineStyle::kLine, PointStyle::kHighlight);
+ TimeSeries missing_feedback_series("Missing feedback", LineStyle::kNone,
+ PointStyle::kHighlight);
+ PacketLossSummary window_summary;
+ Timestamp last_observation_receive_time = Timestamp::Zero();
+
+ // Use loss based bwe 2 observation duration and observation window size.
+ constexpr TimeDelta kObservationDuration = TimeDelta::Millis(250);
+ constexpr uint32_t kObservationWindowSize = 20;
+ std::deque<PacketLossSummary> observations;
+ SeqNumUnwrapper<uint16_t> unwrapper;
+ int64_t last_acked = 1;
+ if (!parsed_log_.transport_feedbacks(kIncomingPacket).empty()) {
+ last_acked =
+ unwrapper.Unwrap(parsed_log_.transport_feedbacks(kIncomingPacket)[0]
+ .transport_feedback.GetBaseSequence());
+ }
+ for (auto& feedback : parsed_log_.transport_feedbacks(kIncomingPacket)) {
+ const rtcp::TransportFeedback& transport_feedback =
+ feedback.transport_feedback;
+ size_t base_seq_num =
+ unwrapper.Unwrap(transport_feedback.GetBaseSequence());
+ // Collect packets that do not have feedback, which are from the last acked
+ // packet, to the current base packet.
+ for (size_t seq_num = last_acked; seq_num < base_seq_num; ++seq_num) {
+ missing_feedback_series.points.emplace_back(
+ config_.GetCallTimeSec(feedback.timestamp),
+ 100 + seq_num - last_acked);
+ }
+ last_acked = base_seq_num + transport_feedback.GetPacketStatusCount();
+
+ // Compute loss rate from the transport feedback.
+ auto loss_rate =
+ static_cast<float>((transport_feedback.GetPacketStatusCount() -
+ transport_feedback.GetReceivedPackets().size()) *
+ 100.0 / transport_feedback.GetPacketStatusCount());
+ loss_rate_series.points.emplace_back(
+ config_.GetCallTimeSec(feedback.timestamp), loss_rate);
+
+ // Compute loss rate in a window of kObservationWindowSize.
+ if (window_summary.num_packets == 0) {
+ window_summary.base_time = feedback.log_time();
+ }
+ window_summary.num_packets += transport_feedback.GetPacketStatusCount();
+ window_summary.num_lost_packets +=
+ transport_feedback.GetPacketStatusCount() -
+ transport_feedback.GetReceivedPackets().size();
+
+ const Timestamp last_received_time = feedback.log_time();
+ const TimeDelta observation_duration =
+ window_summary.base_time == Timestamp::Zero()
+ ? TimeDelta::Zero()
+ : last_received_time - window_summary.base_time;
+ if (observation_duration > kObservationDuration) {
+ last_observation_receive_time = last_received_time;
+ observations.push_back(window_summary);
+ if (observations.size() > kObservationWindowSize) {
+ observations.pop_front();
+ }
+
+ // Compute average loss rate in a number of windows.
+ int total_packets = 0;
+ int total_loss = 0;
+ for (const auto& observation : observations) {
+ total_loss += observation.num_lost_packets;
+ total_packets += observation.num_packets;
+ }
+ if (total_packets > 0) {
+ float average_loss_rate = total_loss * 100.0 / total_packets;
+ average_loss_rate_series.points.emplace_back(
+ config_.GetCallTimeSec(feedback.timestamp), average_loss_rate);
+ } else {
+ average_loss_rate_series.points.emplace_back(
+ config_.GetCallTimeSec(feedback.timestamp), 0);
+ }
+ window_summary = PacketLossSummary();
+ }
+ }
+ // Add the data set to the plot.
+ plot->AppendTimeSeriesIfNotEmpty(std::move(loss_rate_series));
+ plot->AppendTimeSeriesIfNotEmpty(std::move(average_loss_rate_series));
+ plot->AppendTimeSeriesIfNotEmpty(std::move(missing_feedback_series));
+
+ plot->SetXAxis(config_.CallBeginTimeSec(), config_.CallEndTimeSec(),
+ "Time (s)", kLeftMargin, kRightMargin);
+ plot->SetSuggestedYAxis(0, 100, "Loss rate (percent)", kBottomMargin,
+ kTopMargin);
+ plot->SetTitle("Outgoing loss rate (from TWCC feedback)");
+}
+
void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) {
using RtpPacketType = LoggedRtpPacketOutgoing;
using TransportFeedbackType = LoggedRtcpPacketTransportFeedback;
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.h b/rtc_tools/rtc_event_log_visualizer/analyzer.h
index e58a4823f7..3dfd5de616 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer.h
@@ -11,16 +11,15 @@
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
+#include <cstdint>
+#include <cstdio>
#include <map>
-#include <memory>
-#include <set>
#include <string>
-#include <utility>
#include <vector>
+#include "api/function_view.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
-#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
-#include "rtc_base/strings/string_builder.h"
+#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
@@ -67,6 +66,7 @@ class EventLogAnalyzer {
void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot);
void CreateBitrateAllocationGraph(PacketDirection direction, Plot* plot);
+ void CreateOutgoingTWCCLossRateGraph(Plot* plot);
void CreateGoogCcSimulationGraph(Plot* plot);
void CreateSendSideBweSimulationGraph(Plot* plot);
void CreateReceiveSideBweSimulationGraph(Plot* plot);
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc
new file mode 100644
index 0000000000..829591323f
--- /dev/null
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.cc
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h"
+
+#include <cstddef>
+#include <cstdint>
+#include <iostream>
+#include <string>
+
+#include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
+#include "api/units/time_delta.h"
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
+#include "rtc_base/numerics/safe_conversions.h"
+#include "rtc_base/protobuf_utils.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyzer.h"
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
+#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
+
+#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
+#include "external/webrtc/webrtc/rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+#else
+#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+#endif
+
+using webrtc::PacketDirection;
+
+void analyze_rtc_event_log(const char* log_contents,
+ size_t log_size,
+ const char* selection,
+ size_t selection_size,
+ char* output,
+ uint32_t* output_size) {
+ webrtc::ParsedRtcEventLog parsed_log(
+ webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions::kDontParse,
+ /*allow_incomplete_logs*/ false);
+
+ absl::string_view log_view(log_contents, log_size);
+ auto status = parsed_log.ParseString(log_view);
+ if (!status.ok()) {
+ std::cerr << "Failed to parse log: " << status.message() << std::endl;
+ *output_size = 0;
+ return;
+ }
+
+ webrtc::AnalyzerConfig config;
+ config.window_duration_ = webrtc::TimeDelta::Millis(250);
+ config.step_ = webrtc::TimeDelta::Millis(10);
+ if (!parsed_log.start_log_events().empty()) {
+ config.rtc_to_utc_offset_ = parsed_log.start_log_events()[0].utc_time() -
+ parsed_log.start_log_events()[0].log_time();
+ }
+ config.normalize_time_ = true;
+ config.begin_time_ = parsed_log.first_timestamp();
+ config.end_time_ = parsed_log.last_timestamp();
+ if (config.end_time_ < config.begin_time_) {
+ std::cerr << "Log end time " << config.end_time_.ms()
+ << " not after begin time " << config.begin_time_.ms()
+ << ". Nothing to analyze. Is the log broken?";
+ *output_size = 0;
+ return;
+ }
+
+ absl::string_view selection_view(selection, selection_size);
+ webrtc::EventLogAnalyzer analyzer(parsed_log, config);
+ webrtc::PlotCollection collection;
+ collection.SetCallTimeToUtcOffsetMs(config.CallTimeToUtcOffsetMs());
+
+ // Outgoing
+ if (absl::StrContains(selection_view, "outgoing_packet_sizes")) {
+ analyzer.CreatePacketGraph(
+ PacketDirection::kOutgoingPacket,
+ collection.AppendNewPlot("outgoing_packet_sizes"));
+ }
+ if (absl::StrContains(selection_view, "outgoing_stream_bitrate")) {
+ analyzer.CreateStreamBitrateGraph(
+ PacketDirection::kOutgoingPacket,
+ collection.AppendNewPlot("outgoing_stream_bitrate"));
+ }
+ if (absl::StrContains(selection_view, "outgoing_bitrate")) {
+ analyzer.CreateTotalOutgoingBitrateGraph(
+ collection.AppendNewPlot("outgoing_bitrate"),
+ /*show_detector_state*/ true,
+ /*show_alr_state*/ false,
+ /*show_link_capacity*/ true);
+ }
+ if (absl::StrContains(selection_view, "network_delay_feedback")) {
+ analyzer.CreateNetworkDelayFeedbackGraph(
+ collection.AppendNewPlot("network_delay_feedback"));
+ }
+ if (absl::StrContains(selection_view, "fraction_loss_feedback")) {
+ analyzer.CreateFractionLossGraph(
+ collection.AppendNewPlot("fraction_loss_feedback"));
+ }
+
+ // Incoming
+ if (absl::StrContains(selection_view, "incoming_packet_sizes")) {
+ analyzer.CreatePacketGraph(
+ PacketDirection::kIncomingPacket,
+ collection.AppendNewPlot("incoming_packet_sizes"));
+ }
+ if (absl::StrContains(selection_view, "incoming_stream_bitrate")) {
+ analyzer.CreateStreamBitrateGraph(
+ PacketDirection::kIncomingPacket,
+ collection.AppendNewPlot("incoming_stream_bitrate"));
+ }
+ if (absl::StrContains(selection_view, "incoming_bitrate")) {
+ analyzer.CreateTotalIncomingBitrateGraph(
+ collection.AppendNewPlot("incoming_bitrate"));
+ }
+ if (absl::StrContains(selection_view, "incoming_delay")) {
+ analyzer.CreateIncomingDelayGraph(
+ collection.AppendNewPlot("incoming_delay"));
+ }
+ if (absl::StrContains(selection_view, "incoming_loss_rate")) {
+ analyzer.CreateIncomingPacketLossGraph(
+ collection.AppendNewPlot("incoming_loss_rate"));
+ }
+
+ webrtc::analytics::ChartCollection proto_charts;
+ collection.ExportProtobuf(&proto_charts);
+ std::string serialized_charts = proto_charts.SerializeAsString();
+ if (rtc::checked_cast<uint32_t>(serialized_charts.size()) > *output_size) {
+ std::cerr << "Serialized charts larger than available output buffer: "
+ << serialized_charts.size() << " vs " << *output_size;
+ *output_size = 0;
+ return;
+ }
+
+ memcpy(output, serialized_charts.data(), serialized_charts.size());
+ *output_size = rtc::checked_cast<uint32_t>(serialized_charts.size());
+}
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h
new file mode 100644
index 0000000000..6662d9bc0e
--- /dev/null
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_
+#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_
+
+#include <cstddef>
+#include <cstdint>
+
+void analyze_rtc_event_log(const char* log_contents,
+ size_t log_size,
+ const char* selection,
+ size_t selection_size,
+ char* output,
+ uint32_t* output_size);
+
+#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_BINDINGS_H_
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc
new file mode 100644
index 0000000000..feb8104297
--- /dev/null
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_bindings_unittest.cc
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "rtc_tools/rtc_event_log_visualizer/analyzer_bindings.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "rtc_base/protobuf_utils.h"
+#include "rtc_base/system/file_wrapper.h"
+#include "test/gmock.h"
+#include "test/gtest.h"
+#include "test/testsupport/file_utils.h"
+
+#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
+#include "external/webrtc/webrtc/rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+#else
+#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+#endif
+
+TEST(RtcEventLogAnalyzerBindingsTest, ProducesCharts) {
+ constexpr int kInputBufferSize = 1'000'000;
+ constexpr int kOutputBufferSize = 1'000'000;
+ std::unique_ptr<char[]> input = std::make_unique<char[]>(kInputBufferSize);
+ std::unique_ptr<char[]> output = std::make_unique<char[]>(kOutputBufferSize);
+
+ // Read an RTC event log to a char buffer.
+ std::string file_name = webrtc::test::ResourcePath(
+ "rtc_event_log/rtc_event_log_500kbps", "binarypb");
+ webrtc::FileWrapper file = webrtc::FileWrapper::OpenReadOnly(file_name);
+ ASSERT_TRUE(file.is_open());
+ int64_t file_size = file.FileSize();
+ ASSERT_LE(file_size, kInputBufferSize);
+ ASSERT_GT(file_size, 0);
+ size_t input_size = file.Read(input.get(), static_cast<size_t>(file_size));
+ ASSERT_EQ(static_cast<size_t>(file_size), input_size);
+
+ // Call analyzer.
+ uint32_t output_size = kOutputBufferSize;
+ char selection[] = "outgoing_bitrate,network_delay_feedback";
+ size_t selection_size = strlen(selection);
+ analyze_rtc_event_log(input.get(), input_size, selection, selection_size,
+ output.get(), &output_size);
+ ASSERT_GT(output_size, 0u);
+
+ // Parse output as charts.
+ webrtc::analytics::ChartCollection collection;
+ bool success =
+ collection.ParseFromArray(output.get(), static_cast<int>(output_size));
+ ASSERT_TRUE(success);
+ EXPECT_EQ(collection.charts().size(), 2);
+ std::vector<std::string> chart_titles;
+ for (const auto& chart : collection.charts()) {
+ chart_titles.push_back(chart.title());
+ }
+ EXPECT_THAT(chart_titles,
+ ::testing::UnorderedElementsAre(
+ "Outgoing RTP bitrate",
+ "Outgoing network delay (based on per-packet feedback)"));
+ std::vector<std::string> chart_ids;
+ for (const auto& chart : collection.charts()) {
+ chart_ids.push_back(chart.id());
+ }
+ EXPECT_THAT(chart_ids, ::testing::UnorderedElementsAre(
+ "outgoing_bitrate", "network_delay_feedback"));
+}
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_common.cc b/rtc_tools/rtc_event_log_visualizer/analyzer_common.cc
index 3d3ce5a4ac..be635fb48c 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer_common.cc
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_common.cc
@@ -11,6 +11,12 @@
#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
+#include <cstdint>
+#include <string>
+
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
+#include "rtc_base/strings/string_builder.h"
+
namespace webrtc {
bool IsRtxSsrc(const ParsedRtcEventLog& parsed_log,
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer_common.h b/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
index b0b556aa62..5f778cb156 100644
--- a/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
+++ b/rtc_tools/rtc_event_log_visualizer/analyzer_common.h
@@ -11,11 +11,14 @@
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_COMMON_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_COMMON_H_
+#include <cstddef>
#include <cstdint>
#include <string>
#include "absl/types/optional.h"
#include "api/function_view.h"
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
diff --git a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc
index 2ef40e62bf..a32c800b70 100644
--- a/rtc_tools/rtc_event_log_visualizer/log_simulation.cc
+++ b/rtc_tools/rtc_event_log_visualizer/log_simulation.cc
@@ -10,10 +10,24 @@
#include "rtc_tools/rtc_event_log_visualizer/log_simulation.h"
#include <algorithm>
+#include <cstdint>
+#include <functional>
+#include <memory>
#include <utility>
+#include "api/transport/network_control.h"
+#include "api/transport/network_types.h"
+#include "api/units/data_rate.h"
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
+#include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
+#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
+#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
+#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "logging/rtc_event_log/rtc_event_processor.h"
+#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/time_util.h"
+#include "rtc_base/network/sent_packet.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
diff --git a/rtc_tools/rtc_event_log_visualizer/log_simulation.h b/rtc_tools/rtc_event_log_visualizer/log_simulation.h
index 15ed25388c..dbb0a1c798 100644
--- a/rtc_tools/rtc_event_log_visualizer/log_simulation.h
+++ b/rtc_tools/rtc_event_log_visualizer/log_simulation.h
@@ -10,15 +10,23 @@
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_LOG_SIMULATION_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_LOG_SIMULATION_H_
+#include <cstddef>
+#include <cstdint>
#include <deque>
#include <functional>
#include <map>
#include <memory>
-#include <vector>
+#include "api/rtc_event_log/rtc_event_log.h"
#include "api/transport/network_control.h"
+#include "api/transport/network_types.h"
+#include "api/units/timestamp.h"
+#include "logging/rtc_event_log/events/logged_rtp_rtcp.h"
+#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
+#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/congestion_controller/rtp/transport_feedback_adapter.h"
+#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
namespace webrtc {
diff --git a/rtc_tools/rtc_event_log_visualizer/main.cc b/rtc_tools/rtc_event_log_visualizer/main.cc
index aa52527903..e9a747ceb7 100644
--- a/rtc_tools/rtc_event_log_visualizer/main.cc
+++ b/rtc_tools/rtc_event_log_visualizer/main.cc
@@ -227,7 +227,7 @@ int main(int argc, char* argv[]) {
{"sendside_bwe",
{"outgoing_packet_sizes", "outgoing_bitrate", "outgoing_stream_bitrate",
"simulated_sendside_bwe", "network_delay_feedback",
- "fraction_loss_feedback"}},
+ "fraction_loss_feedback", "outgoing_twcc_loss"}},
{"receiveside_bwe",
{"incoming_packet_sizes", "incoming_delay", "incoming_loss_rate",
"incoming_bitrate", "incoming_stream_bitrate",
@@ -377,6 +377,9 @@ int main(int argc, char* argv[]) {
plots.RegisterPlot("simulated_goog_cc", [&](Plot* plot) {
analyzer.CreateGoogCcSimulationGraph(plot);
});
+ plots.RegisterPlot("outgoing_twcc_loss", [&](Plot* plot) {
+ analyzer.CreateOutgoingTWCCLossRateGraph(plot);
+ });
plots.RegisterPlot("network_delay_feedback", [&](Plot* plot) {
analyzer.CreateNetworkDelayFeedbackGraph(plot);
});
@@ -610,9 +613,8 @@ int main(int argc, char* argv[]) {
for (const auto& plot : plots) {
if (plot.enabled) {
- Plot* output = collection.AppendNewPlot();
+ Plot* output = collection.AppendNewPlot(plot.label);
plot.plot_func(output);
- output->SetId(plot.label);
}
}
diff --git a/rtc_tools/rtc_event_log_visualizer/plot_base.cc b/rtc_tools/rtc_event_log_visualizer/plot_base.cc
index 294500ccf1..597a22c822 100644
--- a/rtc_tools/rtc_event_log_visualizer/plot_base.cc
+++ b/rtc_tools/rtc_event_log_visualizer/plot_base.cc
@@ -11,8 +11,14 @@
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
#include <algorithm>
+#include <cstddef>
+#include <cstdio>
#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+#include "absl/strings/string_view.h"
#include "rtc_base/checks.h"
namespace webrtc {
@@ -80,6 +86,10 @@ void Plot::SetId(const std::string& id) {
id_ = id;
}
+void Plot::SetId(absl::string_view id) {
+ id_ = id;
+}
+
void Plot::AppendTimeSeries(TimeSeries&& time_series) {
series_list_.emplace_back(std::move(time_series));
}
@@ -338,4 +348,10 @@ Plot* PlotCollection::AppendNewPlot() {
return plots_.back().get();
}
+Plot* PlotCollection::AppendNewPlot(absl::string_view chart_id) {
+ plots_.push_back(std::make_unique<Plot>());
+ plots_.back()->SetId(chart_id);
+ return plots_.back().get();
+}
+
} // namespace webrtc
diff --git a/rtc_tools/rtc_event_log_visualizer/plot_base.h b/rtc_tools/rtc_event_log_visualizer/plot_base.h
index bc753e320c..aacffa4d59 100644
--- a/rtc_tools/rtc_event_log_visualizer/plot_base.h
+++ b/rtc_tools/rtc_event_log_visualizer/plot_base.h
@@ -10,6 +10,7 @@
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
+#include <cstdint>
#include <memory>
#include <string>
#include <utility>
@@ -18,11 +19,9 @@
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
-#include "rtc_base/ignore_wundef.h"
-RTC_PUSH_IGNORING_WUNDEF()
+// Generated at build-time by the protobuf compiler.
#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
-RTC_POP_IGNORING_WUNDEF()
namespace webrtc {
@@ -156,6 +155,7 @@ class Plot {
// the title might change in future releases whereas the ID should be stable
// over time.
void SetId(const std::string& id);
+ void SetId(absl::string_view id);
// Add a new TimeSeries to the plot.
void AppendTimeSeries(TimeSeries&& time_series);
@@ -197,6 +197,8 @@ class PlotCollection {
virtual Plot* AppendNewPlot();
+ virtual Plot* AppendNewPlot(absl::string_view);
+
void SetCallTimeToUtcOffsetMs(int64_t calltime_to_utc_ms) {
calltime_to_utc_ms_ = calltime_to_utc_ms;
}
diff --git a/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h b/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h
index fbe68853a3..1d082aae9c 100644
--- a/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h
+++ b/rtc_tools/rtc_event_log_visualizer/plot_protobuf.h
@@ -11,12 +11,11 @@
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_
#include "absl/base/attributes.h"
-#include "rtc_base/ignore_wundef.h"
-RTC_PUSH_IGNORING_WUNDEF()
-#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
-RTC_POP_IGNORING_WUNDEF()
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
+// Generated at build-time by the protobuf compiler.
+#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
+
namespace webrtc {
class ProtobufPlot final : public Plot {
diff --git a/rtc_tools/rtc_event_log_visualizer/proto/chart_enums.proto b/rtc_tools/rtc_event_log_visualizer/proto/chart_enums.proto
index 985ad0ad7d..8df7770e53 100644
--- a/rtc_tools/rtc_event_log_visualizer/proto/chart_enums.proto
+++ b/rtc_tools/rtc_event_log_visualizer/proto/chart_enums.proto
@@ -1,5 +1,6 @@
syntax = "proto3";
// Contains enums used as part of chart.proto
+option optimize_for = LITE_RUNTIME;
package webrtc.analytics;
message ChartStyle {
diff --git a/rtc_tools/unpack_aecdump/unpack.cc b/rtc_tools/unpack_aecdump/unpack.cc
index a43fe75b36..e8bb587cfa 100644
--- a/rtc_tools/unpack_aecdump/unpack.cc
+++ b/rtc_tools/unpack_aecdump/unpack.cc
@@ -29,13 +29,11 @@
#include "common_audio/wav_file.h"
#include "modules/audio_processing/test/protobuf_utils.h"
#include "rtc_base/checks.h"
-#include "rtc_base/ignore_wundef.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/system/arch.h"
-RTC_PUSH_IGNORING_WUNDEF()
+// Generated at build-time by the protobuf compiler.
#include "modules/audio_processing/debug.pb.h"
-RTC_POP_IGNORING_WUNDEF()
ABSL_FLAG(std::string,
input_file,
diff --git a/rtc_tools/video_encoder/video_encoder.cc b/rtc_tools/video_encoder/video_encoder.cc
index d2b9b5844e..9436910ed3 100644
--- a/rtc_tools/video_encoder/video_encoder.cc
+++ b/rtc_tools/video_encoder/video_encoder.cc
@@ -16,6 +16,7 @@
#include "api/test/frame_generator_interface.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
+#include "media/base/media_constants.h"
#include "modules/video_coding/codecs/av1/av1_svc_config.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/svc/scalability_mode_util.h"
@@ -72,9 +73,6 @@ ABSL_FLAG(bool, verbose, false, "Verbose logs to stderr");
namespace webrtc {
namespace {
-// See `WebRtcVideoSendChannel::kDefaultQpMax`.
-constexpr unsigned int kDefaultQpMax = 56;
-
[[maybe_unused]] const char* InterLayerPredModeToString(
const InterLayerPredMode& inter_layer_pred_mode) {
switch (inter_layer_pred_mode) {
@@ -257,8 +255,6 @@ class TestVideoEncoderFactoryWrapper final {
video_codec.active = true;
- video_codec.qpMax = kDefaultQpMax;
-
// Simulcast is not implemented at this moment.
video_codec.numberOfSimulcastStreams = 0;
@@ -270,6 +266,7 @@ class TestVideoEncoderFactoryWrapper final {
*(video_codec.VP8()) = VideoEncoder::GetDefaultVp8Settings();
video_codec.VP8()->numberOfTemporalLayers = temporal_layers;
+ video_codec.qpMax = cricket::kDefaultVideoMaxQpVpx;
break;
case kVideoCodecVP9:
@@ -277,6 +274,7 @@ class TestVideoEncoderFactoryWrapper final {
video_codec.VP9()->numberOfSpatialLayers = spatial_layers;
video_codec.VP9()->numberOfTemporalLayers = temporal_layers;
video_codec.VP9()->interLayerPred = inter_layer_pred_mode;
+ video_codec.qpMax = cricket::kDefaultVideoMaxQpVpx;
break;
case kVideoCodecH264:
@@ -284,6 +282,7 @@ class TestVideoEncoderFactoryWrapper final {
*(video_codec.H264()) = VideoEncoder::GetDefaultH264Settings();
video_codec.H264()->numberOfTemporalLayers = temporal_layers;
+ video_codec.qpMax = cricket::kDefaultVideoMaxQpH26x;
break;
case kVideoCodecAV1:
@@ -294,9 +293,11 @@ class TestVideoEncoderFactoryWrapper final {
} else {
RTC_LOG(LS_WARNING) << "Failed to configure svc bitrates for av1.";
}
+ video_codec.qpMax = cricket::kDefaultVideoMaxQpVpx;
break;
case kVideoCodecH265:
// TODO(bugs.webrtc.org/13485)
+ video_codec.qpMax = cricket::kDefaultVideoMaxQpH26x;
break;
default:
RTC_CHECK_NOTREACHED();
diff --git a/rtc_tools/video_file_reader.h b/rtc_tools/video_file_reader.h
index 1293beba2f..270955b5f5 100644
--- a/rtc_tools/video_file_reader.h
+++ b/rtc_tools/video_file_reader.h
@@ -16,16 +16,16 @@
#include <iterator>
#include <string>
+#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/video/video_frame_buffer.h"
-#include "rtc_base/ref_count.h"
namespace webrtc {
namespace test {
// Iterable class representing a sequence of I420 buffers. This class is not
// thread safe because it is expected to be backed by a file.
-class Video : public rtc::RefCountInterface {
+class Video : public RefCountInterface {
public:
class Iterator {
public:
diff --git a/rtc_tools/video_replay.cc b/rtc_tools/video_replay.cc
index c8bfec2ade..b19850ed57 100644
--- a/rtc_tools/video_replay.cc
+++ b/rtc_tools/video_replay.cc
@@ -494,10 +494,10 @@ class RtpReplayer final {
"worker_thread", TaskQueueFactory::Priority::NORMAL));
rtc::Event event;
worker_thread_->PostTask([&]() {
- Call::Config call_config(&event_log_);
+ CallConfig call_config(&event_log_);
call_config.trials = field_trials_.get();
call_config.task_queue_factory = task_queue_factory;
- call_.reset(Call::Create(call_config));
+ call_ = Call::Create(call_config);
// Creation of the streams must happen inside a task queue because it is
// resued as a worker thread.
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 4f5ceb5ed3..bff9b91680 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -1051,6 +1051,7 @@ if (is_ios || is_mac) {
":videosource_objc",
":videotoolbox_objc",
"../api:dtmf_sender_interface",
+ "../api:enable_media",
"../api:libjingle_peerconnection_api",
"../api:media_stream_interface",
"../api:rtc_event_log_output_file",
@@ -1071,7 +1072,6 @@ if (is_ios || is_mac) {
"../api/video_codecs:video_codecs_api",
"../common_video",
"../media:media_constants",
- "../media:rtc_audio_video",
"../media:rtc_media_base",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing",
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 9aae8b9aa5..b050933aac 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -221,6 +221,7 @@ if (is_android) {
"api/org/webrtc/GlTextureFrameBuffer.java",
"api/org/webrtc/GlUtil.java",
"api/org/webrtc/JavaI420Buffer.java",
+ "api/org/webrtc/RenderSynchronizer.java",
"api/org/webrtc/RendererCommon.java",
"api/org/webrtc/SurfaceTextureHelper.java",
"api/org/webrtc/TextureBufferImpl.java",
@@ -767,8 +768,8 @@ if (current_os == "linux" || is_android) {
":native_api_jni",
":native_api_stacktrace",
"..:media_constraints",
- "../../api:callfactory_api",
"../../api:dtmf_sender_interface",
+ "../../api:enable_media",
"../../api:libjingle_peerconnection_api",
"../../api:media_stream_interface",
"../../api:rtc_event_log_output_file",
@@ -780,7 +781,6 @@ if (current_os == "linux" || is_android) {
"../../api/task_queue:default_task_queue_factory",
"../../api/video_codecs:video_codecs_api",
"../../call:call_interfaces",
- "../../media:rtc_audio_video",
"../../media:rtc_media_base",
"../../modules/audio_device",
"../../modules/audio_processing:api",
@@ -1631,6 +1631,7 @@ if (is_android) {
":native_test_jni_onload",
":opensles_audio_device_module",
":video_jni",
+ "../../api:enable_media_with_defaults",
"../../api:field_trials_view",
"../../api:scoped_refptr",
"../../api/rtc_event_log:rtc_event_log_factory",
@@ -1641,7 +1642,6 @@ if (is_android) {
"../../media:rtc_audio_video",
"../../media:rtc_internal_video_codecs",
"../../media:rtc_media_base",
- "../../media:rtc_media_engine_defaults",
"../../modules/audio_device",
"../../modules/audio_device:mock_audio_device",
"../../modules/audio_processing:api",
@@ -1720,6 +1720,7 @@ if (is_android) {
"tests/src/org/webrtc/HardwareVideoEncoderTest.java",
"tests/src/org/webrtc/IceCandidateTest.java",
"tests/src/org/webrtc/RefCountDelegateTest.java",
+ "tests/src/org/webrtc/RenderSynchronizerTest.java",
"tests/src/org/webrtc/ScalingSettingsTest.java",
"tests/src/org/webrtc/audio/LowLatencyAudioBufferManagerTest.java",
]
diff --git a/sdk/android/api/org/webrtc/EglRenderer.java b/sdk/android/api/org/webrtc/EglRenderer.java
index 202094a092..0a0479b311 100644
--- a/sdk/android/api/org/webrtc/EglRenderer.java
+++ b/sdk/android/api/org/webrtc/EglRenderer.java
@@ -332,7 +332,6 @@ public class EglRenderer implements VideoSink {
* Set if the video stream should be mirrored horizontally or not.
*/
public void setMirror(final boolean mirror) {
- logD("setMirrorHorizontally: " + mirror);
synchronized (layoutLock) {
this.mirrorHorizontally = mirror;
}
@@ -342,7 +341,6 @@ public class EglRenderer implements VideoSink {
* Set if the video stream should be mirrored vertically or not.
*/
public void setMirrorVertically(final boolean mirrorVertically) {
- logD("setMirrorVertically: " + mirrorVertically);
synchronized (layoutLock) {
this.mirrorVertically = mirrorVertically;
}
@@ -353,7 +351,6 @@ public class EglRenderer implements VideoSink {
* Set this to 0 to disable cropping.
*/
public void setLayoutAspectRatio(float layoutAspectRatio) {
- logD("setLayoutAspectRatio: " + layoutAspectRatio);
synchronized (layoutLock) {
this.layoutAspectRatio = layoutAspectRatio;
}
@@ -366,7 +363,6 @@ public class EglRenderer implements VideoSink {
* reduction.
*/
public void setFpsReduction(float fps) {
- logD("setFpsReduction: " + fps);
synchronized (fpsReductionLock) {
final long previousRenderPeriodNs = minRenderPeriodNs;
if (fps <= 0) {
@@ -562,6 +558,32 @@ public class EglRenderer implements VideoSink {
}
}
+ private void swapBuffersOnRenderThread(final VideoFrame frame, long swapBuffersStartTimeNs) {
+ synchronized (threadLock) {
+ if (eglThread != null) {
+ eglThread.scheduleRenderUpdate(
+ runsInline -> {
+ if (!runsInline) {
+ if (eglBase == null || !eglBase.hasSurface()) {
+ return;
+ }
+ eglBase.makeCurrent();
+ }
+
+ if (usePresentationTimeStamp) {
+ eglBase.swapBuffers(frame.getTimestampNs());
+ } else {
+ eglBase.swapBuffers();
+ }
+
+ synchronized (statisticsLock) {
+ renderSwapBufferTimeNs += (System.nanoTime() - swapBuffersStartTimeNs);
+ }
+ });
+ }
+ }
+ }
+
/**
* Renders and releases `pendingFrame`.
*/
@@ -638,17 +660,11 @@ public class EglRenderer implements VideoSink {
eglBase.surfaceWidth(), eglBase.surfaceHeight());
final long swapBuffersStartTimeNs = System.nanoTime();
- if (usePresentationTimeStamp) {
- eglBase.swapBuffers(frame.getTimestampNs());
- } else {
- eglBase.swapBuffers();
- }
+ swapBuffersOnRenderThread(frame, swapBuffersStartTimeNs);
- final long currentTimeNs = System.nanoTime();
synchronized (statisticsLock) {
++framesRendered;
- renderTimeNs += (currentTimeNs - startTimeNs);
- renderSwapBufferTimeNs += (currentTimeNs - swapBuffersStartTimeNs);
+ renderTimeNs += (swapBuffersStartTimeNs - startTimeNs);
}
}
@@ -663,8 +679,8 @@ public class EglRenderer implements VideoSink {
drawer.release();
frameDrawer.release();
bitmapTextureFramebuffer.release();
- // Continue here on purpose and retry again for next frame. In worst case, this is a continous
- // problem and no more frames will be drawn.
+ // Continue here on purpose and retry again for next frame. In worst case, this is a
+ // continuous problem and no more frames will be drawn.
} finally {
frame.release();
}
diff --git a/sdk/android/api/org/webrtc/EglThread.java b/sdk/android/api/org/webrtc/EglThread.java
index 47f7810b7c..73323d59c8 100644
--- a/sdk/android/api/org/webrtc/EglThread.java
+++ b/sdk/android/api/org/webrtc/EglThread.java
@@ -21,7 +21,7 @@ import java.util.List;
import org.webrtc.EglBase.EglConnection;
/** EGL graphics thread that allows multiple clients to share the same underlying EGLContext. */
-public class EglThread {
+public class EglThread implements RenderSynchronizer.Listener {
/** Callback for externally managed reference count. */
public interface ReleaseMonitor {
/**
@@ -31,8 +31,21 @@ public class EglThread {
boolean onRelease(EglThread eglThread);
}
- public static EglThread create(@Nullable ReleaseMonitor releaseMonitor,
- @Nullable final EglBase.Context sharedContext, final int[] configAttributes) {
+ /** Interface for clients to schedule rendering updates that will run synchronized. */
+ public interface RenderUpdate {
+
+ /**
+ * Called by EglThread when the rendering window is open. `runsInline` is true when the update
+ * is executed directly while the client schedules the update.
+ */
+ void update(boolean runsInline);
+ }
+
+ public static EglThread create(
+ @Nullable ReleaseMonitor releaseMonitor,
+ @Nullable final EglBase.Context sharedContext,
+ final int[] configAttributes,
+ @Nullable RenderSynchronizer renderSynchronizer) {
final HandlerThread renderThread = new HandlerThread("EglThread");
renderThread.start();
HandlerWithExceptionCallbacks handler =
@@ -53,7 +66,17 @@ public class EglThread {
});
return new EglThread(
- releaseMonitor != null ? releaseMonitor : eglThread -> true, handler, eglConnection);
+ releaseMonitor != null ? releaseMonitor : eglThread -> true,
+ handler,
+ eglConnection,
+ renderSynchronizer);
+ }
+
+ public static EglThread create(
+ @Nullable ReleaseMonitor releaseMonitor,
+ @Nullable final EglBase.Context sharedContext,
+ final int[] configAttributes) {
+ return create(releaseMonitor, sharedContext, configAttributes, /* renderSynchronizer= */ null);
}
/**
@@ -98,12 +121,22 @@ public class EglThread {
private final ReleaseMonitor releaseMonitor;
private final HandlerWithExceptionCallbacks handler;
private final EglConnection eglConnection;
-
- private EglThread(ReleaseMonitor releaseMonitor, HandlerWithExceptionCallbacks handler,
- EglConnection eglConnection) {
+ private final RenderSynchronizer renderSynchronizer;
+ private final List<RenderUpdate> pendingRenderUpdates = new ArrayList<>();
+ private boolean renderWindowOpen = true;
+
+ private EglThread(
+ ReleaseMonitor releaseMonitor,
+ HandlerWithExceptionCallbacks handler,
+ EglConnection eglConnection,
+ RenderSynchronizer renderSynchronizer) {
this.releaseMonitor = releaseMonitor;
this.handler = handler;
this.eglConnection = eglConnection;
+ this.renderSynchronizer = renderSynchronizer;
+ if (renderSynchronizer != null) {
+ renderSynchronizer.registerListener(this);
+ }
}
public void release() {
@@ -112,6 +145,10 @@ public class EglThread {
return;
}
+ if (renderSynchronizer != null) {
+ renderSynchronizer.removeListener(this);
+ }
+
handler.post(eglConnection::release);
handler.getLooper().quitSafely();
}
@@ -146,4 +183,34 @@ public class EglThread {
public void removeExceptionCallback(Runnable callback) {
handler.removeExceptionCallback(callback);
}
+
+ /**
+ * Schedules a render update (like swapBuffers) to be run in sync with other updates on the next
+ * open render window. If the render window is currently open the update will run immediately.
+ * This method must be called on the EglThread during a render pass.
+ */
+ public void scheduleRenderUpdate(RenderUpdate update) {
+ if (renderWindowOpen) {
+ update.update(/* runsInline = */true);
+ } else {
+ pendingRenderUpdates.add(update);
+ }
+ }
+
+ @Override
+ public void onRenderWindowOpen() {
+ handler.post(
+ () -> {
+ renderWindowOpen = true;
+ for (RenderUpdate update : pendingRenderUpdates) {
+ update.update(/* runsInline = */false);
+ }
+ pendingRenderUpdates.clear();
+ });
+ }
+
+ @Override
+ public void onRenderWindowClose() {
+ handler.post(() -> renderWindowOpen = false);
+ }
}
diff --git a/sdk/android/api/org/webrtc/RenderSynchronizer.java b/sdk/android/api/org/webrtc/RenderSynchronizer.java
new file mode 100644
index 0000000000..b1ade84298
--- /dev/null
+++ b/sdk/android/api/org/webrtc/RenderSynchronizer.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+package org.webrtc;
+
+import android.os.Handler;
+import android.os.Looper;
+import android.view.Choreographer;
+import androidx.annotation.GuardedBy;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Class to synchronize rendering updates with display refresh cycles and save power by blocking
+ * updates that exceeds the target frame rate.
+ */
+public final class RenderSynchronizer {
+
+ /** Interface for listening to render window updates. */
+ public interface Listener {
+ void onRenderWindowOpen();
+
+ void onRenderWindowClose();
+ }
+
+ private static final String TAG = "RenderSynchronizer";
+ private static final float DEFAULT_TARGET_FPS = 30f;
+ private final Object lock = new Object();
+ private final List<Listener> listeners = new CopyOnWriteArrayList<>();
+ private final long targetFrameIntervalNanos;
+ private final Handler mainThreadHandler;
+ private Choreographer choreographer;
+
+ @GuardedBy("lock")
+ private boolean isListening;
+
+ private boolean renderWindowOpen;
+ private long lastRefreshTimeNanos;
+ private long lastOpenedTimeNanos;
+
+ public RenderSynchronizer(float targetFrameRateFps) {
+ this.targetFrameIntervalNanos = Math.round(TimeUnit.SECONDS.toNanos(1) / targetFrameRateFps);
+ this.mainThreadHandler = new Handler(Looper.getMainLooper());
+ mainThreadHandler.post(() -> this.choreographer = Choreographer.getInstance());
+ Logging.d(TAG, "Created");
+ }
+
+ public RenderSynchronizer() {
+ this(DEFAULT_TARGET_FPS);
+ }
+
+ public void registerListener(Listener listener) {
+ listeners.add(listener);
+
+ synchronized (lock) {
+ if (!isListening) {
+ Logging.d(TAG, "First listener, subscribing to frame callbacks");
+ isListening = true;
+ mainThreadHandler.post(
+ () -> choreographer.postFrameCallback(this::onDisplayRefreshCycleBegin));
+ }
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ private void onDisplayRefreshCycleBegin(long refreshTimeNanos) {
+ synchronized (lock) {
+ if (listeners.isEmpty()) {
+ Logging.d(TAG, "No listeners, unsubscribing to frame callbacks");
+ isListening = false;
+ return;
+ }
+ }
+ choreographer.postFrameCallback(this::onDisplayRefreshCycleBegin);
+
+ long lastOpenDeltaNanos = refreshTimeNanos - lastOpenedTimeNanos;
+ long refreshDeltaNanos = refreshTimeNanos - lastRefreshTimeNanos;
+ lastRefreshTimeNanos = refreshTimeNanos;
+
+ // Make a greedy choice whether to open (or keep open) the render window. If the current time
+ // since the render window was last opened is closer to the target than what we predict it would
+ // be in the next refresh cycle then we open the window.
+ if (Math.abs(lastOpenDeltaNanos - targetFrameIntervalNanos)
+ < Math.abs(lastOpenDeltaNanos - targetFrameIntervalNanos + refreshDeltaNanos)) {
+ lastOpenedTimeNanos = refreshTimeNanos;
+ openRenderWindow();
+ } else if (renderWindowOpen) {
+ closeRenderWindow();
+ }
+ }
+
+ private void openRenderWindow() {
+ renderWindowOpen = true;
+ for (Listener listener : listeners) {
+ listener.onRenderWindowOpen();
+ }
+ }
+
+ private void closeRenderWindow() {
+ renderWindowOpen = false;
+ for (Listener listener : listeners) {
+ listener.onRenderWindowClose();
+ }
+ }
+}
diff --git a/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java b/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java
index c4bb45f419..5a0bf5c74d 100644
--- a/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java
+++ b/sdk/android/api/org/webrtc/audio/AudioDeviceModule.java
@@ -43,4 +43,14 @@ public interface AudioDeviceModule {
default boolean setNoiseSuppressorEnabled(boolean enabled) {
return false;
}
+
+ /**
+ * Sets the preferred field dimension for the built-in microphone. Returns
+ * true if setting was successful, otherwise false is returned.
+ * This functionality can be implemented with
+ * {@code android.media.MicrophoneDirection.setPreferredMicrophoneFieldDimension}.
+ */
+ default boolean setPreferredMicrophoneFieldDimension(float dimension) {
+ return false;
+ }
}
diff --git a/sdk/android/api/org/webrtc/audio/LegacyAudioDeviceModule.java b/sdk/android/api/org/webrtc/audio/LegacyAudioDeviceModule.java
deleted file mode 100644
index de0d0d61f9..0000000000
--- a/sdk/android/api/org/webrtc/audio/LegacyAudioDeviceModule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-package org.webrtc.audio;
-
-import org.webrtc.voiceengine.WebRtcAudioRecord;
-import org.webrtc.voiceengine.WebRtcAudioTrack;
-
-/**
- * This class represents the legacy AudioDeviceModule that is currently hardcoded into C++ WebRTC.
- * It will return a null native AudioDeviceModule pointer, leading to an internal object being
- * created inside WebRTC that is controlled by static calls to the classes under the voiceengine
- * package. Please use the new JavaAudioDeviceModule instead of this class.
- */
-@Deprecated
-public class LegacyAudioDeviceModule implements AudioDeviceModule {
- @Override
- public long getNativeAudioDeviceModulePointer() {
- // Returning a null pointer will make WebRTC construct the built-in legacy AudioDeviceModule for
- // Android internally.
- return 0;
- }
-
- @Override
- public void release() {
- // All control for this ADM goes through static global methods and the C++ object is owned
- // internally by WebRTC.
- }
-
- @Override
- public void setSpeakerMute(boolean mute) {
- WebRtcAudioTrack.setSpeakerMute(mute);
- }
-
- @Override
- public void setMicrophoneMute(boolean mute) {
- WebRtcAudioRecord.setMicrophoneMute(mute);
- }
-}
diff --git a/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java b/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java
index 04e4ab47e8..5b3749afba 100644
--- a/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java
+++ b/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java
@@ -26,12 +26,18 @@ import androidx.test.filters.SmallTest;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.concurrent.CountDownLatch;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
// EmptyActivity is needed for the surface.
+@RunWith(Parameterized.class)
public class EglRendererTest {
private final static String TAG = "EglRendererTest";
private final static int RENDER_WAIT_MS = 1000;
@@ -100,6 +106,9 @@ public class EglRendererTest {
}
}
+ @Parameter(0)
+ public boolean useRenderSynchronizer;
+
final TestFrameListener testFrameListener = new TestFrameListener();
EglRenderer eglRenderer;
@@ -108,14 +117,24 @@ public class EglRendererTest {
int oesTextureId;
SurfaceTexture surfaceTexture;
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[] {true}, new Object[] {false});
+ }
+
@Before
public void setUp() throws Exception {
PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions
.builder(InstrumentationRegistry.getTargetContext())
.setNativeLibraryName(TestConstants.NATIVE_LIBRARY)
.createInitializationOptions());
+ RenderSynchronizer renderSynchronizer = useRenderSynchronizer ? new RenderSynchronizer() : null;
eglThread =
- EglThread.create(null /* releaseMonitor */, null /* sharedContext */, EglBase.CONFIG_RGBA);
+ EglThread.create(
+ null /* releaseMonitor */,
+ null /* sharedContext */,
+ EglBase.CONFIG_RGBA,
+ renderSynchronizer);
eglRenderer = new EglRenderer("TestRenderer: ");
eglRenderer.init(eglThread, new GlRectDrawer(), false /* usePresentationTimeStamp */);
oesTextureId = GlUtil.generateTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
diff --git a/sdk/android/native_unittests/audio_device/audio_device_unittest.cc b/sdk/android/native_unittests/audio_device/audio_device_unittest.cc
index 601f710d22..90476413a2 100644
--- a/sdk/android/native_unittests/audio_device/audio_device_unittest.cc
+++ b/sdk/android/native_unittests/audio_device/audio_device_unittest.cc
@@ -1154,7 +1154,8 @@ TEST_F(AudioDeviceTest, DISABLED_MeasureLoopbackLatency) {
latency_audio_stream->PrintResults();
}
-TEST(JavaAudioDeviceTest, TestRunningTwoAdmsSimultaneously) {
+// TODO(https://crbug.com/webrtc/15537): test randomly fails.
+TEST(JavaAudioDeviceTest, DISABLED_TestRunningTwoAdmsSimultaneously) {
JNIEnv* jni = AttachCurrentThreadIfNeeded();
ScopedJavaLocalRef<jobject> context = GetAppContext(jni);
diff --git a/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc b/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
index b7513909a4..df97e768e6 100644
--- a/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
+++ b/sdk/android/native_unittests/peerconnection/peer_connection_factory_unittest.cc
@@ -11,20 +11,20 @@
#include <memory>
+#include "api/enable_media_with_defaults.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "media/base/media_engine.h"
#include "media/engine/internal_decoder_factory.h"
#include "media/engine/internal_encoder_factory.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "rtc_base/logging.h"
#include "rtc_base/physical_socket_server.h"
#include "rtc_base/thread.h"
#include "sdk/android/generated_native_unittests_jni/PeerConnectionFactoryInitializationHelper_jni.h"
#include "sdk/android/native_api/audio_device_module/audio_device_android.h"
-#include "sdk/android/native_api/jni/jvm.h"
#include "sdk/android/native_api/jni/application_context_provider.h"
+#include "sdk/android/native_api/jni/jvm.h"
#include "sdk/android/src/jni/jni_helpers.h"
#include "test/gtest.h"
@@ -50,21 +50,15 @@ rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> CreateTestPCF(
pcf_deps.worker_thread = worker_thread;
pcf_deps.signaling_thread = signaling_thread;
pcf_deps.task_queue_factory = CreateDefaultTaskQueueFactory();
- pcf_deps.call_factory = CreateCallFactory();
pcf_deps.event_log_factory =
std::make_unique<RtcEventLogFactory>(pcf_deps.task_queue_factory.get());
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = pcf_deps.task_queue_factory.get();
- media_deps.adm =
- CreateJavaAudioDeviceModule(jni, GetAppContext(jni).obj());
- media_deps.video_encoder_factory =
+ pcf_deps.adm = CreateJavaAudioDeviceModule(jni, GetAppContext(jni).obj());
+ pcf_deps.video_encoder_factory =
std::make_unique<webrtc::InternalEncoderFactory>();
- media_deps.video_decoder_factory =
+ pcf_deps.video_decoder_factory =
std::make_unique<webrtc::InternalDecoderFactory>();
- SetMediaEngineDefaults(&media_deps);
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
- RTC_LOG(LS_INFO) << "Media engine created: " << pcf_deps.media_engine.get();
+ EnableMediaWithDefaults(pcf_deps);
auto factory = CreateModularPeerConnectionFactory(std::move(pcf_deps));
RTC_LOG(LS_INFO) << "PeerConnectionFactory created: " << factory.get();
diff --git a/sdk/android/src/java/org/webrtc/EglBase10Impl.java b/sdk/android/src/java/org/webrtc/EglBase10Impl.java
index 5f3cd82e13..caa10e7e51 100644
--- a/sdk/android/src/java/org/webrtc/EglBase10Impl.java
+++ b/sdk/android/src/java/org/webrtc/EglBase10Impl.java
@@ -94,6 +94,7 @@ class EglBase10Impl implements EglBase10 {
private final EGLDisplay eglDisplay;
private final EGLConfig eglConfig;
private final RefCountDelegate refCountDelegate;
+ private EGLSurface currentSurface = EGL10.EGL_NO_SURFACE;
public EglConnection(EGLContext sharedContext, int[] configAttributes) {
egl = (EGL10) EGLContext.getEGL();
@@ -111,6 +112,7 @@ class EglBase10Impl implements EglBase10 {
}
egl.eglDestroyContext(eglDisplay, eglContext);
egl.eglTerminate(eglDisplay);
+ currentSurface = EGL10.EGL_NO_SURFACE;
});
}
@@ -152,6 +154,31 @@ class EglBase10Impl implements EglBase10 {
public EGLConfig getConfig() {
return eglConfig;
}
+
+ public void makeCurrent(EGLSurface eglSurface) {
+ if (egl.eglGetCurrentContext() == eglContext && currentSurface == eglSurface) {
+ return;
+ }
+
+ synchronized (EglBase.lock) {
+ if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
+ throw new GLException(egl.eglGetError(),
+ "eglMakeCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
+ }
+ }
+ currentSurface = eglSurface;
+ }
+
+ public void detachCurrent() {
+ synchronized (EglBase.lock) {
+ if (!egl.eglMakeCurrent(
+ eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)) {
+ throw new GLException(egl.eglGetError(),
+ "eglDetachCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
+ }
+ }
+ currentSurface = EGL10.EGL_NO_SURFACE;
+ }
}
// Create a new context with the specified config type, sharing data with sharedContext.
@@ -339,27 +366,13 @@ class EglBase10Impl implements EglBase10 {
if (eglSurface == EGL10.EGL_NO_SURFACE) {
throw new RuntimeException("No EGLSurface - can't make current");
}
- synchronized (EglBase.lock) {
- EGL10 egl = eglConnection.getEgl();
- if (!egl.eglMakeCurrent(
- eglConnection.getDisplay(), eglSurface, eglSurface, eglConnection.getContext())) {
- throw new GLException(egl.eglGetError(),
- "eglMakeCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
- }
- }
+ eglConnection.makeCurrent(eglSurface);
}
// Detach the current EGL context, so that it can be made current on another thread.
@Override
public void detachCurrent() {
- synchronized (EglBase.lock) {
- EGL10 egl = eglConnection.getEgl();
- if (!egl.eglMakeCurrent(eglConnection.getDisplay(), EGL10.EGL_NO_SURFACE,
- EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT)) {
- throw new GLException(egl.eglGetError(),
- "eglDetachCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
- }
- }
+ eglConnection.detachCurrent();
}
@Override
diff --git a/sdk/android/src/java/org/webrtc/EglBase14Impl.java b/sdk/android/src/java/org/webrtc/EglBase14Impl.java
index 4c0a3e9dfa..22cee8668b 100644
--- a/sdk/android/src/java/org/webrtc/EglBase14Impl.java
+++ b/sdk/android/src/java/org/webrtc/EglBase14Impl.java
@@ -56,6 +56,7 @@ class EglBase14Impl implements EglBase14 {
private final EGLDisplay eglDisplay;
private final EGLConfig eglConfig;
private final RefCountDelegate refCountDelegate;
+ private EGLSurface currentSurface = EGL14.EGL_NO_SURFACE;
public EglConnection(EGLContext sharedContext, int[] configAttributes) {
eglDisplay = getEglDisplay();
@@ -73,6 +74,7 @@ class EglBase14Impl implements EglBase14 {
}
EGL14.eglReleaseThread();
EGL14.eglTerminate(eglDisplay);
+ currentSurface = EGL14.EGL_NO_SURFACE;
});
}
@@ -108,6 +110,31 @@ class EglBase14Impl implements EglBase14 {
public EGLConfig getConfig() {
return eglConfig;
}
+
+ public void makeCurrent(EGLSurface eglSurface) {
+ if (EGL14.eglGetCurrentContext() == eglContext && currentSurface == eglSurface) {
+ return;
+ }
+
+ synchronized (EglBase.lock) {
+ if (!EGL14.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
+ throw new GLException(EGL14.eglGetError(),
+ "eglMakeCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
+ }
+ }
+ currentSurface = eglSurface;
+ }
+
+ public void detachCurrent() {
+ synchronized (EglBase.lock) {
+ if (!EGL14.eglMakeCurrent(
+ eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) {
+ throw new GLException(EGL14.eglGetError(),
+ "eglDetachCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
+ }
+ }
+ currentSurface = EGL14.EGL_NO_SURFACE;
+ }
}
// Create a new context with the specified config type, sharing data with sharedContext.
// `sharedContext` may be null.
@@ -224,25 +251,13 @@ class EglBase14Impl implements EglBase14 {
if (eglSurface == EGL14.EGL_NO_SURFACE) {
throw new RuntimeException("No EGLSurface - can't make current");
}
- synchronized (EglBase.lock) {
- if (!EGL14.eglMakeCurrent(
- eglConnection.getDisplay(), eglSurface, eglSurface, eglConnection.getContext())) {
- throw new GLException(EGL14.eglGetError(),
- "eglMakeCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
- }
- }
+ eglConnection.makeCurrent(eglSurface);
}
// Detach the current EGL context, so that it can be made current on another thread.
@Override
public void detachCurrent() {
- synchronized (EglBase.lock) {
- if (!EGL14.eglMakeCurrent(eglConnection.getDisplay(), EGL14.EGL_NO_SURFACE,
- EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) {
- throw new GLException(EGL14.eglGetError(),
- "eglDetachCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
- }
- }
+ eglConnection.detachCurrent();
}
@Override
diff --git a/sdk/android/src/java/org/webrtc/HardwareVideoEncoder.java b/sdk/android/src/java/org/webrtc/HardwareVideoEncoder.java
index 94dfdf0728..4512d9a049 100644
--- a/sdk/android/src/java/org/webrtc/HardwareVideoEncoder.java
+++ b/sdk/android/src/java/org/webrtc/HardwareVideoEncoder.java
@@ -292,7 +292,7 @@ class HardwareVideoEncoder implements VideoEncoder {
updateInputFormat(codec.getInputFormat());
codec.start();
- } catch (IllegalStateException e) {
+ } catch (IllegalArgumentException | IllegalStateException e) {
Logging.e(TAG, "initEncodeInternal failed", e);
release();
return VideoCodecStatus.FALLBACK_SOFTWARE;
diff --git a/sdk/android/src/jni/audio_device/audio_device_module.cc b/sdk/android/src/jni/audio_device/audio_device_module.cc
index 3742d89dde..3c910b850c 100644
--- a/sdk/android/src/jni/audio_device/audio_device_module.cc
+++ b/sdk/android/src/jni/audio_device/audio_device_module.cc
@@ -575,6 +575,12 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
return output_->GetPlayoutUnderrunCount();
}
+ absl::optional<Stats> GetStats() const override {
+ if (!initialized_)
+ return absl::nullopt;
+ return output_->GetStats();
+ }
+
int32_t AttachAudioBuffer() {
RTC_DLOG(LS_INFO) << __FUNCTION__;
output_->AttachAudioBuffer(audio_device_buffer_.get());
diff --git a/sdk/android/src/jni/audio_device/audio_device_module.h b/sdk/android/src/jni/audio_device/audio_device_module.h
index 9ec73de873..e8acc9031e 100644
--- a/sdk/android/src/jni/audio_device/audio_device_module.h
+++ b/sdk/android/src/jni/audio_device/audio_device_module.h
@@ -66,6 +66,9 @@ class AudioOutput {
virtual absl::optional<uint32_t> MinSpeakerVolume() const = 0;
virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) = 0;
virtual int GetPlayoutUnderrunCount() = 0;
+ virtual absl::optional<AudioDeviceModule::Stats> GetStats() const {
+ return absl::nullopt;
+ }
};
// Extract an android.media.AudioManager from an android.content.Context.
diff --git a/sdk/android/src/jni/pc/peer_connection_factory.cc b/sdk/android/src/jni/pc/peer_connection_factory.cc
index c6099c2736..4d2a41355c 100644
--- a/sdk/android/src/jni/pc/peer_connection_factory.cc
+++ b/sdk/android/src/jni/pc/peer_connection_factory.cc
@@ -14,21 +14,14 @@
#include <utility>
#include "absl/memory/memory.h"
-#include "api/video_codecs/video_decoder_factory.h"
-#include "api/video_codecs/video_encoder_factory.h"
-#include "media/base/media_engine.h"
-#include "modules/audio_device/include/audio_device.h"
-#include "modules/utility/include/jvm_android.h"
-// We don't depend on the audio processing module implementation.
-// The user may pass in a nullptr.
-#include "api/call/call_factory_interface.h"
+#include "api/enable_media.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
+#include "modules/utility/include/jvm_android.h"
#include "rtc_base/event_tracer.h"
#include "rtc_base/physical_socket_server.h"
#include "rtc_base/thread.h"
@@ -276,7 +269,6 @@ ScopedJavaLocalRef<jobject> CreatePeerConnectionFactoryForJava(
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());
dependencies.fec_controller_factory = std::move(fec_controller_factory);
@@ -290,18 +282,15 @@ ScopedJavaLocalRef<jobject> CreatePeerConnectionFactoryForJava(
std::make_unique<AndroidNetworkMonitorFactory>();
}
- cricket::MediaEngineDependencies media_dependencies;
- media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
- media_dependencies.adm = std::move(audio_device_module);
- media_dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
- media_dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
- media_dependencies.audio_processing = std::move(audio_processor);
- media_dependencies.video_encoder_factory =
+ dependencies.adm = std::move(audio_device_module);
+ dependencies.audio_encoder_factory = std::move(audio_encoder_factory);
+ dependencies.audio_decoder_factory = std::move(audio_decoder_factory);
+ dependencies.audio_processing = std::move(audio_processor);
+ dependencies.video_encoder_factory =
absl::WrapUnique(CreateVideoEncoderFactory(jni, jencoder_factory));
- media_dependencies.video_decoder_factory =
+ dependencies.video_decoder_factory =
absl::WrapUnique(CreateVideoDecoderFactory(jni, jdecoder_factory));
- dependencies.media_engine =
- cricket::CreateMediaEngine(std::move(media_dependencies));
+ EnableMedia(dependencies);
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory =
CreateModularPeerConnectionFactory(std::move(dependencies));
diff --git a/sdk/android/src/jni/video_decoder_wrapper.cc b/sdk/android/src/jni/video_decoder_wrapper.cc
index 0c0358d8d6..e083df5ae8 100644
--- a/sdk/android/src/jni/video_decoder_wrapper.cc
+++ b/sdk/android/src/jni/video_decoder_wrapper.cc
@@ -257,9 +257,8 @@ absl::optional<uint8_t> VideoDecoderWrapper::ParseQP(
}
#ifdef RTC_ENABLE_H265
case kVideoCodecH265:
- h265_bitstream_parser_.ParseBitstream(buffer);
- qp = h265_bitstream_parser_.GetLastSliceQp().value_or(-1);
- success = (qp >= 0);
+ h265_bitstream_parser_.ParseBitstream(input_image);
+ qp = h265_bitstream_parser_.GetLastSliceQp();
break;
#endif
default:
diff --git a/sdk/android/tests/src/org/webrtc/RenderSynchronizerTest.java b/sdk/android/tests/src/org/webrtc/RenderSynchronizerTest.java
new file mode 100644
index 0000000000..3292f72c2d
--- /dev/null
+++ b/sdk/android/tests/src/org/webrtc/RenderSynchronizerTest.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2023 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+package org.webrtc;
+
+import static java.lang.Math.ceil;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import androidx.test.runner.AndroidJUnit4;
+import java.time.Duration;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowLooper;
+import org.robolectric.shadows.ShadowChoreographer;
+
+@RunWith(AndroidJUnit4.class)
+@Config(manifest = Config.NONE)
+public class RenderSynchronizerTest {
+
+ private static final Duration FRAME_DELAY = Duration.ofMillis(16);
+ private static final float DEFAULT_FRAME_RATE = 30f;
+
+ @Mock private RenderSynchronizer.Listener mockListener;
+ private RenderSynchronizer renderSynchronizer;
+ private Duration refreshDelay;
+ private float frameRate;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ ShadowChoreographer.setPaused(true);
+ }
+
+ private void init(float displayRefreshRate, float renderFrameRate) {
+ refreshDelay = Duration.ofMillis((long)ceil(1000 / displayRefreshRate));
+ frameRate = renderFrameRate;
+
+ ShadowChoreographer.setFrameDelay(refreshDelay);
+ renderSynchronizer = new RenderSynchronizer(renderFrameRate);
+ renderSynchronizer.registerListener(mockListener);
+ }
+
+ @Test
+ public void renderWindowOpensOnFirstFrame() {
+ init(/* displayRefreshRate= */60f, /* renderFrameRate= */30f);
+
+ advanceOneRefreshCycle();
+ verify(mockListener).onRenderWindowOpen();
+ }
+
+ @Test
+ public void doubleDisplayRefreshRate() {
+ init(/* displayRefreshRate= */60f, /* renderFrameRate= */30f);
+
+ InOrder inOrder = inOrder(mockListener);
+ for (int i = 0; i < 10; ++i) {
+ advanceOneRefreshCycle();
+ inOrder.verify(mockListener).onRenderWindowOpen();
+
+ advanceOneRefreshCycle();
+ inOrder.verify(mockListener).onRenderWindowClose();
+ }
+ }
+
+ @Test
+ public void trippleRefreshRate() {
+ init(/* displayRefreshRate= */90f, /* renderFrameRate= */30f);
+ InOrder inOrder = inOrder(mockListener);
+ for (int i = 0; i < 10; ++i) {
+ advanceOneRefreshCycle();
+ inOrder.verify(mockListener).onRenderWindowOpen();
+
+ advanceOneRefreshCycle();
+ inOrder.verify(mockListener).onRenderWindowClose();
+
+ advanceOneRefreshCycle();
+ // No action expected, window stays closed/
+ }
+ }
+
+ @Test
+ public void equalRefreshRate() {
+ init(/* displayRefreshRate= */30f, /* renderFrameRate= */30f);
+ for (int i = 0; i < 10; ++i) {
+ advanceOneRefreshCycle();
+ }
+ verify(mockListener, times(10)).onRenderWindowOpen();
+ verify(mockListener, times(0)).onRenderWindowClose();
+ }
+
+ @Test
+ public void halfRefreshRate() {
+ init(/* displayRefreshRate= */30f, /* renderFrameRate= */60f);
+ for (int i = 0; i < 10; ++i) {
+ advanceOneRefreshCycle();
+ }
+ verify(mockListener, times(10)).onRenderWindowOpen();
+ verify(mockListener, times(0)).onRenderWindowClose();
+ }
+
+ private void advanceOneRefreshCycle() {
+ advanceBy(refreshDelay);
+ }
+
+ private void advanceBy(Duration duration) {
+ ShadowLooper.idleMainLooper(duration.toMillis(), MILLISECONDS);
+ }
+}
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
index 62b55543d4..15f9eb9ee4 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
@@ -32,12 +32,12 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
+#include "api/enable_media.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/transport/field_trial_based_config.h"
#import "components/video_codec/RTCVideoDecoderFactoryH264.h"
#import "components/video_codec/RTCVideoEncoderFactoryH264.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
@@ -195,21 +195,17 @@
dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();
dependencies.task_queue_factory =
webrtc::CreateDefaultTaskQueueFactory(dependencies.trials.get());
- cricket::MediaEngineDependencies media_deps;
- media_deps.adm = std::move(audioDeviceModule);
- media_deps.task_queue_factory = dependencies.task_queue_factory.get();
- media_deps.audio_encoder_factory = std::move(audioEncoderFactory);
- media_deps.audio_decoder_factory = std::move(audioDecoderFactory);
- media_deps.video_encoder_factory = std::move(videoEncoderFactory);
- media_deps.video_decoder_factory = std::move(videoDecoderFactory);
+ dependencies.adm = std::move(audioDeviceModule);
+ dependencies.audio_encoder_factory = std::move(audioEncoderFactory);
+ dependencies.audio_decoder_factory = std::move(audioDecoderFactory);
+ dependencies.video_encoder_factory = std::move(videoEncoderFactory);
+ dependencies.video_decoder_factory = std::move(videoDecoderFactory);
if (audioProcessingModule) {
- media_deps.audio_processing = std::move(audioProcessingModule);
+ dependencies.audio_processing = std::move(audioProcessingModule);
} else {
- media_deps.audio_processing = webrtc::AudioProcessingBuilder().Create();
+ dependencies.audio_processing = webrtc::AudioProcessingBuilder().Create();
}
- media_deps.trials = dependencies.trials.get();
- dependencies.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
- dependencies.call_factory = webrtc::CreateCallFactory();
+ webrtc::EnableMedia(dependencies);
dependencies.event_log_factory =
std::make_unique<webrtc::RtcEventLogFactory>(dependencies.task_queue_factory.get());
dependencies.network_controller_factory = std::move(networkControllerFactory);
diff --git a/test/BUILD.gn b/test/BUILD.gn
index e8d4fdbc04..fbc1ab1ad5 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -588,16 +588,6 @@ if (rtc_include_tests) {
absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
}
- rtc_library("test_flags") {
- visibility = [ "*" ]
- testonly = true
- sources = [
- "test_flags.cc",
- "test_flags.h",
- ]
- absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
- }
-
rtc_library("test_main_lib") {
visibility = [ "*" ]
testonly = true
@@ -726,6 +716,7 @@ if (rtc_include_tests) {
":test_main",
":test_support",
":test_support_test_artifacts",
+ ":video_codec_tester",
":video_test_common",
":video_test_support",
":y4m_frame_generator",
@@ -733,11 +724,15 @@ if (rtc_include_tests) {
"../api:create_frame_generator",
"../api:create_simulcast_test_fixture_api",
"../api:frame_generator_api",
+ "../api:mock_video_codec_factory",
+ "../api:mock_video_decoder",
+ "../api:mock_video_encoder",
"../api:scoped_refptr",
"../api:simulcast_test_fixture_api",
"../api/task_queue:task_queue_test",
"../api/test/video:function_video_factory",
"../api/test/video:video_frame_writer",
+ "../api/units:data_rate",
"../api/units:time_delta",
"../api/video:encoded_image",
"../api/video:video_frame",
@@ -754,6 +749,7 @@ if (rtc_include_tests) {
"../modules/video_coding:webrtc_h264",
"../modules/video_coding:webrtc_vp8",
"../modules/video_coding:webrtc_vp9",
+ "../modules/video_coding/svc:scalability_mode_util",
"../rtc_base:criticalsection",
"../rtc_base:rtc_event",
"../rtc_base:rtc_task_queue",
@@ -767,6 +763,7 @@ if (rtc_include_tests) {
"scenario:scenario_unittests",
"time_controller:time_controller",
"time_controller:time_controller_unittests",
+ "//third_party/libyuv",
]
absl_deps = [
"//third_party/abseil-cpp/absl/flags:flag",
@@ -791,6 +788,7 @@ if (rtc_include_tests) {
"testsupport/y4m_frame_writer_unittest.cc",
"testsupport/yuv_frame_reader_unittest.cc",
"testsupport/yuv_frame_writer_unittest.cc",
+ "video_codec_tester_unittest.cc",
]
if (rtc_enable_protobuf) {
@@ -1245,6 +1243,15 @@ if (!build_with_chromium) {
]
}
+ rtc_library("test_flags") {
+ testonly = true
+ sources = [
+ "test_flags.cc",
+ "test_flags.h",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
+ }
+
rtc_library("test_common") {
testonly = true
sources = [
@@ -1266,6 +1273,7 @@ if (!build_with_chromium) {
":mock_transport",
":run_loop",
":scoped_key_value_config",
+ ":test_flags",
":test_support",
":test_video_capturer",
":video_test_common",
@@ -1312,7 +1320,10 @@ if (!build_with_chromium) {
"../system_wrappers:field_trial",
"../video/config:encoder_config",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/flags:flag",
+ "//third_party/abseil-cpp/absl/types:optional",
+ ]
if (!is_android && !build_with_chromium) {
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
@@ -1334,6 +1345,8 @@ if (!build_with_chromium && is_android) {
}
rtc_library("call_config_utils") {
+ testonly = true
+
# TODO(bugs.webrtc.org/10814): Remove rtc_json_suppressions as soon as it
# gets removed upstream.
public_configs = [ "../rtc_base:rtc_json_suppressions" ]
@@ -1363,3 +1376,46 @@ rtc_library("fake_encoded_frame") {
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
+
+rtc_library("video_codec_tester") {
+ testonly = true
+ sources = [
+ "video_codec_tester.cc",
+ "video_codec_tester.h",
+ ]
+ deps = [
+ "../api:array_view",
+ "../api/numerics:numerics",
+ "../api/test/metrics:metric",
+ "../api/test/metrics:metrics_logger",
+ "../api/units:data_rate",
+ "../api/units:data_size",
+ "../api/units:frequency",
+ "../api/units:time_delta",
+ "../api/units:timestamp",
+ "../api/video:builtin_video_bitrate_allocator_factory",
+ "../api/video:encoded_image",
+ "../api/video:resolution",
+ "../api/video:video_bitrate_allocator",
+ "../api/video:video_frame",
+ "../api/video_codecs:video_codecs_api",
+ "../media:media_constants",
+ "../modules/video_coding:video_codec_interface",
+ "../modules/video_coding:video_coding_utility",
+ "../modules/video_coding:webrtc_vp9_helpers",
+ "../modules/video_coding/codecs/av1:av1_svc_config",
+ "../modules/video_coding/svc:scalability_mode_util",
+ "../rtc_base:checks",
+ "../rtc_base:logging",
+ "../rtc_base:rtc_event",
+ "../rtc_base:task_queue_for_test",
+ "../rtc_base:timeutils",
+ "../rtc_base/synchronization:mutex",
+ "../system_wrappers",
+ "../test:fileutils",
+ "../test:video_test_support",
+ "//third_party/libyuv",
+ ]
+
+ absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
diff --git a/test/call_test.cc b/test/call_test.cc
index b8a1cd76b8..2b71608ac6 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -97,7 +97,7 @@ void CallTest::RunBaseTest(BaseTest* test) {
num_audio_streams_ = test->GetNumAudioStreams();
num_flexfec_streams_ = test->GetNumFlexfecStreams();
RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0);
- Call::Config send_config(send_event_log_.get());
+ CallConfig send_config(send_event_log_.get());
test->ModifySenderBitrateConfig(&send_config.bitrate_config);
if (num_audio_streams_ > 0) {
CreateFakeAudioDevices(test->CreateCapturer(), test->CreateRenderer());
@@ -117,7 +117,7 @@ void CallTest::RunBaseTest(BaseTest* test) {
}
CreateSenderCall(send_config);
if (test->ShouldCreateReceivers()) {
- Call::Config recv_config(recv_event_log_.get());
+ CallConfig recv_config(recv_event_log_.get());
test->ModifyReceiverBitrateConfig(&recv_config.bitrate_config);
if (num_audio_streams_ > 0) {
AudioState::Config audio_state_config;
@@ -207,35 +207,35 @@ void CallTest::RunBaseTest(BaseTest* test) {
}
void CallTest::CreateCalls() {
- CreateCalls(Call::Config(send_event_log_.get()),
- Call::Config(recv_event_log_.get()));
+ CreateCalls(CallConfig(send_event_log_.get()),
+ CallConfig(recv_event_log_.get()));
}
-void CallTest::CreateCalls(const Call::Config& sender_config,
- const Call::Config& receiver_config) {
+void CallTest::CreateCalls(const CallConfig& sender_config,
+ const CallConfig& receiver_config) {
CreateSenderCall(sender_config);
CreateReceiverCall(receiver_config);
}
void CallTest::CreateSenderCall() {
- CreateSenderCall(Call::Config(send_event_log_.get()));
+ CreateSenderCall(CallConfig(send_event_log_.get()));
}
-void CallTest::CreateSenderCall(const Call::Config& config) {
+void CallTest::CreateSenderCall(const CallConfig& config) {
auto sender_config = config;
sender_config.task_queue_factory = task_queue_factory_.get();
sender_config.network_state_predictor_factory =
network_state_predictor_factory_.get();
sender_config.network_controller_factory = network_controller_factory_.get();
sender_config.trials = &field_trials_;
- sender_call_.reset(Call::Create(sender_config));
+ sender_call_ = Call::Create(sender_config);
}
-void CallTest::CreateReceiverCall(const Call::Config& config) {
+void CallTest::CreateReceiverCall(const CallConfig& config) {
auto receiver_config = config;
receiver_config.task_queue_factory = task_queue_factory_.get();
receiver_config.trials = &field_trials_;
- receiver_call_.reset(Call::Create(receiver_config));
+ receiver_call_ = Call::Create(receiver_config);
}
void CallTest::DestroyCalls() {
diff --git a/test/call_test.h b/test/call_test.h
index 08d0e49a68..8d2b001f72 100644
--- a/test/call_test.h
+++ b/test/call_test.h
@@ -63,11 +63,11 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface {
void RunBaseTest(BaseTest* test);
void CreateCalls();
- void CreateCalls(const Call::Config& sender_config,
- const Call::Config& receiver_config);
+ void CreateCalls(const CallConfig& sender_config,
+ const CallConfig& receiver_config);
void CreateSenderCall();
- void CreateSenderCall(const Call::Config& config);
- void CreateReceiverCall(const Call::Config& config);
+ void CreateSenderCall(const CallConfig& config);
+ void CreateReceiverCall(const CallConfig& config);
void DestroyCalls();
void CreateVideoSendConfig(VideoSendStream::Config* video_config,
diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn
index 114deb03c3..3d2ac7a7e7 100644
--- a/test/fuzzers/BUILD.gn
+++ b/test/fuzzers/BUILD.gn
@@ -519,7 +519,7 @@ webrtc_fuzzer_test("aec3_config_json_fuzzer") {
deps = [
":fuzz_data_helper",
"../../api/audio:aec3_config",
- "../../api/audio:aec3_config_json",
+ "../../modules/audio_processing:aec3_config_json",
]
dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
seed_corpus = "corpora/aec3-config-json-corpus"
diff --git a/test/fuzzers/aec3_config_json_fuzzer.cc b/test/fuzzers/aec3_config_json_fuzzer.cc
index 626350c52c..b2ded1b5b0 100644
--- a/test/fuzzers/aec3_config_json_fuzzer.cc
+++ b/test/fuzzers/aec3_config_json_fuzzer.cc
@@ -11,7 +11,7 @@
#include <string>
#include "api/audio/echo_canceller3_config.h"
-#include "api/audio/echo_canceller3_config_json.h"
+#include "modules/audio_processing/test/echo_canceller3_config_json.h"
#include "test/fuzzers/fuzz_data_helper.h"
namespace webrtc {
diff --git a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
index ea66c4a1c8..93673f0b8e 100644
--- a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
+++ b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
@@ -23,7 +23,7 @@ class DataReader {
template <typename T>
void CopyTo(T* object) {
- static_assert(std::is_pod<T>(), "");
+ static_assert(std::is_trivial_v<T> && std::is_standard_layout_v<T>, "");
uint8_t* destination = reinterpret_cast<uint8_t*>(object);
size_t object_size = sizeof(T);
size_t num_bytes = std::min(size_ - offset_, object_size);
diff --git a/test/fuzzers/utils/rtp_replayer.cc b/test/fuzzers/utils/rtp_replayer.cc
index 83f894dc28..f6d7119338 100644
--- a/test/fuzzers/utils/rtp_replayer.cc
+++ b/test/fuzzers/utils/rtp_replayer.cc
@@ -76,7 +76,7 @@ void RtpReplayer::Replay(
webrtc::RtcEventLogNull event_log;
std::unique_ptr<TaskQueueFactory> task_queue_factory =
CreateDefaultTaskQueueFactory();
- Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.task_queue_factory = task_queue_factory.get();
FieldTrialBasedConfig field_trials;
call_config.trials = &field_trials;
diff --git a/test/mock_transformable_frame.h b/test/mock_transformable_frame.h
index 17d7e834f9..26eb6b7030 100644
--- a/test/mock_transformable_frame.h
+++ b/test/mock_transformable_frame.h
@@ -33,6 +33,7 @@ class MockTransformableAudioFrame : public TransformableAudioFrameInterface {
MOCK_METHOD(uint32_t, GetTimestamp, (), (const, override));
MOCK_METHOD(void, SetRTPTimestamp, (uint32_t), (override));
MOCK_METHOD(Direction, GetDirection, (), (const, override));
+ MOCK_METHOD(std::string, GetMimeType, (), (const, override));
};
} // namespace webrtc
diff --git a/test/network/BUILD.gn b/test/network/BUILD.gn
index 5a6cb31f4b..2b4c39624f 100644
--- a/test/network/BUILD.gn
+++ b/test/network/BUILD.gn
@@ -117,6 +117,7 @@ if (rtc_include_tests && !build_with_chromium) {
":emulated_network",
"../:test_support",
"../../api:callfactory_api",
+ "../../api:enable_media_with_defaults",
"../../api:libjingle_peerconnection_api",
"../../api:scoped_refptr",
"../../api:simulated_network_api",
@@ -125,7 +126,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../../api/transport:field_trial_based_config",
"../../call:simulated_network",
"../../media:rtc_audio_video",
- "../../media:rtc_media_engine_defaults",
"../../modules/audio_device:test_audio_device_module",
"../../p2p:rtc_p2p",
"../../pc:pc_test_utils",
diff --git a/test/network/network_emulation_pc_unittest.cc b/test/network/network_emulation_pc_unittest.cc
index 51a45a8234..09d3946747 100644
--- a/test/network/network_emulation_pc_unittest.cc
+++ b/test/network/network_emulation_pc_unittest.cc
@@ -11,7 +11,7 @@
#include <cstdint>
#include <memory>
-#include "api/call/call_factory_interface.h"
+#include "api/enable_media_with_defaults.h"
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/scoped_refptr.h"
@@ -19,7 +19,6 @@
#include "api/transport/field_trial_based_config.h"
#include "call/simulated_network.h"
#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "modules/audio_device/include/test_audio_device.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/client/basic_port_allocator.h"
@@ -57,23 +56,18 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread) {
PeerConnectionFactoryDependencies pcf_deps;
pcf_deps.task_queue_factory = CreateDefaultTaskQueueFactory();
- pcf_deps.call_factory = CreateCallFactory();
pcf_deps.event_log_factory =
std::make_unique<RtcEventLogFactory>(pcf_deps.task_queue_factory.get());
pcf_deps.network_thread = network_thread;
pcf_deps.signaling_thread = signaling_thread;
pcf_deps.trials = std::make_unique<FieldTrialBasedConfig>();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = pcf_deps.task_queue_factory.get();
- media_deps.adm = TestAudioDeviceModule::Create(
- media_deps.task_queue_factory,
+ pcf_deps.adm = TestAudioDeviceModule::Create(
+ pcf_deps.task_queue_factory.get(),
TestAudioDeviceModule::CreatePulsedNoiseCapturer(kMaxAptitude,
kSamplingFrequency),
TestAudioDeviceModule::CreateDiscardRenderer(kSamplingFrequency),
/*speed=*/1.f);
- media_deps.trials = pcf_deps.trials.get();
- SetMediaEngineDefaults(&media_deps);
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
+ EnableMediaWithDefaults(pcf_deps);
return CreateModularPeerConnectionFactory(std::move(pcf_deps));
}
diff --git a/test/pc/e2e/BUILD.gn b/test/pc/e2e/BUILD.gn
index 75db40eef5..9d1c1d437f 100644
--- a/test/pc/e2e/BUILD.gn
+++ b/test/pc/e2e/BUILD.gn
@@ -96,6 +96,7 @@ if (!build_with_chromium) {
":test_peer",
"../..:copy_to_file_audio_capturer",
"../../../api:create_time_controller",
+ "../../../api:enable_media_with_defaults",
"../../../api:time_controller",
"../../../api/rtc_event_log:rtc_event_log_factory",
"../../../api/task_queue:default_task_queue_factory",
@@ -105,8 +106,6 @@ if (!build_with_chromium) {
"../../../api/transport:field_trial_based_config",
"../../../api/video_codecs:builtin_video_decoder_factory",
"../../../api/video_codecs:builtin_video_encoder_factory",
- "../../../media:rtc_audio_video",
- "../../../media:rtc_media_engine_defaults",
"../../../modules/audio_device:test_audio_device_module",
"../../../modules/audio_processing/aec_dump",
"../../../p2p:rtc_p2p",
@@ -226,6 +225,7 @@ if (!build_with_chromium) {
"../..:field_trial",
"../..:fileutils",
"../..:perf_test",
+ "../..:test_flags",
"../../../api:audio_quality_analyzer_api",
"../../../api:libjingle_peerconnection_api",
"../../../api:media_stream_interface",
@@ -260,7 +260,10 @@ if (!build_with_chromium) {
"analyzer/video:video_quality_analyzer_injection_helper",
"analyzer/video:video_quality_metrics_reporter",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/flags:flag",
+ "//third_party/abseil-cpp/absl/strings",
+ ]
}
peer_connection_e2e_smoke_test_resources = [
diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc
index 83613118f9..5eb47b4682 100644
--- a/test/pc/e2e/peer_connection_quality_test.cc
+++ b/test/pc/e2e/peer_connection_quality_test.cc
@@ -14,6 +14,7 @@
#include <set>
#include <utility>
+#include "absl/flags/flag.h"
#include "absl/strings/string_view.h"
#include "api/jsep.h"
#include "api/media_stream_interface.h"
@@ -44,6 +45,7 @@
#include "test/pc/e2e/peer_params_preprocessor.h"
#include "test/pc/e2e/stats_poller.h"
#include "test/pc/e2e/test_peer_factory.h"
+#include "test/test_flags.h"
#include "test/testsupport/file_utils.h"
namespace webrtc {
@@ -384,7 +386,7 @@ void PeerConnectionE2EQualityTest::Run(RunParams run_params) {
executor_->Start(task_queue_.get());
Timestamp start_time = Now();
- bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest");
+ bool is_quick_test_enabled = absl::GetFlag(FLAGS_webrtc_quick_perf_test);
if (is_quick_test_enabled) {
time_controller_.AdvanceTime(kQuickTestModeRunDuration);
} else {
diff --git a/test/pc/e2e/test_peer_factory.cc b/test/pc/e2e/test_peer_factory.cc
index 9b2f2d6953..dd900027ee 100644
--- a/test/pc/e2e/test_peer_factory.cc
+++ b/test/pc/e2e/test_peer_factory.cc
@@ -13,6 +13,7 @@
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
+#include "api/enable_media_with_defaults.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/test/create_time_controller.h"
#include "api/test/pclf/media_configuration.h"
@@ -21,8 +22,6 @@
#include "api/transport/field_trial_based_config.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
-#include "media/engine/webrtc_media_engine.h"
-#include "media/engine/webrtc_media_engine_defaults.h"
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
#include "p2p/client/basic_port_allocator.h"
#include "rtc_base/thread.h"
@@ -50,18 +49,10 @@ void SetMandatoryEntities(InjectableComponents* components,
RTC_DCHECK(components->pc_dependencies);
// Setup required peer connection factory dependencies.
- if (components->pcf_dependencies->task_queue_factory == nullptr) {
- components->pcf_dependencies->task_queue_factory =
- time_controller.CreateTaskQueueFactory();
- }
- if (components->pcf_dependencies->call_factory == nullptr) {
- components->pcf_dependencies->call_factory =
- CreateTimeControllerBasedCallFactory(&time_controller);
- }
if (components->pcf_dependencies->event_log_factory == nullptr) {
components->pcf_dependencies->event_log_factory =
std::make_unique<RtcEventLogFactory>(
- components->pcf_dependencies->task_queue_factory.get());
+ time_controller.GetTaskQueueFactory());
}
if (!components->pcf_dependencies->trials) {
components->pcf_dependencies->trials =
@@ -154,27 +145,6 @@ rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceModule(
std::move(renderer), /*speed=*/1.f);
}
-std::unique_ptr<cricket::MediaEngineInterface> CreateMediaEngine(
- PeerConnectionFactoryComponents* pcf_dependencies,
- rtc::scoped_refptr<AudioDeviceModule> audio_device_module) {
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = pcf_dependencies->task_queue_factory.get();
- media_deps.adm = audio_device_module;
- media_deps.audio_processing = pcf_dependencies->audio_processing;
- media_deps.audio_mixer = pcf_dependencies->audio_mixer;
- media_deps.video_encoder_factory =
- std::move(pcf_dependencies->video_encoder_factory);
- media_deps.video_decoder_factory =
- std::move(pcf_dependencies->video_decoder_factory);
- media_deps.audio_encoder_factory = pcf_dependencies->audio_encoder_factory;
- media_deps.audio_decoder_factory = pcf_dependencies->audio_decoder_factory;
- webrtc::SetMediaEngineDefaults(&media_deps);
- RTC_DCHECK(pcf_dependencies->trials);
- media_deps.trials = pcf_dependencies->trials.get();
-
- return cricket::CreateMediaEngine(std::move(media_deps));
-}
-
void WrapVideoEncoderFactory(
absl::string_view peer_name,
double bitrate_multiplier,
@@ -212,7 +182,8 @@ void WrapVideoDecoderFactory(
// from InjectableComponents::PeerConnectionFactoryComponents.
PeerConnectionFactoryDependencies CreatePCFDependencies(
std::unique_ptr<PeerConnectionFactoryComponents> pcf_dependencies,
- std::unique_ptr<cricket::MediaEngineInterface> media_engine,
+ TimeController& time_controller,
+ rtc::scoped_refptr<AudioDeviceModule> audio_device_module,
rtc::Thread* signaling_thread,
rtc::Thread* worker_thread,
rtc::Thread* network_thread) {
@@ -220,11 +191,9 @@ PeerConnectionFactoryDependencies CreatePCFDependencies(
pcf_deps.signaling_thread = signaling_thread;
pcf_deps.worker_thread = worker_thread;
pcf_deps.network_thread = network_thread;
- pcf_deps.media_engine = std::move(media_engine);
- pcf_deps.call_factory = std::move(pcf_dependencies->call_factory);
pcf_deps.event_log_factory = std::move(pcf_dependencies->event_log_factory);
- pcf_deps.task_queue_factory = std::move(pcf_dependencies->task_queue_factory);
+ pcf_deps.task_queue_factory = time_controller.CreateTaskQueueFactory();
if (pcf_dependencies->fec_controller_factory != nullptr) {
pcf_deps.fec_controller_factory =
@@ -241,6 +210,18 @@ PeerConnectionFactoryDependencies CreatePCFDependencies(
pcf_deps.trials = std::move(pcf_dependencies->trials);
}
+ // Media dependencies
+ pcf_deps.adm = std::move(audio_device_module);
+ pcf_deps.audio_processing = pcf_dependencies->audio_processing;
+ pcf_deps.audio_mixer = pcf_dependencies->audio_mixer;
+ pcf_deps.video_encoder_factory =
+ std::move(pcf_dependencies->video_encoder_factory);
+ pcf_deps.video_decoder_factory =
+ std::move(pcf_dependencies->video_decoder_factory);
+ pcf_deps.audio_encoder_factory = pcf_dependencies->audio_encoder_factory;
+ pcf_deps.audio_decoder_factory = pcf_dependencies->audio_decoder_factory;
+ EnableMediaWithDefaultsAndTimeController(time_controller, pcf_deps);
+
return pcf_deps;
}
@@ -318,9 +299,9 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
*params->aec_dump_path, -1, task_queue_);
}
rtc::scoped_refptr<AudioDeviceModule> audio_device_module =
- CreateAudioDeviceModule(
- params->audio_config, remote_audio_config, echo_emulation_config,
- components->pcf_dependencies->task_queue_factory.get());
+ CreateAudioDeviceModule(params->audio_config, remote_audio_config,
+ echo_emulation_config,
+ time_controller_.GetTaskQueueFactory());
WrapVideoEncoderFactory(
params->name.value(), params->video_encoder_bitrate_multiplier,
CalculateRequiredSpatialIndexPerStream(
@@ -329,9 +310,6 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
WrapVideoDecoderFactory(params->name.value(),
components->pcf_dependencies.get(),
video_analyzer_helper_);
- std::unique_ptr<cricket::MediaEngineInterface> media_engine =
- CreateMediaEngine(components->pcf_dependencies.get(),
- audio_device_module);
std::unique_ptr<rtc::Thread> owned_worker_thread =
components->worker_thread != nullptr
@@ -346,8 +324,9 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing =
components->pcf_dependencies->audio_processing;
PeerConnectionFactoryDependencies pcf_deps = CreatePCFDependencies(
- std::move(components->pcf_dependencies), std::move(media_engine),
- signaling_thread_, components->worker_thread, components->network_thread);
+ std::move(components->pcf_dependencies), time_controller_,
+ std::move(audio_device_module), signaling_thread_,
+ components->worker_thread, components->network_thread);
rtc::scoped_refptr<PeerConnectionFactoryInterface> peer_connection_factory =
CreateModularPeerConnectionFactory(std::move(pcf_deps));
diff --git a/test/peer_scenario/peer_scenario_client.cc b/test/peer_scenario/peer_scenario_client.cc
index 697bf055a7..60f2ea7f2e 100644
--- a/test/peer_scenario/peer_scenario_client.cc
+++ b/test/peer_scenario/peer_scenario_client.cc
@@ -246,17 +246,13 @@ PeerScenarioClient::PeerScenarioClient(
pcf_deps.network_thread = manager->network_thread();
pcf_deps.signaling_thread = signaling_thread_;
pcf_deps.worker_thread = worker_thread_.get();
- pcf_deps.call_factory =
- CreateTimeControllerBasedCallFactory(net->time_controller());
pcf_deps.task_queue_factory =
net->time_controller()->CreateTaskQueueFactory();
pcf_deps.event_log_factory =
std::make_unique<RtcEventLogFactory>(task_queue_factory_);
pcf_deps.trials = std::make_unique<FieldTrialBasedConfig>();
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = task_queue_factory_;
- media_deps.adm = TestAudioDeviceModule::Create(
+ pcf_deps.adm = TestAudioDeviceModule::Create(
task_queue_factory_,
TestAudioDeviceModule::CreatePulsedNoiseCapturer(
config.audio.pulsed_noise->amplitude *
@@ -264,28 +260,24 @@ PeerScenarioClient::PeerScenarioClient(
config.audio.sample_rate, config.audio.channels),
TestAudioDeviceModule::CreateDiscardRenderer(config.audio.sample_rate));
- media_deps.audio_processing = AudioProcessingBuilder().Create();
if (config.video.use_fake_codecs) {
- media_deps.video_encoder_factory =
- std::make_unique<FakeVideoEncoderFactory>(
- net->time_controller()->GetClock());
- media_deps.video_decoder_factory =
+ pcf_deps.video_encoder_factory = std::make_unique<FakeVideoEncoderFactory>(
+ net->time_controller()->GetClock());
+ pcf_deps.video_decoder_factory =
std::make_unique<FakeVideoDecoderFactory>();
} else {
- media_deps.video_encoder_factory =
+ pcf_deps.video_encoder_factory =
std::make_unique<VideoEncoderFactoryTemplate<
LibvpxVp8EncoderTemplateAdapter, LibvpxVp9EncoderTemplateAdapter,
OpenH264EncoderTemplateAdapter, LibaomAv1EncoderTemplateAdapter>>();
- media_deps.video_decoder_factory =
+ pcf_deps.video_decoder_factory =
std::make_unique<VideoDecoderFactoryTemplate<
LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter,
OpenH264DecoderTemplateAdapter, Dav1dDecoderTemplateAdapter>>();
}
- media_deps.audio_encoder_factory = CreateBuiltinAudioEncoderFactory();
- media_deps.audio_decoder_factory = CreateBuiltinAudioDecoderFactory();
- media_deps.trials = pcf_deps.trials.get();
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
+ EnableMediaWithDefaultsAndTimeController(*net->time_controller(), pcf_deps);
+
pcf_deps.fec_controller_factory = nullptr;
pcf_deps.network_controller_factory = nullptr;
pcf_deps.network_state_predictor_factory = nullptr;
diff --git a/test/rtp_rtcp_observer.h b/test/rtp_rtcp_observer.h
index cbbff1abfc..14c5ce3641 100644
--- a/test/rtp_rtcp_observer.h
+++ b/test/rtp_rtcp_observer.h
@@ -15,6 +15,7 @@
#include <utility>
#include <vector>
+#include "absl/flags/flag.h"
#include "api/array_view.h"
#include "api/test/simulated_network.h"
#include "api/units/time_delta.h"
@@ -25,10 +26,7 @@
#include "system_wrappers/include/field_trial.h"
#include "test/direct_transport.h"
#include "test/gtest.h"
-
-namespace {
-constexpr webrtc::TimeDelta kShortTimeout = webrtc::TimeDelta::Millis(500);
-}
+#include "test/test_flags.h"
namespace webrtc {
namespace test {
@@ -45,8 +43,8 @@ class RtpRtcpObserver {
virtual ~RtpRtcpObserver() {}
virtual bool Wait() {
- if (field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
- observation_complete_.Wait(kShortTimeout);
+ if (absl::GetFlag(FLAGS_webrtc_quick_perf_test)) {
+ observation_complete_.Wait(TimeDelta::Millis(500));
return true;
}
return observation_complete_.Wait(timeout_);
diff --git a/test/scenario/audio_stream.cc b/test/scenario/audio_stream.cc
index 7715555e23..5f7db7acdf 100644
--- a/test/scenario/audio_stream.cc
+++ b/test/scenario/audio_stream.cc
@@ -14,13 +14,11 @@
#include "test/video_test_constants.h"
#if WEBRTC_ENABLE_PROTOBUF
-RTC_PUSH_IGNORING_WUNDEF()
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
#include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h"
#else
#include "modules/audio_coding/audio_network_adaptor/config.pb.h"
#endif
-RTC_POP_IGNORING_WUNDEF()
#endif
namespace webrtc {
diff --git a/test/scenario/call_client.cc b/test/scenario/call_client.cc
index d2019aebc7..fdf36dee08 100644
--- a/test/scenario/call_client.cc
+++ b/test/scenario/call_client.cc
@@ -59,11 +59,12 @@ CallClientFakeAudio InitAudio(TimeController* time_controller) {
return setup;
}
-Call* CreateCall(TimeController* time_controller,
- RtcEventLog* event_log,
- CallClientConfig config,
- LoggingNetworkControllerFactory* network_controller_factory,
- rtc::scoped_refptr<AudioState> audio_state) {
+std::unique_ptr<Call> CreateCall(
+ TimeController* time_controller,
+ RtcEventLog* event_log,
+ CallClientConfig config,
+ LoggingNetworkControllerFactory* network_controller_factory,
+ rtc::scoped_refptr<AudioState> audio_state) {
CallConfig call_config(event_log);
call_config.bitrate_config.max_bitrate_bps =
config.transport.rates.max_rate.bps_or(-1);
@@ -230,9 +231,9 @@ CallClient::CallClient(
log_writer_factory_.get());
fake_audio_setup_ = InitAudio(time_controller_);
- call_.reset(CreateCall(time_controller_, event_log_.get(), config,
- &network_controller_factory_,
- fake_audio_setup_.audio_state));
+ call_ =
+ CreateCall(time_controller_, event_log_.get(), config,
+ &network_controller_factory_, fake_audio_setup_.audio_state);
transport_ = std::make_unique<NetworkNodeTransport>(clock_, call_.get());
});
}
diff --git a/test/scenario/video_stream.cc b/test/scenario/video_stream.cc
index d376a8fbb3..38e42c88e0 100644
--- a/test/scenario/video_stream.cc
+++ b/test/scenario/video_stream.cc
@@ -40,7 +40,6 @@ enum : int { // The first valid value is 1.
kVideoRotationRtpExtensionId,
};
-constexpr int kDefaultMaxQp = cricket::WebRtcVideoSendChannel::kDefaultQpMax;
uint8_t CodecTypeToPayloadType(VideoCodecType codec_type) {
switch (codec_type) {
case VideoCodecType::kVideoCodecGeneric:
@@ -234,8 +233,8 @@ VideoEncoderConfig CreateVideoEncoderConfig(VideoStreamConfig config) {
VideoStreamConfig::Encoder::ContentType::kScreen;
encoder_config.video_stream_factory =
rtc::make_ref_counted<cricket::EncoderStreamFactory>(
- cricket_codec, kDefaultMaxQp, screenshare, screenshare,
- encoder_info);
+ cricket_codec, cricket::kDefaultVideoMaxQpVpx, screenshare,
+ screenshare, encoder_info);
} else {
encoder_config.video_stream_factory =
rtc::make_ref_counted<DefaultVideoStreamFactory>();
diff --git a/test/test_flags.cc b/test/test_flags.cc
index a0fff747fe..4df2583672 100644
--- a/test/test_flags.cc
+++ b/test/test_flags.cc
@@ -49,3 +49,8 @@ ABSL_FLAG(bool,
export_perf_results_new_api,
false,
"Tells to initialize new API for exporting performance metrics");
+
+ABSL_FLAG(bool,
+ webrtc_quick_perf_test,
+ false,
+ "Runs webrtc perfomance tests in quick mode.");
diff --git a/test/test_flags.h b/test/test_flags.h
index 30f918fc7d..84f1c29503 100644
--- a/test/test_flags.h
+++ b/test/test_flags.h
@@ -20,5 +20,6 @@ ABSL_DECLARE_FLAG(std::vector<std::string>, plot);
ABSL_DECLARE_FLAG(std::string, isolated_script_test_perf_output);
ABSL_DECLARE_FLAG(std::string, webrtc_test_metrics_output_path);
ABSL_DECLARE_FLAG(bool, export_perf_results_new_api);
+ABSL_DECLARE_FLAG(bool, webrtc_quick_perf_test);
#endif // TEST_TEST_FLAGS_H_
diff --git a/test/testsupport/yuv_frame_reader.cc b/test/testsupport/yuv_frame_reader.cc
index 02c1a68008..db4ba23269 100644
--- a/test/testsupport/yuv_frame_reader.cc
+++ b/test/testsupport/yuv_frame_reader.cc
@@ -36,7 +36,7 @@ int WrapFrameNum(int frame_num, int num_frames, RepeatMode mode) {
}
RTC_CHECK_EQ(RepeatMode::kPingPong, mode);
- int cycle_len = 2 * (num_frames - 1);
+ int cycle_len = std::max(1, 2 * (num_frames - 1));
int wrapped_num = frame_num % cycle_len;
if (wrapped_num >= num_frames) {
return cycle_len - wrapped_num;
diff --git a/test/testsupport/yuv_frame_reader_unittest.cc b/test/testsupport/yuv_frame_reader_unittest.cc
index b9ea2d0c46..b8f902bb88 100644
--- a/test/testsupport/yuv_frame_reader_unittest.cc
+++ b/test/testsupport/yuv_frame_reader_unittest.cc
@@ -29,8 +29,7 @@ using Ratio = FrameReader::Ratio;
using RepeatMode = YuvFrameReaderImpl::RepeatMode;
constexpr Resolution kResolution({.width = 1, .height = 1});
-constexpr char kFrameContent[3][3] = {{0, 1, 2}, {1, 2, 3}, {2, 3, 4}};
-constexpr int kNumFrames = sizeof(kFrameContent) / sizeof(kFrameContent[0]);
+constexpr int kDefaultNumFrames = 3;
} // namespace
class YuvFrameReaderTest : public ::testing::Test {
@@ -41,39 +40,48 @@ class YuvFrameReaderTest : public ::testing::Test {
void SetUp() override {
filepath_ = webrtc::test::TempFilename(webrtc::test::OutputPath(),
"yuv_frame_reader_unittest");
+ CreateYuvFileAndReader(/*num_frames=*/3, RepeatMode::kSingle);
+ }
+
+ void TearDown() override { remove(filepath_.c_str()); }
+
+ void CreateYuvFileAndReader(int num_frames, RepeatMode repeat_mode) {
FILE* file = fopen(filepath_.c_str(), "wb");
- fwrite(kFrameContent, 1, sizeof(kFrameContent), file);
+ for (int i = 0; i < num_frames; ++i) {
+ uint8_t y = static_cast<uint8_t>(i & 255);
+ uint8_t u = static_cast<uint8_t>((i + 1) & 255);
+ uint8_t v = static_cast<uint8_t>((i + 2) & 255);
+ fwrite(&y, 1, 1, file);
+ fwrite(&u, 1, 1, file);
+ fwrite(&v, 1, 1, file);
+ }
fclose(file);
- reader_ = CreateYuvFrameReader(filepath_, kResolution);
+ reader_ = CreateYuvFrameReader(filepath_, kResolution, repeat_mode);
}
- void TearDown() override { remove(filepath_.c_str()); }
-
std::string filepath_;
std::unique_ptr<FrameReader> reader_;
};
TEST_F(YuvFrameReaderTest, num_frames) {
- EXPECT_EQ(kNumFrames, reader_->num_frames());
+ EXPECT_EQ(kDefaultNumFrames, reader_->num_frames());
}
TEST_F(YuvFrameReaderTest, PullFrame_frameContent) {
rtc::scoped_refptr<I420BufferInterface> buffer = reader_->PullFrame();
- EXPECT_EQ(kFrameContent[0][0], *buffer->DataY());
- EXPECT_EQ(kFrameContent[0][1], *buffer->DataU());
- EXPECT_EQ(kFrameContent[0][2], *buffer->DataV());
+ EXPECT_EQ(0u, *buffer->DataY());
+ EXPECT_EQ(1u, *buffer->DataU());
+ EXPECT_EQ(2u, *buffer->DataV());
}
TEST_F(YuvFrameReaderTest, ReadFrame_randomOrder) {
- std::vector<int> expected_frames = {2, 0, 1};
- std::vector<int> actual_frames;
- for (int frame_num : expected_frames) {
- rtc::scoped_refptr<I420BufferInterface> buffer =
- reader_->ReadFrame(frame_num);
- actual_frames.push_back(*buffer->DataY());
- }
- EXPECT_EQ(expected_frames, actual_frames);
+ rtc::scoped_refptr<I420BufferInterface> buffer = reader_->ReadFrame(2);
+ EXPECT_EQ(2u, *buffer->DataY());
+ buffer = reader_->ReadFrame(0);
+ EXPECT_EQ(0u, *buffer->DataY());
+ buffer = reader_->ReadFrame(1);
+ EXPECT_EQ(1u, *buffer->DataY());
}
TEST_F(YuvFrameReaderTest, PullFrame_scale) {
@@ -87,30 +95,31 @@ TEST_F(YuvFrameReaderTest, PullFrame_scale) {
class YuvFrameReaderRepeatModeTest
: public YuvFrameReaderTest,
public ::testing::WithParamInterface<
- std::tuple<RepeatMode, std::vector<int>>> {};
+ std::tuple<int, RepeatMode, std::vector<uint8_t>>> {};
TEST_P(YuvFrameReaderRepeatModeTest, PullFrame) {
- RepeatMode mode = std::get<0>(GetParam());
- std::vector<int> expected_frames = std::get<1>(GetParam());
-
- reader_ = CreateYuvFrameReader(filepath_, kResolution, mode);
- std::vector<int> read_frames;
- for (size_t i = 0; i < expected_frames.size(); ++i) {
+ auto [num_frames, repeat_mode, expected_frames] = GetParam();
+ CreateYuvFileAndReader(num_frames, repeat_mode);
+ for (auto expected_frame : expected_frames) {
rtc::scoped_refptr<I420BufferInterface> buffer = reader_->PullFrame();
- read_frames.push_back(*buffer->DataY());
+ EXPECT_EQ(expected_frame, *buffer->DataY());
}
- EXPECT_EQ(expected_frames, read_frames);
}
INSTANTIATE_TEST_SUITE_P(
YuvFrameReaderTest,
YuvFrameReaderRepeatModeTest,
::testing::ValuesIn(
- {std::make_tuple(RepeatMode::kSingle, std::vector<int>{0, 1, 2}),
- std::make_tuple(RepeatMode::kRepeat,
- std::vector<int>{0, 1, 2, 0, 1, 2}),
- std::make_tuple(RepeatMode::kPingPong,
- std::vector<int>{0, 1, 2, 1, 0, 1, 2})}));
+ {std::make_tuple(3, RepeatMode::kSingle, std::vector<uint8_t>{0, 1, 2}),
+ std::make_tuple(3,
+ RepeatMode::kRepeat,
+ std::vector<uint8_t>{0, 1, 2, 0, 1, 2}),
+ std::make_tuple(3,
+ RepeatMode::kPingPong,
+ std::vector<uint8_t>{0, 1, 2, 1, 0, 1, 2}),
+ std::make_tuple(1,
+ RepeatMode::kPingPong,
+ std::vector<uint8_t>{0, 0})}));
class YuvFrameReaderFramerateScaleTest
: public YuvFrameReaderTest,
@@ -118,17 +127,13 @@ class YuvFrameReaderFramerateScaleTest
std::tuple<Ratio, std::vector<int>>> {};
TEST_P(YuvFrameReaderFramerateScaleTest, PullFrame) {
- Ratio framerate_scale = std::get<0>(GetParam());
- std::vector<int> expected_frames = std::get<1>(GetParam());
-
- std::vector<int> actual_frames;
- for (size_t i = 0; i < expected_frames.size(); ++i) {
+ auto [framerate_scale, expected_frames] = GetParam();
+ for (auto expected_frame : expected_frames) {
int pulled_frame;
rtc::scoped_refptr<I420BufferInterface> buffer =
reader_->PullFrame(&pulled_frame, kResolution, framerate_scale);
- actual_frames.push_back(pulled_frame);
+ EXPECT_EQ(pulled_frame, expected_frame);
}
- EXPECT_EQ(expected_frames, actual_frames);
}
INSTANTIATE_TEST_SUITE_P(YuvFrameReaderTest,
diff --git a/test/video_codec_tester.cc b/test/video_codec_tester.cc
new file mode 100644
index 0000000000..26f0a61372
--- /dev/null
+++ b/test/video_codec_tester.cc
@@ -0,0 +1,1260 @@
+/*
+ * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "test/video_codec_tester.h"
+
+#include <algorithm>
+#include <set>
+#include <tuple>
+#include <utility>
+
+#include "api/array_view.h"
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
+#include "api/video/builtin_video_bitrate_allocator_factory.h"
+#include "api/video/i420_buffer.h"
+#include "api/video/video_bitrate_allocator.h"
+#include "api/video/video_codec_type.h"
+#include "api/video/video_frame.h"
+#include "api/video_codecs/video_decoder.h"
+#include "api/video_codecs/video_encoder.h"
+#include "media/base/media_constants.h"
+#include "modules/video_coding/codecs/av1/av1_svc_config.h"
+#include "modules/video_coding/codecs/vp9/svc_config.h"
+#include "modules/video_coding/include/video_codec_interface.h"
+#include "modules/video_coding/include/video_error_codes.h"
+#include "modules/video_coding/svc/scalability_mode_util.h"
+#include "modules/video_coding/utility/ivf_file_writer.h"
+#include "rtc_base/event.h"
+#include "rtc_base/logging.h"
+#include "rtc_base/synchronization/mutex.h"
+#include "rtc_base/task_queue_for_test.h"
+#include "rtc_base/time_utils.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/testsupport/file_utils.h"
+#include "test/testsupport/frame_reader.h"
+#include "test/testsupport/video_frame_writer.h"
+#include "third_party/libyuv/include/libyuv/compare.h"
+
+namespace webrtc {
+namespace test {
+
+namespace {
+using CodedVideoSource = VideoCodecTester::CodedVideoSource;
+using VideoSourceSettings = VideoCodecTester::VideoSourceSettings;
+using EncodingSettings = VideoCodecTester::EncodingSettings;
+using LayerSettings = EncodingSettings::LayerSettings;
+using LayerId = VideoCodecTester::LayerId;
+using EncoderSettings = VideoCodecTester::EncoderSettings;
+using DecoderSettings = VideoCodecTester::DecoderSettings;
+using PacingSettings = VideoCodecTester::PacingSettings;
+using PacingMode = PacingSettings::PacingMode;
+using VideoCodecStats = VideoCodecTester::VideoCodecStats;
+using DecodeCallback =
+ absl::AnyInvocable<void(const VideoFrame& decoded_frame)>;
+using webrtc::test::ImprovementDirection;
+
+constexpr Frequency k90kHz = Frequency::Hertz(90000);
+
+const std::set<ScalabilityMode> kFullSvcScalabilityModes{
+ ScalabilityMode::kL2T1, ScalabilityMode::kL2T1h, ScalabilityMode::kL2T2,
+ ScalabilityMode::kL2T2h, ScalabilityMode::kL2T3, ScalabilityMode::kL2T3h,
+ ScalabilityMode::kL3T1, ScalabilityMode::kL3T1h, ScalabilityMode::kL3T2,
+ ScalabilityMode::kL3T2h, ScalabilityMode::kL3T3, ScalabilityMode::kL3T3h};
+
+const std::set<ScalabilityMode> kKeySvcScalabilityModes{
+ ScalabilityMode::kL2T1_KEY, ScalabilityMode::kL2T2_KEY,
+ ScalabilityMode::kL2T2_KEY_SHIFT, ScalabilityMode::kL2T3_KEY,
+ ScalabilityMode::kL3T1_KEY, ScalabilityMode::kL3T2_KEY,
+ ScalabilityMode::kL3T3_KEY};
+
+// A thread-safe raw video frame reader.
+class VideoSource {
+ public:
+ explicit VideoSource(VideoSourceSettings source_settings)
+ : source_settings_(source_settings) {
+ MutexLock lock(&mutex_);
+ frame_reader_ = CreateYuvFrameReader(
+ source_settings_.file_path, source_settings_.resolution,
+ YuvFrameReaderImpl::RepeatMode::kPingPong);
+ RTC_CHECK(frame_reader_);
+ }
+
+ // Pulls next frame.
+ VideoFrame PullFrame(uint32_t timestamp_rtp,
+ Resolution resolution,
+ Frequency framerate) {
+ MutexLock lock(&mutex_);
+ int frame_num;
+ auto buffer = frame_reader_->PullFrame(
+ &frame_num, resolution,
+ {.num = framerate.millihertz<int>(),
+ .den = source_settings_.framerate.millihertz<int>()});
+ RTC_CHECK(buffer) << "Can not pull frame. RTP timestamp " << timestamp_rtp;
+ frame_num_[timestamp_rtp] = frame_num;
+ return VideoFrame::Builder()
+ .set_video_frame_buffer(buffer)
+ .set_timestamp_rtp(timestamp_rtp)
+ .set_timestamp_us((timestamp_rtp / k90kHz).us())
+ .build();
+ }
+
+ // Reads frame specified by `timestamp_rtp`, scales it to `resolution` and
+ // returns. Frame with the given `timestamp_rtp` is expected to be pulled
+ // before.
+ VideoFrame ReadFrame(uint32_t timestamp_rtp, Resolution resolution) {
+ MutexLock lock(&mutex_);
+ RTC_CHECK(frame_num_.find(timestamp_rtp) != frame_num_.end())
+ << "Frame with RTP timestamp " << timestamp_rtp
+ << " was not pulled before";
+ auto buffer =
+ frame_reader_->ReadFrame(frame_num_.at(timestamp_rtp), resolution);
+ return VideoFrame::Builder()
+ .set_video_frame_buffer(buffer)
+ .set_timestamp_rtp(timestamp_rtp)
+ .build();
+ }
+
+ private:
+ VideoSourceSettings source_settings_;
+ std::unique_ptr<FrameReader> frame_reader_ RTC_GUARDED_BY(mutex_);
+ std::map<uint32_t, int> frame_num_ RTC_GUARDED_BY(mutex_);
+ Mutex mutex_;
+};
+
+// Pacer calculates delay necessary to keep frame encode or decode call spaced
+// from the previous calls by the pacing time. `Schedule` is expected to be
+// called as close as possible to posting frame encode or decode task. This
+// class is not thread safe.
+class Pacer {
+ public:
+ explicit Pacer(PacingSettings settings)
+ : settings_(settings), delay_(TimeDelta::Zero()) {}
+
+ Timestamp Schedule(Timestamp timestamp) {
+ Timestamp now = Timestamp::Micros(rtc::TimeMicros());
+ if (settings_.mode == PacingMode::kNoPacing) {
+ return now;
+ }
+
+ Timestamp scheduled = now;
+ if (prev_scheduled_) {
+ scheduled = *prev_scheduled_ + PacingTime(timestamp);
+ if (scheduled < now) {
+ scheduled = now;
+ }
+ }
+
+ prev_timestamp_ = timestamp;
+ prev_scheduled_ = scheduled;
+ return scheduled;
+ }
+
+ private:
+ TimeDelta PacingTime(Timestamp timestamp) {
+ if (settings_.mode == PacingMode::kRealTime) {
+ return timestamp - *prev_timestamp_;
+ }
+ RTC_CHECK_EQ(PacingMode::kConstantRate, settings_.mode);
+ return 1 / settings_.constant_rate;
+ }
+
+ PacingSettings settings_;
+ absl::optional<Timestamp> prev_timestamp_;
+ absl::optional<Timestamp> prev_scheduled_;
+ TimeDelta delay_;
+};
+
+class LimitedTaskQueue {
+ public:
+ // The codec tester reads frames from video source in the main thread.
+ // Encoding and decoding are done in separate threads. If encoding or
+ // decoding is slow, the reading may go far ahead and may buffer too many
+ // frames in memory. To prevent this we limit the encoding/decoding queue
+ // size. When the queue is full, the main thread and, hence, reading frames
+ // from video source is blocked until a previously posted encoding/decoding
+ // task starts.
+ static constexpr int kMaxTaskQueueSize = 3;
+
+ LimitedTaskQueue() : queue_size_(0) {}
+
+ void PostScheduledTask(absl::AnyInvocable<void() &&> task, Timestamp start) {
+ ++queue_size_;
+ task_queue_.PostTask([this, task = std::move(task), start]() mutable {
+ // `TaskQueue` doesn't guarantee FIFO order of execution for delayed
+ // tasks.
+ int wait_ms = static_cast<int>(start.ms() - rtc::TimeMillis());
+ if (wait_ms > 0) {
+ SleepMs(wait_ms);
+ }
+ std::move(task)();
+ --queue_size_;
+ task_executed_.Set();
+ });
+
+ task_executed_.Reset();
+ if (queue_size_ > kMaxTaskQueueSize) {
+ task_executed_.Wait(rtc::Event::kForever);
+ RTC_CHECK(queue_size_ <= kMaxTaskQueueSize);
+ }
+ }
+
+ void PostTaskAndWait(absl::AnyInvocable<void() &&> task) {
+ PostScheduledTask(std::move(task), Timestamp::Zero());
+ task_queue_.WaitForPreviouslyPostedTasks();
+ }
+
+ private:
+ TaskQueueForTest task_queue_;
+ std::atomic_int queue_size_;
+ rtc::Event task_executed_;
+};
+
+class TesterY4mWriter {
+ public:
+ explicit TesterY4mWriter(absl::string_view base_path)
+ : base_path_(base_path) {}
+
+ ~TesterY4mWriter() {
+ task_queue_.SendTask([] {});
+ }
+
+ void Write(const VideoFrame& frame, int spatial_idx) {
+ task_queue_.PostTask([this, frame, spatial_idx] {
+ if (y4m_writers_.find(spatial_idx) == y4m_writers_.end()) {
+ std::string file_path =
+ base_path_ + "-s" + std::to_string(spatial_idx) + ".y4m";
+ Y4mVideoFrameWriterImpl* y4m_writer = new Y4mVideoFrameWriterImpl(
+ file_path, frame.width(), frame.height(), /*fps=*/30);
+ RTC_CHECK(y4m_writer);
+
+ y4m_writers_[spatial_idx] =
+ std::unique_ptr<VideoFrameWriter>(y4m_writer);
+ }
+
+ y4m_writers_.at(spatial_idx)->WriteFrame(frame);
+ });
+ }
+
+ private:
+ std::string base_path_;
+ std::map<int, std::unique_ptr<VideoFrameWriter>> y4m_writers_;
+ TaskQueueForTest task_queue_;
+};
+
+class TesterIvfWriter {
+ public:
+ explicit TesterIvfWriter(absl::string_view base_path)
+ : base_path_(base_path) {}
+
+ ~TesterIvfWriter() {
+ task_queue_.SendTask([] {});
+ }
+
+ void Write(const EncodedImage& encoded_frame) {
+ task_queue_.PostTask([this, encoded_frame] {
+ int spatial_idx = encoded_frame.SimulcastIndex().value_or(0);
+ if (ivf_file_writers_.find(spatial_idx) == ivf_file_writers_.end()) {
+ std::string ivf_path =
+ base_path_ + "-s" + std::to_string(spatial_idx) + ".ivf";
+ FileWrapper ivf_file = FileWrapper::OpenWriteOnly(ivf_path);
+ RTC_CHECK(ivf_file.is_open());
+
+ std::unique_ptr<IvfFileWriter> ivf_writer =
+ IvfFileWriter::Wrap(std::move(ivf_file), /*byte_limit=*/0);
+ RTC_CHECK(ivf_writer);
+
+ ivf_file_writers_[spatial_idx] = std::move(ivf_writer);
+ }
+
+ // To play: ffplay -vcodec vp8|vp9|av1|hevc|h264 filename
+ ivf_file_writers_.at(spatial_idx)
+ ->WriteFrame(encoded_frame, VideoCodecType::kVideoCodecGeneric);
+ });
+ }
+
+ private:
+ std::string base_path_;
+ std::map<int, std::unique_ptr<IvfFileWriter>> ivf_file_writers_;
+ TaskQueueForTest task_queue_;
+};
+
+class LeakyBucket {
+ public:
+ LeakyBucket() : level_bits_(0) {}
+
+ // Updates bucket level and returns its current level in bits. Data is remove
+ // from bucket with rate equal to target bitrate of previous frame. Bucket
+ // level is tracked with floating point precision. Returned value of bucket
+ // level is rounded up.
+ int Update(const VideoCodecStats::Frame& frame) {
+ RTC_CHECK(frame.target_bitrate) << "Bitrate must be specified.";
+ if (prev_frame_) {
+ RTC_CHECK_GT(frame.timestamp_rtp, prev_frame_->timestamp_rtp)
+ << "Timestamp must increase.";
+ TimeDelta passed =
+ (frame.timestamp_rtp - prev_frame_->timestamp_rtp) / k90kHz;
+ level_bits_ -=
+ prev_frame_->target_bitrate->bps<double>() * passed.seconds<double>();
+ level_bits_ = std::max(level_bits_, 0.0);
+ }
+ prev_frame_ = frame;
+ level_bits_ += frame.frame_size.bytes() * 8;
+ return static_cast<int>(std::ceil(level_bits_));
+ }
+
+ private:
+ absl::optional<VideoCodecStats::Frame> prev_frame_;
+ double level_bits_;
+};
+
+class VideoCodecAnalyzer : public VideoCodecTester::VideoCodecStats {
+ public:
+ explicit VideoCodecAnalyzer(VideoSource* video_source)
+ : video_source_(video_source) {}
+
+ void StartEncode(const VideoFrame& video_frame,
+ const EncodingSettings& encoding_settings) {
+ int64_t encode_start_us = rtc::TimeMicros();
+ task_queue_.PostTask([this, timestamp_rtp = video_frame.timestamp(),
+ encoding_settings, encode_start_us]() {
+ RTC_CHECK(frames_.find(timestamp_rtp) == frames_.end())
+ << "Duplicate frame. Frame with timestamp " << timestamp_rtp
+ << " was seen before";
+
+ Frame frame;
+ frame.timestamp_rtp = timestamp_rtp;
+ frame.encode_start = Timestamp::Micros(encode_start_us),
+ frames_.emplace(timestamp_rtp,
+ std::map<int, Frame>{{/*spatial_idx=*/0, frame}});
+ encoding_settings_.emplace(timestamp_rtp, encoding_settings);
+ });
+ }
+
+ void FinishEncode(const EncodedImage& encoded_frame) {
+ int64_t encode_finished_us = rtc::TimeMicros();
+ task_queue_.PostTask(
+ [this, timestamp_rtp = encoded_frame.RtpTimestamp(),
+ spatial_idx = encoded_frame.SpatialIndex().value_or(0),
+ temporal_idx = encoded_frame.TemporalIndex().value_or(0),
+ width = encoded_frame._encodedWidth,
+ height = encoded_frame._encodedHeight,
+ frame_type = encoded_frame._frameType,
+ frame_size_bytes = encoded_frame.size(), qp = encoded_frame.qp_,
+ encode_finished_us]() {
+ if (spatial_idx > 0) {
+ RTC_CHECK(frames_.find(timestamp_rtp) != frames_.end())
+ << "Spatial layer 0 frame with timestamp " << timestamp_rtp
+ << " was not seen before";
+ const Frame& base_frame =
+ frames_.at(timestamp_rtp).at(/*spatial_idx=*/0);
+ frames_.at(timestamp_rtp).emplace(spatial_idx, base_frame);
+ }
+
+ Frame& frame = frames_.at(timestamp_rtp).at(spatial_idx);
+ frame.layer_id = {.spatial_idx = spatial_idx,
+ .temporal_idx = temporal_idx};
+ frame.width = width;
+ frame.height = height;
+ frame.frame_size = DataSize::Bytes(frame_size_bytes);
+ frame.qp = qp;
+ frame.keyframe = frame_type == VideoFrameType::kVideoFrameKey;
+ frame.encode_time =
+ Timestamp::Micros(encode_finished_us) - frame.encode_start;
+ frame.encoded = true;
+ });
+ }
+
+ void StartDecode(const EncodedImage& encoded_frame) {
+ int64_t decode_start_us = rtc::TimeMicros();
+ task_queue_.PostTask(
+ [this, timestamp_rtp = encoded_frame.RtpTimestamp(),
+ spatial_idx = encoded_frame.SpatialIndex().value_or(0),
+ frame_size_bytes = encoded_frame.size(), decode_start_us]() {
+ if (frames_.find(timestamp_rtp) == frames_.end() ||
+ frames_.at(timestamp_rtp).find(spatial_idx) ==
+ frames_.at(timestamp_rtp).end()) {
+ Frame frame;
+ frame.timestamp_rtp = timestamp_rtp;
+ frame.layer_id = {.spatial_idx = spatial_idx};
+ frame.frame_size = DataSize::Bytes(frame_size_bytes);
+ frames_.emplace(timestamp_rtp,
+ std::map<int, Frame>{{spatial_idx, frame}});
+ }
+
+ Frame& frame = frames_.at(timestamp_rtp).at(spatial_idx);
+ frame.decode_start = Timestamp::Micros(decode_start_us);
+ });
+ }
+
+ void FinishDecode(const VideoFrame& decoded_frame, int spatial_idx) {
+ int64_t decode_finished_us = rtc::TimeMicros();
+ task_queue_.PostTask([this, timestamp_rtp = decoded_frame.timestamp(),
+ spatial_idx, width = decoded_frame.width(),
+ height = decoded_frame.height(),
+ decode_finished_us]() {
+ Frame& frame = frames_.at(timestamp_rtp).at(spatial_idx);
+ frame.decode_time =
+ Timestamp::Micros(decode_finished_us) - frame.decode_start;
+ if (!frame.encoded) {
+ frame.width = width;
+ frame.height = height;
+ }
+ frame.decoded = true;
+ });
+
+ if (video_source_ != nullptr) {
+ // Copy hardware-backed frame into main memory to release output buffers
+ // which number may be limited in hardware decoders.
+ rtc::scoped_refptr<I420BufferInterface> decoded_buffer =
+ decoded_frame.video_frame_buffer()->ToI420();
+
+ task_queue_.PostTask([this, decoded_buffer,
+ timestamp_rtp = decoded_frame.timestamp(),
+ spatial_idx]() {
+ VideoFrame ref_frame = video_source_->ReadFrame(
+ timestamp_rtp, {.width = decoded_buffer->width(),
+ .height = decoded_buffer->height()});
+ rtc::scoped_refptr<I420BufferInterface> ref_buffer =
+ ref_frame.video_frame_buffer()->ToI420();
+ Frame& frame = frames_.at(timestamp_rtp).at(spatial_idx);
+ frame.psnr = CalcPsnr(*decoded_buffer, *ref_buffer);
+ });
+ }
+ }
+
+ std::vector<Frame> Slice(Filter filter, bool merge) const {
+ std::vector<Frame> slice;
+ for (const auto& [timestamp_rtp, temporal_unit_frames] : frames_) {
+ if (temporal_unit_frames.empty()) {
+ continue;
+ }
+
+ bool is_svc = false;
+ if (!encoding_settings_.empty()) {
+ ScalabilityMode scalability_mode =
+ encoding_settings_.at(timestamp_rtp).scalability_mode;
+ if (kFullSvcScalabilityModes.count(scalability_mode) > 0 ||
+ (kKeySvcScalabilityModes.count(scalability_mode) > 0 &&
+ temporal_unit_frames.at(0).keyframe)) {
+ is_svc = true;
+ }
+ }
+
+ std::vector<Frame> subframes;
+ for (const auto& [spatial_idx, frame] : temporal_unit_frames) {
+ if (frame.timestamp_rtp < filter.min_timestamp_rtp ||
+ frame.timestamp_rtp > filter.max_timestamp_rtp) {
+ continue;
+ }
+ if (filter.layer_id) {
+ if ((is_svc &&
+ frame.layer_id.spatial_idx > filter.layer_id->spatial_idx) ||
+ (!is_svc &&
+ frame.layer_id.spatial_idx != filter.layer_id->spatial_idx)) {
+ continue;
+ }
+ if (frame.layer_id.temporal_idx > filter.layer_id->temporal_idx) {
+ continue;
+ }
+ }
+ subframes.push_back(frame);
+ }
+
+ if (subframes.empty()) {
+ continue;
+ }
+
+ if (!merge) {
+ std::copy(subframes.begin(), subframes.end(),
+ std::back_inserter(slice));
+ continue;
+ }
+
+ Frame superframe = subframes.back();
+ for (const Frame& frame :
+ rtc::ArrayView<Frame>(subframes).subview(0, subframes.size() - 1)) {
+ superframe.frame_size += frame.frame_size;
+ superframe.keyframe |= frame.keyframe;
+ superframe.encode_time =
+ std::max(superframe.encode_time, frame.encode_time);
+ superframe.decode_time =
+ std::max(superframe.decode_time, frame.decode_time);
+ }
+
+ if (!encoding_settings_.empty()) {
+ RTC_CHECK(encoding_settings_.find(superframe.timestamp_rtp) !=
+ encoding_settings_.end())
+ << "No encoding settings for frame " << superframe.timestamp_rtp;
+ const EncodingSettings& es =
+ encoding_settings_.at(superframe.timestamp_rtp);
+ superframe.target_bitrate = GetTargetBitrate(es, filter.layer_id);
+ superframe.target_framerate = GetTargetFramerate(es, filter.layer_id);
+ }
+
+ slice.push_back(superframe);
+ }
+ return slice;
+ }
+
+ Stream Aggregate(Filter filter) const {
+ std::vector<Frame> frames = Slice(filter, /*merge=*/true);
+ Stream stream;
+ LeakyBucket leaky_bucket;
+ for (const Frame& frame : frames) {
+ Timestamp time = Timestamp::Micros((frame.timestamp_rtp / k90kHz).us());
+ if (!frame.frame_size.IsZero()) {
+ stream.width.AddSample(StatsSample(frame.width, time));
+ stream.height.AddSample(StatsSample(frame.height, time));
+ stream.frame_size_bytes.AddSample(
+ StatsSample(frame.frame_size.bytes(), time));
+ stream.keyframe.AddSample(StatsSample(frame.keyframe, time));
+ if (frame.qp) {
+ stream.qp.AddSample(StatsSample(*frame.qp, time));
+ }
+ }
+ if (frame.encoded) {
+ stream.encode_time_ms.AddSample(
+ StatsSample(frame.encode_time.ms(), time));
+ }
+ if (frame.decoded) {
+ stream.decode_time_ms.AddSample(
+ StatsSample(frame.decode_time.ms(), time));
+ }
+ if (frame.psnr) {
+ stream.psnr.y.AddSample(StatsSample(frame.psnr->y, time));
+ stream.psnr.u.AddSample(StatsSample(frame.psnr->u, time));
+ stream.psnr.v.AddSample(StatsSample(frame.psnr->v, time));
+ }
+ if (frame.target_framerate) {
+ stream.target_framerate_fps.AddSample(
+ StatsSample(frame.target_framerate->hertz<double>(), time));
+ }
+ if (frame.target_bitrate) {
+ stream.target_bitrate_kbps.AddSample(
+ StatsSample(frame.target_bitrate->kbps<double>(), time));
+ int buffer_level_bits = leaky_bucket.Update(frame);
+ stream.transmission_time_ms.AddSample(StatsSample(
+ 1000 * buffer_level_bits / frame.target_bitrate->bps<double>(),
+ time));
+ }
+ }
+
+ int num_encoded_frames = stream.frame_size_bytes.NumSamples();
+ const Frame& first_frame = frames.front();
+
+ Filter filter_all_layers{.min_timestamp_rtp = filter.min_timestamp_rtp,
+ .max_timestamp_rtp = filter.max_timestamp_rtp};
+ std::vector<Frame> frames_all_layers =
+ Slice(filter_all_layers, /*merge=*/true);
+ const Frame& last_frame = frames_all_layers.back();
+ TimeDelta duration =
+ (last_frame.timestamp_rtp - first_frame.timestamp_rtp) / k90kHz;
+ if (last_frame.target_framerate) {
+ duration += 1 / *last_frame.target_framerate;
+ }
+
+ DataRate encoded_bitrate =
+ DataSize::Bytes(stream.frame_size_bytes.GetSum()) / duration;
+ Frequency encoded_framerate = num_encoded_frames / duration;
+
+ double bitrate_mismatch_pct = 0.0;
+ if (const auto& target_bitrate = first_frame.target_bitrate;
+ target_bitrate) {
+ bitrate_mismatch_pct = 100 * (encoded_bitrate / *target_bitrate - 1);
+ }
+ double framerate_mismatch_pct = 0.0;
+ if (const auto& target_framerate = first_frame.target_framerate;
+ target_framerate) {
+ framerate_mismatch_pct =
+ 100 * (encoded_framerate / *target_framerate - 1);
+ }
+
+ for (Frame& frame : frames) {
+ Timestamp time = Timestamp::Micros((frame.timestamp_rtp / k90kHz).us());
+ stream.encoded_bitrate_kbps.AddSample(
+ StatsSample(encoded_bitrate.kbps<double>(), time));
+ stream.encoded_framerate_fps.AddSample(
+ StatsSample(encoded_framerate.hertz<double>(), time));
+ stream.bitrate_mismatch_pct.AddSample(
+ StatsSample(bitrate_mismatch_pct, time));
+ stream.framerate_mismatch_pct.AddSample(
+ StatsSample(framerate_mismatch_pct, time));
+ }
+
+ return stream;
+ }
+
+ void Flush() { task_queue_.WaitForPreviouslyPostedTasks(); }
+
+ private:
+ struct FrameId {
+ uint32_t timestamp_rtp;
+ int spatial_idx;
+
+ bool operator==(const FrameId& o) const {
+ return timestamp_rtp == o.timestamp_rtp && spatial_idx == o.spatial_idx;
+ }
+ bool operator<(const FrameId& o) const {
+ return timestamp_rtp < o.timestamp_rtp ||
+ (timestamp_rtp == o.timestamp_rtp && spatial_idx < o.spatial_idx);
+ }
+ };
+
+ Frame::Psnr CalcPsnr(const I420BufferInterface& ref_buffer,
+ const I420BufferInterface& dec_buffer) {
+ RTC_CHECK_EQ(ref_buffer.width(), dec_buffer.width());
+ RTC_CHECK_EQ(ref_buffer.height(), dec_buffer.height());
+
+ uint64_t sse_y = libyuv::ComputeSumSquareErrorPlane(
+ dec_buffer.DataY(), dec_buffer.StrideY(), ref_buffer.DataY(),
+ ref_buffer.StrideY(), dec_buffer.width(), dec_buffer.height());
+
+ uint64_t sse_u = libyuv::ComputeSumSquareErrorPlane(
+ dec_buffer.DataU(), dec_buffer.StrideU(), ref_buffer.DataU(),
+ ref_buffer.StrideU(), dec_buffer.width() / 2, dec_buffer.height() / 2);
+
+ uint64_t sse_v = libyuv::ComputeSumSquareErrorPlane(
+ dec_buffer.DataV(), dec_buffer.StrideV(), ref_buffer.DataV(),
+ ref_buffer.StrideV(), dec_buffer.width() / 2, dec_buffer.height() / 2);
+
+ int num_y_samples = dec_buffer.width() * dec_buffer.height();
+ Frame::Psnr psnr;
+ psnr.y = libyuv::SumSquareErrorToPsnr(sse_y, num_y_samples);
+ psnr.u = libyuv::SumSquareErrorToPsnr(sse_u, num_y_samples / 4);
+ psnr.v = libyuv::SumSquareErrorToPsnr(sse_v, num_y_samples / 4);
+ return psnr;
+ }
+
+ DataRate GetTargetBitrate(const EncodingSettings& encoding_settings,
+ absl::optional<LayerId> layer_id) const {
+ int base_spatial_idx;
+ if (layer_id.has_value()) {
+ bool is_svc =
+ kFullSvcScalabilityModes.count(encoding_settings.scalability_mode);
+ base_spatial_idx = is_svc ? 0 : layer_id->spatial_idx;
+ } else {
+ int num_spatial_layers =
+ ScalabilityModeToNumSpatialLayers(encoding_settings.scalability_mode);
+ int num_temporal_layers = ScalabilityModeToNumTemporalLayers(
+ encoding_settings.scalability_mode);
+ layer_id = LayerId({.spatial_idx = num_spatial_layers - 1,
+ .temporal_idx = num_temporal_layers - 1});
+ base_spatial_idx = 0;
+ }
+
+ DataRate bitrate = DataRate::Zero();
+ for (int sidx = base_spatial_idx; sidx <= layer_id->spatial_idx; ++sidx) {
+ for (int tidx = 0; tidx <= layer_id->temporal_idx; ++tidx) {
+ auto layer_settings = encoding_settings.layers_settings.find(
+ {.spatial_idx = sidx, .temporal_idx = tidx});
+ RTC_CHECK(layer_settings != encoding_settings.layers_settings.end())
+ << "bitrate is not specified for layer sidx=" << sidx
+ << " tidx=" << tidx;
+ bitrate += layer_settings->second.bitrate;
+ }
+ }
+ return bitrate;
+ }
+
+ Frequency GetTargetFramerate(const EncodingSettings& encoding_settings,
+ absl::optional<LayerId> layer_id) const {
+ if (layer_id.has_value()) {
+ auto layer_settings = encoding_settings.layers_settings.find(
+ {.spatial_idx = layer_id->spatial_idx,
+ .temporal_idx = layer_id->temporal_idx});
+ RTC_CHECK(layer_settings != encoding_settings.layers_settings.end())
+ << "framerate is not specified for layer sidx="
+ << layer_id->spatial_idx << " tidx=" << layer_id->temporal_idx;
+ return layer_settings->second.framerate;
+ }
+ return encoding_settings.layers_settings.rbegin()->second.framerate;
+ }
+
+ SamplesStatsCounter::StatsSample StatsSample(double value,
+ Timestamp time) const {
+ return SamplesStatsCounter::StatsSample{value, time};
+ }
+
+ VideoSource* const video_source_;
+ TaskQueueForTest task_queue_;
+ // RTP timestamp -> spatial layer -> Frame
+ std::map<uint32_t, std::map<int, Frame>> frames_;
+ std::map<uint32_t, EncodingSettings> encoding_settings_;
+};
+
+class Decoder : public DecodedImageCallback {
+ public:
+ Decoder(VideoDecoderFactory* decoder_factory,
+ const DecoderSettings& decoder_settings,
+ VideoCodecAnalyzer* analyzer)
+ : decoder_factory_(decoder_factory),
+ analyzer_(analyzer),
+ pacer_(decoder_settings.pacing_settings) {
+ RTC_CHECK(analyzer_) << "Analyzer must be provided";
+
+ if (decoder_settings.decoder_input_base_path) {
+ ivf_writer_ = std::make_unique<TesterIvfWriter>(
+ *decoder_settings.decoder_input_base_path);
+ }
+
+ if (decoder_settings.decoder_output_base_path) {
+ y4m_writer_ = std::make_unique<TesterY4mWriter>(
+ *decoder_settings.decoder_output_base_path);
+ }
+ }
+
+ void Initialize(const SdpVideoFormat& sdp_video_format) {
+ decoder_ = decoder_factory_->CreateVideoDecoder(sdp_video_format);
+ RTC_CHECK(decoder_) << "Could not create decoder for video format "
+ << sdp_video_format.ToString();
+
+ task_queue_.PostTaskAndWait([this, &sdp_video_format] {
+ decoder_->RegisterDecodeCompleteCallback(this);
+
+ VideoDecoder::Settings ds;
+ ds.set_codec_type(PayloadStringToCodecType(sdp_video_format.name));
+ ds.set_number_of_cores(1);
+ ds.set_max_render_resolution({1280, 720});
+ bool result = decoder_->Configure(ds);
+ RTC_CHECK(result) << "Failed to configure decoder";
+ });
+ }
+
+ void Decode(const EncodedImage& encoded_frame) {
+ Timestamp pts =
+ Timestamp::Micros((encoded_frame.RtpTimestamp() / k90kHz).us());
+
+ task_queue_.PostScheduledTask(
+ [this, encoded_frame] {
+ analyzer_->StartDecode(encoded_frame);
+ int error = decoder_->Decode(encoded_frame, /*render_time_ms*/ 0);
+ if (error != 0) {
+ RTC_LOG(LS_WARNING)
+ << "Decode failed with error code " << error
+ << " RTP timestamp " << encoded_frame.RtpTimestamp();
+ }
+ },
+ pacer_.Schedule(pts));
+
+ if (ivf_writer_) {
+ ivf_writer_->Write(encoded_frame);
+ }
+ }
+
+ void Flush() {
+ // TODO(webrtc:14852): Add Flush() to VideoDecoder API.
+ task_queue_.PostTaskAndWait([this] { decoder_->Release(); });
+ }
+
+ private:
+ int Decoded(VideoFrame& decoded_frame) override {
+ analyzer_->FinishDecode(decoded_frame, /*spatial_idx=*/0);
+
+ if (y4m_writer_) {
+ y4m_writer_->Write(decoded_frame, /*spatial_idx=*/0);
+ }
+
+ return WEBRTC_VIDEO_CODEC_OK;
+ }
+
+ VideoDecoderFactory* decoder_factory_;
+ std::unique_ptr<VideoDecoder> decoder_;
+ VideoCodecAnalyzer* const analyzer_;
+ Pacer pacer_;
+ LimitedTaskQueue task_queue_;
+ std::unique_ptr<TesterIvfWriter> ivf_writer_;
+ std::unique_ptr<TesterY4mWriter> y4m_writer_;
+};
+
+class Encoder : public EncodedImageCallback {
+ public:
+ using EncodeCallback =
+ absl::AnyInvocable<void(const EncodedImage& encoded_frame)>;
+
+ Encoder(VideoEncoderFactory* encoder_factory,
+ const EncoderSettings& encoder_settings,
+ VideoCodecAnalyzer* analyzer)
+ : encoder_factory_(encoder_factory),
+ analyzer_(analyzer),
+ pacer_(encoder_settings.pacing_settings) {
+ RTC_CHECK(analyzer_) << "Analyzer must be provided";
+
+ if (encoder_settings.encoder_input_base_path) {
+ y4m_writer_ = std::make_unique<TesterY4mWriter>(
+ *encoder_settings.encoder_input_base_path);
+ }
+
+ if (encoder_settings.encoder_output_base_path) {
+ ivf_writer_ = std::make_unique<TesterIvfWriter>(
+ *encoder_settings.encoder_output_base_path);
+ }
+ }
+
+ void Initialize(const EncodingSettings& encoding_settings) {
+ encoder_ = encoder_factory_->CreateVideoEncoder(
+ encoding_settings.sdp_video_format);
+ RTC_CHECK(encoder_) << "Could not create encoder for video format "
+ << encoding_settings.sdp_video_format.ToString();
+
+ task_queue_.PostTaskAndWait([this, encoding_settings] {
+ encoder_->RegisterEncodeCompleteCallback(this);
+ Configure(encoding_settings);
+ SetRates(encoding_settings);
+ });
+ }
+
+ void Encode(const VideoFrame& input_frame,
+ const EncodingSettings& encoding_settings,
+ EncodeCallback callback) {
+ {
+ MutexLock lock(&mutex_);
+ callbacks_[input_frame.timestamp()] = std::move(callback);
+ }
+
+ Timestamp pts = Timestamp::Micros((input_frame.timestamp() / k90kHz).us());
+
+ task_queue_.PostScheduledTask(
+ [this, input_frame, encoding_settings] {
+ analyzer_->StartEncode(input_frame, encoding_settings);
+
+ if (!last_encoding_settings_ ||
+ !IsSameRate(encoding_settings, *last_encoding_settings_)) {
+ SetRates(encoding_settings);
+ }
+
+ int error = encoder_->Encode(input_frame, /*frame_types=*/nullptr);
+ if (error != 0) {
+ RTC_LOG(LS_WARNING) << "Encode failed with error code " << error
+ << " RTP timestamp " << input_frame.timestamp();
+ }
+
+ last_encoding_settings_ = encoding_settings;
+ },
+ pacer_.Schedule(pts));
+
+ if (y4m_writer_) {
+ y4m_writer_->Write(input_frame, /*spatial_idx=*/0);
+ }
+ }
+
+ void Flush() {
+ task_queue_.PostTaskAndWait([this] { encoder_->Release(); });
+ }
+
+ private:
+ Result OnEncodedImage(const EncodedImage& encoded_frame,
+ const CodecSpecificInfo* codec_specific_info) override {
+ analyzer_->FinishEncode(encoded_frame);
+
+ {
+ MutexLock lock(&mutex_);
+ auto it = callbacks_.find(encoded_frame.RtpTimestamp());
+ RTC_CHECK(it != callbacks_.end());
+ it->second(encoded_frame);
+ callbacks_.erase(callbacks_.begin(), it);
+ }
+
+ if (ivf_writer_ != nullptr) {
+ ivf_writer_->Write(encoded_frame);
+ }
+
+ return Result(Result::Error::OK);
+ }
+
+ void Configure(const EncodingSettings& es) {
+ const LayerSettings& layer_settings = es.layers_settings.rbegin()->second;
+ const DataRate& bitrate = layer_settings.bitrate;
+
+ VideoCodec vc;
+ vc.width = layer_settings.resolution.width;
+ vc.height = layer_settings.resolution.height;
+ vc.startBitrate = bitrate.kbps();
+ vc.maxBitrate = bitrate.kbps();
+ vc.minBitrate = 0;
+ vc.maxFramerate = layer_settings.framerate.hertz<uint32_t>();
+ vc.active = true;
+ vc.numberOfSimulcastStreams = 0;
+ vc.mode = webrtc::VideoCodecMode::kRealtimeVideo;
+ vc.SetFrameDropEnabled(true);
+ vc.SetScalabilityMode(es.scalability_mode);
+ vc.SetVideoEncoderComplexity(VideoCodecComplexity::kComplexityNormal);
+
+ vc.codecType = PayloadStringToCodecType(es.sdp_video_format.name);
+ switch (vc.codecType) {
+ case kVideoCodecVP8:
+ *(vc.VP8()) = VideoEncoder::GetDefaultVp8Settings();
+ vc.VP8()->SetNumberOfTemporalLayers(
+ ScalabilityModeToNumTemporalLayers(es.scalability_mode));
+ vc.qpMax = cricket::kDefaultVideoMaxQpVpx;
+ // TODO(webrtc:14852): Configure simulcast.
+ break;
+ case kVideoCodecVP9:
+ *(vc.VP9()) = VideoEncoder::GetDefaultVp9Settings();
+ // See LibvpxVp9Encoder::ExplicitlyConfiguredSpatialLayers.
+ vc.spatialLayers[0].targetBitrate = vc.maxBitrate;
+ vc.qpMax = cricket::kDefaultVideoMaxQpVpx;
+ break;
+ case kVideoCodecAV1:
+ vc.qpMax = cricket::kDefaultVideoMaxQpVpx;
+ break;
+ case kVideoCodecH264:
+ *(vc.H264()) = VideoEncoder::GetDefaultH264Settings();
+ vc.qpMax = cricket::kDefaultVideoMaxQpH26x;
+ break;
+ case kVideoCodecH265:
+ vc.qpMax = cricket::kDefaultVideoMaxQpH26x;
+ break;
+ case kVideoCodecGeneric:
+ case kVideoCodecMultiplex:
+ RTC_CHECK_NOTREACHED();
+ break;
+ }
+
+ VideoEncoder::Settings ves(
+ VideoEncoder::Capabilities(/*loss_notification=*/false),
+ /*number_of_cores=*/1,
+ /*max_payload_size=*/1440);
+
+ int result = encoder_->InitEncode(&vc, ves);
+ RTC_CHECK(result == WEBRTC_VIDEO_CODEC_OK);
+
+ SetRates(es);
+ }
+
+ void SetRates(const EncodingSettings& es) {
+ VideoEncoder::RateControlParameters rc;
+ int num_spatial_layers =
+ ScalabilityModeToNumSpatialLayers(es.scalability_mode);
+ int num_temporal_layers =
+ ScalabilityModeToNumTemporalLayers(es.scalability_mode);
+ for (int sidx = 0; sidx < num_spatial_layers; ++sidx) {
+ for (int tidx = 0; tidx < num_temporal_layers; ++tidx) {
+ auto layers_settings = es.layers_settings.find(
+ {.spatial_idx = sidx, .temporal_idx = tidx});
+ RTC_CHECK(layers_settings != es.layers_settings.end())
+ << "Bitrate for layer S=" << sidx << " T=" << tidx << " is not set";
+ rc.bitrate.SetBitrate(sidx, tidx,
+ layers_settings->second.bitrate.bps());
+ }
+ }
+ rc.framerate_fps =
+ es.layers_settings.rbegin()->second.framerate.hertz<double>();
+ encoder_->SetRates(rc);
+ }
+
+ bool IsSameRate(const EncodingSettings& a, const EncodingSettings& b) const {
+ for (auto [layer_id, layer] : a.layers_settings) {
+ const auto& other_layer = b.layers_settings.at(layer_id);
+ if (layer.bitrate != other_layer.bitrate ||
+ layer.framerate != other_layer.framerate) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ VideoEncoderFactory* const encoder_factory_;
+ std::unique_ptr<VideoEncoder> encoder_;
+ VideoCodecAnalyzer* const analyzer_;
+ Pacer pacer_;
+ absl::optional<EncodingSettings> last_encoding_settings_;
+ std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_;
+ LimitedTaskQueue task_queue_;
+ std::unique_ptr<TesterY4mWriter> y4m_writer_;
+ std::unique_ptr<TesterIvfWriter> ivf_writer_;
+ std::map<uint32_t, int> sidx_ RTC_GUARDED_BY(mutex_);
+ std::map<uint32_t, EncodeCallback> callbacks_ RTC_GUARDED_BY(mutex_);
+ Mutex mutex_;
+};
+
+std::tuple<std::vector<DataRate>, ScalabilityMode>
+SplitBitrateAndUpdateScalabilityMode(std::string codec_type,
+ ScalabilityMode scalability_mode,
+ int width,
+ int height,
+ std::vector<int> bitrates_kbps,
+ double framerate_fps) {
+ int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode);
+ int num_temporal_layers =
+ ScalabilityModeToNumTemporalLayers(scalability_mode);
+
+ if (bitrates_kbps.size() > 1 ||
+ (num_spatial_layers == 1 && num_temporal_layers == 1)) {
+ RTC_CHECK(bitrates_kbps.size() ==
+ static_cast<size_t>(num_spatial_layers * num_temporal_layers))
+ << "bitrates must be provided for all layers";
+ std::vector<DataRate> bitrates;
+ for (const auto& bitrate_kbps : bitrates_kbps) {
+ bitrates.push_back(DataRate::KilobitsPerSec(bitrate_kbps));
+ }
+ return std::make_tuple(bitrates, scalability_mode);
+ }
+
+ VideoCodec vc;
+ vc.codecType = PayloadStringToCodecType(codec_type);
+ vc.width = width;
+ vc.height = height;
+ vc.startBitrate = bitrates_kbps.front();
+ vc.maxBitrate = bitrates_kbps.front();
+ vc.minBitrate = 0;
+ vc.maxFramerate = static_cast<uint32_t>(framerate_fps);
+ vc.numberOfSimulcastStreams = 0;
+ vc.mode = webrtc::VideoCodecMode::kRealtimeVideo;
+ vc.SetScalabilityMode(scalability_mode);
+
+ switch (vc.codecType) {
+ case kVideoCodecVP8:
+ // TODO(webrtc:14852): Configure simulcast.
+ *(vc.VP8()) = VideoEncoder::GetDefaultVp8Settings();
+ vc.VP8()->SetNumberOfTemporalLayers(num_temporal_layers);
+ vc.simulcastStream[0].width = vc.width;
+ vc.simulcastStream[0].height = vc.height;
+ break;
+ case kVideoCodecVP9: {
+ *(vc.VP9()) = VideoEncoder::GetDefaultVp9Settings();
+ vc.VP9()->SetNumberOfTemporalLayers(num_temporal_layers);
+ const std::vector<SpatialLayer> spatialLayers = GetVp9SvcConfig(vc);
+ for (size_t i = 0; i < spatialLayers.size(); ++i) {
+ vc.spatialLayers[i] = spatialLayers[i];
+ vc.spatialLayers[i].active = true;
+ }
+ } break;
+ case kVideoCodecAV1: {
+ bool result =
+ SetAv1SvcConfig(vc, num_spatial_layers, num_temporal_layers);
+ RTC_CHECK(result) << "SetAv1SvcConfig failed";
+ } break;
+ case kVideoCodecH264: {
+ *(vc.H264()) = VideoEncoder::GetDefaultH264Settings();
+ vc.H264()->SetNumberOfTemporalLayers(num_temporal_layers);
+ } break;
+ case kVideoCodecH265:
+ break;
+ case kVideoCodecGeneric:
+ case kVideoCodecMultiplex:
+ RTC_CHECK_NOTREACHED();
+ }
+
+ if (*vc.GetScalabilityMode() != scalability_mode) {
+ RTC_LOG(LS_WARNING) << "Scalability mode changed from "
+ << ScalabilityModeToString(scalability_mode) << " to "
+ << ScalabilityModeToString(*vc.GetScalabilityMode());
+ num_spatial_layers =
+ ScalabilityModeToNumSpatialLayers(*vc.GetScalabilityMode());
+ num_temporal_layers =
+ ScalabilityModeToNumTemporalLayers(*vc.GetScalabilityMode());
+ }
+
+ std::unique_ptr<VideoBitrateAllocator> bitrate_allocator =
+ CreateBuiltinVideoBitrateAllocatorFactory()->CreateVideoBitrateAllocator(
+ vc);
+ VideoBitrateAllocation bitrate_allocation =
+ bitrate_allocator->Allocate(VideoBitrateAllocationParameters(
+ 1000 * bitrates_kbps.front(), framerate_fps));
+
+ std::vector<DataRate> bitrates;
+ for (int sidx = 0; sidx < num_spatial_layers; ++sidx) {
+ for (int tidx = 0; tidx < num_temporal_layers; ++tidx) {
+ int bitrate_bps = bitrate_allocation.GetBitrate(sidx, tidx);
+ bitrates.push_back(DataRate::BitsPerSec(bitrate_bps));
+ }
+ }
+
+ return std::make_tuple(bitrates, *vc.GetScalabilityMode());
+}
+
+} // namespace
+
+void VideoCodecStats::Stream::LogMetrics(
+ MetricsLogger* logger,
+ std::string test_case_name,
+ std::map<std::string, std::string> metadata) const {
+ logger->LogMetric("width", test_case_name, width, Unit::kCount,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("height", test_case_name, height, Unit::kCount,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("frame_size_bytes", test_case_name, frame_size_bytes,
+ Unit::kBytes, ImprovementDirection::kNeitherIsBetter,
+ metadata);
+ logger->LogMetric("keyframe", test_case_name, keyframe, Unit::kCount,
+ ImprovementDirection::kSmallerIsBetter, metadata);
+ logger->LogMetric("qp", test_case_name, qp, Unit::kUnitless,
+ ImprovementDirection::kSmallerIsBetter, metadata);
+ logger->LogMetric("encode_time_ms", test_case_name, encode_time_ms,
+ Unit::kMilliseconds, ImprovementDirection::kSmallerIsBetter,
+ metadata);
+ logger->LogMetric("decode_time_ms", test_case_name, decode_time_ms,
+ Unit::kMilliseconds, ImprovementDirection::kSmallerIsBetter,
+ metadata);
+ // TODO(webrtc:14852): Change to kUnitLess. kKilobitsPerSecond are converted
+ // to bytes per second in Chromeperf dash.
+ logger->LogMetric("target_bitrate_kbps", test_case_name, target_bitrate_kbps,
+ Unit::kKilobitsPerSecond,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("target_framerate_fps", test_case_name,
+ target_framerate_fps, Unit::kHertz,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ // TODO(webrtc:14852): Change to kUnitLess. kKilobitsPerSecond are converted
+ // to bytes per second in Chromeperf dash.
+ logger->LogMetric("encoded_bitrate_kbps", test_case_name,
+ encoded_bitrate_kbps, Unit::kKilobitsPerSecond,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("encoded_framerate_fps", test_case_name,
+ encoded_framerate_fps, Unit::kHertz,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("bitrate_mismatch_pct", test_case_name,
+ bitrate_mismatch_pct, Unit::kPercent,
+ ImprovementDirection::kNeitherIsBetter, metadata);
+ logger->LogMetric("framerate_mismatch_pct", test_case_name,
+ framerate_mismatch_pct, Unit::kPercent,
+ ImprovementDirection::kNeitherIsBetter, metadata);
+ logger->LogMetric("transmission_time_ms", test_case_name,
+ transmission_time_ms, Unit::kMilliseconds,
+ ImprovementDirection::kSmallerIsBetter, metadata);
+ logger->LogMetric("psnr_y_db", test_case_name, psnr.y, Unit::kUnitless,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("psnr_u_db", test_case_name, psnr.u, Unit::kUnitless,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+ logger->LogMetric("psnr_v_db", test_case_name, psnr.v, Unit::kUnitless,
+ ImprovementDirection::kBiggerIsBetter, metadata);
+}
+
+// TODO(ssilkin): use Frequency and DataRate for framerate and bitrate.
+std::map<uint32_t, EncodingSettings> VideoCodecTester::CreateEncodingSettings(
+ std::string codec_type,
+ std::string scalability_name,
+ int width,
+ int height,
+ std::vector<int> layer_bitrates_kbps,
+ double framerate_fps,
+ int num_frames,
+ uint32_t first_timestamp_rtp) {
+ auto [layer_bitrates, scalability_mode] =
+ SplitBitrateAndUpdateScalabilityMode(
+ codec_type, *ScalabilityModeFromString(scalability_name), width,
+ height, layer_bitrates_kbps, framerate_fps);
+
+ int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode);
+ int num_temporal_layers =
+ ScalabilityModeToNumTemporalLayers(scalability_mode);
+
+ std::map<LayerId, LayerSettings> layers_settings;
+ for (int sidx = 0; sidx < num_spatial_layers; ++sidx) {
+ int layer_width = width >> (num_spatial_layers - sidx - 1);
+ int layer_height = height >> (num_spatial_layers - sidx - 1);
+ for (int tidx = 0; tidx < num_temporal_layers; ++tidx) {
+ double layer_framerate_fps =
+ framerate_fps / (1 << (num_temporal_layers - tidx - 1));
+ layers_settings.emplace(
+ LayerId{.spatial_idx = sidx, .temporal_idx = tidx},
+ LayerSettings{
+ .resolution = {.width = layer_width, .height = layer_height},
+ .framerate = Frequency::MilliHertz(1000 * layer_framerate_fps),
+ .bitrate = layer_bitrates[sidx * num_temporal_layers + tidx]});
+ }
+ }
+
+ std::map<uint32_t, EncodingSettings> frames_settings;
+ uint32_t timestamp_rtp = first_timestamp_rtp;
+ for (int frame_num = 0; frame_num < num_frames; ++frame_num) {
+ frames_settings.emplace(
+ timestamp_rtp,
+ EncodingSettings{.sdp_video_format = SdpVideoFormat(codec_type),
+ .scalability_mode = scalability_mode,
+ .layers_settings = layers_settings});
+
+ timestamp_rtp += k90kHz / Frequency::MilliHertz(1000 * framerate_fps);
+ }
+
+ return frames_settings;
+}
+
+std::unique_ptr<VideoCodecTester::VideoCodecStats>
+VideoCodecTester::RunDecodeTest(CodedVideoSource* video_source,
+ VideoDecoderFactory* decoder_factory,
+ const DecoderSettings& decoder_settings,
+ const SdpVideoFormat& sdp_video_format) {
+ std::unique_ptr<VideoCodecAnalyzer> analyzer =
+ std::make_unique<VideoCodecAnalyzer>(/*video_source=*/nullptr);
+ Decoder decoder(decoder_factory, decoder_settings, analyzer.get());
+ decoder.Initialize(sdp_video_format);
+
+ while (auto frame = video_source->PullFrame()) {
+ decoder.Decode(*frame);
+ }
+
+ decoder.Flush();
+ analyzer->Flush();
+ return std::move(analyzer);
+}
+
+std::unique_ptr<VideoCodecTester::VideoCodecStats>
+VideoCodecTester::RunEncodeTest(
+ const VideoSourceSettings& source_settings,
+ VideoEncoderFactory* encoder_factory,
+ const EncoderSettings& encoder_settings,
+ const std::map<uint32_t, EncodingSettings>& encoding_settings) {
+ VideoSource video_source(source_settings);
+ std::unique_ptr<VideoCodecAnalyzer> analyzer =
+ std::make_unique<VideoCodecAnalyzer>(/*video_source=*/nullptr);
+ Encoder encoder(encoder_factory, encoder_settings, analyzer.get());
+ encoder.Initialize(encoding_settings.begin()->second);
+
+ for (const auto& [timestamp_rtp, frame_settings] : encoding_settings) {
+ const EncodingSettings::LayerSettings& top_layer =
+ frame_settings.layers_settings.rbegin()->second;
+ VideoFrame source_frame = video_source.PullFrame(
+ timestamp_rtp, top_layer.resolution, top_layer.framerate);
+ encoder.Encode(source_frame, frame_settings,
+ [](const EncodedImage& encoded_frame) {});
+ }
+
+ encoder.Flush();
+ analyzer->Flush();
+ return std::move(analyzer);
+}
+
+std::unique_ptr<VideoCodecTester::VideoCodecStats>
+VideoCodecTester::RunEncodeDecodeTest(
+ const VideoSourceSettings& source_settings,
+ VideoEncoderFactory* encoder_factory,
+ VideoDecoderFactory* decoder_factory,
+ const EncoderSettings& encoder_settings,
+ const DecoderSettings& decoder_settings,
+ const std::map<uint32_t, EncodingSettings>& encoding_settings) {
+ VideoSource video_source(source_settings);
+ std::unique_ptr<VideoCodecAnalyzer> analyzer =
+ std::make_unique<VideoCodecAnalyzer>(&video_source);
+ Decoder decoder(decoder_factory, decoder_settings, analyzer.get());
+ Encoder encoder(encoder_factory, encoder_settings, analyzer.get());
+ encoder.Initialize(encoding_settings.begin()->second);
+ decoder.Initialize(encoding_settings.begin()->second.sdp_video_format);
+
+ for (const auto& [timestamp_rtp, frame_settings] : encoding_settings) {
+ const EncodingSettings::LayerSettings& top_layer =
+ frame_settings.layers_settings.rbegin()->second;
+ VideoFrame source_frame = video_source.PullFrame(
+ timestamp_rtp, top_layer.resolution, top_layer.framerate);
+ encoder.Encode(source_frame, frame_settings,
+ [&decoder](const EncodedImage& encoded_frame) {
+ decoder.Decode(encoded_frame);
+ });
+ }
+
+ encoder.Flush();
+ decoder.Flush();
+ analyzer->Flush();
+ return std::move(analyzer);
+}
+
+} // namespace test
+} // namespace webrtc
diff --git a/test/video_codec_tester.h b/test/video_codec_tester.h
new file mode 100644
index 0000000000..dc72645c18
--- /dev/null
+++ b/test/video_codec_tester.h
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef TEST_VIDEO_CODEC_TESTER_H_
+#define TEST_VIDEO_CODEC_TESTER_H_
+
+#include <limits>
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "absl/types/optional.h"
+#include "api/numerics/samples_stats_counter.h"
+#include "api/test/metrics/metric.h"
+#include "api/test/metrics/metrics_logger.h"
+#include "api/units/data_rate.h"
+#include "api/units/data_size.h"
+#include "api/units/frequency.h"
+#include "api/video/encoded_image.h"
+#include "api/video/resolution.h"
+#include "api/video_codecs/video_decoder_factory.h"
+#include "api/video_codecs/video_encoder_factory.h"
+
+namespace webrtc {
+namespace test {
+
+class VideoCodecTester {
+ public:
+ struct LayerId {
+ int spatial_idx = 0;
+ int temporal_idx = 0;
+
+ bool operator==(const LayerId& o) const {
+ return spatial_idx == o.spatial_idx && temporal_idx == o.temporal_idx;
+ }
+ bool operator<(const LayerId& o) const {
+ return spatial_idx < o.spatial_idx ||
+ (spatial_idx == o.spatial_idx && temporal_idx < o.temporal_idx);
+ }
+ };
+
+ struct EncodingSettings {
+ SdpVideoFormat sdp_video_format = SdpVideoFormat("VP8");
+ ScalabilityMode scalability_mode = ScalabilityMode::kL1T1;
+
+ struct LayerSettings {
+ Resolution resolution;
+ Frequency framerate;
+ DataRate bitrate;
+ };
+ std::map<LayerId, LayerSettings> layers_settings;
+ };
+
+ class VideoCodecStats {
+ public:
+ struct Filter {
+ uint32_t min_timestamp_rtp = std::numeric_limits<uint32_t>::min();
+ uint32_t max_timestamp_rtp = std::numeric_limits<uint32_t>::max();
+ absl::optional<LayerId> layer_id;
+ };
+
+ struct Frame {
+ int frame_num = 0;
+ uint32_t timestamp_rtp = 0;
+ LayerId layer_id;
+ bool encoded = false;
+ bool decoded = false;
+ int width = 0;
+ int height = 0;
+ DataSize frame_size = DataSize::Zero();
+ bool keyframe = false;
+ absl::optional<int> qp;
+ Timestamp encode_start = Timestamp::Zero();
+ TimeDelta encode_time = TimeDelta::Zero();
+ Timestamp decode_start = Timestamp::Zero();
+ TimeDelta decode_time = TimeDelta::Zero();
+ absl::optional<DataRate> target_bitrate;
+ absl::optional<Frequency> target_framerate;
+
+ struct Psnr {
+ double y = 0.0;
+ double u = 0.0;
+ double v = 0.0;
+ };
+ absl::optional<Psnr> psnr;
+ };
+
+ struct Stream {
+ SamplesStatsCounter width;
+ SamplesStatsCounter height;
+ SamplesStatsCounter frame_size_bytes;
+ SamplesStatsCounter keyframe;
+ SamplesStatsCounter qp;
+ SamplesStatsCounter encode_time_ms;
+ SamplesStatsCounter decode_time_ms;
+ SamplesStatsCounter target_bitrate_kbps;
+ SamplesStatsCounter target_framerate_fps;
+ SamplesStatsCounter encoded_bitrate_kbps;
+ SamplesStatsCounter encoded_framerate_fps;
+ SamplesStatsCounter bitrate_mismatch_pct;
+ SamplesStatsCounter framerate_mismatch_pct;
+ SamplesStatsCounter transmission_time_ms;
+
+ struct Psnr {
+ SamplesStatsCounter y;
+ SamplesStatsCounter u;
+ SamplesStatsCounter v;
+ } psnr;
+
+ // Logs `Stream` metrics to provided `MetricsLogger`.
+ void LogMetrics(MetricsLogger* logger,
+ std::string test_case_name,
+ std::map<std::string, std::string> metadata = {}) const;
+ };
+
+ virtual ~VideoCodecStats() = default;
+
+ // Returns frames for the slice specified by `filter`. If `merge` is true,
+ // also merges frames belonging to the same temporal unit into one
+ // superframe.
+ virtual std::vector<Frame> Slice(Filter filter, bool merge) const = 0;
+
+ // Returns video statistics aggregated for the slice specified by `filter`.
+ virtual Stream Aggregate(Filter filter) const = 0;
+ };
+
+ // Pacing settings for codec input.
+ struct PacingSettings {
+ enum PacingMode {
+ // Pacing is not used. Frames are sent to codec back-to-back.
+ kNoPacing,
+ // Pace with the rate equal to the target video frame rate. Pacing time is
+ // derived from RTP timestamp.
+ kRealTime,
+ // Pace with the explicitly provided rate.
+ kConstantRate,
+ };
+ PacingMode mode = PacingMode::kNoPacing;
+ // Pacing rate for `kConstantRate` mode.
+ Frequency constant_rate = Frequency::Zero();
+ };
+
+ struct VideoSourceSettings {
+ std::string file_path;
+ Resolution resolution;
+ Frequency framerate;
+ };
+
+ struct DecoderSettings {
+ PacingSettings pacing_settings;
+ absl::optional<std::string> decoder_input_base_path;
+ absl::optional<std::string> decoder_output_base_path;
+ };
+
+ struct EncoderSettings {
+ PacingSettings pacing_settings;
+ absl::optional<std::string> encoder_input_base_path;
+ absl::optional<std::string> encoder_output_base_path;
+ };
+
+ virtual ~VideoCodecTester() = default;
+
+ // Interface for a coded video frames source.
+ class CodedVideoSource {
+ public:
+ virtual ~CodedVideoSource() = default;
+
+ // Returns next frame. Returns `absl::nullopt` if the end-of-stream is
+ // reached. Frames should have RTP timestamps representing desired frame
+ // rate.
+ virtual absl::optional<EncodedImage> PullFrame() = 0;
+ };
+
+ // A helper function that creates `EncodingSettings` for `num_frames` frames,
+ // wraps the settings into RTP timestamp -> settings map and returns the map.
+ static std::map<uint32_t, EncodingSettings> CreateEncodingSettings(
+ std::string codec_type,
+ std::string scalability_name,
+ int width,
+ int height,
+ std::vector<int> bitrates_kbps,
+ double framerate_fps,
+ int num_frames,
+ uint32_t first_timestamp_rtp = 90000);
+
+ // Decodes video, collects and returns decode metrics.
+ static std::unique_ptr<VideoCodecStats> RunDecodeTest(
+ CodedVideoSource* video_source,
+ VideoDecoderFactory* decoder_factory,
+ const DecoderSettings& decoder_settings,
+ const SdpVideoFormat& sdp_video_format);
+
+ // Encodes video, collects and returns encode metrics.
+ static std::unique_ptr<VideoCodecStats> RunEncodeTest(
+ const VideoSourceSettings& source_settings,
+ VideoEncoderFactory* encoder_factory,
+ const EncoderSettings& encoder_settings,
+ const std::map<uint32_t, EncodingSettings>& encoding_settings);
+
+ // Encodes and decodes video, collects and returns encode and decode metrics.
+ static std::unique_ptr<VideoCodecStats> RunEncodeDecodeTest(
+ const VideoSourceSettings& source_settings,
+ VideoEncoderFactory* encoder_factory,
+ VideoDecoderFactory* decoder_factory,
+ const EncoderSettings& encoder_settings,
+ const DecoderSettings& decoder_settings,
+ const std::map<uint32_t, EncodingSettings>& encoding_settings);
+};
+
+} // namespace test
+} // namespace webrtc
+
+#endif // TEST_VIDEO_CODEC_TESTER_H_
diff --git a/test/video_codec_tester_unittest.cc b/test/video_codec_tester_unittest.cc
new file mode 100644
index 0000000000..af31fe2c13
--- /dev/null
+++ b/test/video_codec_tester_unittest.cc
@@ -0,0 +1,513 @@
+/*
+ * Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "test/video_codec_tester.h"
+
+#include <map>
+#include <memory>
+#include <string>
+#include <tuple>
+#include <utility>
+#include <vector>
+
+#include "api/test/mock_video_decoder.h"
+#include "api/test/mock_video_decoder_factory.h"
+#include "api/test/mock_video_encoder.h"
+#include "api/test/mock_video_encoder_factory.h"
+#include "api/units/data_rate.h"
+#include "api/units/time_delta.h"
+#include "api/video/i420_buffer.h"
+#include "api/video/video_frame.h"
+#include "modules/video_coding/include/video_codec_interface.h"
+#include "modules/video_coding/svc/scalability_mode_util.h"
+#include "test/gmock.h"
+#include "test/gtest.h"
+#include "test/testsupport/file_utils.h"
+#include "third_party/libyuv/include/libyuv/planar_functions.h"
+
+namespace webrtc {
+namespace test {
+
+namespace {
+using ::testing::_;
+using ::testing::ElementsAre;
+using ::testing::Field;
+using ::testing::Invoke;
+using ::testing::InvokeWithoutArgs;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SizeIs;
+
+using VideoCodecStats = VideoCodecTester::VideoCodecStats;
+using VideoSourceSettings = VideoCodecTester::VideoSourceSettings;
+using CodedVideoSource = VideoCodecTester::CodedVideoSource;
+using EncodingSettings = VideoCodecTester::EncodingSettings;
+using LayerSettings = EncodingSettings::LayerSettings;
+using LayerId = VideoCodecTester::LayerId;
+using DecoderSettings = VideoCodecTester::DecoderSettings;
+using EncoderSettings = VideoCodecTester::EncoderSettings;
+using PacingSettings = VideoCodecTester::PacingSettings;
+using PacingMode = PacingSettings::PacingMode;
+using Filter = VideoCodecStats::Filter;
+using Frame = VideoCodecTester::VideoCodecStats::Frame;
+using Stream = VideoCodecTester::VideoCodecStats::Stream;
+
+constexpr int kWidth = 2;
+constexpr int kHeight = 2;
+const DataRate kTargetLayerBitrate = DataRate::BytesPerSec(100);
+const Frequency kTargetFramerate = Frequency::Hertz(30);
+constexpr Frequency k90kHz = Frequency::Hertz(90000);
+
+rtc::scoped_refptr<I420Buffer> CreateYuvBuffer(uint8_t y = 0,
+ uint8_t u = 0,
+ uint8_t v = 0) {
+ rtc::scoped_refptr<I420Buffer> buffer(I420Buffer::Create(2, 2));
+
+ libyuv::I420Rect(buffer->MutableDataY(), buffer->StrideY(),
+ buffer->MutableDataU(), buffer->StrideU(),
+ buffer->MutableDataV(), buffer->StrideV(), 0, 0,
+ buffer->width(), buffer->height(), y, u, v);
+ return buffer;
+}
+
+std::string CreateYuvFile(int width, int height, int num_frames) {
+ std::string path = webrtc::test::TempFilename(webrtc::test::OutputPath(),
+ "video_codec_tester_unittest");
+ FILE* file = fopen(path.c_str(), "wb");
+ for (int frame_num = 0; frame_num < num_frames; ++frame_num) {
+ uint8_t y = (frame_num + 0) & 255;
+ uint8_t u = (frame_num + 1) & 255;
+ uint8_t v = (frame_num + 2) & 255;
+ rtc::scoped_refptr<I420Buffer> buffer = CreateYuvBuffer(y, u, v);
+ fwrite(buffer->DataY(), 1, width * height, file);
+ int chroma_size_bytes = (width + 1) / 2 * (height + 1) / 2;
+ fwrite(buffer->DataU(), 1, chroma_size_bytes, file);
+ fwrite(buffer->DataV(), 1, chroma_size_bytes, file);
+ }
+ fclose(file);
+ return path;
+}
+
+std::unique_ptr<VideoCodecStats> RunTest(std::vector<std::vector<Frame>> frames,
+ ScalabilityMode scalability_mode) {
+ int num_frames = static_cast<int>(frames.size());
+ std::string source_yuv_path = CreateYuvFile(kWidth, kHeight, num_frames);
+ VideoSourceSettings source_settings{
+ .file_path = source_yuv_path,
+ .resolution = {.width = kWidth, .height = kHeight},
+ .framerate = kTargetFramerate};
+
+ int num_encoded_frames = 0;
+ EncodedImageCallback* encoded_frame_callback;
+ NiceMock<MockVideoEncoderFactory> encoder_factory;
+ ON_CALL(encoder_factory, CreateVideoEncoder)
+ .WillByDefault([&](const SdpVideoFormat&) {
+ auto encoder = std::make_unique<NiceMock<MockVideoEncoder>>();
+ ON_CALL(*encoder, RegisterEncodeCompleteCallback)
+ .WillByDefault([&](EncodedImageCallback* callback) {
+ encoded_frame_callback = callback;
+ return WEBRTC_VIDEO_CODEC_OK;
+ });
+ ON_CALL(*encoder, Encode)
+ .WillByDefault([&](const VideoFrame& input_frame,
+ const std::vector<VideoFrameType>*) {
+ for (const Frame& frame : frames[num_encoded_frames]) {
+ EncodedImage encoded_frame;
+ encoded_frame._encodedWidth = frame.width;
+ encoded_frame._encodedHeight = frame.height;
+ encoded_frame.SetFrameType(
+ frame.keyframe ? VideoFrameType::kVideoFrameKey
+ : VideoFrameType::kVideoFrameDelta);
+ encoded_frame.SetRtpTimestamp(input_frame.timestamp());
+ encoded_frame.SetSpatialIndex(frame.layer_id.spatial_idx);
+ encoded_frame.SetTemporalIndex(frame.layer_id.temporal_idx);
+ encoded_frame.SetEncodedData(
+ EncodedImageBuffer::Create(frame.frame_size.bytes()));
+ encoded_frame_callback->OnEncodedImage(
+ encoded_frame,
+ /*codec_specific_info=*/nullptr);
+ }
+ ++num_encoded_frames;
+ return WEBRTC_VIDEO_CODEC_OK;
+ });
+ return encoder;
+ });
+
+ int num_decoded_frames = 0;
+ DecodedImageCallback* decode_callback;
+ NiceMock<MockVideoDecoderFactory> decoder_factory;
+ ON_CALL(decoder_factory, CreateVideoDecoder)
+ .WillByDefault([&](const SdpVideoFormat&) {
+ auto decoder = std::make_unique<NiceMock<MockVideoDecoder>>();
+ ON_CALL(*decoder, RegisterDecodeCompleteCallback)
+ .WillByDefault([&](DecodedImageCallback* callback) {
+ decode_callback = callback;
+ return WEBRTC_VIDEO_CODEC_OK;
+ });
+ ON_CALL(*decoder, Decode(_, _))
+ .WillByDefault([&](const EncodedImage& encoded_frame, int64_t) {
+ // Make values to be different from source YUV generated in
+ // `CreateYuvFile`.
+ uint8_t y = ((num_decoded_frames + 1) * 2) & 255;
+ uint8_t u = ((num_decoded_frames + 2) * 2) & 255;
+ uint8_t v = ((num_decoded_frames + 3) * 2) & 255;
+ rtc::scoped_refptr<I420Buffer> frame_buffer =
+ CreateYuvBuffer(y, u, v);
+ VideoFrame decoded_frame =
+ VideoFrame::Builder()
+ .set_video_frame_buffer(frame_buffer)
+ .set_timestamp_rtp(encoded_frame.RtpTimestamp())
+ .build();
+ decode_callback->Decoded(decoded_frame);
+ ++num_decoded_frames;
+ return WEBRTC_VIDEO_CODEC_OK;
+ });
+ return decoder;
+ });
+
+ int num_spatial_layers = ScalabilityModeToNumSpatialLayers(scalability_mode);
+ int num_temporal_layers =
+ ScalabilityModeToNumTemporalLayers(scalability_mode);
+
+ std::map<uint32_t, EncodingSettings> encoding_settings;
+ for (int frame_num = 0; frame_num < num_frames; ++frame_num) {
+ std::map<LayerId, LayerSettings> layers_settings;
+ for (int sidx = 0; sidx < num_spatial_layers; ++sidx) {
+ for (int tidx = 0; tidx < num_temporal_layers; ++tidx) {
+ layers_settings.emplace(
+ LayerId{.spatial_idx = sidx, .temporal_idx = tidx},
+ LayerSettings{.resolution = {.width = kWidth, .height = kHeight},
+ .framerate = kTargetFramerate /
+ (1 << (num_temporal_layers - 1 - tidx)),
+ .bitrate = kTargetLayerBitrate});
+ }
+ }
+ encoding_settings.emplace(
+ frames[frame_num][0].timestamp_rtp,
+ EncodingSettings{.scalability_mode = scalability_mode,
+ .layers_settings = layers_settings});
+ }
+
+ EncoderSettings encoder_settings;
+ DecoderSettings decoder_settings;
+ std::unique_ptr<VideoCodecStats> stats =
+ VideoCodecTester::RunEncodeDecodeTest(
+ source_settings, &encoder_factory, &decoder_factory, encoder_settings,
+ decoder_settings, encoding_settings);
+ remove(source_yuv_path.c_str());
+ return stats;
+}
+
+EncodedImage CreateEncodedImage(uint32_t timestamp_rtp) {
+ EncodedImage encoded_image;
+ encoded_image.SetRtpTimestamp(timestamp_rtp);
+ return encoded_image;
+}
+
+class MockCodedVideoSource : public CodedVideoSource {
+ public:
+ MockCodedVideoSource(int num_frames, Frequency framerate)
+ : num_frames_(num_frames), frame_num_(0), framerate_(framerate) {}
+
+ absl::optional<EncodedImage> PullFrame() override {
+ if (frame_num_ >= num_frames_) {
+ return absl::nullopt;
+ }
+ uint32_t timestamp_rtp = frame_num_ * k90kHz / framerate_;
+ ++frame_num_;
+ return CreateEncodedImage(timestamp_rtp);
+ }
+
+ private:
+ int num_frames_;
+ int frame_num_;
+ Frequency framerate_;
+};
+
+} // namespace
+
+TEST(VideoCodecTester, Slice) {
+ std::unique_ptr<VideoCodecStats> stats = RunTest(
+ {{{.timestamp_rtp = 0, .layer_id = {.spatial_idx = 0, .temporal_idx = 0}},
+ {.timestamp_rtp = 0,
+ .layer_id = {.spatial_idx = 1, .temporal_idx = 0}}},
+ {{.timestamp_rtp = 1,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 1}}}},
+ ScalabilityMode::kL2T2);
+ std::vector<Frame> slice = stats->Slice(Filter{}, /*merge=*/false);
+ EXPECT_THAT(slice, ElementsAre(Field(&Frame::timestamp_rtp, 0),
+ Field(&Frame::timestamp_rtp, 0),
+ Field(&Frame::timestamp_rtp, 1)));
+
+ slice = stats->Slice({.min_timestamp_rtp = 1}, /*merge=*/false);
+ EXPECT_THAT(slice, ElementsAre(Field(&Frame::timestamp_rtp, 1)));
+
+ slice = stats->Slice({.max_timestamp_rtp = 0}, /*merge=*/false);
+ EXPECT_THAT(slice, ElementsAre(Field(&Frame::timestamp_rtp, 0),
+ Field(&Frame::timestamp_rtp, 0)));
+
+ slice = stats->Slice({.layer_id = {{.spatial_idx = 0, .temporal_idx = 0}}},
+ /*merge=*/false);
+ EXPECT_THAT(slice, ElementsAre(Field(&Frame::timestamp_rtp, 0)));
+
+ slice = stats->Slice({.layer_id = {{.spatial_idx = 0, .temporal_idx = 1}}},
+ /*merge=*/false);
+ EXPECT_THAT(slice, ElementsAre(Field(&Frame::timestamp_rtp, 0),
+ Field(&Frame::timestamp_rtp, 1)));
+}
+
+TEST(VideoCodecTester, Merge) {
+ std::unique_ptr<VideoCodecStats> stats =
+ RunTest({{{.timestamp_rtp = 0,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 0},
+ .frame_size = DataSize::Bytes(1),
+ .keyframe = true},
+ {.timestamp_rtp = 0,
+ .layer_id = {.spatial_idx = 1, .temporal_idx = 0},
+ .frame_size = DataSize::Bytes(2)}},
+ {{.timestamp_rtp = 1,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 1},
+ .frame_size = DataSize::Bytes(4)},
+ {.timestamp_rtp = 1,
+ .layer_id = {.spatial_idx = 1, .temporal_idx = 1},
+ .frame_size = DataSize::Bytes(8)}}},
+ ScalabilityMode::kL2T2_KEY);
+
+ std::vector<Frame> slice = stats->Slice(Filter{}, /*merge=*/true);
+ EXPECT_THAT(
+ slice,
+ ElementsAre(
+ AllOf(Field(&Frame::timestamp_rtp, 0), Field(&Frame::keyframe, true),
+ Field(&Frame::frame_size, DataSize::Bytes(3))),
+ AllOf(Field(&Frame::timestamp_rtp, 1), Field(&Frame::keyframe, false),
+ Field(&Frame::frame_size, DataSize::Bytes(12)))));
+}
+
+struct AggregationTestParameters {
+ Filter filter;
+ double expected_keyframe_sum;
+ double expected_encoded_bitrate_kbps;
+ double expected_encoded_framerate_fps;
+ double expected_bitrate_mismatch_pct;
+ double expected_framerate_mismatch_pct;
+};
+
+class VideoCodecTesterTestAggregation
+ : public ::testing::TestWithParam<AggregationTestParameters> {};
+
+TEST_P(VideoCodecTesterTestAggregation, Aggregate) {
+ AggregationTestParameters test_params = GetParam();
+ std::unique_ptr<VideoCodecStats> stats =
+ RunTest({{// L0T0
+ {.timestamp_rtp = 0,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 0},
+ .frame_size = DataSize::Bytes(1),
+ .keyframe = true},
+ // L1T0
+ {.timestamp_rtp = 0,
+ .layer_id = {.spatial_idx = 1, .temporal_idx = 0},
+ .frame_size = DataSize::Bytes(2)}},
+ // Emulate frame drop (frame_size = 0).
+ {{.timestamp_rtp = 3000,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 0},
+ .frame_size = DataSize::Zero()}},
+ {// L0T1
+ {.timestamp_rtp = 87000,
+ .layer_id = {.spatial_idx = 0, .temporal_idx = 1},
+ .frame_size = DataSize::Bytes(4)},
+ // L1T1
+ {.timestamp_rtp = 87000,
+ .layer_id = {.spatial_idx = 1, .temporal_idx = 1},
+ .frame_size = DataSize::Bytes(8)}}},
+ ScalabilityMode::kL2T2_KEY);
+
+ Stream stream = stats->Aggregate(test_params.filter);
+ EXPECT_EQ(stream.keyframe.GetSum(), test_params.expected_keyframe_sum);
+ EXPECT_EQ(stream.encoded_bitrate_kbps.GetAverage(),
+ test_params.expected_encoded_bitrate_kbps);
+ EXPECT_EQ(stream.encoded_framerate_fps.GetAverage(),
+ test_params.expected_encoded_framerate_fps);
+ EXPECT_EQ(stream.bitrate_mismatch_pct.GetAverage(),
+ test_params.expected_bitrate_mismatch_pct);
+ EXPECT_EQ(stream.framerate_mismatch_pct.GetAverage(),
+ test_params.expected_framerate_mismatch_pct);
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ All,
+ VideoCodecTesterTestAggregation,
+ ::testing::Values(
+ // No filtering.
+ AggregationTestParameters{
+ .filter = {},
+ .expected_keyframe_sum = 1,
+ .expected_encoded_bitrate_kbps =
+ DataRate::BytesPerSec(15).kbps<double>(),
+ .expected_encoded_framerate_fps = 2,
+ .expected_bitrate_mismatch_pct =
+ 100 * (15.0 / (kTargetLayerBitrate.bytes_per_sec() * 4) - 1),
+ .expected_framerate_mismatch_pct =
+ 100 * (2.0 / kTargetFramerate.hertz() - 1)},
+ // L0T0
+ AggregationTestParameters{
+ .filter = {.layer_id = {{.spatial_idx = 0, .temporal_idx = 0}}},
+ .expected_keyframe_sum = 1,
+ .expected_encoded_bitrate_kbps =
+ DataRate::BytesPerSec(1).kbps<double>(),
+ .expected_encoded_framerate_fps = 1,
+ .expected_bitrate_mismatch_pct =
+ 100 * (1.0 / kTargetLayerBitrate.bytes_per_sec() - 1),
+ .expected_framerate_mismatch_pct =
+ 100 * (1.0 / (kTargetFramerate.hertz() / 2) - 1)},
+ // L0T1
+ AggregationTestParameters{
+ .filter = {.layer_id = {{.spatial_idx = 0, .temporal_idx = 1}}},
+ .expected_keyframe_sum = 1,
+ .expected_encoded_bitrate_kbps =
+ DataRate::BytesPerSec(5).kbps<double>(),
+ .expected_encoded_framerate_fps = 2,
+ .expected_bitrate_mismatch_pct =
+ 100 * (5.0 / (kTargetLayerBitrate.bytes_per_sec() * 2) - 1),
+ .expected_framerate_mismatch_pct =
+ 100 * (2.0 / kTargetFramerate.hertz() - 1)},
+ // L1T0
+ AggregationTestParameters{
+ .filter = {.layer_id = {{.spatial_idx = 1, .temporal_idx = 0}}},
+ .expected_keyframe_sum = 1,
+ .expected_encoded_bitrate_kbps =
+ DataRate::BytesPerSec(3).kbps<double>(),
+ .expected_encoded_framerate_fps = 1,
+ .expected_bitrate_mismatch_pct =
+ 100 * (3.0 / kTargetLayerBitrate.bytes_per_sec() - 1),
+ .expected_framerate_mismatch_pct =
+ 100 * (1.0 / (kTargetFramerate.hertz() / 2) - 1)},
+ // L1T1
+ AggregationTestParameters{
+ .filter = {.layer_id = {{.spatial_idx = 1, .temporal_idx = 1}}},
+ .expected_keyframe_sum = 1,
+ .expected_encoded_bitrate_kbps =
+ DataRate::BytesPerSec(11).kbps<double>(),
+ .expected_encoded_framerate_fps = 2,
+ .expected_bitrate_mismatch_pct =
+ 100 * (11.0 / (kTargetLayerBitrate.bytes_per_sec() * 2) - 1),
+ .expected_framerate_mismatch_pct =
+ 100 * (2.0 / kTargetFramerate.hertz() - 1)}));
+
+TEST(VideoCodecTester, Psnr) {
+ std::unique_ptr<VideoCodecStats> stats =
+ RunTest({{{.timestamp_rtp = 0, .frame_size = DataSize::Bytes(1)}},
+ {{.timestamp_rtp = 3000, .frame_size = DataSize::Bytes(1)}}},
+ ScalabilityMode::kL1T1);
+
+ std::vector<Frame> slice = stats->Slice(Filter{}, /*merge=*/false);
+ ASSERT_THAT(slice, SizeIs(2));
+ ASSERT_TRUE(slice[0].psnr.has_value());
+ ASSERT_TRUE(slice[1].psnr.has_value());
+ EXPECT_NEAR(slice[0].psnr->y, 42, 1);
+ EXPECT_NEAR(slice[0].psnr->u, 38, 1);
+ EXPECT_NEAR(slice[0].psnr->v, 36, 1);
+ EXPECT_NEAR(slice[1].psnr->y, 38, 1);
+ EXPECT_NEAR(slice[1].psnr->u, 36, 1);
+ EXPECT_NEAR(slice[1].psnr->v, 34, 1);
+}
+
+class VideoCodecTesterTestPacing
+ : public ::testing::TestWithParam<std::tuple<PacingSettings, int>> {
+ public:
+ const int kSourceWidth = 2;
+ const int kSourceHeight = 2;
+ const int kNumFrames = 3;
+ const int kTargetLayerBitrateKbps = 128;
+ const Frequency kTargetFramerate = Frequency::Hertz(10);
+
+ void SetUp() override {
+ source_yuv_file_path_ = webrtc::test::TempFilename(
+ webrtc::test::OutputPath(), "video_codec_tester_impl_unittest");
+ FILE* file = fopen(source_yuv_file_path_.c_str(), "wb");
+ for (int i = 0; i < 3 * kSourceWidth * kSourceHeight / 2; ++i) {
+ fwrite("x", 1, 1, file);
+ }
+ fclose(file);
+ }
+
+ protected:
+ std::string source_yuv_file_path_;
+};
+
+TEST_P(VideoCodecTesterTestPacing, PaceEncode) {
+ auto [pacing_settings, expected_delta_ms] = GetParam();
+ VideoSourceSettings video_source{
+ .file_path = source_yuv_file_path_,
+ .resolution = {.width = kSourceWidth, .height = kSourceHeight},
+ .framerate = kTargetFramerate};
+
+ NiceMock<MockVideoEncoderFactory> encoder_factory;
+ ON_CALL(encoder_factory, CreateVideoEncoder(_))
+ .WillByDefault([](const SdpVideoFormat&) {
+ return std::make_unique<NiceMock<MockVideoEncoder>>();
+ });
+
+ std::map<uint32_t, EncodingSettings> encoding_settings =
+ VideoCodecTester::CreateEncodingSettings(
+ "VP8", "L1T1", kSourceWidth, kSourceHeight, {kTargetLayerBitrateKbps},
+ kTargetFramerate.hertz(), kNumFrames);
+
+ EncoderSettings encoder_settings;
+ encoder_settings.pacing_settings = pacing_settings;
+ std::vector<Frame> frames =
+ VideoCodecTester::RunEncodeTest(video_source, &encoder_factory,
+ encoder_settings, encoding_settings)
+ ->Slice(/*filter=*/{}, /*merge=*/false);
+ ASSERT_THAT(frames, SizeIs(kNumFrames));
+ EXPECT_NEAR((frames[1].encode_start - frames[0].encode_start).ms(),
+ expected_delta_ms, 10);
+ EXPECT_NEAR((frames[2].encode_start - frames[1].encode_start).ms(),
+ expected_delta_ms, 10);
+}
+
+TEST_P(VideoCodecTesterTestPacing, PaceDecode) {
+ auto [pacing_settings, expected_delta_ms] = GetParam();
+ MockCodedVideoSource video_source(kNumFrames, kTargetFramerate);
+
+ NiceMock<MockVideoDecoderFactory> decoder_factory;
+ ON_CALL(decoder_factory, CreateVideoDecoder(_))
+ .WillByDefault([](const SdpVideoFormat&) {
+ return std::make_unique<NiceMock<MockVideoDecoder>>();
+ });
+
+ DecoderSettings decoder_settings;
+ decoder_settings.pacing_settings = pacing_settings;
+ std::vector<Frame> frames =
+ VideoCodecTester::RunDecodeTest(&video_source, &decoder_factory,
+ decoder_settings, SdpVideoFormat("VP8"))
+ ->Slice(/*filter=*/{}, /*merge=*/false);
+ ASSERT_THAT(frames, SizeIs(kNumFrames));
+ EXPECT_NEAR((frames[1].decode_start - frames[0].decode_start).ms(),
+ expected_delta_ms, 10);
+ EXPECT_NEAR((frames[2].decode_start - frames[1].decode_start).ms(),
+ expected_delta_ms, 10);
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ DISABLED_All,
+ VideoCodecTesterTestPacing,
+ ::testing::Values(
+ // No pacing.
+ std::make_tuple(PacingSettings{.mode = PacingMode::kNoPacing},
+ /*expected_delta_ms=*/0),
+ // Real-time pacing.
+ std::make_tuple(PacingSettings{.mode = PacingMode::kRealTime},
+ /*expected_delta_ms=*/100),
+ // Pace with specified constant rate.
+ std::make_tuple(PacingSettings{.mode = PacingMode::kConstantRate,
+ .constant_rate = Frequency::Hertz(20)},
+ /*expected_delta_ms=*/50)));
+} // namespace test
+} // namespace webrtc
diff --git a/tools_webrtc/autoroller/roll_deps.py b/tools_webrtc/autoroller/roll_deps.py
index c57ba9c040..8e3b760c43 100755
--- a/tools_webrtc/autoroller/roll_deps.py
+++ b/tools_webrtc/autoroller/roll_deps.py
@@ -22,11 +22,11 @@ import urllib.request
def FindSrcDirPath():
- """Returns the abs path to the src/ dir of the project."""
- src_dir = os.path.dirname(os.path.abspath(__file__))
- while os.path.basename(src_dir) != 'src':
- src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
- return src_dir
+ """Returns the abs path to the src/ dir of the project."""
+ src_dir = os.path.dirname(os.path.abspath(__file__))
+ while os.path.basename(src_dir) != 'src':
+ src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
+ return src_dir
# Skip these dependencies (list without solution name prefix).
@@ -101,42 +101,42 @@ ChromiumRevisionUpdate = collections.namedtuple('ChromiumRevisionUpdate',
class RollError(Exception):
- pass
+ pass
def StrExpansion():
- return lambda str_value: str_value
+ return lambda str_value: str_value
def VarLookup(local_scope):
- return lambda var_name: local_scope['vars'][var_name]
+ return lambda var_name: local_scope['vars'][var_name]
def ParseDepsDict(deps_content):
- local_scope = {}
- global_scope = {
- 'Str': StrExpansion(),
- 'Var': VarLookup(local_scope),
- 'deps_os': {},
- }
- exec(deps_content, global_scope, local_scope)
- return local_scope
+ local_scope = {}
+ global_scope = {
+ 'Str': StrExpansion(),
+ 'Var': VarLookup(local_scope),
+ 'deps_os': {},
+ }
+ exec(deps_content, global_scope, local_scope)
+ return local_scope
def ParseLocalDepsFile(filename):
- with open(filename, 'rb') as f:
- deps_content = f.read().decode('utf-8')
- return ParseDepsDict(deps_content)
+ with open(filename, 'rb') as f:
+ deps_content = f.read().decode('utf-8')
+ return ParseDepsDict(deps_content)
def ParseCommitPosition(commit_message):
- for line in reversed(commit_message.splitlines()):
- m = COMMIT_POSITION_RE.match(line.strip())
- if m:
- return int(m.group(1))
- logging.error('Failed to parse commit position id from:\n%s\n',
- commit_message)
- sys.exit(-1)
+ for line in reversed(commit_message.splitlines()):
+ m = COMMIT_POSITION_RE.match(line.strip())
+ if m:
+ return int(m.group(1))
+ logging.error('Failed to parse commit position id from:\n%s\n',
+ commit_message)
+ sys.exit(-1)
def _RunCommand(command,
@@ -144,68 +144,69 @@ def _RunCommand(command,
ignore_exit_code=False,
extra_env=None,
input_data=None):
- """Runs a command and returns the output from that command.
+ """Runs a command and returns the output from that command.
If the command fails (exit code != 0), the function will exit the process.
Returns:
A tuple containing the stdout and stderr outputs as strings.
"""
- working_dir = working_dir or CHECKOUT_SRC_DIR
- logging.debug('CMD: %s CWD: %s', ' '.join(command), working_dir)
- env = os.environ.copy()
- if extra_env:
- assert all(isinstance(value, str) for value in extra_env.values())
- logging.debug('extra env: %s', extra_env)
- env.update(extra_env)
- p = subprocess.Popen(command,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- env=env,
- cwd=working_dir,
- universal_newlines=True)
- std_output, err_output = p.communicate(input_data)
- p.stdout.close()
- p.stderr.close()
- if not ignore_exit_code and p.returncode != 0:
- logging.error('Command failed: %s\n'
- 'stdout:\n%s\n'
- 'stderr:\n%s\n', ' '.join(command), std_output, err_output)
- sys.exit(p.returncode)
- return std_output, err_output
+ working_dir = working_dir or CHECKOUT_SRC_DIR
+ logging.debug('CMD: %s CWD: %s', ' '.join(command), working_dir)
+ env = os.environ.copy()
+ if extra_env:
+ assert all(isinstance(value, str) for value in extra_env.values())
+ logging.debug('extra env: %s', extra_env)
+ env.update(extra_env)
+ p = subprocess.Popen(command,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env=env,
+ cwd=working_dir,
+ universal_newlines=True)
+ std_output, err_output = p.communicate(input_data)
+ p.stdout.close()
+ p.stderr.close()
+ if not ignore_exit_code and p.returncode != 0:
+ logging.error('Command failed: %s\n'
+ 'stdout:\n%s\n'
+ 'stderr:\n%s\n', ' '.join(command), std_output,
+ err_output)
+ sys.exit(p.returncode)
+ return std_output, err_output
def _GetBranches():
- """Returns a tuple of active,branches.
+ """Returns a tuple of active,branches.
The 'active' is the name of the currently active branch and 'branches' is a
list of all branches.
"""
- lines = _RunCommand(['git', 'branch'])[0].split('\n')
- branches = []
- active = ''
- for line in lines:
- if '*' in line:
- # The assumption is that the first char will always be the '*'.
- active = line[1:].strip()
- branches.append(active)
- else:
- branch = line.strip()
- if branch:
- branches.append(branch)
- return active, branches
+ lines = _RunCommand(['git', 'branch'])[0].split('\n')
+ branches = []
+ active = ''
+ for line in lines:
+ if '*' in line:
+ # The assumption is that the first char will always be the '*'.
+ active = line[1:].strip()
+ branches.append(active)
+ else:
+ branch = line.strip()
+ if branch:
+ branches.append(branch)
+ return active, branches
def _ReadGitilesContent(url):
- # Download and decode BASE64 content until
- # https://code.google.com/p/gitiles/issues/detail?id=7 is fixed.
- base64_content = ReadUrlContent(url + '?format=TEXT')
- return base64.b64decode(base64_content[0]).decode('utf-8')
+ # Download and decode BASE64 content until
+ # https://code.google.com/p/gitiles/issues/detail?id=7 is fixed.
+ base64_content = ReadUrlContent(url + '?format=TEXT')
+ return base64.b64decode(base64_content[0]).decode('utf-8')
def ReadRemoteCrFile(path_below_src, revision):
- """Reads a remote Chromium file of a specific revision.
+ """Reads a remote Chromium file of a specific revision.
Args:
path_below_src: A path to the target file relative to src dir.
@@ -213,35 +214,35 @@ def ReadRemoteCrFile(path_below_src, revision):
Returns:
A string with file content.
"""
- return _ReadGitilesContent(CHROMIUM_FILE_TEMPLATE %
- (revision, path_below_src))
+ return _ReadGitilesContent(CHROMIUM_FILE_TEMPLATE %
+ (revision, path_below_src))
def ReadRemoteCrCommit(revision):
- """Reads a remote Chromium commit message. Returns a string."""
- return _ReadGitilesContent(CHROMIUM_COMMIT_TEMPLATE % revision)
+ """Reads a remote Chromium commit message. Returns a string."""
+ return _ReadGitilesContent(CHROMIUM_COMMIT_TEMPLATE % revision)
def ReadUrlContent(url):
- """Connect to a remote host and read the contents.
+ """Connect to a remote host and read the contents.
Args:
url: URL to connect to.
Returns:
A list of lines.
"""
- conn = urllib.request.urlopen(url)
- try:
- return conn.readlines()
- except IOError as e:
- logging.exception('Error connecting to %s. Error: %s', url, e)
- raise
- finally:
- conn.close()
+ conn = urllib.request.urlopen(url)
+ try:
+ return conn.readlines()
+ except IOError as e:
+ logging.exception('Error connecting to %s. Error: %s', url, e)
+ raise
+ finally:
+ conn.close()
def GetMatchingDepsEntries(depsentry_dict, dir_path):
- """Gets all deps entries matching the provided path.
+ """Gets all deps entries matching the provided path.
This list may contain more than one DepsEntry object.
Example: dir_path='src/testing' would give results containing both
@@ -253,94 +254,95 @@ def GetMatchingDepsEntries(depsentry_dict, dir_path):
Returns:
A list of DepsEntry objects.
"""
- result = []
- for path, depsentry in depsentry_dict.items():
- if path == dir_path:
- result.append(depsentry)
- else:
- parts = path.split('/')
- if all(part == parts[i] for i, part in enumerate(dir_path.split('/'))):
- result.append(depsentry)
- return result
-
-
-def BuildDepsentryDict(deps_dict):
- """Builds a dict of paths to DepsEntry objects from a raw deps dict."""
- result = {}
-
- def AddDepsEntries(deps_subdict):
- for path, dep in deps_subdict.items():
- if path in result:
- continue
- if not isinstance(dep, dict):
- dep = {'url': dep}
- if dep.get('dep_type') == 'cipd':
- result[path] = CipdDepsEntry(path, dep['packages'])
- else:
- if '@' not in dep['url']:
- url, revision = dep['url'], 'HEAD'
+ result = []
+ for path, depsentry in depsentry_dict.items():
+ if path == dir_path:
+ result.append(depsentry)
else:
- url, revision = dep['url'].split('@')
- result[path] = DepsEntry(path, url, revision)
+ parts = path.split('/')
+ if all(part == parts[i]
+ for i, part in enumerate(dir_path.split('/'))):
+ result.append(depsentry)
+ return result
- def AddVersionEntry(vars_subdict):
- for key, value in vars_subdict.items():
- if key in result:
- continue
- if not key.endswith('_version'):
- continue
- key = re.sub('_version$', '', key)
- result[key] = VersionEntry(value)
- AddDepsEntries(deps_dict['deps'])
- for deps_os in ['win', 'mac', 'linux', 'android', 'ios', 'unix']:
- AddDepsEntries(deps_dict.get('deps_os', {}).get(deps_os, {}))
- AddVersionEntry(deps_dict.get('vars', {}))
- return result
+def BuildDepsentryDict(deps_dict):
+ """Builds a dict of paths to DepsEntry objects from a raw deps dict."""
+ result = {}
+
+ def AddDepsEntries(deps_subdict):
+ for path, dep in deps_subdict.items():
+ if path in result:
+ continue
+ if not isinstance(dep, dict):
+ dep = {'url': dep}
+ if dep.get('dep_type') == 'cipd':
+ result[path] = CipdDepsEntry(path, dep['packages'])
+ else:
+ if '@' not in dep['url']:
+ url, revision = dep['url'], 'HEAD'
+ else:
+ url, revision = dep['url'].split('@')
+ result[path] = DepsEntry(path, url, revision)
+
+ def AddVersionEntry(vars_subdict):
+ for key, value in vars_subdict.items():
+ if key in result:
+ continue
+ if not key.endswith('_version'):
+ continue
+ key = re.sub('_version$', '', key)
+ result[key] = VersionEntry(value)
+
+ AddDepsEntries(deps_dict['deps'])
+ for deps_os in ['win', 'mac', 'linux', 'android', 'ios', 'unix']:
+ AddDepsEntries(deps_dict.get('deps_os', {}).get(deps_os, {}))
+ AddVersionEntry(deps_dict.get('vars', {}))
+ return result
def _FindChangedCipdPackages(path, old_pkgs, new_pkgs):
- old_pkgs_names = {p['package'] for p in old_pkgs}
- new_pkgs_names = {p['package'] for p in new_pkgs}
- pkgs_equal = (old_pkgs_names == new_pkgs_names)
- added_pkgs = [p for p in new_pkgs_names if p not in old_pkgs_names]
- removed_pkgs = [p for p in old_pkgs_names if p not in new_pkgs_names]
-
- assert pkgs_equal, ('Old: %s\n New: %s.\nYou need to do a manual roll '
- 'and remove/add entries in DEPS so the old and new '
- 'list match.\nMost likely, you should add \"%s\" and '
- 'remove \"%s\"' %
- (old_pkgs, new_pkgs, added_pkgs, removed_pkgs))
-
- for old_pkg in old_pkgs:
- for new_pkg in new_pkgs:
- old_version = old_pkg['version']
- new_version = new_pkg['version']
- if (old_pkg['package'] == new_pkg['package']
- and old_version != new_version):
- logging.debug('Roll dependency %s to %s', path, new_version)
- yield ChangedCipdPackage(path, old_pkg['package'], old_version,
- new_version)
+ old_pkgs_names = {p['package'] for p in old_pkgs}
+ new_pkgs_names = {p['package'] for p in new_pkgs}
+ pkgs_equal = (old_pkgs_names == new_pkgs_names)
+ added_pkgs = [p for p in new_pkgs_names if p not in old_pkgs_names]
+ removed_pkgs = [p for p in old_pkgs_names if p not in new_pkgs_names]
+
+ assert pkgs_equal, ('Old: %s\n New: %s.\nYou need to do a manual roll '
+ 'and remove/add entries in DEPS so the old and new '
+ 'list match.\nMost likely, you should add \"%s\" and '
+ 'remove \"%s\"' %
+ (old_pkgs, new_pkgs, added_pkgs, removed_pkgs))
+
+ for old_pkg in old_pkgs:
+ for new_pkg in new_pkgs:
+ old_version = old_pkg['version']
+ new_version = new_pkg['version']
+ if (old_pkg['package'] == new_pkg['package']
+ and old_version != new_version):
+ logging.debug('Roll dependency %s to %s', path, new_version)
+ yield ChangedCipdPackage(path, old_pkg['package'], old_version,
+ new_version)
def _FindChangedVars(name, old_version, new_version):
- if old_version != new_version:
- logging.debug('Roll dependency %s to %s', name, new_version)
- yield ChangedVersionEntry(name, old_version, new_version)
+ if old_version != new_version:
+ logging.debug('Roll dependency %s to %s', name, new_version)
+ yield ChangedVersionEntry(name, old_version, new_version)
def _FindNewDeps(old, new):
- """ Gather dependencies only in `new` and return corresponding paths. """
- old_entries = set(BuildDepsentryDict(old))
- new_entries = set(BuildDepsentryDict(new))
- return [
- path for path in new_entries - old_entries
- if path not in DONT_AUTOROLL_THESE
- ]
+ """ Gather dependencies only in `new` and return corresponding paths. """
+ old_entries = set(BuildDepsentryDict(old))
+ new_entries = set(BuildDepsentryDict(new))
+ return [
+ path for path in new_entries - old_entries
+ if path not in DONT_AUTOROLL_THESE
+ ]
def FindAddedDeps(webrtc_deps, new_cr_deps):
- """
+ """
Calculate new deps entries of interest.
Ideally, that would mean: only appearing in chromium DEPS
@@ -361,18 +363,18 @@ def FindAddedDeps(webrtc_deps, new_cr_deps):
A list of paths added dependencies sitting in `ANDROID_DEPS_PATH`.
A list of paths for other added dependencies.
"""
- all_added_deps = _FindNewDeps(webrtc_deps, new_cr_deps)
- generated_android_deps = [
- path for path in all_added_deps if path.startswith(ANDROID_DEPS_PATH)
- ]
- other_deps = [
- path for path in all_added_deps if path not in generated_android_deps
- ]
- return generated_android_deps, other_deps
+ all_added_deps = _FindNewDeps(webrtc_deps, new_cr_deps)
+ generated_android_deps = [
+ path for path in all_added_deps if path.startswith(ANDROID_DEPS_PATH)
+ ]
+ other_deps = [
+ path for path in all_added_deps if path not in generated_android_deps
+ ]
+ return generated_android_deps, other_deps
def FindRemovedDeps(webrtc_deps, new_cr_deps):
- """
+ """
Calculate obsolete deps entries.
Ideally, that would mean: no more appearing in chromium DEPS
@@ -395,19 +397,20 @@ def FindRemovedDeps(webrtc_deps, new_cr_deps):
A list of paths of dependencies removed from `ANDROID_DEPS_PATH`.
A list of paths of unexpected disappearing dependencies.
"""
- all_removed_deps = _FindNewDeps(new_cr_deps, webrtc_deps)
- generated_android_deps = sorted(
- [path for path in all_removed_deps if path.startswith(ANDROID_DEPS_PATH)])
- # Webrtc-only dependencies are handled in CalculateChangedDeps.
- other_deps = sorted([
- path for path in all_removed_deps
- if path not in generated_android_deps and path not in WEBRTC_ONLY_DEPS
- ])
- return generated_android_deps, other_deps
+ all_removed_deps = _FindNewDeps(new_cr_deps, webrtc_deps)
+ generated_android_deps = sorted([
+ path for path in all_removed_deps if path.startswith(ANDROID_DEPS_PATH)
+ ])
+ # Webrtc-only dependencies are handled in CalculateChangedDeps.
+ other_deps = sorted([
+ path for path in all_removed_deps
+ if path not in generated_android_deps and path not in WEBRTC_ONLY_DEPS
+ ])
+ return generated_android_deps, other_deps
def CalculateChangedDeps(webrtc_deps, new_cr_deps):
- """
+ """
Calculate changed deps entries based on entries defined in the WebRTC DEPS
file:
- If a shared dependency with the Chromium DEPS file: roll it to the same
@@ -421,70 +424,71 @@ def CalculateChangedDeps(webrtc_deps, new_cr_deps):
Returns:
A list of ChangedDep objects representing the changed deps.
"""
- result = []
- webrtc_entries = BuildDepsentryDict(webrtc_deps)
- new_cr_entries = BuildDepsentryDict(new_cr_deps)
- for path, webrtc_deps_entry in webrtc_entries.items():
- if path in DONT_AUTOROLL_THESE:
- continue
- cr_deps_entry = new_cr_entries.get(path)
- if cr_deps_entry:
- assert type(cr_deps_entry) is type(webrtc_deps_entry)
-
- if isinstance(cr_deps_entry, CipdDepsEntry):
- result.extend(
- _FindChangedCipdPackages(path, webrtc_deps_entry.packages,
- cr_deps_entry.packages))
- continue
-
- if isinstance(cr_deps_entry, VersionEntry):
- result.extend(
- _FindChangedVars(path, webrtc_deps_entry.version,
- cr_deps_entry.version))
- continue
-
- # Use the revision from Chromium's DEPS file.
- new_rev = cr_deps_entry.revision
- assert webrtc_deps_entry.url == cr_deps_entry.url, (
- 'WebRTC DEPS entry %s has a different URL %s than Chromium %s.' %
- (path, webrtc_deps_entry.url, cr_deps_entry.url))
- else:
- if isinstance(webrtc_deps_entry, DepsEntry):
- # Use the HEAD of the deps repo.
- stdout, _ = _RunCommand(
- ['git', 'ls-remote', webrtc_deps_entry.url, 'HEAD'])
- new_rev = stdout.strip().split('\t')[0]
- else:
- # The dependency has been removed from chromium.
- # This is handled by FindRemovedDeps.
- continue
-
- # Check if an update is necessary.
- if webrtc_deps_entry.revision != new_rev:
- logging.debug('Roll dependency %s to %s', path, new_rev)
- result.append(
- ChangedDep(path, webrtc_deps_entry.url, webrtc_deps_entry.revision,
- new_rev))
- return sorted(result)
+ result = []
+ webrtc_entries = BuildDepsentryDict(webrtc_deps)
+ new_cr_entries = BuildDepsentryDict(new_cr_deps)
+ for path, webrtc_deps_entry in webrtc_entries.items():
+ if path in DONT_AUTOROLL_THESE:
+ continue
+ cr_deps_entry = new_cr_entries.get(path)
+ if cr_deps_entry:
+ assert type(cr_deps_entry) is type(webrtc_deps_entry)
+
+ if isinstance(cr_deps_entry, CipdDepsEntry):
+ result.extend(
+ _FindChangedCipdPackages(path, webrtc_deps_entry.packages,
+ cr_deps_entry.packages))
+ continue
+
+ if isinstance(cr_deps_entry, VersionEntry):
+ result.extend(
+ _FindChangedVars(path, webrtc_deps_entry.version,
+ cr_deps_entry.version))
+ continue
+
+ # Use the revision from Chromium's DEPS file.
+ new_rev = cr_deps_entry.revision
+ assert webrtc_deps_entry.url == cr_deps_entry.url, (
+ 'WebRTC DEPS entry %s has a different URL %s than Chromium %s.'
+ % (path, webrtc_deps_entry.url, cr_deps_entry.url))
+ else:
+ if isinstance(webrtc_deps_entry, DepsEntry):
+ # Use the HEAD of the deps repo.
+ stdout, _ = _RunCommand(
+ ['git', 'ls-remote', webrtc_deps_entry.url, 'HEAD'])
+ new_rev = stdout.strip().split('\t')[0]
+ else:
+ # The dependency has been removed from chromium.
+ # This is handled by FindRemovedDeps.
+ continue
+
+ # Check if an update is necessary.
+ if webrtc_deps_entry.revision != new_rev:
+ logging.debug('Roll dependency %s to %s', path, new_rev)
+ result.append(
+ ChangedDep(path, webrtc_deps_entry.url,
+ webrtc_deps_entry.revision, new_rev))
+ return sorted(result)
def CalculateChangedClang(new_cr_rev):
- def GetClangRev(lines):
- for line in lines:
- match = CLANG_REVISION_RE.match(line)
- if match:
- return match.group(1)
- raise RollError('Could not parse Clang revision!')
+ def GetClangRev(lines):
+ for line in lines:
+ match = CLANG_REVISION_RE.match(line)
+ if match:
+ return match.group(1)
+ raise RollError('Could not parse Clang revision!')
- with open(CLANG_UPDATE_SCRIPT_LOCAL_PATH, 'r') as f:
- current_lines = f.readlines()
- current_rev = GetClangRev(current_lines)
+ with open(CLANG_UPDATE_SCRIPT_LOCAL_PATH, 'r') as f:
+ current_lines = f.readlines()
+ current_rev = GetClangRev(current_lines)
- new_clang_update_py = ReadRemoteCrFile(CLANG_UPDATE_SCRIPT_URL_PATH,
- new_cr_rev).splitlines()
- new_rev = GetClangRev(new_clang_update_py)
- return ChangedDep(CLANG_UPDATE_SCRIPT_LOCAL_PATH, None, current_rev, new_rev)
+ new_clang_update_py = ReadRemoteCrFile(CLANG_UPDATE_SCRIPT_URL_PATH,
+ new_cr_rev).splitlines()
+ new_rev = GetClangRev(new_clang_update_py)
+ return ChangedDep(CLANG_UPDATE_SCRIPT_LOCAL_PATH, None, current_rev,
+ new_rev)
def GenerateCommitMessage(
@@ -496,181 +500,186 @@ def GenerateCommitMessage(
removed_deps_paths=None,
clang_change=None,
):
- current_cr_rev = rev_update.current_chromium_rev[0:10]
- new_cr_rev = rev_update.new_chromium_rev[0:10]
- rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
- git_number_interval = '%s:%s' % (current_commit_pos, new_commit_pos)
-
- commit_msg = [
- 'Roll chromium_revision %s (%s)\n' % (rev_interval, git_number_interval),
- 'Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval),
- 'Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE % rev_interval)
- ]
-
- def Section(adjective, deps):
- noun = 'dependency' if len(deps) == 1 else 'dependencies'
- commit_msg.append('%s %s' % (adjective, noun))
-
- if changed_deps_list:
- Section('Changed', changed_deps_list)
+ current_cr_rev = rev_update.current_chromium_rev[0:10]
+ new_cr_rev = rev_update.new_chromium_rev[0:10]
+ rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
+ git_number_interval = '%s:%s' % (current_commit_pos, new_commit_pos)
+
+ commit_msg = [
+ 'Roll chromium_revision %s (%s)\n' %
+ (rev_interval, git_number_interval),
+ 'Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval),
+ 'Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE % rev_interval)
+ ]
+
+ def Section(adjective, deps):
+ noun = 'dependency' if len(deps) == 1 else 'dependencies'
+ commit_msg.append('%s %s' % (adjective, noun))
+
+ if changed_deps_list:
+ Section('Changed', changed_deps_list)
+
+ for c in changed_deps_list:
+ if isinstance(c, ChangedCipdPackage):
+ commit_msg.append('* %s: %s..%s' %
+ (c.path, c.current_version, c.new_version))
+ elif isinstance(c, ChangedVersionEntry):
+ commit_msg.append('* %s_version: %s..%s' %
+ (c.path, c.current_version, c.new_version))
+ else:
+ commit_msg.append(
+ '* %s: %s/+log/%s..%s' %
+ (c.path, c.url, c.current_rev[0:10], c.new_rev[0:10]))
+
+ if added_deps_paths:
+ Section('Added', added_deps_paths)
+ commit_msg.extend('* %s' % p for p in added_deps_paths)
+
+ if removed_deps_paths:
+ Section('Removed', removed_deps_paths)
+ commit_msg.extend('* %s' % p for p in removed_deps_paths)
+
+ if any([changed_deps_list, added_deps_paths, removed_deps_paths]):
+ change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS')
+ commit_msg.append('DEPS diff: %s\n' % change_url)
+ else:
+ commit_msg.append('No dependencies changed.')
+
+ if clang_change and clang_change.current_rev != clang_change.new_rev:
+ commit_msg.append('Clang version changed %s:%s' %
+ (clang_change.current_rev, clang_change.new_rev))
+ change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval,
+ CLANG_UPDATE_SCRIPT_URL_PATH)
+ commit_msg.append('Details: %s\n' % change_url)
+ else:
+ commit_msg.append('No update to Clang.\n')
- for c in changed_deps_list:
- if isinstance(c, ChangedCipdPackage):
- commit_msg.append('* %s: %s..%s' %
- (c.path, c.current_version, c.new_version))
- elif isinstance(c, ChangedVersionEntry):
- commit_msg.append('* %s_version: %s..%s' %
- (c.path, c.current_version, c.new_version))
- else:
- commit_msg.append('* %s: %s/+log/%s..%s' %
- (c.path, c.url, c.current_rev[0:10], c.new_rev[0:10]))
-
- if added_deps_paths:
- Section('Added', added_deps_paths)
- commit_msg.extend('* %s' % p for p in added_deps_paths)
-
- if removed_deps_paths:
- Section('Removed', removed_deps_paths)
- commit_msg.extend('* %s' % p for p in removed_deps_paths)
-
- if any([changed_deps_list, added_deps_paths, removed_deps_paths]):
- change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS')
- commit_msg.append('DEPS diff: %s\n' % change_url)
- else:
- commit_msg.append('No dependencies changed.')
-
- if clang_change and clang_change.current_rev != clang_change.new_rev:
- commit_msg.append('Clang version changed %s:%s' %
- (clang_change.current_rev, clang_change.new_rev))
- change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval,
- CLANG_UPDATE_SCRIPT_URL_PATH)
- commit_msg.append('Details: %s\n' % change_url)
- else:
- commit_msg.append('No update to Clang.\n')
-
- commit_msg.append('BUG=None')
- return '\n'.join(commit_msg)
+ commit_msg.append('BUG=None')
+ return '\n'.join(commit_msg)
def UpdateDepsFile(deps_filename, rev_update, changed_deps, new_cr_content):
- """Update the DEPS file with the new revision."""
-
- with open(deps_filename, 'rb') as deps_file:
- deps_content = deps_file.read().decode('utf-8')
-
- # Update the chromium_revision variable.
- deps_content = deps_content.replace(rev_update.current_chromium_rev,
- rev_update.new_chromium_rev)
-
- # Add and remove dependencies. For now: only generated android deps.
- # Since gclient cannot add or remove deps, we on the fact that
- # these android deps are located in one place we can copy/paste.
- deps_re = re.compile(ANDROID_DEPS_START + '.*' + ANDROID_DEPS_END, re.DOTALL)
- new_deps = deps_re.search(new_cr_content)
- old_deps = deps_re.search(deps_content)
- if not new_deps or not old_deps:
- faulty = 'Chromium' if not new_deps else 'WebRTC'
- raise RollError('Was expecting to find "%s" and "%s"\n'
- 'in %s DEPS' %
- (ANDROID_DEPS_START, ANDROID_DEPS_END, faulty))
- deps_content = deps_re.sub(new_deps.group(0), deps_content)
-
- for dep in changed_deps:
- if isinstance(dep, ChangedVersionEntry):
- deps_content = deps_content.replace(dep.current_version, dep.new_version)
-
- with open(deps_filename, 'wb') as deps_file:
- deps_file.write(deps_content.encode('utf-8'))
-
- # Update each individual DEPS entry.
- for dep in changed_deps:
- # ChangedVersionEntry types are already been processed.
- if isinstance(dep, ChangedVersionEntry):
- continue
- local_dep_dir = os.path.join(CHECKOUT_ROOT_DIR, dep.path)
- if not os.path.isdir(local_dep_dir):
- raise RollError(
- 'Cannot find local directory %s. Either run\n'
- 'gclient sync --deps=all\n'
- 'or make sure the .gclient file for your solution contains all '
- 'platforms in the target_os list, i.e.\n'
- 'target_os = ["android", "unix", "mac", "ios", "win"];\n'
- 'Then run "gclient sync" again.' % local_dep_dir)
- if isinstance(dep, ChangedCipdPackage):
- package = dep.package.format() # Eliminate double curly brackets
- update = '%s:%s@%s' % (dep.path, package, dep.new_version)
- else:
- update = '%s@%s' % (dep.path, dep.new_rev)
- _RunCommand(['gclient', 'setdep', '--revision', update],
- working_dir=CHECKOUT_SRC_DIR)
+ """Update the DEPS file with the new revision."""
+
+ with open(deps_filename, 'rb') as deps_file:
+ deps_content = deps_file.read().decode('utf-8')
+
+ # Update the chromium_revision variable.
+ deps_content = deps_content.replace(rev_update.current_chromium_rev,
+ rev_update.new_chromium_rev)
+
+ # Add and remove dependencies. For now: only generated android deps.
+ # Since gclient cannot add or remove deps, we on the fact that
+ # these android deps are located in one place we can copy/paste.
+ deps_re = re.compile(ANDROID_DEPS_START + '.*' + ANDROID_DEPS_END,
+ re.DOTALL)
+ new_deps = deps_re.search(new_cr_content)
+ old_deps = deps_re.search(deps_content)
+ if not new_deps or not old_deps:
+ faulty = 'Chromium' if not new_deps else 'WebRTC'
+ raise RollError('Was expecting to find "%s" and "%s"\n'
+ 'in %s DEPS' %
+ (ANDROID_DEPS_START, ANDROID_DEPS_END, faulty))
+ deps_content = deps_re.sub(new_deps.group(0), deps_content)
+
+ for dep in changed_deps:
+ if isinstance(dep, ChangedVersionEntry):
+ deps_content = deps_content.replace(dep.current_version,
+ dep.new_version)
+
+ with open(deps_filename, 'wb') as deps_file:
+ deps_file.write(deps_content.encode('utf-8'))
+
+ # Update each individual DEPS entry.
+ for dep in changed_deps:
+ # ChangedVersionEntry types are already been processed.
+ if isinstance(dep, ChangedVersionEntry):
+ continue
+ local_dep_dir = os.path.join(CHECKOUT_ROOT_DIR, dep.path)
+ if not os.path.isdir(local_dep_dir):
+ raise RollError(
+ 'Cannot find local directory %s. Either run\n'
+ 'gclient sync --deps=all\n'
+ 'or make sure the .gclient file for your solution contains all '
+ 'platforms in the target_os list, i.e.\n'
+ 'target_os = ["android", "unix", "mac", "ios", "win"];\n'
+ 'Then run "gclient sync" again.' % local_dep_dir)
+ if isinstance(dep, ChangedCipdPackage):
+ package = dep.package.format() # Eliminate double curly brackets
+ update = '%s:%s@%s' % (dep.path, package, dep.new_version)
+ else:
+ update = '%s@%s' % (dep.path, dep.new_rev)
+ _RunCommand(['gclient', 'setdep', '--revision', update],
+ working_dir=CHECKOUT_SRC_DIR)
def _IsTreeClean():
- stdout, _ = _RunCommand(['git', 'status', '--porcelain'])
- if len(stdout) == 0:
- return True
+ stdout, _ = _RunCommand(['git', 'status', '--porcelain'])
+ if len(stdout) == 0:
+ return True
- logging.error('Dirty/unversioned files:\n%s', stdout)
- return False
+ logging.error('Dirty/unversioned files:\n%s', stdout)
+ return False
def _EnsureUpdatedMainBranch(dry_run):
- current_branch = _RunCommand(['git', 'rev-parse', '--abbrev-ref',
- 'HEAD'])[0].splitlines()[0]
- if current_branch != 'main':
- logging.error('Please checkout the main branch and re-run this script.')
- if not dry_run:
- sys.exit(-1)
+ current_branch = _RunCommand(['git', 'rev-parse', '--abbrev-ref',
+ 'HEAD'])[0].splitlines()[0]
+ if current_branch != 'main':
+ logging.error(
+ 'Please checkout the main branch and re-run this script.')
+ if not dry_run:
+ sys.exit(-1)
- logging.info('Updating main branch...')
- _RunCommand(['git', 'pull'])
+ logging.info('Updating main branch...')
+ _RunCommand(['git', 'pull'])
def _CreateRollBranch(dry_run):
- logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME)
- if not dry_run:
- _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME])
+ logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME)
+ if not dry_run:
+ _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME])
def _RemovePreviousRollBranch(dry_run):
- active_branch, branches = _GetBranches()
- if active_branch == ROLL_BRANCH_NAME:
- active_branch = 'main'
- if ROLL_BRANCH_NAME in branches:
- logging.info('Removing previous roll branch (%s)', ROLL_BRANCH_NAME)
- if not dry_run:
- _RunCommand(['git', 'checkout', active_branch])
- _RunCommand(['git', 'branch', '-D', ROLL_BRANCH_NAME])
+ active_branch, branches = _GetBranches()
+ if active_branch == ROLL_BRANCH_NAME:
+ active_branch = 'main'
+ if ROLL_BRANCH_NAME in branches:
+ logging.info('Removing previous roll branch (%s)', ROLL_BRANCH_NAME)
+ if not dry_run:
+ _RunCommand(['git', 'checkout', active_branch])
+ _RunCommand(['git', 'branch', '-D', ROLL_BRANCH_NAME])
def _LocalCommit(commit_msg, dry_run):
- logging.info('Committing changes locally.')
- if not dry_run:
- _RunCommand(['git', 'add', '--update', '.'])
- _RunCommand(['git', 'commit', '-m', commit_msg])
+ logging.info('Committing changes locally.')
+ if not dry_run:
+ _RunCommand(['git', 'add', '--update', '.'])
+ _RunCommand(['git', 'commit', '-m', commit_msg])
def ChooseCQMode(skip_cq, cq_over, current_commit_pos, new_commit_pos):
- if skip_cq:
- return 0
- if (new_commit_pos - current_commit_pos) < cq_over:
- return 1
- return 2
+ if skip_cq:
+ return 0
+ if (new_commit_pos - current_commit_pos) < cq_over:
+ return 1
+ return 2
def _GetCcRecipients(changed_deps_list):
- """Returns a list of emails to notify based on the changed deps list.
+ """Returns a list of emails to notify based on the changed deps list.
"""
- cc_recipients = []
- for c in changed_deps_list:
- if 'libvpx' in c.path or 'libaom' in c.path:
- cc_recipients.append('marpan@webrtc.org')
- cc_recipients.append('jianj@chromium.org')
- return cc_recipients
+ cc_recipients = []
+ for c in changed_deps_list:
+ if 'libvpx' in c.path or 'libaom' in c.path:
+ cc_recipients.append('marpan@webrtc.org')
+ cc_recipients.append('jianj@chromium.org')
+ return cc_recipients
def _UploadCL(commit_queue_mode, add_cc=None):
- """Upload the committed changes as a changelist to Gerrit.
+ """Upload the committed changes as a changelist to Gerrit.
commit_queue_mode:
- 2: Submit to commit queue.
@@ -679,139 +688,143 @@ def _UploadCL(commit_queue_mode, add_cc=None):
add_cc: A list of email addresses to add as CC recipients.
"""
- cc_recipients = [NOTIFY_EMAIL]
- if add_cc:
- cc_recipients.extend(add_cc)
- cmd = ['git', 'cl', 'upload', '--force', '--bypass-hooks']
- if commit_queue_mode >= 2:
- logging.info('Sending the CL to the CQ...')
- cmd.extend(['-o', 'label=Bot-Commit+1'])
- cmd.extend(['-o', 'label=Commit-Queue+2'])
- cmd.extend(['--send-mail', '--cc', ','.join(cc_recipients)])
- elif commit_queue_mode >= 1:
- logging.info('Starting CQ dry run...')
- cmd.extend(['-o', 'label=Commit-Queue+1'])
- extra_env = {
- 'EDITOR': 'true',
- 'SKIP_GCE_AUTH_FOR_GIT': '1',
- }
- stdout, stderr = _RunCommand(cmd, extra_env=extra_env)
- logging.debug('Output from "git cl upload":\nstdout:\n%s\n\nstderr:\n%s',
- stdout, stderr)
+ cc_recipients = [NOTIFY_EMAIL]
+ if add_cc:
+ cc_recipients.extend(add_cc)
+ cmd = ['git', 'cl', 'upload', '--force', '--bypass-hooks']
+ if commit_queue_mode >= 2:
+ logging.info('Sending the CL to the CQ...')
+ cmd.extend(['-o', 'label=Bot-Commit+1'])
+ cmd.extend(['-o', 'label=Commit-Queue+2'])
+ cmd.extend(['--send-mail', '--cc', ','.join(cc_recipients)])
+ elif commit_queue_mode >= 1:
+ logging.info('Starting CQ dry run...')
+ cmd.extend(['-o', 'label=Commit-Queue+1'])
+ extra_env = {
+ 'EDITOR': 'true',
+ 'SKIP_GCE_AUTH_FOR_GIT': '1',
+ }
+ stdout, stderr = _RunCommand(cmd, extra_env=extra_env)
+ logging.debug('Output from "git cl upload":\nstdout:\n%s\n\nstderr:\n%s',
+ stdout, stderr)
def GetRollRevisionRanges(opts, webrtc_deps):
- current_cr_rev = webrtc_deps['vars']['chromium_revision']
- new_cr_rev = opts.revision
- if not new_cr_rev:
- stdout, _ = _RunCommand(['git', 'ls-remote', CHROMIUM_SRC_URL, 'HEAD'])
- head_rev = stdout.strip().split('\t')[0]
- logging.info('No revision specified. Using HEAD: %s', head_rev)
- new_cr_rev = head_rev
+ current_cr_rev = webrtc_deps['vars']['chromium_revision']
+ new_cr_rev = opts.revision
+ if not new_cr_rev:
+ stdout, _ = _RunCommand(['git', 'ls-remote', CHROMIUM_SRC_URL, 'HEAD'])
+ head_rev = stdout.strip().split('\t')[0]
+ logging.info('No revision specified. Using HEAD: %s', head_rev)
+ new_cr_rev = head_rev
- return ChromiumRevisionUpdate(current_cr_rev, new_cr_rev)
+ return ChromiumRevisionUpdate(current_cr_rev, new_cr_rev)
def main():
- p = argparse.ArgumentParser()
- p.add_argument('--clean',
- action='store_true',
- default=False,
- help='Removes any previous local roll branch.')
- p.add_argument('-r',
- '--revision',
- help=('Chromium Git revision to roll to. Defaults to the '
- 'Chromium HEAD revision if omitted.'))
- p.add_argument('--dry-run',
- action='store_true',
- default=False,
- help=('Calculate changes and modify DEPS, but don\'t create '
- 'any local branch, commit, upload CL or send any '
- 'tryjobs.'))
- p.add_argument('-i',
- '--ignore-unclean-workdir',
- action='store_true',
- default=False,
- help=('Ignore if the current branch is not main or if there '
- 'are uncommitted changes (default: %(default)s).'))
- grp = p.add_mutually_exclusive_group()
- grp.add_argument('--skip-cq',
+ p = argparse.ArgumentParser()
+ p.add_argument('--clean',
action='store_true',
default=False,
- help='Skip sending the CL to the CQ (default: %(default)s)')
- grp.add_argument('--cq-over',
- type=int,
- default=1,
- help=('Commit queue dry run if the revision difference '
- 'is below this number (default: %(default)s)'))
- p.add_argument('-v',
- '--verbose',
- action='store_true',
- default=False,
- help='Be extra verbose in printing of log messages.')
- opts = p.parse_args()
-
- if opts.verbose:
- logging.basicConfig(level=logging.DEBUG)
- else:
- logging.basicConfig(level=logging.INFO)
-
- if not opts.ignore_unclean_workdir and not _IsTreeClean():
- logging.error('Please clean your local checkout first.')
- return 1
-
- if opts.clean:
- _RemovePreviousRollBranch(opts.dry_run)
-
- if not opts.ignore_unclean_workdir:
- _EnsureUpdatedMainBranch(opts.dry_run)
-
- deps_filename = os.path.join(CHECKOUT_SRC_DIR, 'DEPS')
- webrtc_deps = ParseLocalDepsFile(deps_filename)
-
- rev_update = GetRollRevisionRanges(opts, webrtc_deps)
-
- current_commit_pos = ParseCommitPosition(
- ReadRemoteCrCommit(rev_update.current_chromium_rev))
- new_commit_pos = ParseCommitPosition(
- ReadRemoteCrCommit(rev_update.new_chromium_rev))
-
- new_cr_content = ReadRemoteCrFile('DEPS', rev_update.new_chromium_rev)
- new_cr_deps = ParseDepsDict(new_cr_content)
- changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
- # Discard other deps, assumed to be chromium-only dependencies.
- new_generated_android_deps, _ = FindAddedDeps(webrtc_deps, new_cr_deps)
- removed_generated_android_deps, other_deps = FindRemovedDeps(
- webrtc_deps, new_cr_deps)
- if other_deps:
- raise RollError('WebRTC DEPS entries are missing from Chromium: %s.\n'
- 'Remove them or add them to either '
- 'WEBRTC_ONLY_DEPS or DONT_AUTOROLL_THESE.' % other_deps)
- clang_change = CalculateChangedClang(rev_update.new_chromium_rev)
- commit_msg = GenerateCommitMessage(
- rev_update,
- current_commit_pos,
- new_commit_pos,
- changed_deps,
- added_deps_paths=new_generated_android_deps,
- removed_deps_paths=removed_generated_android_deps,
- clang_change=clang_change)
- logging.debug('Commit message:\n%s', commit_msg)
-
- _CreateRollBranch(opts.dry_run)
- if not opts.dry_run:
- UpdateDepsFile(deps_filename, rev_update, changed_deps, new_cr_content)
- if _IsTreeClean():
- logging.info("No DEPS changes detected, skipping CL creation.")
- else:
- _LocalCommit(commit_msg, opts.dry_run)
- commit_queue_mode = ChooseCQMode(opts.skip_cq, opts.cq_over,
- current_commit_pos, new_commit_pos)
- logging.info('Uploading CL...')
+ help='Removes any previous local roll branch.')
+ p.add_argument('-r',
+ '--revision',
+ help=('Chromium Git revision to roll to. Defaults to the '
+ 'Chromium HEAD revision if omitted.'))
+ p.add_argument(
+ '--dry-run',
+ action='store_true',
+ default=False,
+ help=('Calculate changes and modify DEPS, but don\'t create '
+ 'any local branch, commit, upload CL or send any '
+ 'tryjobs.'))
+ p.add_argument(
+ '-i',
+ '--ignore-unclean-workdir',
+ action='store_true',
+ default=False,
+ help=('Ignore if the current branch is not main or if there '
+ 'are uncommitted changes (default: %(default)s).'))
+ grp = p.add_mutually_exclusive_group()
+ grp.add_argument(
+ '--skip-cq',
+ action='store_true',
+ default=False,
+ help='Skip sending the CL to the CQ (default: %(default)s)')
+ grp.add_argument('--cq-over',
+ type=int,
+ default=1,
+ help=('Commit queue dry run if the revision difference '
+ 'is below this number (default: %(default)s)'))
+ p.add_argument('-v',
+ '--verbose',
+ action='store_true',
+ default=False,
+ help='Be extra verbose in printing of log messages.')
+ opts = p.parse_args()
+
+ if opts.verbose:
+ logging.basicConfig(level=logging.DEBUG)
+ else:
+ logging.basicConfig(level=logging.INFO)
+
+ if not opts.ignore_unclean_workdir and not _IsTreeClean():
+ logging.error('Please clean your local checkout first.')
+ return 1
+
+ if opts.clean:
+ _RemovePreviousRollBranch(opts.dry_run)
+
+ if not opts.ignore_unclean_workdir:
+ _EnsureUpdatedMainBranch(opts.dry_run)
+
+ deps_filename = os.path.join(CHECKOUT_SRC_DIR, 'DEPS')
+ webrtc_deps = ParseLocalDepsFile(deps_filename)
+
+ rev_update = GetRollRevisionRanges(opts, webrtc_deps)
+
+ current_commit_pos = ParseCommitPosition(
+ ReadRemoteCrCommit(rev_update.current_chromium_rev))
+ new_commit_pos = ParseCommitPosition(
+ ReadRemoteCrCommit(rev_update.new_chromium_rev))
+
+ new_cr_content = ReadRemoteCrFile('DEPS', rev_update.new_chromium_rev)
+ new_cr_deps = ParseDepsDict(new_cr_content)
+ changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
+ # Discard other deps, assumed to be chromium-only dependencies.
+ new_generated_android_deps, _ = FindAddedDeps(webrtc_deps, new_cr_deps)
+ removed_generated_android_deps, other_deps = FindRemovedDeps(
+ webrtc_deps, new_cr_deps)
+ if other_deps:
+ raise RollError('WebRTC DEPS entries are missing from Chromium: %s.\n'
+ 'Remove them or add them to either '
+ 'WEBRTC_ONLY_DEPS or DONT_AUTOROLL_THESE.' %
+ other_deps)
+ clang_change = CalculateChangedClang(rev_update.new_chromium_rev)
+ commit_msg = GenerateCommitMessage(
+ rev_update,
+ current_commit_pos,
+ new_commit_pos,
+ changed_deps,
+ added_deps_paths=new_generated_android_deps,
+ removed_deps_paths=removed_generated_android_deps,
+ clang_change=clang_change)
+ logging.debug('Commit message:\n%s', commit_msg)
+
+ _CreateRollBranch(opts.dry_run)
if not opts.dry_run:
- _UploadCL(commit_queue_mode, _GetCcRecipients(changed_deps))
- return 0
+ UpdateDepsFile(deps_filename, rev_update, changed_deps, new_cr_content)
+ if _IsTreeClean():
+ logging.info("No DEPS changes detected, skipping CL creation.")
+ else:
+ _LocalCommit(commit_msg, opts.dry_run)
+ commit_queue_mode = ChooseCQMode(opts.skip_cq, opts.cq_over,
+ current_commit_pos, new_commit_pos)
+ logging.info('Uploading CL...')
+ if not opts.dry_run:
+ _UploadCL(commit_queue_mode, _GetCcRecipients(changed_deps))
+ return 0
if __name__ == '__main__':
- sys.exit(main())
+ sys.exit(main())
diff --git a/tools_webrtc/mb/mb_config.pyl b/tools_webrtc/mb/mb_config.pyl
index cb52f9124a..c0f5130ff0 100644
--- a/tools_webrtc/mb/mb_config.pyl
+++ b/tools_webrtc/mb/mb_config.pyl
@@ -227,18 +227,65 @@
'configs': {
'android_asan_shared_release_bot_arm':
['android', 'asan', 'clang', 'pure_release_bot', 'arm'],
- 'android_debug_static_bot_arm': ['android', 'debug_static_bot', 'arm'],
- 'android_debug_static_bot_arm64': ['android', 'debug_static_bot', 'arm64'],
- 'android_debug_static_bot_x64': ['android', 'debug_static_bot', 'x64'],
- 'android_debug_static_bot_x86': ['android', 'debug_static_bot', 'x86'],
+ 'android_debug_static_bot_arm': [
+ 'android',
+ 'debug_static_bot',
+ 'arm',
+ 'h265',
+ ],
+ 'android_debug_static_bot_arm64': [
+ 'android',
+ 'debug_static_bot',
+ 'arm64',
+ 'h265',
+ ],
+ 'android_debug_static_bot_x64': [
+ 'android',
+ 'debug_static_bot',
+ 'x64',
+ 'h265',
+ ],
+ 'android_debug_static_bot_x86': [
+ 'android',
+ 'debug_static_bot',
+ 'x86',
+ 'h265',
+ ],
'android_pure_release_bot_arm': ['android', 'pure_release_bot', 'arm'],
'android_pure_release_bot_arm64': ['android', 'pure_release_bot', 'arm64'],
- 'android_release_bot_arm': ['android', 'release_bot', 'arm'],
- 'android_release_bot_arm64': ['android', 'release_bot', 'arm64'],
- 'android_release_bot_x64': ['android', 'release_bot', 'x64'],
- 'android_release_bot_x86': ['android', 'release_bot', 'x86'],
- 'asan_lsan_clang_release_bot_x64':
- ['asan', 'lsan', 'clang', 'openh264', 'pure_release_bot', 'x64', 'h265'],
+ 'android_release_bot_arm': [
+ 'android',
+ 'release_bot',
+ 'arm',
+ 'h265',
+ ],
+ 'android_release_bot_arm64': [
+ 'android',
+ 'release_bot',
+ 'arm64',
+ 'h265',
+ ],
+ 'android_release_bot_x64': [
+ 'android',
+ 'release_bot',
+ 'x64',
+ 'h265',
+ ],
+ 'android_release_bot_x86': [
+ 'android',
+ 'release_bot',
+ 'x86',
+ 'h265',
+ ],
+ 'asan_lsan_clang_release_bot_x64': [
+ 'asan',
+ 'lsan',
+ 'clang',
+ 'openh264',
+ 'pure_release_bot',
+ 'x64',
+ 'h265',
+ ],
'bwe_test_logging_android_arm':
['android', 'debug_static_bot', 'arm', 'bwe_test_logging'],
'bwe_test_logging_x64': ['debug_bot', 'x64', 'bwe_test_logging'],
@@ -397,10 +444,10 @@
'gn_args': 'is_debug=true',
},
'debug_bot': {
- 'mixins': ['debug', 'reclient'],
+ 'mixins': ['debug', 'reclient', 'strict_field_trials'],
},
'debug_static_bot': {
- 'mixins': ['debug', 'minimal_symbols', 'reclient'],
+ 'mixins': ['debug', 'minimal_symbols', 'reclient', 'strict_field_trials'],
},
'dummy_audio_file_devices': {
'gn_args': 'rtc_use_dummy_audio_file_devices=true',
@@ -465,7 +512,7 @@
'gn_args': 'is_debug=false',
},
'release_bot': {
- 'mixins': ['pure_release_bot', 'dcheck_always_on'],
+ 'mixins': ['pure_release_bot', 'dcheck_always_on', 'strict_field_trials'],
},
'rtc_objc_test_prefix': {
'gn_args': 'rtc_objc_prefix="RTC_TESTING"',
@@ -473,6 +520,9 @@
'rtti': {
'gn_args': 'use_rtti=true',
},
+ 'strict_field_trials': {
+ 'gn_args': 'rtc_strict_field_trials="dcheck"',
+ },
'tsan': {
'gn_args': 'is_tsan=true',
},
diff --git a/tools_webrtc/remove_extra_namespace.py b/tools_webrtc/remove_extra_namespace.py
new file mode 100755
index 0000000000..21ac2d1aa2
--- /dev/null
+++ b/tools_webrtc/remove_extra_namespace.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env vpython3
+
+# Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+"""Remove extra namespace qualifications
+
+Looks for names that don't need to be qualified by namespace, and deletes
+the qualifier.
+
+Depends on namespace names being properly formatted
+"""
+import os
+import glob
+import sys
+import re
+import argparse
+
+
+def remove_extra_namespace_from_file(namespace, filename):
+ print('Processing namespace', namespace, 'file', filename)
+ with open(filename) as file:
+ newfile = open(filename + '.NEW', 'w')
+ namespaces = []
+ changes = 0
+ for line in file:
+ match = re.match(r'namespace (\S+) {', line)
+ if match is not None:
+ namespaces.insert(0, match.group(1))
+ newfile.write(line)
+ continue
+ match = re.match(r'}\s+// namespace (\S+)$', line)
+ if match is not None:
+ if match.group(1) != namespaces[0]:
+ print('Namespace mismatch')
+ raise RuntimeError('Namespace mismatch')
+ del namespaces[0]
+ newfile.write(line)
+ continue
+ # Remove namespace usage. Only replacing when target
+ # namespace is the innermost namespace.
+ if len(namespaces) > 0 and namespaces[0] == namespace:
+ # Note that in namespace foo, we match neither ::foo::name
+ # nor morefoo::name
+ # Neither do we match foo:: when it is not followed by
+ # an identifier character.
+ usage_re = r'(?<=[^a-z:]){}::(?=[a-zA-Z])'.format(
+ namespaces[0])
+ if re.search(usage_re, line):
+ line = re.sub(usage_re, '', line)
+ changes += 1
+ newfile.write(line)
+ if changes > 0:
+ print('Made', changes, 'changes to', filename)
+ os.remove(filename)
+ os.rename(filename + '.NEW', filename)
+ else:
+ os.remove(filename + '.NEW')
+
+
+def remove_extra_namespace_from_files(namespace, files):
+ for file in files:
+ if os.path.isfile(file):
+ if re.search(r'\.(h|cc)$', file):
+ remove_extra_namespace_from_file(namespace, file)
+ elif os.path.isdir(file):
+ if file in ('third_party', 'out'):
+ continue
+ subfiles = glob.glob(file + '/*')
+ remove_extra_namespace_from_files(namespace, subfiles)
+ else:
+ print(file, 'is not a file or directory, ignoring')
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ prog='remove_extra_namespace.py',
+ description=__doc__.strip().splitlines()[0],
+ epilog=''.join(__doc__.splitlines(True)[1:]),
+ formatter_class=argparse.RawDescriptionHelpFormatter,
+ )
+ parser.add_argument('--namespace')
+ parser.add_argument('files', nargs=argparse.REMAINDER)
+ args = parser.parse_args()
+ return remove_extra_namespace_from_files(args.namespace, args.files)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/video/BUILD.gn b/video/BUILD.gn
index d696445db2..1722ad4f6e 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -244,6 +244,7 @@ rtc_library("frame_cadence_adapter") {
"../rtc_base:timeutils",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:no_unique_address",
+ "../rtc_base/system:unused",
"../rtc_base/task_utils:repeating_task",
"../system_wrappers",
"../system_wrappers:field_trial",
@@ -561,6 +562,7 @@ if (rtc_include_tests) {
"../test:platform_video_capturer",
"../test:rtp_test_utils",
"../test:test_common",
+ "../test:test_flags",
"../test:test_renderer",
"../test:test_support",
"../test:test_support_test_artifacts",
@@ -661,6 +663,7 @@ if (rtc_include_tests) {
"../test:run_test",
"../test:run_test_interface",
"../test:test_common",
+ "../test:test_flags",
"../test:test_renderer",
"../test:test_support",
"//testing/gtest",
@@ -706,6 +709,7 @@ if (rtc_include_tests) {
"../test:run_test",
"../test:run_test_interface",
"../test:test_common",
+ "../test:test_flags",
"../test:test_renderer",
"../test:test_support",
"//third_party/abseil-cpp/absl/flags:flag",
@@ -732,6 +736,7 @@ if (rtc_include_tests) {
"../test:run_test",
"../test:run_test_interface",
"../test:test_common",
+ "../test:test_flags",
"../test:test_renderer",
"../test:test_support",
"//testing/gtest",
diff --git a/video/adaptation/overuse_frame_detector.cc b/video/adaptation/overuse_frame_detector.cc
index e5c2c7d379..56fe71af41 100644
--- a/video/adaptation/overuse_frame_detector.cc
+++ b/video/adaptation/overuse_frame_detector.cc
@@ -25,6 +25,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/numerics/exp_filter.h"
#include "rtc_base/time_utils.h"
+#include "rtc_base/trace_event.h"
#include "system_wrappers/include/field_trial.h"
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
@@ -587,6 +588,7 @@ void OveruseFrameDetector::CheckForOveruse(
return;
int64_t now_ms = rtc::TimeMillis();
+ const char* action = "NoAction";
if (IsOverusing(*encode_usage_percent_)) {
// If the last thing we did was going up, and now have to back down, we need
@@ -612,21 +614,24 @@ void OveruseFrameDetector::CheckForOveruse(
++num_overuse_detections_;
observer->AdaptDown();
+ action = "AdaptDown";
} else if (IsUnderusing(*encode_usage_percent_, now_ms)) {
last_rampup_time_ms_ = now_ms;
in_quick_rampup_ = true;
observer->AdaptUp();
+ action = "AdaptUp";
}
+ TRACE_EVENT2("webrtc", "OveruseFrameDetector::CheckForOveruse",
+ "encode_usage_percent", *encode_usage_percent_, "action",
+ TRACE_STR_COPY(action));
int rampup_delay =
in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_;
- RTC_LOG(LS_VERBOSE) << " Frame stats: "
- " encode usage "
- << *encode_usage_percent_ << " overuse detections "
- << num_overuse_detections_ << " rampup delay "
- << rampup_delay;
+ RTC_LOG(LS_INFO) << "CheckForOveruse: encode usage " << *encode_usage_percent_
+ << " overuse detections " << num_overuse_detections_
+ << " rampup delay " << rampup_delay << " action " << action;
}
void OveruseFrameDetector::SetOptions(const CpuOveruseOptions& options) {
diff --git a/video/adaptation/quality_scaler_resource.cc b/video/adaptation/quality_scaler_resource.cc
index 68d56fe29e..a24a3e88ff 100644
--- a/video/adaptation/quality_scaler_resource.cc
+++ b/video/adaptation/quality_scaler_resource.cc
@@ -12,6 +12,7 @@
#include <utility>
+#include "api/field_trials_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/experiments/balanced_degradation_settings.h"
#include "rtc_base/time_utils.h"
@@ -37,11 +38,12 @@ bool QualityScalerResource::is_started() const {
}
void QualityScalerResource::StartCheckForOveruse(
- VideoEncoder::QpThresholds qp_thresholds) {
+ VideoEncoder::QpThresholds qp_thresholds,
+ const FieldTrialsView& field_trials) {
RTC_DCHECK_RUN_ON(encoder_queue());
RTC_DCHECK(!is_started());
- quality_scaler_ =
- std::make_unique<QualityScaler>(this, std::move(qp_thresholds));
+ quality_scaler_ = std::make_unique<QualityScaler>(
+ this, std::move(qp_thresholds), field_trials);
}
void QualityScalerResource::StopCheckForOveruse() {
diff --git a/video/adaptation/quality_scaler_resource.h b/video/adaptation/quality_scaler_resource.h
index cbb6d3d06f..a1ed34a1ce 100644
--- a/video/adaptation/quality_scaler_resource.h
+++ b/video/adaptation/quality_scaler_resource.h
@@ -16,6 +16,7 @@
#include <string>
#include "absl/types/optional.h"
+#include "api/field_trials_view.h"
#include "api/scoped_refptr.h"
#include "api/video/video_adaptation_reason.h"
#include "api/video_codecs/video_encoder.h"
@@ -37,7 +38,8 @@ class QualityScalerResource : public VideoStreamEncoderResource,
bool is_started() const;
- void StartCheckForOveruse(VideoEncoder::QpThresholds qp_thresholds);
+ void StartCheckForOveruse(VideoEncoder::QpThresholds qp_thresholds,
+ const FieldTrialsView& field_trials);
void StopCheckForOveruse();
void SetQpThresholds(VideoEncoder::QpThresholds qp_thresholds);
bool QpFastFilterLow();
diff --git a/video/adaptation/video_stream_encoder_resource_manager.cc b/video/adaptation/video_stream_encoder_resource_manager.cc
index 183aa41b40..eaeb0d5a46 100644
--- a/video/adaptation/video_stream_encoder_resource_manager.cc
+++ b/video/adaptation/video_stream_encoder_resource_manager.cc
@@ -21,6 +21,7 @@
#include "absl/algorithm/container.h"
#include "absl/base/macros.h"
#include "api/adaptation/resource.h"
+#include "api/field_trials_view.h"
#include "api/sequence_checker.h"
#include "api/task_queue/task_queue_base.h"
#include "api/video/video_adaptation_reason.h"
@@ -116,9 +117,10 @@ absl::optional<DataRate> GetSingleActiveLayerMaxBitrate(
class VideoStreamEncoderResourceManager::InitialFrameDropper {
public:
explicit InitialFrameDropper(
- rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource)
+ rtc::scoped_refptr<QualityScalerResource> quality_scaler_resource,
+ const FieldTrialsView& field_trials)
: quality_scaler_resource_(quality_scaler_resource),
- quality_scaler_settings_(QualityScalerSettings::ParseFromFieldTrials()),
+ quality_scaler_settings_(field_trials),
has_seen_first_bwe_drop_(false),
set_start_bitrate_(DataRate::Zero()),
set_start_bitrate_time_ms_(0),
@@ -289,8 +291,10 @@ VideoStreamEncoderResourceManager::VideoStreamEncoderResourceManager(
clock_(clock),
experiment_cpu_load_estimator_(experiment_cpu_load_estimator),
initial_frame_dropper_(
- std::make_unique<InitialFrameDropper>(quality_scaler_resource_)),
- quality_scaling_experiment_enabled_(QualityScalingExperiment::Enabled()),
+ std::make_unique<InitialFrameDropper>(quality_scaler_resource_,
+ field_trials)),
+ quality_scaling_experiment_enabled_(
+ QualityScalingExperiment::Enabled(field_trials_)),
pixel_limit_resource_experiment_enabled_(
field_trials.IsEnabled(kPixelLimitResourceFieldTrialName)),
encoder_target_bitrate_bps_(absl::nullopt),
@@ -561,7 +565,8 @@ void VideoStreamEncoderResourceManager::UpdateQualityScalerSettings(
if (quality_scaler_resource_->is_started()) {
quality_scaler_resource_->SetQpThresholds(qp_thresholds.value());
} else {
- quality_scaler_resource_->StartCheckForOveruse(qp_thresholds.value());
+ quality_scaler_resource_->StartCheckForOveruse(qp_thresholds.value(),
+ field_trials_);
AddResource(quality_scaler_resource_, VideoAdaptationReason::kQuality);
}
} else if (quality_scaler_resource_->is_started()) {
@@ -615,7 +620,7 @@ void VideoStreamEncoderResourceManager::ConfigureQualityScaler(
absl::optional<VideoEncoder::QpThresholds> experimental_thresholds;
if (quality_scaling_experiment_enabled_) {
experimental_thresholds = QualityScalingExperiment::GetQpThresholds(
- GetVideoCodecTypeOrGeneric(encoder_settings_));
+ GetVideoCodecTypeOrGeneric(encoder_settings_), field_trials_);
}
UpdateQualityScalerSettings(experimental_thresholds.has_value()
? experimental_thresholds
diff --git a/video/encoder_bitrate_adjuster.cc b/video/encoder_bitrate_adjuster.cc
index 30bfcd5d68..02468cb0b3 100644
--- a/video/encoder_bitrate_adjuster.cc
+++ b/video/encoder_bitrate_adjuster.cc
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "api/field_trials_view.h"
#include "rtc_base/experiments/rate_control_settings.h"
#include "rtc_base/logging.h"
#include "rtc_base/time_utils.h"
@@ -43,9 +44,12 @@ constexpr int64_t EncoderBitrateAdjuster::kWindowSizeMs;
constexpr size_t EncoderBitrateAdjuster::kMinFramesSinceLayoutChange;
constexpr double EncoderBitrateAdjuster::kDefaultUtilizationFactor;
-EncoderBitrateAdjuster::EncoderBitrateAdjuster(const VideoCodec& codec_settings)
- : utilize_bandwidth_headroom_(RateControlSettings::ParseFromFieldTrials()
- .BitrateAdjusterCanUseNetworkHeadroom()),
+EncoderBitrateAdjuster::EncoderBitrateAdjuster(
+ const VideoCodec& codec_settings,
+ const FieldTrialsView& field_trials)
+ : utilize_bandwidth_headroom_(
+ RateControlSettings::ParseFromKeyValueConfig(&field_trials)
+ .BitrateAdjusterCanUseNetworkHeadroom()),
frames_since_layout_change_(0),
min_bitrates_bps_{},
frame_size_pixels_{},
diff --git a/video/encoder_bitrate_adjuster.h b/video/encoder_bitrate_adjuster.h
index 53f4b0377a..0ddd20b9b3 100644
--- a/video/encoder_bitrate_adjuster.h
+++ b/video/encoder_bitrate_adjuster.h
@@ -13,6 +13,7 @@
#include <memory>
+#include "api/field_trials_view.h"
#include "api/video/encoded_image.h"
#include "api/video/video_bitrate_allocation.h"
#include "api/video_codecs/video_encoder.h"
@@ -34,7 +35,8 @@ class EncoderBitrateAdjuster {
// build too much queue at the very start.
static constexpr double kDefaultUtilizationFactor = 1.2;
- explicit EncoderBitrateAdjuster(const VideoCodec& codec_settings);
+ EncoderBitrateAdjuster(const VideoCodec& codec_settings,
+ const FieldTrialsView& field_trials);
~EncoderBitrateAdjuster();
// Adjusts the given rate allocation to make it paceable within the target
diff --git a/video/encoder_bitrate_adjuster_unittest.cc b/video/encoder_bitrate_adjuster_unittest.cc
index ef6b564bcb..e0f6de3120 100644
--- a/video/encoder_bitrate_adjuster_unittest.cc
+++ b/video/encoder_bitrate_adjuster_unittest.cc
@@ -13,11 +13,12 @@
#include <memory>
#include <vector>
+#include "api/field_trials_view.h"
#include "api/units/data_rate.h"
#include "rtc_base/fake_clock.h"
#include "rtc_base/numerics/safe_conversions.h"
-#include "test/field_trial.h"
#include "test/gtest.h"
+#include "test/scoped_key_value_config.h"
namespace webrtc {
namespace test {
@@ -82,7 +83,8 @@ class EncoderBitrateAdjusterTest : public ::testing::Test {
}
}
- adjuster_ = std::make_unique<EncoderBitrateAdjuster>(codec_);
+ adjuster_ =
+ std::make_unique<EncoderBitrateAdjuster>(codec_, scoped_field_trial_);
adjuster_->OnEncoderInfo(encoder_info_);
current_adjusted_allocation_ =
adjuster_->AdjustRateAllocation(VideoEncoder::RateControlParameters(
@@ -234,6 +236,7 @@ class EncoderBitrateAdjusterTest : public ::testing::Test {
double target_framerate_fps_;
int tl_pattern_idx_[kMaxSpatialLayers];
int sequence_idx_[kMaxSpatialLayers][kMaxTemporalStreams];
+ test::ScopedKeyValueConfig scoped_field_trial_;
const std::vector<int> kTlPatterns[kMaxTemporalStreams] = {
{0},
@@ -422,7 +425,8 @@ TEST_F(EncoderBitrateAdjusterTest, DifferentSpatialOvershoots) {
TEST_F(EncoderBitrateAdjusterTest, HeadroomAllowsOvershootToMediaRate) {
// Two streams, both with three temporal layers.
// Media rate is 1.0, but network rate is higher.
- ScopedFieldTrials field_trial(
+ test::ScopedKeyValueConfig field_trial(
+ scoped_field_trial_,
"WebRTC-VideoRateControl/adjuster_use_headroom:true/");
const uint32_t kS0Bitrate = 300000;
@@ -464,7 +468,8 @@ TEST_F(EncoderBitrateAdjusterTest, HeadroomAllowsOvershootToMediaRate) {
TEST_F(EncoderBitrateAdjusterTest, DontExceedMediaRateEvenWithHeadroom) {
// Two streams, both with three temporal layers.
// Media rate is 1.1, but network rate is higher.
- ScopedFieldTrials field_trial(
+ test::ScopedKeyValueConfig field_trial(
+ scoped_field_trial_,
"WebRTC-VideoRateControl/adjuster_use_headroom:true/");
const uint32_t kS0Bitrate = 300000;
diff --git a/video/end_to_end_tests/multi_stream_tester.cc b/video/end_to_end_tests/multi_stream_tester.cc
index 8d99329194..1eb388cc76 100644
--- a/video/end_to_end_tests/multi_stream_tester.cc
+++ b/video/end_to_end_tests/multi_stream_tester.cc
@@ -14,7 +14,6 @@
#include <utility>
#include <vector>
-#include "absl/memory/memory.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_base.h"
@@ -50,7 +49,7 @@ void MultiStreamTester::RunTest() {
// to make test more stable.
auto task_queue = task_queue_factory->CreateTaskQueue(
"TaskQueue", TaskQueueFactory::Priority::HIGH);
- Call::Config config(&event_log);
+ CallConfig config(&event_log);
test::ScopedKeyValueConfig field_trials;
config.trials = &field_trials;
config.task_queue_factory = task_queue_factory.get();
@@ -69,8 +68,8 @@ void MultiStreamTester::RunTest() {
InternalDecoderFactory decoder_factory;
SendTask(task_queue.get(), [&]() {
- sender_call = absl::WrapUnique(Call::Create(config));
- receiver_call = absl::WrapUnique(Call::Create(config));
+ sender_call = Call::Create(config);
+ receiver_call = Call::Create(config);
sender_transport = CreateSendTransport(task_queue.get(), sender_call.get());
receiver_transport =
CreateReceiveTransport(task_queue.get(), receiver_call.get());
diff --git a/video/end_to_end_tests/network_state_tests.cc b/video/end_to_end_tests/network_state_tests.cc
index 4d43f7609c..7bc9f1493e 100644
--- a/video/end_to_end_tests/network_state_tests.cc
+++ b/video/end_to_end_tests/network_state_tests.cc
@@ -94,7 +94,7 @@ void NetworkStateEndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState(
SendTask(task_queue(), [this, network_to_bring_up, &encoder_factory,
transport]() {
- CreateSenderCall(Call::Config(send_event_log_.get()));
+ CreateSenderCall(CallConfig(send_event_log_.get()));
sender_call_->SignalChannelNetworkState(network_to_bring_up, kNetworkUp);
CreateSendConfig(1, 0, 0, transport);
diff --git a/video/end_to_end_tests/stats_tests.cc b/video/end_to_end_tests/stats_tests.cc
index 475a6cd2da..cc0b328b2b 100644
--- a/video/end_to_end_tests/stats_tests.cc
+++ b/video/end_to_end_tests/stats_tests.cc
@@ -518,9 +518,9 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
metrics::Reset();
- Call::Config send_config(send_event_log_.get());
+ CallConfig send_config(send_event_log_.get());
test.ModifySenderBitrateConfig(&send_config.bitrate_config);
- Call::Config recv_config(recv_event_log_.get());
+ CallConfig recv_config(recv_event_log_.get());
test.ModifyReceiverBitrateConfig(&recv_config.bitrate_config);
VideoEncoderConfig encoder_config_with_screenshare;
diff --git a/video/frame_cadence_adapter.cc b/video/frame_cadence_adapter.cc
index 6d7de566ca..0781651fec 100644
--- a/video/frame_cadence_adapter.cc
+++ b/video/frame_cadence_adapter.cc
@@ -31,6 +31,7 @@
#include "rtc_base/rate_statistics.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/system/no_unique_address.h"
+#include "rtc_base/system/unused.h"
#include "rtc_base/task_utils/repeating_task.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/time_utils.h"
@@ -248,7 +249,7 @@ class FrameCadenceAdapterImpl : public FrameCadenceAdapterInterface {
const VideoTrackSourceConstraints& constraints) override;
private:
- // Called from OnFrame in zero-hertz mode.
+ // Called from OnFrame in both pass-through and zero-hertz mode.
void OnFrameOnMainQueue(Timestamp post_time,
int frames_scheduled_for_processing,
const VideoFrame& frame) RTC_RUN_ON(queue_);
@@ -275,6 +276,7 @@ class FrameCadenceAdapterImpl : public FrameCadenceAdapterInterface {
absl::optional<ZeroHertzAdapterMode> zero_hertz_adapter_;
// If set, zero-hertz mode has been enabled.
absl::optional<ZeroHertzModeParams> zero_hertz_params_;
+ std::atomic<bool> zero_hertz_adapter_is_active_{false};
// Cache for the current adapter mode.
AdapterMode* current_adapter_mode_ = nullptr;
@@ -292,7 +294,6 @@ class FrameCadenceAdapterImpl : public FrameCadenceAdapterInterface {
// Race checker for incoming frames. This is the network thread in chromium,
// but may vary from test contexts.
rtc::RaceChecker incoming_frame_race_checker_;
- bool has_reported_screenshare_frame_rate_umas_ RTC_GUARDED_BY(queue_) = false;
// Number of frames that are currently scheduled for processing on the
// `queue_`.
@@ -382,6 +383,7 @@ void ZeroHertzAdapterMode::OnFrame(Timestamp post_time,
queue_->PostDelayedHighPrecisionTask(
SafeTask(safety_.flag(),
[this, frame_id, frame] {
+ RTC_UNUSED(frame_id);
RTC_DCHECK_RUN_ON(&sequence_checker_);
TRACE_EVENT_ASYNC_END0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
"QueueToEncode", frame_id);
@@ -607,8 +609,6 @@ void FrameCadenceAdapterImpl::SetZeroHertzModeEnabled(
absl::optional<ZeroHertzModeParams> params) {
RTC_DCHECK_RUN_ON(queue_);
bool was_zero_hertz_enabled = zero_hertz_params_.has_value();
- if (params.has_value() && !was_zero_hertz_enabled)
- has_reported_screenshare_frame_rate_umas_ = false;
zero_hertz_params_ = params;
MaybeReconfigureAdapters(was_zero_hertz_enabled);
}
@@ -655,14 +655,21 @@ void FrameCadenceAdapterImpl::OnFrame(const VideoFrame& frame) {
// Local time in webrtc time base.
Timestamp post_time = clock_->CurrentTime();
frames_scheduled_for_processing_.fetch_add(1, std::memory_order_relaxed);
- TRACE_EVENT_ASYNC_BEGIN0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
- "OnFrameToEncode", frame.video_frame_buffer().get());
- TRACE_EVENT_ASYNC_BEGIN0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
- "OnFrameToQueue", frame.video_frame_buffer().get());
+ if (zero_hertz_adapter_is_active_.load(std::memory_order_relaxed)) {
+ TRACE_EVENT_ASYNC_BEGIN0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
+ "OnFrameToEncode",
+ frame.video_frame_buffer().get());
+ TRACE_EVENT_ASYNC_BEGIN0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
+ "OnFrameToQueue",
+ frame.video_frame_buffer().get());
+ }
queue_->PostTask(SafeTask(safety_.flag(), [this, post_time, frame] {
RTC_DCHECK_RUN_ON(queue_);
- TRACE_EVENT_ASYNC_END0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
- "OnFrameToQueue", frame.video_frame_buffer().get());
+ if (zero_hertz_adapter_is_active_.load(std::memory_order_relaxed)) {
+ TRACE_EVENT_ASYNC_END0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
+ "OnFrameToQueue",
+ frame.video_frame_buffer().get());
+ }
if (zero_hertz_adapter_created_timestamp_.has_value()) {
TimeDelta time_until_first_frame =
clock_->CurrentTime() - *zero_hertz_adapter_created_timestamp_;
@@ -725,17 +732,24 @@ void FrameCadenceAdapterImpl::MaybeReconfigureAdapters(
RTC_DCHECK_RUN_ON(queue_);
bool is_zero_hertz_enabled = IsZeroHertzScreenshareEnabled();
if (is_zero_hertz_enabled) {
- if (!was_zero_hertz_enabled) {
+ bool max_fps_has_changed = GetInputFrameRateFps().value_or(-1) !=
+ source_constraints_->max_fps.value_or(-1);
+ if (!was_zero_hertz_enabled || max_fps_has_changed) {
zero_hertz_adapter_.emplace(queue_, clock_, callback_,
source_constraints_->max_fps.value());
- RTC_LOG(LS_INFO) << "Zero hertz mode activated.";
+ zero_hertz_adapter_is_active_.store(true, std::memory_order_relaxed);
+ RTC_LOG(LS_INFO) << "Zero hertz mode enabled (max_fps="
+ << source_constraints_->max_fps.value() << ")";
zero_hertz_adapter_created_timestamp_ = clock_->CurrentTime();
}
zero_hertz_adapter_->ReconfigureParameters(zero_hertz_params_.value());
current_adapter_mode_ = &zero_hertz_adapter_.value();
} else {
- if (was_zero_hertz_enabled)
+ if (was_zero_hertz_enabled) {
zero_hertz_adapter_ = absl::nullopt;
+ zero_hertz_adapter_is_active_.store(false, std::memory_order_relaxed);
+ RTC_LOG(LS_INFO) << "Zero hertz mode disabled.";
+ }
current_adapter_mode_ = &passthrough_adapter_.value();
}
}
diff --git a/video/frame_cadence_adapter_unittest.cc b/video/frame_cadence_adapter_unittest.cc
index 052b0a6c61..11be45070d 100644
--- a/video/frame_cadence_adapter_unittest.cc
+++ b/video/frame_cadence_adapter_unittest.cc
@@ -184,6 +184,29 @@ TEST(FrameCadenceAdapterTest, FrameRateFollowsMaxFpsWhenZeroHertzActivated) {
}
}
+TEST(FrameCadenceAdapterTest, ZeroHertzAdapterSupportsMaxFpsChange) {
+ ZeroHertzFieldTrialEnabler enabler;
+ GlobalSimulatedTimeController time_controller(Timestamp::Zero());
+ auto adapter = CreateAdapter(enabler, time_controller.GetClock());
+ MockCallback callback;
+ adapter->Initialize(&callback);
+ adapter->SetZeroHertzModeEnabled(
+ FrameCadenceAdapterInterface::ZeroHertzModeParams{});
+ adapter->OnConstraintsChanged(VideoTrackSourceConstraints{0, 1});
+ time_controller.AdvanceTime(TimeDelta::Zero());
+ EXPECT_EQ(adapter->GetInputFrameRateFps(), 1u);
+ adapter->OnFrame(CreateFrame());
+ time_controller.AdvanceTime(TimeDelta::Seconds(1));
+ adapter->OnConstraintsChanged(VideoTrackSourceConstraints{0, 2});
+ time_controller.AdvanceTime(TimeDelta::Zero());
+ EXPECT_EQ(adapter->GetInputFrameRateFps(), 2u);
+ adapter->OnFrame(CreateFrame());
+ // Ensure that the max_fps has been changed from 1 to 2 fps even if it was
+ // changed while zero hertz was already active.
+ EXPECT_CALL(callback, OnFrame);
+ time_controller.AdvanceTime(TimeDelta::Millis(500));
+}
+
TEST(FrameCadenceAdapterTest,
FrameRateFollowsRateStatisticsAfterZeroHertzDeactivated) {
ZeroHertzFieldTrialEnabler enabler;
diff --git a/video/pc_full_stack_tests.cc b/video/pc_full_stack_tests.cc
index 83b06830e0..d7e7a4b3f5 100644
--- a/video/pc_full_stack_tests.cc
+++ b/video/pc_full_stack_tests.cc
@@ -182,9 +182,7 @@ TEST(PCGenericDescriptorTest,
}
// VP9 2nd profile isn't supported on android arm and arm 64.
-#if (defined(WEBRTC_ANDROID) && \
- (defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM))) || \
- (defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64))
+#if defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM)
#define MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2 \
DISABLED_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2
#else
diff --git a/video/screenshare_loopback.cc b/video/screenshare_loopback.cc
index 239e472f6e..40bf9ee496 100644
--- a/video/screenshare_loopback.cc
+++ b/video/screenshare_loopback.cc
@@ -28,6 +28,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/run_test.h"
+#include "test/test_flags.h"
#include "video/video_quality_test.h"
using ::webrtc::BitrateConstraints;
@@ -256,15 +257,6 @@ ABSL_FLAG(bool, generic_descriptor, false, "Use the generic frame descriptor.");
ABSL_FLAG(bool, allow_reordering, false, "Allow packet reordering to occur");
-ABSL_FLAG(
- std::string,
- force_fieldtrials,
- "",
- "Field trials control experimental feature code which can be forced. "
- "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
- " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
- "trials are separated by \"/\"");
-
// Screenshare-specific flags.
ABSL_FLAG(int,
min_transmit_bitrate,
diff --git a/video/sv_loopback.cc b/video/sv_loopback.cc
index af475ae4eb..2a8f9743e8 100644
--- a/video/sv_loopback.cc
+++ b/video/sv_loopback.cc
@@ -28,6 +28,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/run_test.h"
+#include "test/test_flags.h"
#include "video/video_quality_test.h"
// Flags for video.
@@ -311,15 +312,6 @@ ABSL_FLAG(bool,
ABSL_FLAG(bool, video, true, "Add video stream");
-ABSL_FLAG(
- std::string,
- force_fieldtrials,
- "",
- "Field trials control experimental feature code which can be forced. "
- "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
- " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
- "trials are separated by \"/\"");
-
// Video-specific flags.
ABSL_FLAG(std::string,
vclip,
diff --git a/video/video_loopback.cc b/video/video_loopback.cc
index ba0a0e5745..b02184a685 100644
--- a/video/video_loopback.cc
+++ b/video/video_loopback.cc
@@ -28,6 +28,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/run_test.h"
+#include "test/test_flags.h"
#include "video/video_quality_test.h"
// Flags common with screenshare loopback, with different default values.
@@ -199,15 +200,6 @@ ABSL_FLAG(bool,
ABSL_FLAG(bool, video, true, "Add video stream");
-ABSL_FLAG(
- std::string,
- force_fieldtrials,
- "",
- "Field trials control experimental feature code which can be forced. "
- "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
- " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
- "trials are separated by \"/\"");
-
// Video-specific flags.
ABSL_FLAG(std::string,
clip,
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index 8759f3bb43..971c129329 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -48,6 +48,7 @@
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/task_queue_for_test.h"
#include "test/platform_video_capturer.h"
+#include "test/test_flags.h"
#include "test/testsupport/file_utils.h"
#include "test/video_renderer.h"
#include "video/frame_dumping_decoder.h"
@@ -76,8 +77,6 @@ constexpr int kFramesSentInQuickTest = 1;
constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000;
constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000;
-constexpr int kDefaultMaxQp = cricket::WebRtcVideoSendChannel::kDefaultQpMax;
-
const VideoEncoder::Capabilities kCapabilities(false);
std::pair<uint32_t, uint32_t> GetMinMaxBitratesBps(const VideoCodec& codec,
@@ -578,7 +577,7 @@ VideoStream VideoQualityTest::DefaultVideoStream(const Params& params,
stream.min_bitrate_bps = params.video[video_idx].min_bitrate_bps;
stream.target_bitrate_bps = params.video[video_idx].target_bitrate_bps;
stream.max_bitrate_bps = params.video[video_idx].max_bitrate_bps;
- stream.max_qp = kDefaultMaxQp;
+ stream.max_qp = cricket::kDefaultVideoMaxQpVpx;
stream.num_temporal_layers = params.video[video_idx].num_temporal_layers;
stream.active = true;
return stream;
@@ -593,7 +592,7 @@ VideoStream VideoQualityTest::DefaultThumbnailStream() {
stream.min_bitrate_bps = 7500;
stream.target_bitrate_bps = 37500;
stream.max_bitrate_bps = 50000;
- stream.max_qp = kDefaultMaxQp;
+ stream.max_qp = cricket::kDefaultVideoMaxQpVpx;
return stream;
}
@@ -626,7 +625,7 @@ void VideoQualityTest::FillScalabilitySettings(
encoder_config.simulcast_layers = std::vector<VideoStream>(num_streams);
encoder_config.video_stream_factory =
rtc::make_ref_counted<cricket::EncoderStreamFactory>(
- params->video[video_idx].codec, kDefaultMaxQp,
+ params->video[video_idx].codec, cricket::kDefaultVideoMaxQpVpx,
params->screenshare[video_idx].enabled, true, encoder_info);
params->ss[video_idx].streams =
encoder_config.video_stream_factory->CreateEncoderStreams(
@@ -1246,8 +1245,8 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) {
}
SendTask(task_queue(), [this, &params, &send_transport, &recv_transport]() {
- Call::Config send_call_config(send_event_log_.get());
- Call::Config recv_call_config(recv_event_log_.get());
+ CallConfig send_call_config(send_event_log_.get());
+ CallConfig recv_call_config(recv_event_log_.get());
send_call_config.bitrate_config = params.call.call_bitrate_config;
recv_call_config.bitrate_config = params.call.call_bitrate_config;
if (params_.audio.enabled)
@@ -1262,7 +1261,7 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) {
std::string graph_title = params_.analyzer.graph_title;
if (graph_title.empty())
graph_title = VideoQualityTest::GenerateGraphTitle();
- bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest");
+ bool is_quick_test_enabled = absl::GetFlag(FLAGS_webrtc_quick_perf_test);
analyzer_ = std::make_unique<VideoAnalyzer>(
send_transport.get(), params_.analyzer.test_label,
params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
@@ -1365,8 +1364,8 @@ rtc::scoped_refptr<AudioDeviceModule> VideoQualityTest::CreateAudioDevice() {
#endif
}
-void VideoQualityTest::InitializeAudioDevice(Call::Config* send_call_config,
- Call::Config* recv_call_config,
+void VideoQualityTest::InitializeAudioDevice(CallConfig* send_call_config,
+ CallConfig* recv_call_config,
bool use_real_adm) {
rtc::scoped_refptr<AudioDeviceModule> audio_device;
if (use_real_adm) {
@@ -1472,11 +1471,11 @@ void VideoQualityTest::RunWithRenderers(const Params& params) {
params_ = params;
CheckParamsAndInjectionComponents();
- // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to
+ // TODO(ivica): Remove bitrate_config and use the default CallConfig(), to
// match the full stack tests.
- Call::Config send_call_config(send_event_log_.get());
+ CallConfig send_call_config(send_event_log_.get());
send_call_config.bitrate_config = params_.call.call_bitrate_config;
- Call::Config recv_call_config(recv_event_log_.get());
+ CallConfig recv_call_config(recv_event_log_.get());
if (params_.audio.enabled)
InitializeAudioDevice(&send_call_config, &recv_call_config,
diff --git a/video/video_quality_test.h b/video/video_quality_test.h
index f66256e94c..63fa4813f0 100644
--- a/video/video_quality_test.h
+++ b/video/video_quality_test.h
@@ -90,8 +90,8 @@ class VideoQualityTest : public test::CallTest,
void DestroyThumbnailStreams();
// Helper method for creating a real ADM (using hardware) for all platforms.
rtc::scoped_refptr<AudioDeviceModule> CreateAudioDevice();
- void InitializeAudioDevice(Call::Config* send_call_config,
- Call::Config* recv_call_config,
+ void InitializeAudioDevice(CallConfig* send_call_config,
+ CallConfig* recv_call_config,
bool use_real_adm);
void SetupAudio(Transport* transport);
diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc
index d0a96ce06c..ee023d9fec 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -165,7 +165,8 @@ bool SameStreamsEnabled(const VideoBitrateAllocation& lhs,
absl::optional<float> GetConfiguredPacingFactor(
const VideoSendStream::Config& config,
VideoEncoderConfig::ContentType content_type,
- const PacingConfig& default_pacing_config) {
+ const PacingConfig& default_pacing_config,
+ const FieldTrialsView& field_trials) {
if (!TransportSeqNumExtensionConfigured(config))
return absl::nullopt;
@@ -175,7 +176,7 @@ absl::optional<float> GetConfiguredPacingFactor(
return alr_settings->pacing_factor;
RateControlSettings rate_control_settings =
- RateControlSettings::ParseFromFieldTrials();
+ RateControlSettings::ParseFromKeyValueConfig(&field_trials);
return rate_control_settings.GetPacingFactor().value_or(
default_pacing_config.pacing_factor);
}
@@ -246,8 +247,10 @@ VideoSendStreamImpl::VideoSendStreamImpl(
encoder_bitrate_priority_(initial_encoder_bitrate_priority),
video_stream_encoder_(video_stream_encoder),
rtp_video_sender_(rtp_video_sender),
- configured_pacing_factor_(
- GetConfiguredPacingFactor(*config_, content_type, pacing_config_)) {
+ configured_pacing_factor_(GetConfiguredPacingFactor(*config_,
+ content_type,
+ pacing_config_,
+ field_trials)) {
RTC_DCHECK_GE(config_->rtp.payload_type, 0);
RTC_DCHECK_LE(config_->rtp.payload_type, 127);
RTC_DCHECK(!config_->rtp.ssrcs.empty());
@@ -281,7 +284,7 @@ VideoSendStreamImpl::VideoSendStreamImpl(
queue_time_limit_ms = alr_settings->max_paced_queue_time;
} else {
RateControlSettings rate_control_settings =
- RateControlSettings::ParseFromFieldTrials();
+ RateControlSettings::ParseFromKeyValueConfig(&field_trials);
enable_alr_bw_probing = rate_control_settings.UseAlrProbing();
queue_time_limit_ms = pacing_config_.max_pacing_delay.Get().ms();
}
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index 84f6108807..2e5a120eed 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -650,7 +650,8 @@ VideoStreamEncoder::VideoStreamEncoder(
sink_(nullptr),
settings_(settings),
allocation_cb_type_(allocation_cb_type),
- rate_control_settings_(RateControlSettings::ParseFromFieldTrials()),
+ rate_control_settings_(
+ RateControlSettings::ParseFromKeyValueConfig(&field_trials)),
encoder_selector_from_constructor_(encoder_selector),
encoder_selector_from_factory_(
encoder_selector_from_constructor_
@@ -1368,7 +1369,8 @@ void VideoStreamEncoder::ReconfigureEncoder() {
const VideoEncoder::EncoderInfo info = encoder_->GetEncoderInfo();
if (rate_control_settings_.UseEncoderBitrateAdjuster()) {
- bitrate_adjuster_ = std::make_unique<EncoderBitrateAdjuster>(codec);
+ bitrate_adjuster_ =
+ std::make_unique<EncoderBitrateAdjuster>(codec, field_trials_);
bitrate_adjuster_->OnEncoderInfo(info);
}
diff --git a/webrtc.gni b/webrtc.gni
index 5a1c43c888..173d66c791 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -480,9 +480,6 @@ all_poison_types = [
# Default echo detector implementation.
"default_echo_detector",
- # JSON parsing should not be needed in the "slim and modular" WebRTC.
- "rtc_json",
-
# Software video codecs (VP8 and VP9 through libvpx).
"software_video_codecs",
]
diff --git a/webrtc_lib_link_test.cc b/webrtc_lib_link_test.cc
index 868c17287e..64da01e4ef 100644
--- a/webrtc_lib_link_test.cc
+++ b/webrtc_lib_link_test.cc
@@ -12,8 +12,8 @@
#include "api/audio_codecs/audio_encoder_factory_template.h"
#include "api/audio_codecs/opus/audio_decoder_opus.h"
#include "api/audio_codecs/opus/audio_encoder_opus.h"
-#include "api/call/call_factory_interface.h"
#include "api/create_peerconnection_factory.h"
+#include "api/enable_media.h"
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/stats/rtcstats_objects.h"
@@ -28,18 +28,14 @@
#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 "api/video_codecs/video_encoder_factory_template_open_h264_adapter.h"
-#include "media/engine/webrtc_media_engine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
namespace webrtc {
-cricket::MediaEngineDependencies CreateSomeMediaDeps(
- TaskQueueFactory* task_queue_factory) {
- cricket::MediaEngineDependencies media_deps;
- media_deps.task_queue_factory = task_queue_factory;
+void CreateSomeMediaDeps(PeerConnectionFactoryDependencies& media_deps) {
media_deps.adm = AudioDeviceModule::CreateForTest(
- AudioDeviceModule::kDummyAudio, task_queue_factory);
+ AudioDeviceModule::kDummyAudio, media_deps.task_queue_factory.get());
media_deps.audio_encoder_factory =
webrtc::CreateAudioEncoderFactory<webrtc::AudioEncoderOpus>();
media_deps.audio_decoder_factory =
@@ -53,7 +49,6 @@ cricket::MediaEngineDependencies CreateSomeMediaDeps(
LibvpxVp8DecoderTemplateAdapter, LibvpxVp9DecoderTemplateAdapter,
OpenH264DecoderTemplateAdapter, Dav1dDecoderTemplateAdapter>>();
media_deps.audio_processing = webrtc::AudioProcessingBuilder().Create();
- return media_deps;
}
webrtc::PeerConnectionFactoryDependencies CreateSomePcfDeps() {
@@ -62,11 +57,10 @@ webrtc::PeerConnectionFactoryDependencies CreateSomePcfDeps() {
pcf_deps.signaling_thread = rtc::Thread::Current();
pcf_deps.network_thread = rtc::Thread::Current();
pcf_deps.worker_thread = rtc::Thread::Current();
- pcf_deps.call_factory = webrtc::CreateCallFactory();
pcf_deps.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>(
pcf_deps.task_queue_factory.get());
- auto media_deps = CreateSomeMediaDeps(pcf_deps.task_queue_factory.get());
- pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));
+ CreateSomeMediaDeps(pcf_deps);
+ EnableMedia(pcf_deps);
return pcf_deps;
}
@@ -86,8 +80,9 @@ void TestCase1ModularFactory() {
}
void TestCase2RegularFactory() {
- auto task_queue_factory = CreateDefaultTaskQueueFactory();
- auto media_deps = CreateSomeMediaDeps(task_queue_factory.get());
+ PeerConnectionFactoryDependencies media_deps;
+ media_deps.task_queue_factory = CreateDefaultTaskQueueFactory();
+ CreateSomeMediaDeps(media_deps);
auto peer_connection_factory = webrtc::CreatePeerConnectionFactory(
rtc::Thread::Current(), rtc::Thread::Current(), rtc::Thread::Current(),