webrtc/api
Lennart Grahl a743303211 Fix RTP header extension encryption
Previously, RTP header extensions with encryption had been filtered
if the encryption had been activated (not the other way around) which
was likely an unintended logic inversion.

In addition, it ensures that encrypted RTP header extensions are only
negotiated if RTP header extension encryption is turned on. Formerly,
which extensions had been negotiated depended on the order in which
they were inserted, regardless of whether or not header encryption was
actually enabled, leading to no extensions being sent on the wire.

Further changes:

- If RTP header encryption enabled, prefer encrypted extensions over
  non-encrypted extensions
- Add most extensions to list of extensions supported for encryption
- Discard encrypted extensions in a session description in case encryption
  is not supported for that extension

Note that this depends on https://github.com/cisco/libsrtp/pull/491 to get
into libwebrtc (cherry-pick or bump libsrtp version). Otherwise, two-byte
header extensions will prevent any RTP packets being sent/received.

Bug: webrtc:11713
Change-Id: Ia0779453d342fa11e06996d9bc2d3c826f3466d3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177980
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor <deadbeef@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33723}
2021-04-14 08:53:45 +00:00
..
adaptation Introduce RTC_CHECK_NOTREACHED(), an always-checking RTC_NOTREACHED() 2020-11-09 10:47:55 +00:00
audio Enabling a safe fall-back functionality for overruns in the runtime settings 2021-03-03 12:06:54 +00:00
audio_codecs Remove tautological 'unsigned expr < 0' comparisons 2021-04-12 11:40:14 +00:00
call Remove passing rtp packet metadata through webrtc as array of bytes 2021-02-02 12:22:57 +00:00
crypto frame encryptor: remove note about not being production ready 2020-07-31 06:49:29 +00:00
g3doc API description: PeerConnection description 2021-04-13 12:51:47 +00:00
neteq Add a "Smart flushing" feature to NetEq. 2020-11-26 11:20:28 +00:00
numerics Introduce debug network stats 2020-09-23 09:40:25 +00:00
rtc_event_log Add kill-switch to RTC event log factory. 2020-11-05 14:08:02 +00:00
stats [Stats] Cleanup obsolete stats - isRemote & deleted 2021-03-24 10:49:34 +00:00
task_queue Document expected thread safety of the TaskQueue interface 2021-01-19 11:11:09 +00:00
test Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
transport Modified STUN verification functions 2021-03-02 10:34:17 +00:00
units Rename UNIT_TEST to WEBRTC_UNIT_TEST 2020-12-10 11:04:58 +00:00
video VideoReceiveStream2: AV1 encoded sink support. 2021-04-08 20:07:22 +00:00
video_codecs Reland "Reland "Enable quality scaling when allowed"" 2021-03-16 15:13:52 +00:00
voip Adding MockVoipEngine for downstream project's tests 2021-01-28 21:06:16 +00:00
array_view.h rtc::ArrayView reverse iterators 2020-10-21 08:57:13 +00:00
array_view_unittest.cc rtc::ArrayView reverse iterators 2020-10-21 08:57:13 +00:00
async_dns_resolver.h Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
async_resolver_factory.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
audio_options.cc Remove deprecated code related to AEC2 2019-08-07 10:09:36 +00:00
audio_options.h Add RtpEncodingParameters.adaptive_ptime. 2020-06-25 14:51:13 +00:00
BUILD.gn Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
candidate.cc (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
candidate.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
create_peerconnection_factory.cc Async audio processing API 2020-10-02 12:33:34 +00:00
create_peerconnection_factory.h Async audio processing API 2020-10-02 12:33:34 +00:00
crypto_params.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
data_channel_interface.cc Datachannel: Use absl::optional for maxRetransmits and maxRetransmitTime. 2019-04-09 08:32:43 +00:00
data_channel_interface.h Pass datachannel priority in DC open messages 2020-05-17 10:57:27 +00:00
DEPS dcsctp: Add bounded byte reader and writer 2021-03-31 08:27:37 +00:00
dtls_transport_interface.cc Expose TLS version and SRTP cipher to API 2019-10-29 22:20:49 +00:00
dtls_transport_interface.h Expose TLS version and SRTP cipher to API 2019-10-29 22:20:49 +00:00
dtmf_sender_interface.h Allow DTMF delay configurability 2020-01-22 20:46:52 +00:00
fec_controller.h Make VideoFrameType an enum class, and move to separate file and target 2019-03-22 12:44:51 +00:00
fec_controller_override.h Define FecControllerOverride and plumb it down to VideoEncoder 2019-06-28 15:57:22 +00:00
frame_transformer_interface.h Reland "Make TransformableVideoFrameInterface::GetMetadata pure virtual." 2020-05-18 17:53:38 +00:00
function_view.h Move rtc::FunctionView to the public API 2019-03-21 15:23:05 +00:00
function_view_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
ice_transport_factory.cc Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
ice_transport_factory.h Make ICE transports injectable. 2019-11-15 21:31:19 +00:00
ice_transport_interface.h Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
jsep.cc Reland "Remove old-style OnFailure callbacks" 2020-02-21 14:07:57 +00:00
jsep.h Replace RTC_DEPRECATED with ABSL_DEPRECATED 2021-02-22 12:53:23 +00:00
jsep_ice_candidate.cc Use unique_ptr in JsepCandidateCollection 2019-07-31 01:48:07 +00:00
jsep_ice_candidate.h Make the JsepSessionDesription clone() method copy candidates. 2021-01-05 12:55:24 +00:00
jsep_session_description.h Replace RTC_DEPRECATED with ABSL_DEPRECATED 2021-02-22 12:53:23 +00:00
media_stream_interface.cc New target for api/rtp_parameters.h and api/media_types.h. 2019-08-29 09:04:32 +00:00
media_stream_interface.h Surface the number of encoded channels 2020-12-15 16:38:04 +00:00
media_stream_proxy.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
media_stream_track.h Move pc/media_stream_track.h to the api/ directory 2020-10-12 07:28:01 +00:00
media_stream_track_proxy.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
media_types.cc Introduce RTC_CHECK_NOTREACHED(), an always-checking RTC_NOTREACHED() 2020-11-09 10:47:55 +00:00
media_types.h Reland "introduce an unsupported content description type" 2020-10-21 08:20:05 +00:00
network_state_predictor.h Add base class NetworkPredictor and NetworkPredictorFactory and wire up. 2019-04-10 12:38:58 +00:00
notifier.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
OWNERS Remove kwiberg@webrtc.org from OWNERS files 2020-12-04 15:11:26 +00:00
packet_socket_factory.h Prepare to move packet_socket_factory to api/. 2019-09-06 09:09:02 +00:00
peer_connection_factory_proxy.h Call ChannelManager aec dump methods on the worker thread. 2021-04-01 17:33:48 +00:00
peer_connection_interface.cc Add create function for PeerConnection that can return an error. 2020-11-27 11:08:10 +00:00
peer_connection_interface.h Reland "Use the new DNS resolver API in PeerConnection" 2021-04-08 08:44:14 +00:00
peer_connection_proxy.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
priority.h Pass datachannel priority in DC open messages 2020-05-17 10:57:27 +00:00
proxy.cc Make MessageHandler cleanup optional. 2020-09-07 12:57:15 +00:00
proxy.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
README.md Add a small README file for api/ 2019-02-01 13:24:47 +00:00
ref_counted_base.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
rtc_error.cc Return an error when datachannel closes due to network error 2019-12-08 17:33:54 +00:00
rtc_error.h Rename UNIT_TEST to WEBRTC_UNIT_TEST 2020-12-10 11:04:58 +00:00
rtc_error_unittest.cc Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output.h Adds functionality to write logs to memory. 2019-01-16 17:36:31 +00:00
rtc_event_log_output_file.cc Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output_file.h Format almost everything. 2019-07-08 13:45:15 +00:00
rtc_event_log_output_file_unittest.cc Rename several more tests that use EXPECT_DEATH to *DeathTest. 2020-05-18 16:10:04 +00:00
rtp_headers.cc Remove framemarking RTP extension. 2020-06-15 11:18:00 +00:00
rtp_headers.h Update rsid and mid spec links from draft to release version 2021-03-22 12:24:00 +00:00
rtp_packet_info.cc Remove deprecated RtpPacketInfo::RtpPacketInfo. 2020-04-14 10:59:44 +00:00
rtp_packet_info.h Remove deprecated RtpPacketInfo::RtpPacketInfo. 2020-04-14 10:59:44 +00:00
rtp_packet_info_unittest.cc Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_packet_infos.h Add RtpPacketInfo and RtpPacketInfos to RTC_EXPORT 2020-01-21 12:11:41 +00:00
rtp_packet_infos_unittest.cc Add AbsoluteCaptureTime to RtpPacketInfo. 2019-08-07 10:12:56 +00:00
rtp_parameters.cc Fix RTP header extension encryption 2021-04-14 08:53:45 +00:00
rtp_parameters.h Fix RTP header extension encryption 2021-04-14 08:53:45 +00:00
rtp_parameters_unittest.cc Fix RTP header extension encryption 2021-04-14 08:53:45 +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 Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
rtp_sender_interface.cc Insert frame transformer between Encoded and Packetizer. 2020-02-28 07:43:13 +00:00
rtp_sender_interface.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +00:00
rtp_transceiver_direction.h RtpTransceiverInterface: add header_extensions_to_offer() 2020-03-16 13:16:42 +00:00
rtp_transceiver_interface.cc RtpTransceiverInterface: introduce HeaderExtensionsNegotiated. 2020-12-17 23:43:42 +00:00
rtp_transceiver_interface.h Replace RTC_DEPRECATED with ABSL_DEPRECATED 2021-02-22 12:53:23 +00:00
scoped_refptr.h Replace blocking invokes with PostTask in AndroidNetworkMonitor 2021-03-12 14:52:25 +00:00
scoped_refptr_unittest.cc Mark scoped_refptr move and swap operations as noexcept 2019-11-12 10:17:22 +00:00
sctp_transport_interface.cc Format almost everything. 2019-07-08 13:45:15 +00:00
sctp_transport_interface.h Reland "Fix unsynchronized access to mid_to_transport_ in JsepTransportController" 2021-02-10 13:40:22 +00:00
sequence_checker.h Move SequenceChecker header to API: step 1, move header only 2021-02-08 11:49:58 +00:00
sequence_checker_unittest.cc Move SequenceChecker header to API: step 1, move header only 2021-02-08 11:49:58 +00:00
set_local_description_observer_interface.h Reland "[Perfect Negotiation] Implement non-racy version of SetLocalDescription." 2020-07-29 11:27:43 +00:00
set_remote_description_observer_interface.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
stats_types.cc Reporting audio device underrun counter 2019-08-16 11:49:55 +00:00
stats_types.h Remove deprecated thread checker 2021-02-10 12:25:53 +00:00
turn_customizer.h (4) Rename files to snake_case: update BUILD.gn, include paths, header guards, and DEPS entries 2019-01-11 17:11:39 +00:00
uma_metrics.h peerconnection: measure bundle policy usage 2021-02-09 17:09:46 +00:00
video_track_source_proxy.h Reland "Rename SIGNALING and WORKER to PRIMARY and SECONDARY" 2021-02-26 10:35:22 +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/.

That is, 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.