Break out separate compile targets for various classes

This reduces the degree of interdependency among modules related
to the PeerConnection class, and makes it easier to isolate inappropriate
external dependencies.

Bug: webrtc:11967
Change-Id: Id9777a2ab690cc349dd5842a3a95e24478144c71
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185882
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32235}
This commit is contained in:
Harald Alvestrand
2020-09-29 14:21:47 +00:00
committed by Commit Bot
parent 8036cb791f
commit 445e6b034a
8 changed files with 177 additions and 22 deletions

View File

@ -672,6 +672,7 @@ if (is_linux || is_chromeos || is_win) {
"../api/video_codecs:video_codecs_api",
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../pc:video_track_source",
"../rtc_base:checks",
"../rtc_base/third_party/sigslot",
"../system_wrappers:field_trial",
@ -822,6 +823,7 @@ if (is_win || is_android) {
"../modules/video_capture:video_capture_module",
"../pc:libjingle_peerconnection",
"../pc:peerconnection",
"../pc:video_track_source",
"../rtc_base",
"../test:platform_video_capturer",
"../test:video_test_common",

View File

@ -166,8 +166,6 @@ rtc_library("peerconnection") {
"data_channel_controller.h",
"data_channel_utils.cc",
"data_channel_utils.h",
"dtmf_sender.cc",
"dtmf_sender.h",
"ice_server_parsing.cc",
"ice_server_parsing.h",
"jitter_buffer_delay.cc",
@ -178,8 +176,6 @@ rtc_library("peerconnection") {
"jsep_session_description.cc",
"local_audio_source.cc",
"local_audio_source.h",
"media_stream.cc",
"media_stream.h",
"media_stream_observer.cc",
"media_stream_observer.h",
"media_stream_track.h",
@ -198,10 +194,6 @@ rtc_library("peerconnection") {
"rtp_data_channel.h",
"rtp_parameters_conversion.cc",
"rtp_parameters_conversion.h",
"rtp_receiver.cc",
"rtp_receiver.h",
"rtp_sender.cc",
"rtp_sender.h",
"rtp_transceiver.cc",
"rtp_transceiver.h",
"sctp_data_channel.cc",
@ -225,8 +217,6 @@ rtc_library("peerconnection") {
"video_rtp_track_source.h",
"video_track.cc",
"video_track.h",
"video_track_source.cc",
"video_track_source.h",
"webrtc_sdp.cc",
"webrtc_sdp.h",
"webrtc_session_description_factory.cc",
@ -234,7 +224,13 @@ rtc_library("peerconnection") {
]
deps = [
":dtmf_sender",
":media_stream",
":rtc_pc_base",
":rtp_receiver",
":rtp_sender",
":stats_collector_interface",
":video_track_source",
"../api:array_view",
"../api:audio_options_api",
"../api:call_api",
@ -294,6 +290,113 @@ rtc_library("peerconnection") {
]
}
rtc_library("rtp_receiver") {
sources = [
"rtp_receiver.cc",
"rtp_receiver.h",
]
deps = [
":media_stream",
":video_track_source",
"../api:libjingle_peerconnection_api",
"../api:media_stream_interface",
"../api:rtp_parameters",
"../api:scoped_refptr",
"../api/crypto:frame_decryptor_interface",
"../api/video:video_frame",
"../media:rtc_media_base",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_library("rtp_sender") {
sources = [
"rtp_sender.cc",
"rtp_sender.h",
]
deps = [
":dtmf_sender",
":stats_collector_interface",
"../api:audio_options_api",
"../api:libjingle_peerconnection_api",
"../api:media_stream_interface",
"../media:rtc_media_base",
"../rtc_base:checks",
"../rtc_base:rtc_base",
"../rtc_base/synchronization:mutex",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_library("dtmf_sender") {
sources = [
"dtmf_sender.cc",
"dtmf_sender.h",
]
deps = [
"../api:libjingle_peerconnection_api",
"../rtc_base:checks",
"../rtc_base:rtc_base",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_library("media_stream") {
sources = [
"media_stream.cc",
"media_stream.h",
]
deps = [
"../api:libjingle_peerconnection_api",
"../api:media_stream_interface",
"../api:scoped_refptr",
"../rtc_base:checks",
"../rtc_base:refcount",
"../rtc_base:rtc_base",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_library("video_track_source") {
sources = [
"video_track_source.cc",
"video_track_source.h",
]
deps = [
"../api:media_stream_interface",
"../api/video:video_frame",
"../media:rtc_media_base",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"../rtc_base/system:rtc_export",
]
}
rtc_source_set("stats_collector_interface") {
sources = [ "stats_collector_interface.h" ]
deps = [ "../api:media_stream_interface" ]
}
rtc_source_set("libjingle_peerconnection") {
visibility = [ "*" ]
deps = [
@ -472,6 +575,9 @@ if (rtc_include_tests) {
":libjingle_peerconnection",
":peerconnection",
":rtc_pc_base",
":rtp_receiver",
":rtp_sender",
":video_track_source",
"../api:audio_options_api",
"../api:create_frame_generator",
"../api:create_peerconnection_factory",
@ -569,8 +675,13 @@ if (rtc_include_tests) {
}
deps = [
":dtmf_sender",
":media_stream",
":peerconnection",
":rtc_pc_base",
":rtp_receiver",
":rtp_sender",
":video_track_source",
"../api:array_view",
"../api:audio_options_api",
"../api:create_peerconnection_factory",

View File

@ -17,8 +17,7 @@
#include "api/audio_options.h"
#include "api/media_stream_interface.h"
#include "media/base/media_engine.h"
#include "pc/peer_connection.h"
#include "pc/stats_collector.h"
#include "pc/stats_collector_interface.h"
#include "rtc_base/checks.h"
#include "rtc_base/helpers.h"
#include "rtc_base/location.h"
@ -418,7 +417,7 @@ void LocalAudioSinkAdapter::SetSink(cricket::AudioSource::Sink* sink) {
rtc::scoped_refptr<AudioRtpSender> AudioRtpSender::Create(
rtc::Thread* worker_thread,
const std::string& id,
StatsCollector* stats,
StatsCollectorInterface* stats,
SetStreamsObserver* set_streams_observer) {
return rtc::scoped_refptr<AudioRtpSender>(
new rtc::RefCountedObject<AudioRtpSender>(worker_thread, id, stats,
@ -427,7 +426,7 @@ rtc::scoped_refptr<AudioRtpSender> AudioRtpSender::Create(
AudioRtpSender::AudioRtpSender(rtc::Thread* worker_thread,
const std::string& id,
StatsCollector* stats,
StatsCollectorInterface* stats,
SetStreamsObserver* set_streams_observer)
: RtpSenderBase(worker_thread, id, set_streams_observer),
stats_(stats),

View File

@ -28,7 +28,7 @@
namespace webrtc {
class StatsCollector;
class StatsCollectorInterface;
bool UnimplementedRtpParameterHasValue(const RtpParameters& parameters);
@ -257,7 +257,7 @@ class AudioRtpSender : public DtmfProviderInterface, public RtpSenderBase {
static rtc::scoped_refptr<AudioRtpSender> Create(
rtc::Thread* worker_thread,
const std::string& id,
StatsCollector* stats,
StatsCollectorInterface* stats,
SetStreamsObserver* set_streams_observer);
virtual ~AudioRtpSender();
@ -281,7 +281,7 @@ class AudioRtpSender : public DtmfProviderInterface, public RtpSenderBase {
protected:
AudioRtpSender(rtc::Thread* worker_thread,
const std::string& id,
StatsCollector* stats,
StatsCollectorInterface* stats,
SetStreamsObserver* set_streams_observer);
void SetSend() override;
@ -303,7 +303,7 @@ class AudioRtpSender : public DtmfProviderInterface, public RtpSenderBase {
}
sigslot::signal0<> SignalDestroyed;
StatsCollector* stats_ = nullptr;
StatsCollectorInterface* stats_ = nullptr;
rtc::scoped_refptr<DtmfSenderInterface> dtmf_sender_proxy_;
bool cached_track_enabled_ = false;

View File

@ -16,7 +16,6 @@
#include <vector>
#include "pc/channel.h"
#include "pc/peer_connection.h"
#include "rtc_base/checks.h"
#include "rtc_base/third_party/base64/base64.h"
#include "system_wrappers/include/field_trial.h"

View File

@ -27,6 +27,7 @@
#include "api/stats_types.h"
#include "p2p/base/port.h"
#include "pc/peer_connection_internal.h"
#include "pc/stats_collector_interface.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/ssl_certificate.h"
@ -44,7 +45,7 @@ const char* AdapterTypeToStatsType(rtc::AdapterType type);
// A mapping between track ids and their StatsReport.
typedef std::map<std::string, StatsReport*> TrackIdMap;
class StatsCollector {
class StatsCollector : public StatsCollectorInterface {
public:
// The caller is responsible for ensuring that the pc outlives the
// StatsCollector instance.
@ -57,11 +58,13 @@ class StatsCollector {
void AddTrack(MediaStreamTrackInterface* track);
// Adds a local audio track that is used for getting some voice statistics.
void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc);
void AddLocalAudioTrack(AudioTrackInterface* audio_track,
uint32_t ssrc) override;
// Removes a local audio tracks that is used for getting some voice
// statistics.
void RemoveLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc);
void RemoveLocalAudioTrack(AudioTrackInterface* audio_track,
uint32_t ssrc) override;
// Gather statistics from the session and store them for future use.
void UpdateStats(PeerConnectionInterface::StatsOutputLevel level);

View File

@ -0,0 +1,40 @@
/*
* Copyright 2020 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 contains an interface for the (obsolete) StatsCollector class that
// is used by compilation units that do not wish to depend on the StatsCollector
// implementation.
#ifndef PC_STATS_COLLECTOR_INTERFACE_H_
#define PC_STATS_COLLECTOR_INTERFACE_H_
#include <stdint.h>
#include "api/media_stream_interface.h"
namespace webrtc {
class StatsCollectorInterface {
public:
virtual ~StatsCollectorInterface() {}
// Adds a local audio track that is used for getting some voice statistics.
virtual void AddLocalAudioTrack(AudioTrackInterface* audio_track,
uint32_t ssrc) = 0;
// Removes a local audio tracks that is used for getting some voice
// statistics.
virtual void RemoveLocalAudioTrack(AudioTrackInterface* audio_track,
uint32_t ssrc) = 0;
};
} // namespace webrtc
#endif // PC_STATS_COLLECTOR_INTERFACE_H_

View File

@ -307,6 +307,7 @@ if (!build_with_chromium) {
"../../../api:peer_connection_quality_test_fixture_api",
"../../../api/video:video_frame",
"../../../pc:peerconnection",
"../../../pc:video_track_source",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:variant" ]
}