webrtc/api/BUILD.gn
Benjamin Wright 78410ad413 Fixes use after free error when setting a new FrameEncryptor on ChannelSend.
This change corrects a potential race condition when updating a FrameEncryptor
for the audio send channel. If a FrameEncryptor is set on an active audio
stream it is possible for the current FrameEncryptor attached to the audio channel to be  deallocated due to
the FrameEncryptors reference count reaching zero before the new FrameEncryptor is set on the
channel.

To address this issue the ChannelSend is now holds a scoped_reftptr<FrameEncryptor>
to only allow deallocation when it is actually set on the encoder queue.

ChannelSend is unique in this respect as the Audio Receiver a long with the
Video Sender and Video Receiver streams all recreate themselves when they have
a configuration change. ChannelSend instead reconfigures itself using the
existing channel object.

Added Seth as TBR as this only introduces mocks.

TBR=shampson@webrtc.org

Bug: webrtc:9907
Change-Id: Ibf391dc9cecdbed1874e0252ff5c2cb92a5c64f4
Reviewed-on: https://webrtc-review.googlesource.com/c/107664
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25374}
2018-10-25 17:36:57 +00:00

646 lines
15 KiB
Text

# 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.
import("../webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
group("api") {
visibility = [ "*" ]
deps = []
if (!build_with_mozilla) {
deps += [ ":libjingle_peerconnection_api" ]
}
}
rtc_source_set("call_api") {
visibility = [ "*" ]
sources = [
"call/audio_sink.h",
]
deps = [
# TODO(kjellander): Add remaining dependencies when webrtc:4243 is done.
":transport_api",
"..:webrtc_common",
"../rtc_base:rtc_base_approved",
"audio:audio_mixer_api",
"audio_codecs:audio_codecs_api",
]
}
rtc_source_set("callfactory_api") {
visibility = [ "*" ]
sources = [
"call/callfactoryinterface.h",
]
}
rtc_static_library("libjingle_peerconnection_api") {
visibility = [ "*" ]
cflags = []
sources = [
"asyncresolverfactory.h",
"bitrate_constraints.h",
"candidate.cc",
"candidate.h",
"crypto/cryptooptions.cc",
"crypto/cryptooptions.h",
"crypto/framedecryptorinterface.h",
"crypto/frameencryptorinterface.h",
"cryptoparams.h",
"datachannelinterface.cc",
"datachannelinterface.h",
"dtmfsenderinterface.h",
"jsep.cc",
"jsep.h",
"jsepicecandidate.cc",
"jsepicecandidate.h",
"jsepsessiondescription.h",
"media_transport_interface.cc",
"media_transport_interface.h",
"mediaconstraintsinterface.cc",
"mediaconstraintsinterface.h",
"mediastreaminterface.cc",
"mediastreaminterface.h",
"mediastreamproxy.h",
"mediastreamtrackproxy.h",
"mediatypes.cc",
"mediatypes.h",
"notifier.h",
"peerconnectionfactoryproxy.h",
"peerconnectioninterface.cc",
"peerconnectioninterface.h",
"peerconnectionproxy.h",
"proxy.cc",
"proxy.h",
"rtcerror.cc",
"rtcerror.h",
"rtp_headers.cc",
"rtp_headers.h",
"rtpparameters.cc",
"rtpparameters.h",
"rtpreceiverinterface.cc",
"rtpreceiverinterface.h",
"rtpsenderinterface.cc",
"rtpsenderinterface.h",
"rtptransceiverinterface.cc",
"rtptransceiverinterface.h",
"setremotedescriptionobserverinterface.h",
"statstypes.cc",
"statstypes.h",
"turncustomizer.h",
"umametrics.h",
"videosourceproxy.h",
]
deps = [
":array_view",
":audio_options_api",
":callfactory_api",
":fec_controller_api",
":libjingle_logging_api",
":rtc_stats_api",
"audio:audio_mixer_api",
"audio_codecs:audio_codecs_api",
"transport:bitrate_settings",
"transport:network_control",
"video:encoded_image",
"video:video_frame",
"//third_party/abseil-cpp/absl/types:optional",
# Basically, don't add stuff here. You might break sensitive downstream
# targets like pnacl. API should not depend on anything outside of this
# file, really. All these should arguably go away in time.
"..:webrtc_common",
"../logging:rtc_event_log_api",
"../media:rtc_media_config",
"../modules/audio_processing:audio_processing_statistics",
"../rtc_base:checks",
"../rtc_base:deprecation",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
"../rtc_base/system:rtc_export",
]
if (is_nacl) {
# This is needed by .h files included from rtc_base.
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
}
}
rtc_source_set("video_quality_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/video_quality_test_fixture.h",
]
deps = [
":fec_controller_api",
":libjingle_peerconnection_api",
":simulated_network_api",
"../call:fake_network",
"../call:rtp_interfaces",
"../test:test_common",
"../test:video_test_common",
"video_codecs:video_codecs_api",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("test_dependency_factory") {
visibility = [ "*" ]
testonly = true
sources = [
"test/test_dependency_factory.cc",
"test/test_dependency_factory.h",
]
deps = [
":video_quality_test_fixture_api",
"../rtc_base:thread_checker",
"//third_party/abseil-cpp/absl/memory",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
if (rtc_include_tests) {
rtc_source_set("create_video_quality_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/create_video_quality_test_fixture.cc",
"test/create_video_quality_test_fixture.h",
]
deps = [
":fec_controller_api",
":video_quality_test_fixture_api",
"../rtc_base:ptr_util",
"../video:video_quality_test",
"//third_party/abseil-cpp/absl/memory",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
rtc_source_set("libjingle_logging_api") {
visibility = [ "*" ]
sources = [
"rtceventlogoutput.h",
]
}
rtc_source_set("ortc_api") {
visibility = [ "*" ]
sources = [
"ortc/mediadescription.cc",
"ortc/mediadescription.h",
"ortc/ortcfactoryinterface.h",
"ortc/ortcrtpreceiverinterface.h",
"ortc/ortcrtpsenderinterface.h",
"ortc/packettransportinterface.h",
"ortc/rtptransportcontrollerinterface.h",
"ortc/rtptransportinterface.h",
"ortc/sessiondescription.cc",
"ortc/sessiondescription.h",
"ortc/srtptransportinterface.h",
"ortc/udptransportinterface.h",
]
# For mediastreaminterface.h, etc.
# TODO(deadbeef): Create a separate target for the common things ORTC and
# PeerConnection code shares, so that ortc_api can depend on that instead of
# libjingle_peerconnection_api.
deps = [
":libjingle_peerconnection_api",
"..:webrtc_common",
"../rtc_base:rtc_base",
"//third_party/abseil-cpp/absl/types:optional",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("rtc_stats_api") {
visibility = [ "*" ]
cflags = []
sources = [
"stats/rtcstats.h",
"stats/rtcstats_objects.h",
"stats/rtcstatscollectorcallback.h",
"stats/rtcstatsreport.h",
]
deps = [
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:rtc_export",
]
}
rtc_source_set("audio_options_api") {
visibility = [ "*" ]
sources = [
"audio_options.cc",
"audio_options.h",
]
deps = [
"../rtc_base:stringutils",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_source_set("transport_api") {
visibility = [ "*" ]
sources = [
"call/transport.cc",
"call/transport.h",
]
}
rtc_source_set("simulated_network_api") {
visibility = [ "*" ]
sources = [
"test/simulated_network.h",
]
deps = [
"../rtc_base:criticalsection",
"../rtc_base:rtc_base",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_source_set("fec_controller_api") {
visibility = [ "*" ]
sources = [
"fec_controller.h",
]
deps = [
"..:webrtc_common",
"../modules:module_fec_api",
]
}
rtc_source_set("array_view") {
visibility = [ "*" ]
sources = [
"array_view.h",
]
deps = [
"../rtc_base:checks",
"../rtc_base:type_traits",
]
}
rtc_source_set("refcountedbase") {
visibility = [ "*" ]
sources = [
"refcountedbase.h",
]
deps = [
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("libjingle_peerconnection_test_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/fakeconstraints.h",
]
deps = [
":libjingle_peerconnection_api",
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("neteq_simulator_api") {
visibility = [ "*" ]
sources = [
"test/neteq_simulator.cc",
"test/neteq_simulator.h",
]
}
if (rtc_include_tests) {
if (rtc_enable_protobuf) {
rtc_source_set("audioproc_f_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/audioproc_float.cc",
"test/audioproc_float.h",
]
deps = [
"../modules/audio_processing:audio_processing",
"../modules/audio_processing:audioproc_f_impl",
]
}
rtc_source_set("neteq_simulator_factory") {
visibility = [ "*" ]
testonly = true
sources = [
"test/neteq_simulator_factory.cc",
"test/neteq_simulator_factory.h",
]
deps = [
":neteq_simulator_api",
"../modules/audio_coding:neteq_test_factory",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/memory",
]
}
}
rtc_source_set("simulcast_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/simulcast_test_fixture.h",
]
}
rtc_source_set("create_simulcast_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/create_simulcast_test_fixture.cc",
"test/create_simulcast_test_fixture.h",
]
deps = [
":simulcast_test_fixture_api",
"../modules/video_coding:simulcast_test_fixture_impl",
"../rtc_base:rtc_base_approved",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/memory",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("videocodec_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/videocodec_test_fixture.h",
"test/videocodec_test_stats.cc",
"test/videocodec_test_stats.h",
]
deps = [
"..:webrtc_common",
"../modules/video_coding:video_codec_interface",
"../rtc_base:stringutils",
"video_codecs:video_codecs_api",
]
}
rtc_source_set("create_videocodec_test_fixture_api") {
visibility = [ "*" ]
testonly = true
sources = [
"test/create_videocodec_test_fixture.cc",
"test/create_videocodec_test_fixture.h",
]
deps = [
":videocodec_test_fixture_api",
"../modules/video_coding:video_codecs_test_framework",
"../modules/video_coding:videocodec_test_impl",
"../rtc_base:rtc_base_approved",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/memory",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("mock_audio_mixer") {
testonly = true
sources = [
"test/mock_audio_mixer.h",
]
deps = [
"../test:test_support",
"audio:audio_mixer_api",
]
}
rtc_source_set("mock_frame_encryptor") {
testonly = true
sources = [
"test/mock_frame_encryptor.cc",
"test/mock_frame_encryptor.h",
]
deps = [
":libjingle_peerconnection_api",
"../test:test_support",
]
}
rtc_source_set("mock_frame_decryptor") {
testonly = true
sources = [
"test/mock_frame_decryptor.cc",
"test/mock_frame_decryptor.h",
]
deps = [
":libjingle_peerconnection_api",
"../test:test_support",
]
}
rtc_source_set("fake_frame_encryptor") {
testonly = true
sources = [
"test/fake_frame_encryptor.cc",
"test/fake_frame_encryptor.h",
]
deps = [
":array_view",
":libjingle_peerconnection_api",
"..:webrtc_common",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("fake_frame_decryptor") {
testonly = true
sources = [
"test/fake_frame_decryptor.cc",
"test/fake_frame_decryptor.h",
]
deps = [
":array_view",
":libjingle_peerconnection_api",
"..:webrtc_common",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
]
}
rtc_source_set("mock_peerconnectioninterface") {
testonly = true
sources = [
"test/mock_peerconnectioninterface.h",
]
deps = [
":libjingle_peerconnection_api",
"../test:test_support",
]
}
rtc_source_set("mock_rtp") {
testonly = true
sources = [
"test/mock_rtpreceiver.h",
"test/mock_rtpsender.h",
]
deps = [
":libjingle_peerconnection_api",
"../test:test_support",
]
}
rtc_source_set("mock_video_bitrate_allocator") {
testonly = true
sources = [
"test/mock_video_bitrate_allocator.h",
]
deps = [
"../api/video:video_bitrate_allocator",
"../test:test_support",
]
}
rtc_source_set("mock_video_codec_factory") {
testonly = true
sources = [
"test/mock_video_decoder_factory.h",
"test/mock_video_encoder_factory.h",
]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
]
}
rtc_source_set("mock_video_decoder") {
visibility = [ "*" ]
testonly = true
sources = [
"test/mock_video_decoder.cc",
"test/mock_video_decoder.h",
]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
]
}
rtc_source_set("mock_video_encoder") {
visibility = [ "*" ]
testonly = true
sources = [
"test/mock_video_encoder.cc",
"test/mock_video_encoder.h",
]
deps = [
"../api/video_codecs:video_codecs_api",
"../test:test_support",
]
}
rtc_source_set("fake_media_transport") {
testonly = true
sources = [
"test/fake_media_transport.h",
]
deps = [
":libjingle_peerconnection_api",
"../rtc_base:checks",
"../third_party/abseil-cpp/absl/memory:memory",
]
}
rtc_source_set("loopback_media_transport") {
testonly = true
sources = [
"test/loopback_media_transport.h",
]
deps = [
":libjingle_peerconnection_api",
"../rtc_base:checks",
]
}
rtc_source_set("rtc_api_unittests") {
testonly = true
sources = [
"array_view_unittest.cc",
"ortc/mediadescription_unittest.cc",
"ortc/sessiondescription_unittest.cc",
"rtcerror_unittest.cc",
"rtpparameters_unittest.cc",
"test/loopback_media_transport_unittest.cc",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
":array_view",
":libjingle_peerconnection_api",
":loopback_media_transport",
":ortc_api",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils",
"../test:test_support",
"units:units_unittests",
]
}
}