Henrik Boström 831ae4ef65 Reland "[Perfect Negotiation] Implement non-racy version of SetLocalDescription."
This is a reland of d4089cae47334a4228b69d6bb23f2e49ebb7496e
with the following fix:

Invoke MaybeStartGathering as the last step of DoSetLocalDescription.
This ensures that candidates and onicegatheringstatechange does not
happen before SLD is resolved. This is important for passing
external/wpt/webrtc/RTCPeerConnection-iceGatheringState.html.

Original change's description:
> [Perfect Negotiation] Implement non-racy version of SetLocalDescription.
>
> BACKGROUND
>
> When SLD is invoked with SetSessionDescriptionObserver, the observer is
> called by posting a message back to the execution thread, delaying the
> call. This delay is "artificial" - it's not necessary; the operation is
> already complete. It's a post from the signaling thread to the signaling
> thread. The rationale for the post was to avoid the observer making
> recursive calls back into the PeerConnection. The problem with this is
> that by the time the observer is called, the PeerConnection could
> already have executed other operations and modified its states.
>
> This causes the referenced bug: one can have a race where SLD is
> resolved "too late" (after a pending SRD is executed) and the signaling
> state observed when SLD resolves doesn't make sense.
>
> When implementing Unified Plan, we fixed similar issues for SRD by
> adding a version that takes SetRemoteDescriptionObserverInterface as
> argument instead of SetSessionDescriptionObserver. The new version did
> not have the delay. The old version had to be kept around not to break
> downstream projects that had dependencies both on he delay and on
> allowing the PC to be destroyed midst-operation without informing its
> observers.
>
> THIS CL
>
> This does the old SRD fix for SLD as well: A new observer interface is
> added, SetLocalDescriptionObserverInterface, and
> PeerConnection::SetLocalDescription() is overloaded. If you call it with
> the old observer, you get the delay, but if you call it with the new
> observer, you don't get a delay.
>
> - SetLocalDescriptionObserverInterface is added.
> - SetLocalDescription is overloaded.
> - The adapter for SetSessionDescriptionObserver that causes the delay
>   previously only used for SRD is updated to handle both SLD and SRD.
> - FakeSetLocalDescriptionObserver is added and
>   MockSetRemoteDescriptionObserver is renamed "Fake...".
>
> Bug: chromium:1071733
> Change-Id: I920368e648bede481058ac22f5b8794752a220b3
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179100
> Commit-Queue: Henrik Boström <hbos@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31798}

TBR=hta@webrtc.org

Bug: chromium:1071733
Change-Id: Ic6e8d96afa1c19604762f373716c08dbfa9d178c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180481
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31804}
2020-07-29 11:27:43 +00:00

311 lines
6.2 KiB
Python

# This is supposed to be a complete list of top-level directories,
# excepting only api/ itself.
include_rules = [
"-audio",
"-base",
"-build",
"-buildtools",
"-build_overrides",
"-call",
"-common_audio",
"-common_video",
"-data",
"-examples",
"-ios",
"-infra",
"-logging",
"-media",
"-modules",
"-out",
"-p2p",
"-pc",
"-resources",
"-rtc_base",
"-rtc_tools",
"-sdk",
"-stats",
"-style-guide",
"-system_wrappers",
"-test",
"-testing",
"-third_party",
"-tools",
"-tools_webrtc",
"-video",
"-external/webrtc/webrtc", # Android platform build.
"-libyuv",
"-common_types.h",
"-WebRTC",
]
specific_include_rules = {
# Some internal headers are allowed even in API headers:
".*\.h": [
"+rtc_base/checks.h",
"+rtc_base/system/rtc_export.h",
"+rtc_base/system/rtc_export_template.h",
"+rtc_base/units/unit_base.h",
"+rtc_base/deprecation.h",
],
"array_view\.h": [
"+rtc_base/type_traits.h",
],
# Needed because AudioEncoderOpus is in the wrong place for
# backwards compatibilty reasons. See
# https://bugs.chromium.org/p/webrtc/issues/detail?id=7847
"audio_encoder_opus\.h": [
"+modules/audio_coding/codecs/opus/audio_encoder_opus.h",
],
"async_resolver_factory\.h": [
"+rtc_base/async_resolver_interface.h",
],
"candidate\.h": [
"+rtc_base/network_constants.h",
"+rtc_base/socket_address.h",
],
"data_channel_interface\.h": [
"+rtc_base/copy_on_write_buffer.h",
"+rtc_base/ref_count.h",
],
"data_channel_transport_interface\.h": [
"+rtc_base/copy_on_write_buffer.h",
],
"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",
],
"jsep_ice_candidate\.h": [
"+rtc_base/constructor_magic.h",
],
"jsep_session_description\.h": [
"+rtc_base/constructor_magic.h",
],
"media_stream_interface\.h": [
"+modules/audio_processing/include/audio_processing_statistics.h",
"+rtc_base/ref_count.h",
],
"packet_socket_factory\.h": [
"+rtc_base/proxy_info.h",
"+rtc_base/async_packet_socket.h",
],
"peer_connection_factory_proxy\.h": [
"+rtc_base/bind.h",
],
"peer_connection_interface\.h": [
"+media/base/media_config.h",
"+media/base/media_engine.h",
"+p2p/base/port_allocator.h",
"+rtc_base/network.h",
"+rtc_base/rtc_certificate.h",
"+rtc_base/rtc_certificate_generator.h",
"+rtc_base/socket_address.h",
"+rtc_base/ssl_certificate.h",
"+rtc_base/ssl_stream_adapter.h",
],
"proxy\.h": [
"+rtc_base/event.h",
"+rtc_base/message_handler.h", # Inherits from it.
"+rtc_base/ref_counted_object.h",
"+rtc_base/thread.h",
],
"ref_counted_base\.h": [
"+rtc_base/constructor_magic.h",
"+rtc_base/ref_count.h",
"+rtc_base/ref_counter.h",
],
"rtc_error\.h": [
"+rtc_base/logging.h",
],
"rtc_event_log_output_file.h": [
# 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",
],
"stats_types\.h": [
"+rtc_base/constructor_magic.h",
"+rtc_base/ref_count.h",
"+rtc_base/string_encode.h",
"+rtc_base/thread_checker.h",
],
"uma_metrics\.h": [
"+rtc_base/ref_count.h",
],
"audio_frame\.h": [
"+rtc_base/constructor_magic.h",
],
"audio_mixer\.h": [
"+rtc_base/ref_count.h",
],
"audio_decoder\.h": [
"+rtc_base/buffer.h",
"+rtc_base/constructor_magic.h",
],
"audio_decoder_factory\.h": [
"+rtc_base/ref_count.h",
],
"audio_decoder_factory_template\.h": [
"+rtc_base/ref_counted_object.h",
],
"audio_encoder\.h": [
"+rtc_base/buffer.h",
],
"audio_encoder_factory\.h": [
"+rtc_base/ref_count.h",
],
"audio_encoder_factory_template\.h": [
"+rtc_base/ref_counted_object.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",
"+rtc_base/ref_counted_object.h",
],
"audioproc_float\.h": [
"+modules/audio_processing/include/audio_processing.h",
],
"echo_detector_creator\.h": [
"+modules/audio_processing/include/audio_processing.h",
],
"fake_frame_decryptor\.h": [
"+rtc_base/ref_counted_object.h",
],
"fake_frame_encryptor\.h": [
"+rtc_base/ref_counted_object.h",
],
"mock.*\.h": [
"+test/gmock.h",
],
"simulated_network\.h": [
"+rtc_base/random.h",
"+rtc_base/thread_annotations.h",
],
"test_dependency_factory\.h": [
"+rtc_base/thread_checker.h",
],
"time_controller\.h": [
"+rtc_base/thread.h",
],
"videocodec_test_fixture\.h": [
"+modules/video_coding/include/video_codec_interface.h"
],
"video_encoder_config\.h": [
"+rtc_base/ref_count.h",
],
# .cc files in api/ should not be restricted in what they can #include,
# so we re-add all the top-level directories here. (That's because .h
# files leak their #includes to whoever's #including them, but .cc files
# do not since no one #includes them.)
".*\.cc": [
"+audio",
"+call",
"+common_audio",
"+common_video",
"+examples",
"+logging",
"+media",
"+modules",
"+p2p",
"+pc",
"+rtc_base",
"+rtc_tools",
"+sdk",
"+stats",
"+system_wrappers",
"+test",
"+tools",
"+tools_webrtc",
"+video",
"+third_party",
],
}