webrtc/api
Harald Alvestrand 78f905e5cc Move some users to use webrtc::RefCountInterface
Bug: webrtc:15622
Change-Id: I2d4c20c726af1a052e161b7689a73d1e5e3eb191
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325526
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41067}
2023-11-02 14:45:57 +00:00
..
adaptation Remove rtc_base:rtc_base_approved 2022-05-05 09:43:31 +00:00
audio Make AEC3 json parsing code testonly 2023-10-26 12:03:02 +00:00
audio_codecs Move some users to use webrtc::RefCountInterface 2023-11-02 14:45:57 +00:00
call Introduce new way to enable media in PeerConnectionFactory 2023-10-31 14:31:28 +00:00
crypto Reland "Enable SRTP GCM ciphers by default" 2023-10-03 22:39:48 +00:00
g3doc Reland "Migrate WebRTC documentation to new renderer" 2023-01-31 09:30:04 +00:00
metronome Metronome: complete API migration. 2022-11-10 13:42:30 +00:00
neteq Format ^(api|call|common_audio|examples|media|net|p2p|pc)/ 2023-05-03 11:09:26 +00:00
numerics Add samples sum calculation 2023-02-24 11:48:39 +00:00
rtc_event_log Add RtcEvent to store when MinimumSetDelay is set on NetEq 2023-01-13 17:15:48 +00:00
stats Move some users to use webrtc::RefCountInterface 2023-11-02 14:45:57 +00:00
task_queue Move some users to use webrtc::RefCountInterface 2023-11-02 14:45:57 +00:00
test In PCLF remove ability to inject TaskQueueFactory and CallFactory 2023-10-27 13:03:09 +00:00
transport Export FieldTrialBasedConfig in order to use it in Chromium. 2023-10-16 16:13:48 +00:00
units Format ^(api|call|common_audio|examples|media|net|p2p|pc)/ 2023-05-03 11:09:26 +00:00
video Move some users to use webrtc::RefCountInterface 2023-11-02 14:45:57 +00:00
video_codecs Add codec name H265 to support H265 in WebRTC 2023-09-20 09:25:32 +00:00
voip Format ^(api|call|common_audio|examples|media|net|p2p|pc)/ 2023-05-03 11:09:26 +00:00
array_view.h Add reference, pointer, and co type aliases for rtc::ArrayView. 2023-04-05 20:18:57 +00:00
array_view_unittest.cc rtc::ArrayView reverse iterators 2020-10-21 08:57:13 +00:00
async_dns_resolver.h Convert AsyncDnsResolver to use absl::AnyInvocable 2023-08-31 08:50:40 +00:00
async_resolver_factory.h Reland "Deprecate all classes related to AsyncResolver" 2023-10-17 07:08:57 +00:00
audio_options.cc Remove unused combined_audio_video_bwe. 2023-05-26 15:56:00 +00:00
audio_options.h Remove unused combined_audio_video_bwe. 2023-05-26 15:56:00 +00:00
BUILD.gn Add EnableMediaWithDefaults to replace SetMediaEngineDefaults 2023-11-01 11:47:59 +00:00
candidate.cc candidate: do not log full IP addresses for related address 2023-07-25 17:19:25 +00:00
candidate.h Change PortInterface::Type to string_view and make type_ member const 2023-09-25 13:48:50 +00:00
create_peerconnection_factory.cc Delete CreatePeerConnectionFactory variant that accepts unowned audio frame processor 2023-11-02 14:28:47 +00:00
create_peerconnection_factory.h Delete CreatePeerConnectionFactory variant that accepts unowned audio frame processor 2023-11-02 14:28:47 +00:00
crypto_params.h Rename cipher_suite to crypto_suite 2023-08-02 11:45:24 +00:00
data_channel_interface.cc [DataChannelInterface] Introduce DataChannelInterface::SendAsync() 2023-04-11 19:46:36 +00:00
data_channel_interface.h Move some users to use webrtc::RefCountInterface 2023-11-02 14:45:57 +00:00
DEPS Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
dtls_transport_interface.cc Make DTLS role visible on DtlsTransport interface 2022-02-10 11:04:36 +00:00
dtls_transport_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
dtmf_sender_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
enable_media.cc Introduce new way to enable media in PeerConnectionFactory 2023-10-31 14:31:28 +00:00
enable_media.h Mark EnableMedia with RTC_EXPORT 2023-10-31 22:15:21 +00:00
enable_media_with_defaults.cc Add EnableMediaWithDefaults to replace SetMediaEngineDefaults 2023-11-01 11:47:59 +00:00
enable_media_with_defaults.h Add EnableMediaWithDefaults to replace SetMediaEngineDefaults 2023-11-01 11:47:59 +00:00
fec_controller.h Add SetRetransmissionMode() to FecController, this will be used to control RTX settings in FecController. 2023-06-01 07:51:56 +00:00
fec_controller_override.h Define FecControllerOverride and plumb it down to VideoEncoder 2019-06-28 15:57:22 +00:00
field_trials.cc Add FieldTrialsRegistry that verifies looked up field trials 2022-10-24 09:12:30 +00:00
field_trials.h Add FieldTrialsRegistry that verifies looked up field trials 2022-10-24 09:12:30 +00:00
field_trials_registry.cc Add option to log a warning for unregistered field trials 2023-02-28 15:43:18 +00:00
field_trials_registry.h Add FieldTrialsRegistry that verifies looked up field trials 2022-10-24 09:12:30 +00:00
field_trials_unittest.cc Use ScopedFieldTrials in FieldTrialsTest 2022-12-02 15:57:57 +00:00
field_trials_view.h Cleanup FieldTrialView 2023-03-27 17:06:33 +00:00
frame_transformer_factory.cc Make all encodedaudioframes inherit from TransformableAudioFrameI'face 2023-06-19 18:54:47 +00:00
frame_transformer_factory.h Make all encodedaudioframes inherit from TransformableAudioFrameI'face 2023-06-19 18:54:47 +00:00
frame_transformer_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
function_view.h
function_view_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
ice_transport_factory.cc Add rtc::make_ref_counted to api/ 2022-06-13 15:53:27 +00:00
ice_transport_factory.h Use backticks not vertical bars to denote variables in comments 2021-08-10 10:40:03 +00:00
ice_transport_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
jsep.cc Reland "Remove old-style OnFailure callbacks" 2020-02-21 14:07:57 +00:00
jsep.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
jsep_ice_candidate.cc Use unique_ptr in JsepCandidateCollection 2019-07-31 01:48:07 +00:00
jsep_ice_candidate.h Remove RTC_DISALLOW_COPY_AND_ASSIGN more. 2022-01-20 11:00:18 +00:00
jsep_session_description.h Remove JsepSessionDescription::kDefaultVideoCodecName 2023-03-02 12:28:29 +00:00
legacy_stats_types.cc Add missing method definition for StatsReport::Value::id_val() 2023-06-15 13:53:37 +00:00
legacy_stats_types.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
location.h Implement support for Chrome task origin tracing. #2/4 2023-02-27 13:17:38 +00:00
make_ref_counted.h Fix missing libc++ includes in webrtc 2023-03-02 10:14:51 +00:00
media_stream_interface.cc Format ^(api|call|common_audio|examples|media|net|p2p|pc)/ 2023-05-03 11:09:26 +00:00
media_stream_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
media_stream_track.h Use string_view to pass track ids to constructors 2022-05-30 10:28:57 +00:00
media_types.cc Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED 2021-11-15 21:44:59 +00:00
media_types.h Revert "Define cricket::MediaType in terms of webrtc::MediaType" 2021-05-12 17:06:58 +00:00
network_state_predictor.h
notifier.h Use SequenceChecker(SequenceChecker::kDetached) in a few places. 2023-03-24 07:44:18 +00:00
OWNERS Rearrange api/OWNERS to show who's backup OWNERS 2022-10-07 05:56:08 +00:00
packet_socket_factory.h Reland "Deprecate all classes related to AsyncResolver" 2023-10-17 07:08:57 +00:00
peer_connection_interface.cc Introduce new way to enable media in PeerConnectionFactory 2023-10-31 14:31:28 +00:00
peer_connection_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
priority.h Pass datachannel priority in DC open messages 2020-05-17 10:57:27 +00:00
README.md Discourage structs in api 2023-09-07 10:41:49 +00:00
ref_count.h Move RefCountInterface to api/ and webrtc: namespace 2023-10-31 14:02:50 +00:00
ref_counted_base.h Remove RTC_DISALLOW_COPY_AND_ASSIGN more. 2022-01-20 11:00:18 +00:00
rtc_error.cc Use absl::string_view type as parameter for RTCError message 2023-03-20 18:16:10 +00:00
rtc_error.h Ensure that RTCErrorOr<T, E> doesn't require T to be default constructible 2023-06-05 16:55:00 +00:00
rtc_error_unittest.cc Use absl::string_view type as parameter for RTCError message 2023-03-20 18:16:10 +00:00
rtc_event_log_output.h Remove unnecessary overload in RtcEventLogOutput 2022-07-12 22:09:36 +00:00
rtc_event_log_output_file.cc Remove unnecessary std::string overloads 2022-07-07 14:24:14 +00:00
rtc_event_log_output_file.h Remove unnecessary std::string overloads 2022-07-07 14:24:14 +00:00
rtc_event_log_output_file_unittest.cc Remove unnecessary overload in RtcEventLogOutput 2022-07-12 22:09:36 +00:00
rtp_headers.cc Delete RTPHeader::payload_type_frequency as unused 2023-03-09 16:32:22 +00:00
rtp_headers.h Delete RTPHeader::payload_type_frequency as unused 2023-03-09 16:32:22 +00:00
rtp_packet_info.cc RtpPacketInfo: deprecated ctors and getter removed 2022-09-21 12:00:56 +00:00
rtp_packet_info.h RtpPacketInfo: deprecated ctors and getter removed 2022-09-21 12:00:56 +00:00
rtp_packet_info_unittest.cc Surface local_capture_clock_offset from RtpSource 2022-09-20 12:51:22 +00:00
rtp_packet_infos.h Add rtc::make_ref_counted to api/ 2022-06-13 15:53:27 +00:00
rtp_packet_infos_unittest.cc RtpPacketInfo: new ctor + deprecated ctors clean-up 2022-09-20 08:58:38 +00:00
rtp_parameters.cc Extract common codec fields into RtpCodec 2023-04-14 12:15:24 +00:00
rtp_parameters.h Request keyframe via setParameters 2023-08-29 13:53:33 +00:00
rtp_parameters_unittest.cc Change SetLocalContent in channel classes to avoid Invoke. 2022-01-06 12:52:35 +00:00
rtp_receiver_interface.cc Insert frame transformer between Depacketizer and Decoder. 2020-03-02 08:33:44 +00:00
rtp_receiver_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
rtp_sender_interface.cc pc: Add asynchronous RtpSender::SetParameters() call 2022-11-15 15:31:40 +00:00
rtp_sender_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
rtp_transceiver_direction.h RtpTransceiverInterface: add header_extensions_to_offer() 2020-03-16 13:16:42 +00:00
rtp_transceiver_interface.cc Reland "Remove some default implementations in api/rtp_transcever_interface" 2022-01-19 11:32:24 +00:00
rtp_transceiver_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
scoped_refptr.h Delete implicit conversion from rtc::scoped_refptr<T> to T* 2022-05-09 09:06:44 +00:00
scoped_refptr_unittest.cc Update api/ to not use implicit T* --> scoped_refptr<T> conversion 2022-01-12 11:26:05 +00:00
sctp_transport_interface.cc Format almost everything. 2019-07-08 13:45:15 +00:00
sctp_transport_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
sequence_checker.h Support initializing a SequenceChecker with a provided TaskQueue. 2023-10-23 14:43:04 +00:00
sequence_checker_unittest.cc Support initializing a SequenceChecker with a provided TaskQueue. 2023-10-23 14:43:04 +00:00
set_local_description_observer_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
set_remote_description_observer_interface.h Move all api/ files to use webrtc::RefCountInterface 2023-10-31 15:45:12 +00:00
turn_customizer.h Make header files self contained. 2022-10-08 08:38:36 +00:00
uma_metrics.h Removing enum used for removed UMA metrics WebRTC.PeerConnection.Simulcast.ApplyLocalDescription and WebRTC.PeerConnection.Simulcast.ApplyRemoteDescription 2023-07-13 09:00:52 +00:00
video_track_source_constraints.h Route min/max FPS constraints to VideoStreamEncoder. 2021-10-14 06:49:05 +00:00
video_track_source_proxy_factory.h Make header files self contained. 2022-10-08 08:38:36 +00:00
webrtc_key_value_config.h WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 12/inf 2022-03-29 10:14:00 +00:00
wrapping_async_dns_resolver.cc Add CreateAsyncDnsResolver to PacketSocketFactory API 2021-10-01 16:12:50 +00:00
wrapping_async_dns_resolver.h Reland "Deprecate all classes related to AsyncResolver" 2023-10-17 07:08:57 +00:00

How to write code in the api/ directory

Mostly, just follow the regular style guide, but:

  • Note that api/ code is not exempt from the “.h and .cc files come in pairs” rule, so if you declare something in api/path/to/foo.h, it should be defined in api/path/to/foo.cc.
  • Headers in api/ should, if possible, not #include headers outside api/. Its not always possible to avoid this, but be aware that it adds to a small mountain of technical debt that were trying to shrink.
  • .cc files in api/, on the other hand, are free to #include headers outside api/.
  • Avoid structs in api, prefer classes.

The preferred way for api/ code to access non-api/ code is to call it from a .cc file, so that users of our API headers wont transitively #include non-public headers.

For headers in api/ that need to refer to non-public types, forward declarations are often a lesser evil than including non-public header files. The usual rules still apply, though.

.cc files in api/ should preferably be kept reasonably small. If a substantial implementation is needed, consider putting it with our non-public code, and just call it from the api/ .cc file.

Avoid defining api with structs as it makes harder for the api to evolve. Your struct may gain invariant, or change how it represents data. Evolving struct from the api is particular challenging as it is designed to be used in other code bases and thus needs to be updated independetly from its usage. Class with accessors and setters makes such migration safer. See Google C++ style guide for more.

If you need to evolve existent struct in api, prefer first to convert it into a class.