Create //webrtc/api:libjingle_peerconnection_api + refactorings.

Create a new target //webrtc/api:libjingle_peerconnection_api and start moving
things into it. Move remaining parts of //webrtc/api:libjingle_peerconnection
to //webrtc/pc:libjingle_peerconnection.

Moved the RTCStatsCollectorCallback into its own header file, so that
PeerConnectionInterface can include that instead of pulling in
RTCStatsCollector and PeerConnection and everything.

Separated cricket::MediaType into its own header/source set, so that it
can be used in the api.

BUG=webrtc:5883

Review-Url: https://codereview.webrtc.org/2514883002
Cr-Commit-Position: refs/heads/master@{#16210}
This commit is contained in:
ossu 2017-01-23 04:56:25 -08:00 committed by Commit bot
parent f49ff260d1
commit 7bb87ee4e8
132 changed files with 1586 additions and 1336 deletions

View file

@ -284,7 +284,6 @@ if (!build_with_chromium) {
":video_engine_tests",
":webrtc_nonparallel_tests",
":webrtc_perf_tests",
"api:peerconnection_unittests",
"base:rtc_base_tests_utils",
"common_audio:common_audio_unittests",
"common_video:common_video_unittests",
@ -295,6 +294,7 @@ if (!build_with_chromium) {
"modules/audio_processing:audio_processing_tests",
"modules/rtp_rtcp:test_packet_masks_metrics",
"modules/video_capture:video_capture_internal_impl",
"pc:peerconnection_unittests",
"pc:rtc_pc_unittests",
"stats:rtc_stats_unittests",
"system_wrappers:system_wrappers_unittests",

View file

@ -14,7 +14,7 @@ if (is_android) {
group("api") {
public_deps = [
":libjingle_peerconnection",
":libjingle_peerconnection_api",
]
}
@ -34,122 +34,63 @@ rtc_source_set("call_api") {
]
}
config("libjingle_peerconnection_warnings_config") {
# GN orders flags on a target before flags from configs. The default config
# adds these flags so to cancel them out they need to come from a config and
# cannot be on the target directly.
if (!is_win && !is_clang) {
cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
}
}
rtc_static_library("libjingle_peerconnection") {
rtc_static_library("libjingle_peerconnection_api") {
check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
cflags = []
sources = [
"audiotrack.cc",
"audiotrack.h",
"datachannel.cc",
"datachannel.h",
"datachannelinterface.h",
"dtmfsender.cc",
"dtmfsender.h",
"dtmfsenderinterface.h",
"jsep.h",
"jsepicecandidate.cc",
"jsepicecandidate.h",
"jsepsessiondescription.cc",
"jsepsessiondescription.h",
"localaudiosource.cc",
"localaudiosource.h",
"mediaconstraintsinterface.cc",
"mediaconstraintsinterface.h",
"mediacontroller.cc",
"mediacontroller.h",
"mediastream.cc",
"mediastream.h",
"mediastreaminterface.cc",
"mediastreaminterface.h",
"mediastreamobserver.cc",
"mediastreamobserver.h",
"mediastreamproxy.h",
"mediastreamtrack.h",
"mediastreamtrackproxy.h",
"mediatypes.cc",
"mediatypes.h",
"notifier.h",
"ortcfactory.cc",
"ortcfactory.h",
"ortcfactoryinterface.h",
"peerconnection.cc",
"peerconnection.h",
"peerconnectionfactory.cc",
"peerconnectionfactory.h",
"peerconnectionfactoryproxy.h",
"peerconnectioninterface.h",
"peerconnectionproxy.h",
"proxy.h",
"remoteaudiosource.cc",
"remoteaudiosource.h",
"rtcstatscollector.cc",
"rtcstatscollector.h",
"rtpparameters.h",
"rtpreceiver.cc",
"rtpreceiver.h",
"rtpreceiverinterface.h",
"rtpsender.cc",
"rtpsender.h",
"rtpsenderinterface.h",
"sctputils.cc",
"sctputils.h",
"statscollector.cc",
"statscollector.h",
"statstypes.cc",
"statstypes.h",
"streamcollection.h",
"trackmediainfomap.cc",
"trackmediainfomap.h",
"udptransportinterface.h",
"videocapturertracksource.cc",
"videocapturertracksource.h",
"umametrics.h",
"videosourceproxy.h",
"videotrack.cc",
"videotrack.h",
"videotracksource.cc",
"videotracksource.h",
"webrtcsdp.cc",
"webrtcsdp.h",
"webrtcsession.cc",
"webrtcsession.h",
"webrtcsessiondescriptionfactory.cc",
"webrtcsessiondescriptionfactory.h",
]
configs += [ ":libjingle_peerconnection_warnings_config" ]
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 = [
":call_api",
":rtc_stats_api",
"../call",
"../media",
"../pc",
"../stats",
]
}
if (rtc_use_quic) {
sources += [
"quicdatachannel.cc",
"quicdatachannel.h",
"quicdatatransport.cc",
"quicdatatransport.h",
]
deps += [ "//third_party/libquic" ]
public_deps = [
"//third_party/libquic",
]
}
# TODO(ossu): Remove once downstream projects have updated.
rtc_source_set("libjingle_peerconnection") {
deps = [
"../pc:libjingle_peerconnection",
]
}
rtc_source_set("rtc_stats_api") {
@ -157,6 +98,7 @@ rtc_source_set("rtc_stats_api") {
sources = [
"stats/rtcstats.h",
"stats/rtcstats_objects.h",
"stats/rtcstatscollectorcallback.h",
"stats/rtcstatsreport.h",
]
@ -210,134 +152,6 @@ rtc_source_set("video_frame_api") {
}
if (rtc_include_tests) {
config("peerconnection_unittests_config") {
# The warnings below are enabled by default. Since GN orders compiler flags
# for a target before flags from configs, the only way to disable such
# warnings is by having them in a separate config, loaded from the target.
# TODO(kjellander): Make the code compile without disabling these flags.
# See https://bugs.webrtc.org/3307.
if (is_clang && is_win) {
cflags = [
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
# for -Wno-sign-compare
"-Wno-sign-compare",
"-Wno-unused-function",
]
}
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
}
}
rtc_test("peerconnection_unittests") {
check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
testonly = true
sources = [
"datachannel_unittest.cc",
"dtmfsender_unittest.cc",
"jsepsessiondescription_unittest.cc",
"localaudiosource_unittest.cc",
"mediaconstraintsinterface_unittest.cc",
"mediastream_unittest.cc",
"ortcfactory_unittest.cc",
"peerconnection_unittest.cc",
"peerconnectionendtoend_unittest.cc",
"peerconnectionfactory_unittest.cc",
"peerconnectioninterface_unittest.cc",
"proxy_unittest.cc",
"rtcstats_integrationtest.cc",
"rtcstatscollector_unittest.cc",
"rtpsenderreceiver_unittest.cc",
"sctputils_unittest.cc",
"statscollector_unittest.cc",
"test/fakeaudiocapturemodule.cc",
"test/fakeaudiocapturemodule.h",
"test/fakeaudiocapturemodule_unittest.cc",
"test/fakeconstraints.h",
"test/fakedatachannelprovider.h",
"test/fakeperiodicvideocapturer.h",
"test/fakertccertificategenerator.h",
"test/fakevideotrackrenderer.h",
"test/mock_datachannel.h",
"test/mock_peerconnection.h",
"test/mock_rtpreceiver.h",
"test/mock_rtpsender.h",
"test/mock_webrtcsession.h",
"test/mockpeerconnectionobservers.h",
"test/peerconnectiontestwrapper.cc",
"test/peerconnectiontestwrapper.h",
"test/rtcstatsobtainer.h",
"test/testsdpstrings.h",
"trackmediainfomap_unittest.cc",
"videocapturertracksource_unittest.cc",
"videotrack_unittest.cc",
"webrtcsdp_unittest.cc",
"webrtcsession_unittest.cc",
]
if (rtc_enable_sctp) {
defines = [ "HAVE_SCTP" ]
}
configs += [ ":peerconnection_unittests_config" ]
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" ]
}
# TODO(jschuh): Bug 1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (is_win) {
cflags = [
"/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
"/wd4389", # signed/unsigned mismatch.
]
}
if (rtc_use_quic) {
public_deps = [
"//third_party/libquic",
]
sources += [
"quicdatachannel_unittest.cc",
"quicdatatransport_unittest.cc",
]
}
deps = []
if (is_android) {
sources += [
"test/androidtestinitializer.cc",
"test/androidtestinitializer.h",
]
deps += [
"//testing/android/native_test:native_test_support",
"//webrtc/sdk/android:libjingle_peerconnection_java",
"//webrtc/sdk/android:libjingle_peerconnection_jni",
]
}
deps += [
":fakemetricsobserver",
":libjingle_peerconnection",
"..:webrtc_common",
"../base:rtc_base_tests_utils",
"../media:rtc_unittest_main",
"../pc:rtc_pc",
"../system_wrappers:metrics_default",
"//testing/gmock",
]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
}
rtc_source_set("mock_audio_mixer") {
testonly = true
sources = [
@ -354,6 +168,22 @@ if (rtc_include_tests) {
]
}
rtc_source_set("libjingle_peerconnection_test_api") {
testonly = true
sources = [
"test/fakeconstraints.h",
]
public_deps = [
":libjingle_peerconnection_api",
]
deps = [
"../base:rtc_base_approved",
"//webrtc/test:test_support",
]
}
rtc_source_set("fakemetricsobserver") {
testonly = true
sources = [
@ -361,7 +191,7 @@ if (rtc_include_tests) {
"fakemetricsobserver.h",
]
deps = [
":libjingle_peerconnection",
":libjingle_peerconnection_api",
"../base:rtc_base_approved",
]
if (!build_with_chromium && is_clang) {

View file

@ -5,35 +5,10 @@ include_rules = [
"+webrtc/media",
"+webrtc/p2p",
"+webrtc/pc",
"+webrtc/logging/rtc_event_log",
"+webrtc/modules/audio_device",
"+webrtc/modules/rtp_rtcp",
"+webrtc/modules/video_coding",
"+webrtc/modules/video_render",
"+webrtc/system_wrappers",
]
specific_include_rules = {
"androidtestinitializer\.cc": [
"+base/android", # Allowed only for Android tests.
"+webrtc/voice_engine",
],
# The call/call.h exceptions are here only until the peerconnection
# implementation has been moved out of api/. See:
# http://bugs.webrtc.org/5883
"mediacontroller\.cc": [
"+webrtc/call/call.h"
],
"peerconnection\.cc": [
"+webrtc/call/call.h"
],
"peerconnection_jni\.cc": [
"+webrtc/voice_engine",
],
"peerconnectionfactory\.cc": [
"+webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h",
],
"webrtcsession\.cc": [
"+webrtc/call/call.h"
],
}

View file

@ -11,288 +11,8 @@
#ifndef WEBRTC_API_DATACHANNEL_H_
#define WEBRTC_API_DATACHANNEL_H_
#include <deque>
#include <set>
#include <string>
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/api/proxy.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/pc/channel.h"
namespace webrtc {
class DataChannel;
class DataChannelProviderInterface {
public:
// Sends the data to the transport.
virtual bool SendData(const cricket::SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
cricket::SendDataResult* result) = 0;
// Connects to the transport signals.
virtual bool ConnectDataChannel(DataChannel* data_channel) = 0;
// Disconnects from the transport signals.
virtual void DisconnectDataChannel(DataChannel* data_channel) = 0;
// Adds the data channel SID to the transport for SCTP.
virtual void AddSctpDataStream(int sid) = 0;
// Removes the data channel SID from the transport for SCTP.
virtual void RemoveSctpDataStream(int sid) = 0;
// Returns true if the transport channel is ready to send data.
virtual bool ReadyToSendData() const = 0;
protected:
virtual ~DataChannelProviderInterface() {}
};
struct InternalDataChannelInit : public DataChannelInit {
enum OpenHandshakeRole {
kOpener,
kAcker,
kNone
};
// The default role is kOpener because the default |negotiated| is false.
InternalDataChannelInit() : open_handshake_role(kOpener) {}
explicit InternalDataChannelInit(const DataChannelInit& base)
: DataChannelInit(base), open_handshake_role(kOpener) {
// If the channel is externally negotiated, do not send the OPEN message.
if (base.negotiated) {
open_handshake_role = kNone;
}
}
OpenHandshakeRole open_handshake_role;
};
// Helper class to allocate unique IDs for SCTP DataChannels
class SctpSidAllocator {
public:
// Gets the first unused odd/even id based on the DTLS role. If |role| is
// SSL_CLIENT, the allocated id starts from 0 and takes even numbers;
// otherwise, the id starts from 1 and takes odd numbers.
// Returns false if no id can be allocated.
bool AllocateSid(rtc::SSLRole role, int* sid);
// Attempts to reserve a specific sid. Returns false if it's unavailable.
bool ReserveSid(int sid);
// Indicates that |sid| isn't in use any more, and is thus available again.
void ReleaseSid(int sid);
private:
// Checks if |sid| is available to be assigned to a new SCTP data channel.
bool IsSidAvailable(int sid) const;
std::set<int> used_sids_;
};
// DataChannel is a an implementation of the DataChannelInterface based on
// libjingle's data engine. It provides an implementation of unreliable or
// reliabledata channels. Currently this class is specifically designed to use
// both RtpDataEngine and SctpDataEngine.
// DataChannel states:
// kConnecting: The channel has been created the transport might not yet be
// ready.
// kOpen: The channel have a local SSRC set by a call to UpdateSendSsrc
// and a remote SSRC set by call to UpdateReceiveSsrc and the transport
// has been writable once.
// kClosing: DataChannelInterface::Close has been called or UpdateReceiveSsrc
// has been called with SSRC==0
// kClosed: Both UpdateReceiveSsrc and UpdateSendSsrc has been called with
// SSRC==0.
class DataChannel : public DataChannelInterface,
public sigslot::has_slots<>,
public rtc::MessageHandler {
public:
static rtc::scoped_refptr<DataChannel> Create(
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
const InternalDataChannelInit& config);
virtual void RegisterObserver(DataChannelObserver* observer);
virtual void UnregisterObserver();
virtual std::string label() const { return label_; }
virtual bool reliable() const;
virtual bool ordered() const { return config_.ordered; }
virtual uint16_t maxRetransmitTime() const {
return config_.maxRetransmitTime;
}
virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; }
virtual std::string protocol() const { return config_.protocol; }
virtual bool negotiated() const { return config_.negotiated; }
virtual int id() const { return config_.id; }
virtual uint64_t buffered_amount() const;
virtual void Close();
virtual DataState state() const { return state_; }
virtual uint32_t messages_sent() const { return messages_sent_; }
virtual uint64_t bytes_sent() const { return bytes_sent_; }
virtual uint32_t messages_received() const { return messages_received_; }
virtual uint64_t bytes_received() const { return bytes_received_; }
virtual bool Send(const DataBuffer& buffer);
// rtc::MessageHandler override.
virtual void OnMessage(rtc::Message* msg);
// Called when the channel's ready to use. That can happen when the
// underlying DataMediaChannel becomes ready, or when this channel is a new
// stream on an existing DataMediaChannel, and we've finished negotiation.
void OnChannelReady(bool writable);
// Slots for provider to connect signals to.
void OnDataReceived(const cricket::ReceiveDataParams& params,
const rtc::CopyOnWriteBuffer& payload);
void OnStreamClosedRemotely(int sid);
// The remote peer request that this channel should be closed.
void RemotePeerRequestClose();
// The following methods are for SCTP only.
// Sets the SCTP sid and adds to transport layer if not set yet. Should only
// be called once.
void SetSctpSid(int sid);
// Called when the transport channel is created.
// Only needs to be called for SCTP data channels.
void OnTransportChannelCreated();
// Called when the transport channel is destroyed.
// This method makes sure the DataChannel is disconnected and changes state
// to kClosed.
void OnTransportChannelDestroyed();
// The following methods are for RTP only.
// Set the SSRC this channel should use to send data on the
// underlying data engine. |send_ssrc| == 0 means that the channel is no
// longer part of the session negotiation.
void SetSendSsrc(uint32_t send_ssrc);
// Set the SSRC this channel should use to receive data from the
// underlying data engine.
void SetReceiveSsrc(uint32_t receive_ssrc);
cricket::DataChannelType data_channel_type() const {
return data_channel_type_;
}
// Emitted when state transitions to kOpen.
sigslot::signal1<DataChannel*> SignalOpened;
// Emitted when state transitions to kClosed.
// In the case of SCTP channels, this signal can be used to tell when the
// channel's sid is free.
sigslot::signal1<DataChannel*> SignalClosed;
protected:
DataChannel(DataChannelProviderInterface* client,
cricket::DataChannelType dct,
const std::string& label);
virtual ~DataChannel();
private:
// A packet queue which tracks the total queued bytes. Queued packets are
// owned by this class.
class PacketQueue {
public:
PacketQueue();
~PacketQueue();
size_t byte_count() const {
return byte_count_;
}
bool Empty() const;
DataBuffer* Front();
void Pop();
void Push(DataBuffer* packet);
void Clear();
void Swap(PacketQueue* other);
private:
std::deque<DataBuffer*> packets_;
size_t byte_count_;
};
// The OPEN(_ACK) signaling state.
enum HandshakeState {
kHandshakeInit,
kHandshakeShouldSendOpen,
kHandshakeShouldSendAck,
kHandshakeWaitingForAck,
kHandshakeReady
};
bool Init(const InternalDataChannelInit& config);
void DoClose();
void UpdateState();
void SetState(DataState state);
void DisconnectFromProvider();
void DeliverQueuedReceivedData();
void SendQueuedDataMessages();
bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked);
bool QueueSendDataMessage(const DataBuffer& buffer);
void SendQueuedControlMessages();
void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer);
bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer);
std::string label_;
InternalDataChannelInit config_;
DataChannelObserver* observer_;
DataState state_;
uint32_t messages_sent_;
uint64_t bytes_sent_;
uint32_t messages_received_;
uint64_t bytes_received_;
cricket::DataChannelType data_channel_type_;
DataChannelProviderInterface* provider_;
HandshakeState handshake_state_;
bool connected_to_provider_;
bool send_ssrc_set_;
bool receive_ssrc_set_;
bool writable_;
uint32_t send_ssrc_;
uint32_t receive_ssrc_;
// Control messages that always have to get sent out before any queued
// data.
PacketQueue queued_control_data_;
PacketQueue queued_received_data_;
PacketQueue queued_send_data_;
};
// Define proxy for DataChannelInterface.
BEGIN_SIGNALING_PROXY_MAP(DataChannel)
PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
PROXY_METHOD0(void, UnregisterObserver)
PROXY_CONSTMETHOD0(std::string, label)
PROXY_CONSTMETHOD0(bool, reliable)
PROXY_CONSTMETHOD0(bool, ordered)
PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime)
PROXY_CONSTMETHOD0(uint16_t, maxRetransmits)
PROXY_CONSTMETHOD0(std::string, protocol)
PROXY_CONSTMETHOD0(bool, negotiated)
PROXY_CONSTMETHOD0(int, id)
PROXY_CONSTMETHOD0(DataState, state)
PROXY_CONSTMETHOD0(uint32_t, messages_sent)
PROXY_CONSTMETHOD0(uint64_t, bytes_sent)
PROXY_CONSTMETHOD0(uint32_t, messages_received)
PROXY_CONSTMETHOD0(uint64_t, bytes_received)
PROXY_CONSTMETHOD0(uint64_t, buffered_amount)
PROXY_METHOD0(void, Close)
PROXY_METHOD1(bool, Send, const DataBuffer&)
END_PROXY_MAP()
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/datachannel.h"
#endif // WEBRTC_API_DATACHANNEL_H_

View file

@ -11,34 +11,8 @@
#ifndef WEBRTC_API_MEDIACONTROLLER_H_
#define WEBRTC_API_MEDIACONTROLLER_H_
#include "webrtc/base/thread.h"
namespace cricket {
class ChannelManager;
struct MediaConfig;
} // namespace cricket
namespace webrtc {
class Call;
class VoiceEngine;
class RtcEventLog;
// The MediaController currently owns shared state between media channels, but
// in the future will create and own RtpSenders and RtpReceivers.
class MediaControllerInterface {
public:
static MediaControllerInterface* Create(
const cricket::MediaConfig& config,
rtc::Thread* worker_thread,
cricket::ChannelManager* channel_manager,
webrtc::RtcEventLog* event_log);
virtual ~MediaControllerInterface() {}
virtual void Close() = 0;
virtual webrtc::Call* call_w() = 0;
virtual cricket::ChannelManager* channel_manager() const = 0;
virtual const cricket::MediaConfig& config() const = 0;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/mediacontroller.h"
#endif // WEBRTC_API_MEDIACONTROLLER_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright 2011 The WebRTC project authors. All Rights Reserved.
* Copyright 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
@ -8,51 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
// This file contains the implementation of MediaStreamInterface interface.
#ifndef WEBRTC_API_MEDIASTREAM_H_
#define WEBRTC_API_MEDIASTREAM_H_
#include <string>
#include <vector>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
namespace webrtc {
class MediaStream : public Notifier<MediaStreamInterface> {
public:
static rtc::scoped_refptr<MediaStream> Create(const std::string& label);
std::string label() const override { return label_; }
bool AddTrack(AudioTrackInterface* track) override;
bool AddTrack(VideoTrackInterface* track) override;
bool RemoveTrack(AudioTrackInterface* track) override;
bool RemoveTrack(VideoTrackInterface* track) override;
rtc::scoped_refptr<AudioTrackInterface>
FindAudioTrack(const std::string& track_id) override;
rtc::scoped_refptr<VideoTrackInterface>
FindVideoTrack(const std::string& track_id) override;
AudioTrackVector GetAudioTracks() override { return audio_tracks_; }
VideoTrackVector GetVideoTracks() override { return video_tracks_; }
protected:
explicit MediaStream(const std::string& label);
private:
template <typename TrackVector, typename Track>
bool AddTrack(TrackVector* Tracks, Track* track);
template <typename TrackVector>
bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track);
std::string label_;
AudioTrackVector audio_tracks_;
VideoTrackVector video_tracks_;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/mediastream.h"
#endif // WEBRTC_API_MEDIASTREAM_H_

View file

@ -0,0 +1,18 @@
/*
* Copyright 2017 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.
*/
#include "webrtc/api/mediastreaminterface.h"
namespace webrtc {
const char MediaStreamTrackInterface::kVideoKind[] = "video";
const char MediaStreamTrackInterface::kAudioKind[] = "audio";
} // namespace webrtc

View file

@ -11,52 +11,8 @@
#ifndef WEBRTC_API_MEDIASTREAMTRACK_H_
#define WEBRTC_API_MEDIASTREAMTRACK_H_
#include <string>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
namespace webrtc {
// MediaTrack implements the interface common to AudioTrackInterface and
// VideoTrackInterface.
template <typename T>
class MediaStreamTrack : public Notifier<T> {
public:
typedef typename T::TrackState TypedTrackState;
std::string id() const override { return id_; }
MediaStreamTrackInterface::TrackState state() const override {
return state_;
}
bool enabled() const override { return enabled_; }
bool set_enabled(bool enable) override {
bool fire_on_change = (enable != enabled_);
enabled_ = enable;
if (fire_on_change) {
Notifier<T>::FireOnChanged();
}
return fire_on_change;
}
protected:
explicit MediaStreamTrack(const std::string& id)
: enabled_(true), id_(id), state_(MediaStreamTrackInterface::kLive) {}
bool set_state(MediaStreamTrackInterface::TrackState new_state) {
bool fire_on_change = (state_ != new_state);
state_ = new_state;
if (fire_on_change)
Notifier<T>::FireOnChanged();
return true;
}
private:
bool enabled_;
std::string id_;
MediaStreamTrackInterface::TrackState state_;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/mediastreamtrack.h"
#endif // WEBRTC_API_MEDIASTREAMTRACK_H_

35
webrtc/api/mediatypes.cc Normal file
View file

@ -0,0 +1,35 @@
/*
* Copyright 2016 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.
*/
#include "webrtc/api/mediatypes.h"
#include "webrtc/base/checks.h"
namespace cricket {
std::string MediaTypeToString(MediaType type) {
std::string type_str;
switch (type) {
case MEDIA_TYPE_AUDIO:
type_str = "audio";
break;
case MEDIA_TYPE_VIDEO:
type_str = "video";
break;
case MEDIA_TYPE_DATA:
type_str = "data";
break;
default:
RTC_NOTREACHED();
break;
}
return type_str;
}
} // namespace cricket

28
webrtc/api/mediatypes.h Normal file
View file

@ -0,0 +1,28 @@
/*
* Copyright 2016 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.
*/
#ifndef WEBRTC_API_MEDIATYPES_H_
#define WEBRTC_API_MEDIATYPES_H_
#include <string>
namespace cricket {
enum MediaType {
MEDIA_TYPE_AUDIO,
MEDIA_TYPE_VIDEO,
MEDIA_TYPE_DATA
};
std::string MediaTypeToString(MediaType type);
} // namespace cricket
#endif // WEBRTC_API_MEDIATYPES_H_

View file

@ -61,7 +61,7 @@
#include "webrtc/api/dtmfsenderinterface.h"
#include "webrtc/api/jsep.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/rtcstatscollector.h"
#include "webrtc/api/stats/rtcstatscollectorcallback.h"
#include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/api/rtpsenderinterface.h"
#include "webrtc/api/statstypes.h"

View file

@ -16,12 +16,12 @@
#include <string>
#include "webrtc/api/mediatypes.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/proxy.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/base/refcount.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/pc/mediasession.h"
namespace webrtc {

View file

@ -8,228 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
// This file contains classes that implement RtpSenderInterface.
// An RtpSender associates a MediaStreamTrackInterface with an underlying
// transport (provided by AudioProviderInterface/VideoProviderInterface)
#ifndef WEBRTC_API_RTPSENDER_H_
#define WEBRTC_API_RTPSENDER_H_
#include <memory>
#include <string>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/rtpsenderinterface.h"
#include "webrtc/api/statscollector.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/media/base/audiosource.h"
#include "webrtc/pc/channel.h"
namespace webrtc {
// Internal interface used by PeerConnection.
class RtpSenderInternal : public RtpSenderInterface {
public:
// Used to set the SSRC of the sender, once a local description has been set.
// If |ssrc| is 0, this indiates that the sender should disconnect from the
// underlying transport (this occurs if the sender isn't seen in a local
// description).
virtual void SetSsrc(uint32_t ssrc) = 0;
// TODO(deadbeef): Support one sender having multiple stream ids.
virtual void set_stream_id(const std::string& stream_id) = 0;
virtual std::string stream_id() const = 0;
virtual void Stop() = 0;
};
// LocalAudioSinkAdapter receives data callback as a sink to the local
// AudioTrack, and passes the data to the sink of AudioSource.
class LocalAudioSinkAdapter : public AudioTrackSinkInterface,
public cricket::AudioSource {
public:
LocalAudioSinkAdapter();
virtual ~LocalAudioSinkAdapter();
private:
// AudioSinkInterface implementation.
void OnData(const void* audio_data,
int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames) override;
// cricket::AudioSource implementation.
void SetSink(cricket::AudioSource::Sink* sink) override;
cricket::AudioSource::Sink* sink_;
// Critical section protecting |sink_|.
rtc::CriticalSection lock_;
};
class AudioRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInternal> {
public:
// StatsCollector provided so that Add/RemoveLocalAudioTrack can be called
// at the appropriate times.
// |channel| can be null if one does not exist yet.
AudioRtpSender(AudioTrackInterface* track,
const std::string& stream_id,
cricket::VoiceChannel* channel,
StatsCollector* stats);
// Randomly generates stream_id.
// |channel| can be null if one does not exist yet.
AudioRtpSender(AudioTrackInterface* track,
cricket::VoiceChannel* channel,
StatsCollector* stats);
// Randomly generates id and stream_id.
// |channel| can be null if one does not exist yet.
AudioRtpSender(cricket::VoiceChannel* channel, StatsCollector* stats);
virtual ~AudioRtpSender();
// ObserverInterface implementation
void OnChanged() override;
// RtpSenderInterface implementation
bool SetTrack(MediaStreamTrackInterface* track) override;
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
return track_;
}
uint32_t ssrc() const override { return ssrc_; }
cricket::MediaType media_type() const override {
return cricket::MEDIA_TYPE_AUDIO;
}
std::string id() const override { return id_; }
std::vector<std::string> stream_ids() const override {
std::vector<std::string> ret = {stream_id_};
return ret;
}
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
// RtpSenderInternal implementation.
void SetSsrc(uint32_t ssrc) override;
void set_stream_id(const std::string& stream_id) override {
stream_id_ = stream_id;
}
std::string stream_id() const override { return stream_id_; }
void Stop() override;
// Does not take ownership.
// Should call SetChannel(nullptr) before |channel| is destroyed.
void SetChannel(cricket::VoiceChannel* channel) { channel_ = channel; }
private:
// TODO(nisse): Since SSRC == 0 is technically valid, figure out
// some other way to test if we have a valid SSRC.
bool can_send_track() const { return track_ && ssrc_; }
// Helper function to construct options for
// AudioProviderInterface::SetAudioSend.
void SetAudioSend();
// Helper function to call SetAudioSend with "stop sending" parameters.
void ClearAudioSend();
std::string id_;
std::string stream_id_;
cricket::VoiceChannel* channel_ = nullptr;
StatsCollector* stats_;
rtc::scoped_refptr<AudioTrackInterface> track_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
bool stopped_ = false;
// Used to pass the data callback from the |track_| to the other end of
// cricket::AudioSource.
std::unique_ptr<LocalAudioSinkAdapter> sink_adapter_;
};
class VideoRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInternal> {
public:
// |channel| can be null if one does not exist yet.
VideoRtpSender(VideoTrackInterface* track,
const std::string& stream_id,
cricket::VideoChannel* channel);
// Randomly generates stream_id.
// |channel| can be null if one does not exist yet.
VideoRtpSender(VideoTrackInterface* track, cricket::VideoChannel* channel);
// Randomly generates id and stream_id.
// |channel| can be null if one does not exist yet.
explicit VideoRtpSender(cricket::VideoChannel* channel);
virtual ~VideoRtpSender();
// ObserverInterface implementation
void OnChanged() override;
// RtpSenderInterface implementation
bool SetTrack(MediaStreamTrackInterface* track) override;
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
return track_;
}
uint32_t ssrc() const override { return ssrc_; }
cricket::MediaType media_type() const override {
return cricket::MEDIA_TYPE_VIDEO;
}
std::string id() const override { return id_; }
std::vector<std::string> stream_ids() const override {
std::vector<std::string> ret = {stream_id_};
return ret;
}
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
// RtpSenderInternal implementation.
void SetSsrc(uint32_t ssrc) override;
void set_stream_id(const std::string& stream_id) override {
stream_id_ = stream_id;
}
std::string stream_id() const override { return stream_id_; }
void Stop() override;
// Does not take ownership.
// Should call SetChannel(nullptr) before |channel| is destroyed.
void SetChannel(cricket::VideoChannel* channel) { channel_ = channel; }
private:
bool can_send_track() const { return track_ && ssrc_; }
// Helper function to construct options for
// VideoProviderInterface::SetVideoSend.
void SetVideoSend();
// Helper function to call SetVideoSend with "stop sending" parameters.
void ClearVideoSend();
std::string id_;
std::string stream_id_;
cricket::VideoChannel* channel_ = nullptr;
rtc::scoped_refptr<VideoTrackInterface> track_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
VideoTrackInterface::ContentHint cached_track_content_hint_ =
VideoTrackInterface::ContentHint::kNone;
bool stopped_ = false;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/rtpsender.h"
#endif // WEBRTC_API_RTPSENDER_H_

View file

@ -17,12 +17,12 @@
#include <string>
#include <vector>
#include "webrtc/api/mediatypes.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/proxy.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/base/refcount.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/pc/mediasession.h"
namespace webrtc {

View file

@ -0,0 +1,30 @@
/*
* Copyright 2016 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.
*/
#ifndef WEBRTC_API_STATS_RTCSTATSCOLLECTORCALLBACK_H_
#define WEBRTC_API_STATS_RTCSTATSCOLLECTORCALLBACK_H_
#include "webrtc/api/stats/rtcstatsreport.h"
#include "webrtc/base/refcount.h"
#include "webrtc/base/scoped_ref_ptr.h"
namespace webrtc {
class RTCStatsCollectorCallback : public virtual rtc::RefCountInterface {
public:
virtual ~RTCStatsCollectorCallback() {}
virtual void OnStatsDelivered(
const rtc::scoped_refptr<const RTCStatsReport>& report) = 0;
};
} // namespace webrtc
#endif // WEBRTC_API_STATS_RTCSTATSCOLLECTORCALLBACK_H_

View file

@ -632,6 +632,8 @@ StatsReport::StatsReport(const Id& id) : id_(id), timestamp_(0.0) {
RTC_DCHECK(id_.get());
}
StatsReport::~StatsReport() = default;
// static
StatsReport::Id StatsReport::NewBandwidthEstimationId() {
return Id(new RefCountedObject<BandwidthEstimationId>());

View file

@ -342,6 +342,7 @@ class StatsReport {
// Ownership of |id| is passed to |this|.
explicit StatsReport(const Id& id);
~StatsReport();
// Factory functions for various types of stats IDs.
static Id NewBandwidthEstimationId();

View file

@ -11,98 +11,8 @@
#ifndef WEBRTC_API_STREAMCOLLECTION_H_
#define WEBRTC_API_STREAMCOLLECTION_H_
#include <string>
#include <vector>
#include "webrtc/api/peerconnectioninterface.h"
namespace webrtc {
// Implementation of StreamCollection.
class StreamCollection : public StreamCollectionInterface {
public:
static rtc::scoped_refptr<StreamCollection> Create() {
rtc::RefCountedObject<StreamCollection>* implementation =
new rtc::RefCountedObject<StreamCollection>();
return implementation;
}
static rtc::scoped_refptr<StreamCollection> Create(
StreamCollection* streams) {
rtc::RefCountedObject<StreamCollection>* implementation =
new rtc::RefCountedObject<StreamCollection>(streams);
return implementation;
}
virtual size_t count() {
return media_streams_.size();
}
virtual MediaStreamInterface* at(size_t index) {
return media_streams_.at(index);
}
virtual MediaStreamInterface* find(const std::string& label) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(label) == 0) {
return (*it);
}
}
return NULL;
}
virtual MediaStreamTrackInterface* FindAudioTrack(
const std::string& id) {
for (size_t i = 0; i < media_streams_.size(); ++i) {
MediaStreamTrackInterface* track = media_streams_[i]->FindAudioTrack(id);
if (track) {
return track;
}
}
return NULL;
}
virtual MediaStreamTrackInterface* FindVideoTrack(
const std::string& id) {
for (size_t i = 0; i < media_streams_.size(); ++i) {
MediaStreamTrackInterface* track = media_streams_[i]->FindVideoTrack(id);
if (track) {
return track;
}
}
return NULL;
}
void AddStream(MediaStreamInterface* stream) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(stream->label()) == 0)
return;
}
media_streams_.push_back(stream);
}
void RemoveStream(MediaStreamInterface* remove_stream) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(remove_stream->label()) == 0) {
media_streams_.erase(it);
break;
}
}
}
protected:
StreamCollection() {}
explicit StreamCollection(StreamCollection* original)
: media_streams_(original->media_streams_) {
}
typedef std::vector<rtc::scoped_refptr<MediaStreamInterface> >
StreamVector;
StreamVector media_streams_;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/streamcollection.h"
#endif // WEBRTC_API_STREAMCOLLECTION_H_

View file

@ -11,45 +11,8 @@
#ifndef WEBRTC_API_VIDEOTRACKSOURCE_H_
#define WEBRTC_API_VIDEOTRACKSOURCE_H_
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/media/base/videosinkinterface.h"
// VideoTrackSource implements VideoTrackSourceInterface.
namespace webrtc {
class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
public:
VideoTrackSource(rtc::VideoSourceInterface<VideoFrame>* source, bool remote);
void SetState(SourceState new_state);
// OnSourceDestroyed clears this instance pointer to |source_|. It is useful
// when the underlying rtc::VideoSourceInterface is destroyed before the
// reference counted VideoTrackSource.
void OnSourceDestroyed();
SourceState state() const override { return state_; }
bool remote() const override { return remote_; }
bool is_screencast() const override { return false; }
rtc::Optional<bool> needs_denoising() const override {
return rtc::Optional<bool>(); }
bool GetStats(Stats* stats) override { return false; }
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override;
void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override;
private:
rtc::ThreadChecker worker_thread_checker_;
rtc::VideoSourceInterface<VideoFrame>* source_;
cricket::VideoOptions options_;
SourceState state_;
const bool remote_;
};
} // namespace webrtc
// Including this file is deprecated. It is no longer part of the public API.
// This only includes the file in its new location for backwards compatibility.
#include "webrtc/pc/videotracksource.h"
#endif // WEBRTC_API_VIDEOTRACKSOURCE_H_

View file

@ -52,7 +52,7 @@
"type": "windowed_test_launcher",
},
"peerconnection_unittests": {
"label": "//webrtc/api:peerconnection_unittests",
"label": "//webrtc/pc:peerconnection_unittests",
"type": "console_test_launcher",
},
"rtc_media_unittests": {

View file

@ -505,7 +505,7 @@ if (is_linux || is_win) {
}
deps = [
"//third_party/libyuv",
"//webrtc/api:libjingle_peerconnection",
"//webrtc/pc:libjingle_peerconnection",
"//webrtc/system_wrappers:field_trial_default",
"//webrtc/system_wrappers:metrics_default",
]

View file

@ -6,4 +6,5 @@ include_rules = [
"+webrtc/modules/audio_device",
"+webrtc/modules/video_capture",
"+webrtc/p2p",
"+webrtc/pc",
]

View file

@ -12,13 +12,6 @@
#include <memory>
#include "webrtc/api/fakemetricsobserver.h"
#include "webrtc/p2p/base/fakeportallocator.h"
#include "webrtc/p2p/base/packettransportinterface.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"
#include "webrtc/p2p/base/testrelayserver.h"
#include "webrtc/p2p/base/teststunserver.h"
#include "webrtc/p2p/base/testturnserver.h"
#include "webrtc/p2p/client/basicportallocator.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/dscp.h"
#include "webrtc/base/fakeclock.h"
@ -36,6 +29,13 @@
#include "webrtc/base/thread.h"
#include "webrtc/base/virtualsocketserver.h"
#include "webrtc/p2p/base/icetransportinternal.h"
#include "webrtc/p2p/base/fakeportallocator.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"
#include "webrtc/p2p/base/packettransportinterface.h"
#include "webrtc/p2p/base/testrelayserver.h"
#include "webrtc/p2p/base/teststunserver.h"
#include "webrtc/p2p/base/testturnserver.h"
#include "webrtc/p2p/client/basicportallocator.h"
namespace {

View file

@ -7,6 +7,10 @@
# be found in the AUTHORS file in the root of the source tree.
import("../build/webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
group("pc") {
public_deps = [
@ -69,6 +73,100 @@ rtc_static_library("rtc_pc") {
}
}
config("libjingle_peerconnection_warnings_config") {
# GN orders flags on a target before flags from configs. The default config
# adds these flags so to cancel them out they need to come from a config and
# cannot be on the target directly.
if (!is_win && !is_clang) {
cflags = [ "-Wno-maybe-uninitialized" ] # Only exists for GCC.
}
}
rtc_static_library("libjingle_peerconnection") {
check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
cflags = []
sources = [
"audiotrack.cc",
"audiotrack.h",
"datachannel.cc",
"datachannel.h",
"dtmfsender.cc",
"dtmfsender.h",
"jsepicecandidate.cc",
"jsepsessiondescription.cc",
"localaudiosource.cc",
"localaudiosource.h",
"mediacontroller.cc",
"mediacontroller.h",
"mediastream.cc",
"mediastream.h",
"mediastreamobserver.cc",
"mediastreamobserver.h",
"mediastreamtrack.h",
"ortcfactory.cc",
"ortcfactory.h",
"peerconnection.cc",
"peerconnection.h",
"peerconnectionfactory.cc",
"peerconnectionfactory.h",
"remoteaudiosource.cc",
"remoteaudiosource.h",
"rtcstatscollector.cc",
"rtcstatscollector.h",
"rtpreceiver.cc",
"rtpreceiver.h",
"rtpsender.cc",
"rtpsender.h",
"sctputils.cc",
"sctputils.h",
"statscollector.cc",
"statscollector.h",
"streamcollection.h",
"videocapturertracksource.cc",
"videocapturertracksource.h",
"videotrack.cc",
"videotrack.h",
"videotracksource.cc",
"videotracksource.h",
"webrtcsdp.cc",
"webrtcsdp.h",
"webrtcsession.cc",
"webrtcsession.h",
"webrtcsessiondescriptionfactory.cc",
"webrtcsessiondescriptionfactory.h",
]
configs += [ ":libjingle_peerconnection_warnings_config" ]
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 = [
":rtc_pc",
"../api:call_api",
"../api:libjingle_peerconnection_api",
"../api:rtc_stats_api",
"../call",
"../media",
"../stats",
]
if (rtc_use_quic) {
sources += [
"quicdatachannel.cc",
"quicdatachannel.h",
"quicdatatransport.cc",
"quicdatatransport.h",
]
deps += [ "//third_party/libquic" ]
public_deps = [
"//third_party/libquic",
]
}
}
if (rtc_include_tests) {
config("rtc_pc_unittests_config") {
# GN orders flags on a target before flags from configs. The default config
@ -106,8 +204,8 @@ if (rtc_include_tests) {
}
deps = [
":libjingle_peerconnection",
":rtc_pc",
"../api:libjingle_peerconnection",
"../base:rtc_base_tests_utils",
"../media:rtc_unittest_main",
"../system_wrappers:metrics_default",
@ -121,4 +219,130 @@ if (rtc_include_tests) {
deps += [ "//testing/android/native_test:native_test_support" ]
}
}
config("peerconnection_unittests_config") {
# The warnings below are enabled by default. Since GN orders compiler flags
# for a target before flags from configs, the only way to disable such
# warnings is by having them in a separate config, loaded from the target.
# TODO(kjellander): Make the code compile without disabling these flags.
# See https://bugs.webrtc.org/3307.
if (is_clang && is_win) {
cflags = [
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267
# for -Wno-sign-compare
"-Wno-sign-compare",
"-Wno-unused-function",
]
}
if (!is_win) {
cflags = [ "-Wno-sign-compare" ]
}
}
rtc_test("peerconnection_unittests") {
check_includes = false # TODO(kjellander): Remove (bugs.webrtc.org/6828)
testonly = true
sources = [
"datachannel_unittest.cc",
"dtmfsender_unittest.cc",
"fakemediacontroller.h",
"jsepsessiondescription_unittest.cc",
"localaudiosource_unittest.cc",
"mediaconstraintsinterface_unittest.cc",
"mediastream_unittest.cc",
"ortcfactory_unittest.cc",
"peerconnection_unittest.cc",
"peerconnectionendtoend_unittest.cc",
"peerconnectionfactory_unittest.cc",
"peerconnectioninterface_unittest.cc",
"proxy_unittest.cc",
"rtcstats_integrationtest.cc",
"rtcstatscollector_unittest.cc",
"rtpsenderreceiver_unittest.cc",
"sctputils_unittest.cc",
"statscollector_unittest.cc",
"test/fakeaudiocapturemodule.cc",
"test/fakeaudiocapturemodule.h",
"test/fakeaudiocapturemodule_unittest.cc",
"test/fakedatachannelprovider.h",
"test/fakeperiodicvideocapturer.h",
"test/fakertccertificategenerator.h",
"test/fakevideotrackrenderer.h",
"test/fakevideotracksource.h",
"test/mock_datachannel.h",
"test/mock_peerconnection.h",
"test/mock_webrtcsession.h",
"test/mockpeerconnectionobservers.h",
"test/peerconnectiontestwrapper.cc",
"test/peerconnectiontestwrapper.h",
"test/rtcstatsobtainer.h",
"test/testsdpstrings.h",
"videocapturertracksource_unittest.cc",
"videotrack_unittest.cc",
"webrtcsdp_unittest.cc",
"webrtcsession_unittest.cc",
]
if (rtc_enable_sctp) {
defines = [ "HAVE_SCTP" ]
}
configs += [ ":peerconnection_unittests_config" ]
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" ]
}
# TODO(jschuh): Bug 1348: fix this warning.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
if (is_win) {
cflags = [
"/wd4245", # conversion from int to size_t, signed/unsigned mismatch.
"/wd4389", # signed/unsigned mismatch.
]
}
if (rtc_use_quic) {
public_deps = [
"//third_party/libquic",
]
sources += [
"quicdatachannel_unittest.cc",
"quicdatatransport_unittest.cc",
]
}
deps = []
if (is_android) {
sources += [
"test/androidtestinitializer.cc",
"test/androidtestinitializer.h",
]
deps += [
"//testing/android/native_test:native_test_support",
"//webrtc/sdk/android:libjingle_peerconnection_java",
"//webrtc/sdk/android:libjingle_peerconnection_jni",
]
}
deps += [
":libjingle_peerconnection",
"..:webrtc_common",
"../api:fakemetricsobserver",
"../base:rtc_base_tests_utils",
"../media:rtc_unittest_main",
"../pc:rtc_pc",
"../system_wrappers:metrics_default",
"//testing/gmock",
]
if (is_android) {
deps += [ "//testing/android/native_test:native_test_support" ]
shard_timeout = 900
}
}
}

View file

@ -1,15 +1,29 @@
include_rules = [
"+third_party/libsrtp"
"+webrtc/api",
"+webrtc/base",
"+webrtc/call",
"+webrtc/common_video/h264",
"+webrtc/logging/rtc_event_log",
"+webrtc/logging/rtc_event_log",
"+webrtc/media",
"+webrtc/modules/audio_device",
"+webrtc/modules/rtp_rtcp",
"+webrtc/modules/video_coding",
"+webrtc/modules/video_render",
"+webrtc/p2p",
"+third_party/libsrtp"
"+webrtc/system_wrappers",
]
specific_include_rules = {
"androidtestinitializer\.cc": [
"+base/android", # Allowed only for Android tests.
"+webrtc/voice_engine",
],
"srtpfilter_unittest\.cc": [
"+crypto",
],
"peerconnectionfactory\.cc": [
"+webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h",
],
}

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/audiotrack.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/base/checks.h"
@ -16,8 +16,6 @@ using rtc::scoped_refptr;
namespace webrtc {
const char MediaStreamTrackInterface::kAudioKind[] = "audio";
// static
scoped_refptr<AudioTrack> AudioTrack::Create(
const std::string& id,

View file

@ -8,17 +8,17 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_AUDIOTRACK_H_
#define WEBRTC_API_AUDIOTRACK_H_
#ifndef WEBRTC_PC_AUDIOTRACK_H_
#define WEBRTC_PC_AUDIOTRACK_H_
#include <string>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/mediastreamtrack.h"
#include "webrtc/api/notifier.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/pc/mediastreamtrack.h"
namespace webrtc {
@ -56,4 +56,4 @@ class AudioTrack : public MediaStreamTrack<AudioTrackInterface>,
} // namespace webrtc
#endif // WEBRTC_API_AUDIOTRACK_H_
#endif // WEBRTC_PC_AUDIOTRACK_H_

View file

@ -12,7 +12,6 @@
#include <algorithm>
#include "webrtc/api/mediacontroller.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/common.h"
@ -23,6 +22,7 @@
#include "webrtc/media/base/device.h"
#include "webrtc/media/base/rtpdataengine.h"
#include "webrtc/pc/srtpfilter.h"
#include "webrtc/pc/mediacontroller.h"
namespace cricket {

View file

@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/fakemediacontroller.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/thread.h"
@ -19,6 +18,7 @@
#include "webrtc/media/engine/fakewebrtccall.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/fakemediacontroller.h"
namespace cricket {
const bool kDefaultRtcpMuxRequired = true;

View file

@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/datachannel.h"
#include "webrtc/pc/datachannel.h"
#include <memory>
#include <string>
#include "webrtc/api/sctputils.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/refcount.h"
#include "webrtc/media/sctp/sctptransportinternal.h"
#include "webrtc/pc/sctputils.h"
namespace webrtc {

298
webrtc/pc/datachannel.h Normal file
View file

@ -0,0 +1,298 @@
/*
* Copyright 2012 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.
*/
#ifndef WEBRTC_PC_DATACHANNEL_H_
#define WEBRTC_PC_DATACHANNEL_H_
#include <deque>
#include <set>
#include <string>
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/api/proxy.h"
#include "webrtc/base/messagehandler.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/pc/channel.h"
namespace webrtc {
class DataChannel;
class DataChannelProviderInterface {
public:
// Sends the data to the transport.
virtual bool SendData(const cricket::SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
cricket::SendDataResult* result) = 0;
// Connects to the transport signals.
virtual bool ConnectDataChannel(DataChannel* data_channel) = 0;
// Disconnects from the transport signals.
virtual void DisconnectDataChannel(DataChannel* data_channel) = 0;
// Adds the data channel SID to the transport for SCTP.
virtual void AddSctpDataStream(int sid) = 0;
// Removes the data channel SID from the transport for SCTP.
virtual void RemoveSctpDataStream(int sid) = 0;
// Returns true if the transport channel is ready to send data.
virtual bool ReadyToSendData() const = 0;
protected:
virtual ~DataChannelProviderInterface() {}
};
struct InternalDataChannelInit : public DataChannelInit {
enum OpenHandshakeRole {
kOpener,
kAcker,
kNone
};
// The default role is kOpener because the default |negotiated| is false.
InternalDataChannelInit() : open_handshake_role(kOpener) {}
explicit InternalDataChannelInit(const DataChannelInit& base)
: DataChannelInit(base), open_handshake_role(kOpener) {
// If the channel is externally negotiated, do not send the OPEN message.
if (base.negotiated) {
open_handshake_role = kNone;
}
}
OpenHandshakeRole open_handshake_role;
};
// Helper class to allocate unique IDs for SCTP DataChannels
class SctpSidAllocator {
public:
// Gets the first unused odd/even id based on the DTLS role. If |role| is
// SSL_CLIENT, the allocated id starts from 0 and takes even numbers;
// otherwise, the id starts from 1 and takes odd numbers.
// Returns false if no id can be allocated.
bool AllocateSid(rtc::SSLRole role, int* sid);
// Attempts to reserve a specific sid. Returns false if it's unavailable.
bool ReserveSid(int sid);
// Indicates that |sid| isn't in use any more, and is thus available again.
void ReleaseSid(int sid);
private:
// Checks if |sid| is available to be assigned to a new SCTP data channel.
bool IsSidAvailable(int sid) const;
std::set<int> used_sids_;
};
// DataChannel is a an implementation of the DataChannelInterface based on
// libjingle's data engine. It provides an implementation of unreliable or
// reliabledata channels. Currently this class is specifically designed to use
// both RtpDataEngine and SctpDataEngine.
// DataChannel states:
// kConnecting: The channel has been created the transport might not yet be
// ready.
// kOpen: The channel have a local SSRC set by a call to UpdateSendSsrc
// and a remote SSRC set by call to UpdateReceiveSsrc and the transport
// has been writable once.
// kClosing: DataChannelInterface::Close has been called or UpdateReceiveSsrc
// has been called with SSRC==0
// kClosed: Both UpdateReceiveSsrc and UpdateSendSsrc has been called with
// SSRC==0.
class DataChannel : public DataChannelInterface,
public sigslot::has_slots<>,
public rtc::MessageHandler {
public:
static rtc::scoped_refptr<DataChannel> Create(
DataChannelProviderInterface* provider,
cricket::DataChannelType dct,
const std::string& label,
const InternalDataChannelInit& config);
virtual void RegisterObserver(DataChannelObserver* observer);
virtual void UnregisterObserver();
virtual std::string label() const { return label_; }
virtual bool reliable() const;
virtual bool ordered() const { return config_.ordered; }
virtual uint16_t maxRetransmitTime() const {
return config_.maxRetransmitTime;
}
virtual uint16_t maxRetransmits() const { return config_.maxRetransmits; }
virtual std::string protocol() const { return config_.protocol; }
virtual bool negotiated() const { return config_.negotiated; }
virtual int id() const { return config_.id; }
virtual uint64_t buffered_amount() const;
virtual void Close();
virtual DataState state() const { return state_; }
virtual uint32_t messages_sent() const { return messages_sent_; }
virtual uint64_t bytes_sent() const { return bytes_sent_; }
virtual uint32_t messages_received() const { return messages_received_; }
virtual uint64_t bytes_received() const { return bytes_received_; }
virtual bool Send(const DataBuffer& buffer);
// rtc::MessageHandler override.
virtual void OnMessage(rtc::Message* msg);
// Called when the channel's ready to use. That can happen when the
// underlying DataMediaChannel becomes ready, or when this channel is a new
// stream on an existing DataMediaChannel, and we've finished negotiation.
void OnChannelReady(bool writable);
// Slots for provider to connect signals to.
void OnDataReceived(const cricket::ReceiveDataParams& params,
const rtc::CopyOnWriteBuffer& payload);
void OnStreamClosedRemotely(int sid);
// The remote peer request that this channel should be closed.
void RemotePeerRequestClose();
// The following methods are for SCTP only.
// Sets the SCTP sid and adds to transport layer if not set yet. Should only
// be called once.
void SetSctpSid(int sid);
// Called when the transport channel is created.
// Only needs to be called for SCTP data channels.
void OnTransportChannelCreated();
// Called when the transport channel is destroyed.
// This method makes sure the DataChannel is disconnected and changes state
// to kClosed.
void OnTransportChannelDestroyed();
// The following methods are for RTP only.
// Set the SSRC this channel should use to send data on the
// underlying data engine. |send_ssrc| == 0 means that the channel is no
// longer part of the session negotiation.
void SetSendSsrc(uint32_t send_ssrc);
// Set the SSRC this channel should use to receive data from the
// underlying data engine.
void SetReceiveSsrc(uint32_t receive_ssrc);
cricket::DataChannelType data_channel_type() const {
return data_channel_type_;
}
// Emitted when state transitions to kOpen.
sigslot::signal1<DataChannel*> SignalOpened;
// Emitted when state transitions to kClosed.
// In the case of SCTP channels, this signal can be used to tell when the
// channel's sid is free.
sigslot::signal1<DataChannel*> SignalClosed;
protected:
DataChannel(DataChannelProviderInterface* client,
cricket::DataChannelType dct,
const std::string& label);
virtual ~DataChannel();
private:
// A packet queue which tracks the total queued bytes. Queued packets are
// owned by this class.
class PacketQueue {
public:
PacketQueue();
~PacketQueue();
size_t byte_count() const {
return byte_count_;
}
bool Empty() const;
DataBuffer* Front();
void Pop();
void Push(DataBuffer* packet);
void Clear();
void Swap(PacketQueue* other);
private:
std::deque<DataBuffer*> packets_;
size_t byte_count_;
};
// The OPEN(_ACK) signaling state.
enum HandshakeState {
kHandshakeInit,
kHandshakeShouldSendOpen,
kHandshakeShouldSendAck,
kHandshakeWaitingForAck,
kHandshakeReady
};
bool Init(const InternalDataChannelInit& config);
void DoClose();
void UpdateState();
void SetState(DataState state);
void DisconnectFromProvider();
void DeliverQueuedReceivedData();
void SendQueuedDataMessages();
bool SendDataMessage(const DataBuffer& buffer, bool queue_if_blocked);
bool QueueSendDataMessage(const DataBuffer& buffer);
void SendQueuedControlMessages();
void QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer);
bool SendControlMessage(const rtc::CopyOnWriteBuffer& buffer);
std::string label_;
InternalDataChannelInit config_;
DataChannelObserver* observer_;
DataState state_;
uint32_t messages_sent_;
uint64_t bytes_sent_;
uint32_t messages_received_;
uint64_t bytes_received_;
cricket::DataChannelType data_channel_type_;
DataChannelProviderInterface* provider_;
HandshakeState handshake_state_;
bool connected_to_provider_;
bool send_ssrc_set_;
bool receive_ssrc_set_;
bool writable_;
uint32_t send_ssrc_;
uint32_t receive_ssrc_;
// Control messages that always have to get sent out before any queued
// data.
PacketQueue queued_control_data_;
PacketQueue queued_received_data_;
PacketQueue queued_send_data_;
};
// Define proxy for DataChannelInterface.
BEGIN_SIGNALING_PROXY_MAP(DataChannel)
PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_METHOD1(void, RegisterObserver, DataChannelObserver*)
PROXY_METHOD0(void, UnregisterObserver)
PROXY_CONSTMETHOD0(std::string, label)
PROXY_CONSTMETHOD0(bool, reliable)
PROXY_CONSTMETHOD0(bool, ordered)
PROXY_CONSTMETHOD0(uint16_t, maxRetransmitTime)
PROXY_CONSTMETHOD0(uint16_t, maxRetransmits)
PROXY_CONSTMETHOD0(std::string, protocol)
PROXY_CONSTMETHOD0(bool, negotiated)
PROXY_CONSTMETHOD0(int, id)
PROXY_CONSTMETHOD0(DataState, state)
PROXY_CONSTMETHOD0(uint32_t, messages_sent)
PROXY_CONSTMETHOD0(uint64_t, bytes_sent)
PROXY_CONSTMETHOD0(uint32_t, messages_received)
PROXY_CONSTMETHOD0(uint64_t, bytes_received)
PROXY_CONSTMETHOD0(uint64_t, buffered_amount)
PROXY_METHOD0(void, Close)
PROXY_METHOD1(bool, Send, const DataBuffer&)
END_PROXY_MAP()
} // namespace webrtc
#endif // WEBRTC_PC_DATACHANNEL_H_

View file

@ -10,10 +10,10 @@
#include <memory>
#include "webrtc/api/datachannel.h"
#include "webrtc/api/sctputils.h"
#include "webrtc/api/test/fakedatachannelprovider.h"
#include "webrtc/base/gunit.h"
#include "webrtc/pc/datachannel.h"
#include "webrtc/pc/sctputils.h"
#include "webrtc/pc/test/fakedatachannelprovider.h"
using webrtc::DataChannel;
using webrtc::SctpSidAllocator;

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/dtmfsender.h"
#include "webrtc/pc/dtmfsender.h"
#include <ctype.h>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_DTMFSENDER_H_
#define WEBRTC_API_DTMFSENDER_H_
#ifndef WEBRTC_PC_DTMFSENDER_H_
#define WEBRTC_PC_DTMFSENDER_H_
#include <string>
@ -121,4 +121,4 @@ bool GetDtmfCode(char tone, int* code);
} // namespace webrtc
#endif // WEBRTC_API_DTMFSENDER_H_
#endif // WEBRTC_PC_DTMFSENDER_H_

View file

@ -8,18 +8,18 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/dtmfsender.h"
#include "webrtc/pc/dtmfsender.h"
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "webrtc/api/audiotrack.h"
#include "webrtc/base/fakeclock.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/pc/audiotrack.h"
using webrtc::AudioTrackInterface;
using webrtc::AudioTrack;

View file

@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_FAKEMEDIACONTROLLER_H_
#define WEBRTC_API_FAKEMEDIACONTROLLER_H_
#ifndef WEBRTC_PC_FAKEMEDIACONTROLLER_H_
#define WEBRTC_PC_FAKEMEDIACONTROLLER_H_
#include "webrtc/api/mediacontroller.h"
#include "webrtc/base/checks.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/pc/mediacontroller.h"
namespace cricket {
@ -39,4 +39,4 @@ class FakeMediaController : public webrtc::MediaControllerInterface {
webrtc::Call* call_;
};
} // namespace cricket
#endif // WEBRTC_API_FAKEMEDIACONTROLLER_H_
#endif // WEBRTC_PC_FAKEMEDIACONTROLLER_H_

View file

@ -12,8 +12,8 @@
#include <vector>
#include "webrtc/api/webrtcsdp.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/pc/webrtcsdp.h"
namespace webrtc {

View file

@ -12,10 +12,10 @@
#include <memory>
#include "webrtc/api/webrtcsdp.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/pc/mediasession.h"
#include "webrtc/pc/webrtcsdp.h"
using cricket::SessionDescription;

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/localaudiosource.h"
#include "webrtc/pc/localaudiosource.h"
#include <vector>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_LOCALAUDIOSOURCE_H_
#define WEBRTC_API_LOCALAUDIOSOURCE_H_
#ifndef WEBRTC_PC_LOCALAUDIOSOURCE_H_
#define WEBRTC_PC_LOCALAUDIOSOURCE_H_
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
@ -57,4 +57,4 @@ class LocalAudioSource : public Notifier<AudioSourceInterface> {
} // namespace webrtc
#endif // WEBRTC_API_LOCALAUDIOSOURCE_H_
#endif // WEBRTC_PC_LOCALAUDIOSOURCE_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/localaudiosource.h"
#include "webrtc/pc/localaudiosource.h"
#include <string>
#include <vector>

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/mediacontroller.h"
#include "webrtc/pc/mediacontroller.h"
#include <memory>

View file

@ -0,0 +1,44 @@
/*
* Copyright 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.
*/
#ifndef WEBRTC_PC_MEDIACONTROLLER_H_
#define WEBRTC_PC_MEDIACONTROLLER_H_
#include "webrtc/base/thread.h"
namespace cricket {
class ChannelManager;
struct MediaConfig;
} // namespace cricket
namespace webrtc {
class Call;
class VoiceEngine;
class RtcEventLog;
// The MediaController currently owns shared state between media channels, but
// in the future will create and own RtpSenders and RtpReceivers.
class MediaControllerInterface {
public:
static MediaControllerInterface* Create(
const cricket::MediaConfig& config,
rtc::Thread* worker_thread,
cricket::ChannelManager* channel_manager,
webrtc::RtcEventLog* event_log);
virtual ~MediaControllerInterface() {}
virtual void Close() = 0;
virtual webrtc::Call* call_w() = 0;
virtual cricket::ChannelManager* channel_manager() const = 0;
virtual const cricket::MediaConfig& config() const = 0;
};
} // namespace webrtc
#endif // WEBRTC_PC_MEDIACONTROLLER_H_

View file

@ -1193,25 +1193,6 @@ static bool IsDtlsActive(
return current_tdesc->secure();
}
std::string MediaTypeToString(MediaType type) {
std::string type_str;
switch (type) {
case MEDIA_TYPE_AUDIO:
type_str = "audio";
break;
case MEDIA_TYPE_VIDEO:
type_str = "video";
break;
case MEDIA_TYPE_DATA:
type_str = "data";
break;
default:
RTC_NOTREACHED();
break;
}
return type_str;
}
std::string MediaContentDirectionToString(MediaContentDirection direction) {
std::string dir_str;
switch (direction) {

View file

@ -18,6 +18,7 @@
#include <string>
#include <vector>
#include "webrtc/api/mediatypes.h"
#include "webrtc/media/base/codec.h"
#include "webrtc/media/base/cryptoparams.h"
#include "webrtc/media/base/mediachannel.h"
@ -37,14 +38,6 @@ typedef std::vector<DataCodec> DataCodecs;
typedef std::vector<CryptoParams> CryptoParamsVec;
typedef std::vector<webrtc::RtpExtension> RtpHeaderExtensions;
enum MediaType {
MEDIA_TYPE_AUDIO,
MEDIA_TYPE_VIDEO,
MEDIA_TYPE_DATA
};
std::string MediaTypeToString(MediaType type);
enum MediaContentDirection {
MD_INACTIVE,
MD_SENDONLY,

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/mediastream.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"

58
webrtc/pc/mediastream.h Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright 2011 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 the implementation of MediaStreamInterface interface.
#ifndef WEBRTC_PC_MEDIASTREAM_H_
#define WEBRTC_PC_MEDIASTREAM_H_
#include <string>
#include <vector>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
namespace webrtc {
class MediaStream : public Notifier<MediaStreamInterface> {
public:
static rtc::scoped_refptr<MediaStream> Create(const std::string& label);
std::string label() const override { return label_; }
bool AddTrack(AudioTrackInterface* track) override;
bool AddTrack(VideoTrackInterface* track) override;
bool RemoveTrack(AudioTrackInterface* track) override;
bool RemoveTrack(VideoTrackInterface* track) override;
rtc::scoped_refptr<AudioTrackInterface>
FindAudioTrack(const std::string& track_id) override;
rtc::scoped_refptr<VideoTrackInterface>
FindVideoTrack(const std::string& track_id) override;
AudioTrackVector GetAudioTracks() override { return audio_tracks_; }
VideoTrackVector GetVideoTracks() override { return video_tracks_; }
protected:
explicit MediaStream(const std::string& label);
private:
template <typename TrackVector, typename Track>
bool AddTrack(TrackVector* Tracks, Track* track);
template <typename TrackVector>
bool RemoveTrack(TrackVector* Tracks, MediaStreamTrackInterface* track);
std::string label_;
AudioTrackVector audio_tracks_;
VideoTrackVector video_tracks_;
};
} // namespace webrtc
#endif // WEBRTC_PC_MEDIASTREAM_H_

View file

@ -10,14 +10,14 @@
#include <string>
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/test/fakevideotracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/refcount.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/test/fakevideotracksource.h"
#include "webrtc/pc/videotrack.h"
static const char kStreamLabel1[] = "local_stream_1";
static const char kVideoTrackId[] = "dummy_video_cam_1";

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/mediastreamobserver.h"
#include "webrtc/pc/mediastreamobserver.h"
#include <algorithm>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_MEDIASTREAMOBSERVER_H_
#define WEBRTC_API_MEDIASTREAMOBSERVER_H_
#ifndef WEBRTC_PC_MEDIASTREAMOBSERVER_H_
#define WEBRTC_PC_MEDIASTREAMOBSERVER_H_
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/base/scoped_ref_ptr.h"
@ -45,4 +45,4 @@ class MediaStreamObserver : public ObserverInterface {
} // namespace webrtc
#endif // WEBRTC_API_MEDIASTREAMOBSERVER_H_
#endif // WEBRTC_PC_MEDIASTREAMOBSERVER_H_

View file

@ -0,0 +1,62 @@
/*
* Copyright 2011 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.
*/
#ifndef WEBRTC_PC_MEDIASTREAMTRACK_H_
#define WEBRTC_PC_MEDIASTREAMTRACK_H_
#include <string>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/notifier.h"
namespace webrtc {
// MediaTrack implements the interface common to AudioTrackInterface and
// VideoTrackInterface.
template <typename T>
class MediaStreamTrack : public Notifier<T> {
public:
typedef typename T::TrackState TypedTrackState;
std::string id() const override { return id_; }
MediaStreamTrackInterface::TrackState state() const override {
return state_;
}
bool enabled() const override { return enabled_; }
bool set_enabled(bool enable) override {
bool fire_on_change = (enable != enabled_);
enabled_ = enable;
if (fire_on_change) {
Notifier<T>::FireOnChanged();
}
return fire_on_change;
}
protected:
explicit MediaStreamTrack(const std::string& id)
: enabled_(true), id_(id), state_(MediaStreamTrackInterface::kLive) {}
bool set_state(MediaStreamTrackInterface::TrackState new_state) {
bool fire_on_change = (state_ != new_state);
state_ = new_state;
if (fire_on_change)
Notifier<T>::FireOnChanged();
return true;
}
private:
bool enabled_;
std::string id_;
MediaStreamTrackInterface::TrackState state_;
};
} // namespace webrtc
#endif // WEBRTC_PC_MEDIASTREAMTRACK_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/ortcfactory.h"
#include "webrtc/pc/ortcfactory.h"
#include <string>
#include <utility> // For std::move.

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_ORTCFACTORY_H_
#define WEBRTC_API_ORTCFACTORY_H_
#ifndef WEBRTC_PC_ORTCFACTORY_H_
#define WEBRTC_PC_ORTCFACTORY_H_
#include <memory>
@ -61,4 +61,4 @@ END_PROXY_MAP()
} // namespace webrtc
#endif // WEBRTC_API_ORTCFACTORY_H_
#endif // WEBRTC_PC_ORTCFACTORY_H_

View file

@ -8,28 +8,18 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/peerconnection.h"
#include "webrtc/pc/peerconnection.h"
#include <algorithm>
#include <cctype> // for isdigit
#include <utility>
#include <vector>
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/dtmfsender.h"
#include "webrtc/api/jsepicecandidate.h"
#include "webrtc/api/jsepsessiondescription.h"
#include "webrtc/api/mediaconstraintsinterface.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/mediastreamobserver.h"
#include "webrtc/api/mediastreamproxy.h"
#include "webrtc/api/mediastreamtrackproxy.h"
#include "webrtc/api/remoteaudiosource.h"
#include "webrtc/api/rtpreceiver.h"
#include "webrtc/api/rtpsender.h"
#include "webrtc/api/streamcollection.h"
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/arraysize.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
@ -40,7 +30,18 @@
#include "webrtc/call/call.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/media/sctp/sctptransport.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/dtmfsender.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/mediastreamobserver.h"
#include "webrtc/pc/remoteaudiosource.h"
#include "webrtc/pc/rtpreceiver.h"
#include "webrtc/pc/rtpsender.h"
#include "webrtc/pc/streamcollection.h"
#include "webrtc/pc/videocapturertracksource.h"
#include "webrtc/pc/videotrack.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/field_trial.h"
namespace {

View file

@ -8,22 +8,22 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_PEERCONNECTION_H_
#define WEBRTC_API_PEERCONNECTION_H_
#ifndef WEBRTC_PC_PEERCONNECTION_H_
#define WEBRTC_PC_PEERCONNECTION_H_
#include <string>
#include <map>
#include <memory>
#include <vector>
#include "webrtc/api/peerconnectionfactory.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/rtcstatscollector.h"
#include "webrtc/api/rtpreceiver.h"
#include "webrtc/api/rtpsender.h"
#include "webrtc/api/statscollector.h"
#include "webrtc/api/streamcollection.h"
#include "webrtc/api/webrtcsession.h"
#include "webrtc/pc/peerconnectionfactory.h"
#include "webrtc/pc/rtcstatscollector.h"
#include "webrtc/pc/rtpreceiver.h"
#include "webrtc/pc/rtpsender.h"
#include "webrtc/pc/statscollector.h"
#include "webrtc/pc/streamcollection.h"
#include "webrtc/pc/webrtcsession.h"
namespace webrtc {
@ -452,4 +452,4 @@ class PeerConnection : public PeerConnectionInterface,
} // namespace webrtc
#endif // WEBRTC_API_PEERCONNECTION_H_
#endif // WEBRTC_PC_PEERCONNECTION_H_

View file

@ -17,19 +17,10 @@
#include <utility>
#include <vector>
#include "webrtc/api/dtmfsender.h"
#include "webrtc/api/fakemetricsobserver.h"
#include "webrtc/api/localaudiosource.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/peerconnection.h"
#include "webrtc/api/peerconnectionfactory.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/test/fakeaudiocapturemodule.h"
#include "webrtc/api/test/fakeconstraints.h"
#include "webrtc/api/test/fakeperiodicvideocapturer.h"
#include "webrtc/api/test/fakertccertificategenerator.h"
#include "webrtc/api/test/fakevideotrackrenderer.h"
#include "webrtc/api/test/mockpeerconnectionobservers.h"
#include "webrtc/base/fakenetwork.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/helpers.h"
@ -44,7 +35,16 @@
#include "webrtc/p2p/base/sessiondescription.h"
#include "webrtc/p2p/base/testturnserver.h"
#include "webrtc/p2p/client/basicportallocator.h"
#include "webrtc/pc/dtmfsender.h"
#include "webrtc/pc/localaudiosource.h"
#include "webrtc/pc/mediasession.h"
#include "webrtc/pc/peerconnection.h"
#include "webrtc/pc/peerconnectionfactory.h"
#include "webrtc/pc/test/fakeaudiocapturemodule.h"
#include "webrtc/pc/test/fakeperiodicvideocapturer.h"
#include "webrtc/pc/test/fakertccertificategenerator.h"
#include "webrtc/pc/test/fakevideotrackrenderer.h"
#include "webrtc/pc/test/mockpeerconnectionobservers.h"
#define MAYBE_SKIP_TEST(feature) \
if (!(feature())) { \

View file

@ -10,12 +10,6 @@
#include <memory>
#include "webrtc/api/test/peerconnectiontestwrapper.h"
// Notice that mockpeerconnectionobservers.h must be included after the above!
#include "webrtc/api/test/mockpeerconnectionobservers.h"
#ifdef WEBRTC_ANDROID
#include "webrtc/api/test/androidtestinitializer.h"
#endif
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/ssladapter.h"
@ -23,6 +17,12 @@
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#ifdef WEBRTC_ANDROID
#include "webrtc/pc/test/androidtestinitializer.h"
#endif
#include "webrtc/pc/test/peerconnectiontestwrapper.h"
// Notice that mockpeerconnectionobservers.h must be included after the above!
#include "webrtc/pc/test/mockpeerconnectionobservers.h"
#define MAYBE_SKIP_TEST(feature) \
if (!(feature())) { \

View file

@ -8,22 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/peerconnectionfactory.h"
#include "webrtc/pc/peerconnectionfactory.h"
#include <utility>
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/localaudiosource.h"
#include "webrtc/api/mediaconstraintsinterface.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/mediastreamproxy.h"
#include "webrtc/api/mediastreamtrackproxy.h"
#include "webrtc/api/peerconnection.h"
#include "webrtc/api/peerconnectionfactoryproxy.h"
#include "webrtc/api/peerconnectionproxy.h"
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videosourceproxy.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/media/engine/webrtcmediaengine.h"
@ -33,6 +27,12 @@
#include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
#include "webrtc/p2p/client/basicportallocator.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/localaudiosource.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/peerconnection.h"
#include "webrtc/pc/videocapturertracksource.h"
#include "webrtc/pc/videotrack.h"
namespace webrtc {

View file

@ -8,19 +8,19 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_PEERCONNECTIONFACTORY_H_
#define WEBRTC_API_PEERCONNECTIONFACTORY_H_
#ifndef WEBRTC_PC_PEERCONNECTIONFACTORY_H_
#define WEBRTC_PC_PEERCONNECTIONFACTORY_H_
#include <memory>
#include <string>
#include "webrtc/api/mediacontroller.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/thread.h"
#include "webrtc/base/rtccertificategenerator.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/mediacontroller.h"
namespace rtc {
class BasicNetworkManager;
@ -143,4 +143,4 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
} // namespace webrtc
#endif // WEBRTC_API_PEERCONNECTIONFACTORY_H_
#endif // WEBRTC_PC_PEERCONNECTIONFACTORY_H_

View file

@ -13,18 +13,18 @@
#include <utility>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/peerconnectionfactory.h"
#ifdef WEBRTC_ANDROID
#include "webrtc/api/test/androidtestinitializer.h"
#endif
#include "webrtc/api/test/fakertccertificategenerator.h"
#include "webrtc/api/test/fakevideotrackrenderer.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/thread.h"
#include "webrtc/media/base/fakevideocapturer.h"
#include "webrtc/media/engine/webrtccommon.h"
#include "webrtc/media/engine/webrtcvoe.h"
#include "webrtc/p2p/base/fakeportallocator.h"
#include "webrtc/pc/peerconnectionfactory.h"
#ifdef WEBRTC_ANDROID
#include "webrtc/pc/test/androidtestinitializer.h"
#endif
#include "webrtc/pc/test/fakertccertificategenerator.h"
#include "webrtc/pc/test/fakevideotrackrenderer.h"
using webrtc::DataChannelInterface;
using webrtc::FakeVideoTrackRenderer;

View file

@ -13,22 +13,12 @@
#include <string>
#include <utility>
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/jsepsessiondescription.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/peerconnection.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/api/rtpsenderinterface.h"
#include "webrtc/api/streamcollection.h"
#include "webrtc/api/test/fakeconstraints.h"
#include "webrtc/api/test/fakertccertificategenerator.h"
#include "webrtc/api/test/fakevideotracksource.h"
#include "webrtc/api/test/mockpeerconnectionobservers.h"
#include "webrtc/api/test/testsdpstrings.h"
#include "webrtc/api/videocapturertracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslstreamadapter.h"
@ -38,11 +28,21 @@
#include "webrtc/media/sctp/sctptransportinternal.h"
#include "webrtc/p2p/base/fakeportallocator.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/mediasession.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/peerconnection.h"
#include "webrtc/pc/streamcollection.h"
#include "webrtc/pc/test/fakertccertificategenerator.h"
#include "webrtc/pc/test/fakevideotracksource.h"
#include "webrtc/pc/test/mockpeerconnectionobservers.h"
#include "webrtc/pc/test/testsdpstrings.h"
#include "webrtc/pc/videocapturertracksource.h"
#include "webrtc/pc/videotrack.h"
#include "webrtc/test/gmock.h"
#ifdef WEBRTC_ANDROID
#include "webrtc/api/test/androidtestinitializer.h"
#include "webrtc/pc/test/androidtestinitializer.h"
#endif
static const char kStreamLabel1[] = "local_stream_1";

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/quicdatachannel.h"
#include "webrtc/pc/quicdatachannel.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/bytebuffer.h"

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_QUICDATACHANNEL_H_
#define WEBRTC_API_QUICDATACHANNEL_H_
#ifndef WEBRTC_PC_QUICDATACHANNEL_H_
#define WEBRTC_PC_QUICDATACHANNEL_H_
#include <string>
#include <unordered_map>
@ -217,4 +217,4 @@ class QuicDataChannel : public rtc::RefCountedObject<DataChannelInterface>,
} // namespace webrtc
#endif // WEBRTC_API_QUICDATACHANNEL_H_
#endif // WEBRTC_PC_QUICDATACHANNEL_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/quicdatachannel.h"
#include "webrtc/pc/quicdatachannel.h"
#include <map>
#include <memory>

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/quicdatatransport.h"
#include "webrtc/pc/quicdatatransport.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/logging.h"

View file

@ -8,18 +8,18 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_QUICDATATRANSPORT_H_
#define WEBRTC_API_QUICDATATRANSPORT_H_
#ifndef WEBRTC_PC_QUICDATATRANSPORT_H_
#define WEBRTC_PC_QUICDATATRANSPORT_H_
#include <string>
#include <unordered_map>
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/api/quicdatachannel.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread.h"
#include "webrtc/p2p/base/transportcontroller.h"
#include "webrtc/pc/quicdatachannel.h"
namespace cricket {
class QuicTransportChannel;
@ -112,4 +112,4 @@ class QuicDataTransport : public sigslot::has_slots<> {
} // namespace webrtc
#endif // WEBRTC_API_QUICDATATRANSPORT_H_
#endif // WEBRTC_PC_QUICDATATRANSPORT_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/quicdatatransport.h"
#include "webrtc/pc/quicdatatransport.h"
#include <memory>
#include <set>
@ -16,12 +16,12 @@
#include <unordered_map>
#include <vector>
#include "webrtc/api/quicdatachannel.h"
#include "webrtc/base/bytebuffer.h"
#include "webrtc/base/gunit.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/p2p/quic/quictransportchannel.h"
#include "webrtc/p2p/quic/reliablequicstream.h"
#include "webrtc/pc/quicdatachannel.h"
using webrtc::DataBuffer;
using webrtc::DataChannelInit;

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/remoteaudiosource.h"
#include "webrtc/pc/remoteaudiosource.h"
#include <algorithm>
#include <functional>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_REMOTEAUDIOSOURCE_H_
#define WEBRTC_API_REMOTEAUDIOSOURCE_H_
#ifndef WEBRTC_PC_REMOTEAUDIOSOURCE_H_
#define WEBRTC_PC_REMOTEAUDIOSOURCE_H_
#include <list>
#include <string>
@ -73,4 +73,4 @@ class RemoteAudioSource : public Notifier<AudioSourceInterface> {
} // namespace webrtc
#endif // WEBRTC_API_REMOTEAUDIOSOURCE_H_
#endif // WEBRTC_PC_REMOTEAUDIOSOURCE_H_

View file

@ -15,14 +15,14 @@
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/stats/rtcstats_objects.h"
#include "webrtc/api/stats/rtcstatsreport.h"
#include "webrtc/api/test/peerconnectiontestwrapper.h"
#include "webrtc/api/test/rtcstatsobtainer.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/physicalsocketserver.h"
#include "webrtc/base/refcountedobject.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/virtualsocketserver.h"
#include "webrtc/pc/test/peerconnectiontestwrapper.h"
#include "webrtc/pc/test/rtcstatsobtainer.h"
namespace webrtc {

View file

@ -8,23 +8,23 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/rtcstatscollector.h"
#include "webrtc/pc/rtcstatscollector.h"
#include <memory>
#include <sstream>
#include <utility>
#include <vector>
#include "webrtc/api/peerconnection.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/webrtcsession.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/p2p/base/candidate.h"
#include "webrtc/p2p/base/p2pconstants.h"
#include "webrtc/p2p/base/port.h"
#include "webrtc/pc/peerconnection.h"
#include "webrtc/pc/webrtcsession.h"
namespace webrtc {

View file

@ -8,17 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_RTCSTATSCOLLECTOR_H_
#define WEBRTC_API_RTCSTATSCOLLECTOR_H_
#ifndef WEBRTC_PC_RTCSTATSCOLLECTOR_H_
#define WEBRTC_PC_RTCSTATSCOLLECTOR_H_
#include <map>
#include <memory>
#include <set>
#include <vector>
#include "webrtc/api/datachannel.h"
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/api/stats/rtcstats_objects.h"
#include "webrtc/api/stats/rtcstatscollectorcallback.h"
#include "webrtc/api/stats/rtcstatsreport.h"
#include "webrtc/api/trackmediainfomap.h"
#include "webrtc/base/asyncinvoker.h"
@ -29,6 +28,7 @@
#include "webrtc/base/sslidentity.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/pc/datachannel.h"
namespace cricket {
class Candidate;
@ -44,14 +44,6 @@ class PeerConnection;
struct SessionStats;
struct ChannelNamePairs;
class RTCStatsCollectorCallback : public virtual rtc::RefCountInterface {
public:
virtual ~RTCStatsCollectorCallback() {}
virtual void OnStatsDelivered(
const rtc::scoped_refptr<const RTCStatsReport>& report) = 0;
};
// All public methods of the collector are to be called on the signaling thread.
// Stats are gathered on the signaling, worker and network threads
// asynchronously. The callback is invoked on the signaling thread. Resulting
@ -197,4 +189,4 @@ const char* DataStateToRTCDataChannelStateForTesting(
} // namespace webrtc
#endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_
#endif // WEBRTC_PC_RTCSTATSCOLLECTOR_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/rtcstatscollector.h"
#include "webrtc/pc/rtcstatscollector.h"
#include <initializer_list>
#include <memory>
@ -17,17 +17,11 @@
#include <vector>
#include "webrtc/api/jsepsessiondescription.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/mediastreamtrack.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/api/stats/rtcstats_objects.h"
#include "webrtc/api/stats/rtcstatsreport.h"
#include "webrtc/api/test/mock_datachannel.h"
#include "webrtc/api/test/mock_peerconnection.h"
#include "webrtc/api/test/mock_rtpreceiver.h"
#include "webrtc/api/test/mock_rtpsender.h"
#include "webrtc/api/test/mock_webrtcsession.h"
#include "webrtc/api/test/rtcstatsobtainer.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/fakeclock.h"
#include "webrtc/base/fakesslidentity.h"
@ -42,6 +36,12 @@
#include "webrtc/media/base/test/mock_mediachannel.h"
#include "webrtc/p2p/base/p2pconstants.h"
#include "webrtc/p2p/base/port.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/mediastreamtrack.h"
#include "webrtc/pc/test/mock_datachannel.h"
#include "webrtc/pc/test/mock_peerconnection.h"
#include "webrtc/pc/test/mock_webrtcsession.h"
#include "webrtc/pc/test/rtcstatsobtainer.h"
using testing::_;
using testing::Invoke;

View file

@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/rtpreceiver.h"
#include "webrtc/pc/rtpreceiver.h"
#include "webrtc/api/mediastreamtrackproxy.h"
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/videosourceproxy.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/videotrack.h"
namespace webrtc {

View file

@ -12,8 +12,8 @@
// An RtpReceiver associates a MediaStreamTrackInterface with an underlying
// transport (provided by cricket::VoiceChannel/cricket::VideoChannel)
#ifndef WEBRTC_API_RTPRECEIVER_H_
#define WEBRTC_API_RTPRECEIVER_H_
#ifndef WEBRTC_PC_RTPRECEIVER_H_
#define WEBRTC_PC_RTPRECEIVER_H_
#include <stdint.h>
@ -21,11 +21,12 @@
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/api/remoteaudiosource.h"
#include "webrtc/api/videotracksource.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/media/base/videobroadcaster.h"
#include "webrtc/pc/channel.h"
#include "webrtc/pc/remoteaudiosource.h"
#include "webrtc/pc/videotracksource.h"
namespace webrtc {
@ -154,4 +155,4 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal>,
} // namespace webrtc
#endif // WEBRTC_API_RTPRECEIVER_H_
#endif // WEBRTC_PC_RTPRECEIVER_H_

View file

@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/rtpsender.h"
#include "webrtc/pc/rtpsender.h"
#include "webrtc/api/localaudiosource.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/pc/localaudiosource.h"
namespace webrtc {

235
webrtc/pc/rtpsender.h Normal file
View file

@ -0,0 +1,235 @@
/*
* Copyright 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.
*/
// This file contains classes that implement RtpSenderInterface.
// An RtpSender associates a MediaStreamTrackInterface with an underlying
// transport (provided by AudioProviderInterface/VideoProviderInterface)
#ifndef WEBRTC_PC_RTPSENDER_H_
#define WEBRTC_PC_RTPSENDER_H_
#include <memory>
#include <string>
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/rtpsenderinterface.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/media/base/audiosource.h"
#include "webrtc/pc/channel.h"
#include "webrtc/pc/statscollector.h"
namespace webrtc {
// Internal interface used by PeerConnection.
class RtpSenderInternal : public RtpSenderInterface {
public:
// Used to set the SSRC of the sender, once a local description has been set.
// If |ssrc| is 0, this indiates that the sender should disconnect from the
// underlying transport (this occurs if the sender isn't seen in a local
// description).
virtual void SetSsrc(uint32_t ssrc) = 0;
// TODO(deadbeef): Support one sender having multiple stream ids.
virtual void set_stream_id(const std::string& stream_id) = 0;
virtual std::string stream_id() const = 0;
virtual void Stop() = 0;
};
// LocalAudioSinkAdapter receives data callback as a sink to the local
// AudioTrack, and passes the data to the sink of AudioSource.
class LocalAudioSinkAdapter : public AudioTrackSinkInterface,
public cricket::AudioSource {
public:
LocalAudioSinkAdapter();
virtual ~LocalAudioSinkAdapter();
private:
// AudioSinkInterface implementation.
void OnData(const void* audio_data,
int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames) override;
// cricket::AudioSource implementation.
void SetSink(cricket::AudioSource::Sink* sink) override;
cricket::AudioSource::Sink* sink_;
// Critical section protecting |sink_|.
rtc::CriticalSection lock_;
};
class AudioRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInternal> {
public:
// StatsCollector provided so that Add/RemoveLocalAudioTrack can be called
// at the appropriate times.
// |channel| can be null if one does not exist yet.
AudioRtpSender(AudioTrackInterface* track,
const std::string& stream_id,
cricket::VoiceChannel* channel,
StatsCollector* stats);
// Randomly generates stream_id.
// |channel| can be null if one does not exist yet.
AudioRtpSender(AudioTrackInterface* track,
cricket::VoiceChannel* channel,
StatsCollector* stats);
// Randomly generates id and stream_id.
// |channel| can be null if one does not exist yet.
AudioRtpSender(cricket::VoiceChannel* channel, StatsCollector* stats);
virtual ~AudioRtpSender();
// ObserverInterface implementation
void OnChanged() override;
// RtpSenderInterface implementation
bool SetTrack(MediaStreamTrackInterface* track) override;
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
return track_;
}
uint32_t ssrc() const override { return ssrc_; }
cricket::MediaType media_type() const override {
return cricket::MEDIA_TYPE_AUDIO;
}
std::string id() const override { return id_; }
std::vector<std::string> stream_ids() const override {
std::vector<std::string> ret = {stream_id_};
return ret;
}
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
// RtpSenderInternal implementation.
void SetSsrc(uint32_t ssrc) override;
void set_stream_id(const std::string& stream_id) override {
stream_id_ = stream_id;
}
std::string stream_id() const override { return stream_id_; }
void Stop() override;
// Does not take ownership.
// Should call SetChannel(nullptr) before |channel| is destroyed.
void SetChannel(cricket::VoiceChannel* channel) { channel_ = channel; }
private:
// TODO(nisse): Since SSRC == 0 is technically valid, figure out
// some other way to test if we have a valid SSRC.
bool can_send_track() const { return track_ && ssrc_; }
// Helper function to construct options for
// AudioProviderInterface::SetAudioSend.
void SetAudioSend();
// Helper function to call SetAudioSend with "stop sending" parameters.
void ClearAudioSend();
std::string id_;
std::string stream_id_;
cricket::VoiceChannel* channel_ = nullptr;
StatsCollector* stats_;
rtc::scoped_refptr<AudioTrackInterface> track_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
bool stopped_ = false;
// Used to pass the data callback from the |track_| to the other end of
// cricket::AudioSource.
std::unique_ptr<LocalAudioSinkAdapter> sink_adapter_;
};
class VideoRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInternal> {
public:
// |channel| can be null if one does not exist yet.
VideoRtpSender(VideoTrackInterface* track,
const std::string& stream_id,
cricket::VideoChannel* channel);
// Randomly generates stream_id.
// |channel| can be null if one does not exist yet.
VideoRtpSender(VideoTrackInterface* track, cricket::VideoChannel* channel);
// Randomly generates id and stream_id.
// |channel| can be null if one does not exist yet.
explicit VideoRtpSender(cricket::VideoChannel* channel);
virtual ~VideoRtpSender();
// ObserverInterface implementation
void OnChanged() override;
// RtpSenderInterface implementation
bool SetTrack(MediaStreamTrackInterface* track) override;
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
return track_;
}
uint32_t ssrc() const override { return ssrc_; }
cricket::MediaType media_type() const override {
return cricket::MEDIA_TYPE_VIDEO;
}
std::string id() const override { return id_; }
std::vector<std::string> stream_ids() const override {
std::vector<std::string> ret = {stream_id_};
return ret;
}
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
// RtpSenderInternal implementation.
void SetSsrc(uint32_t ssrc) override;
void set_stream_id(const std::string& stream_id) override {
stream_id_ = stream_id;
}
std::string stream_id() const override { return stream_id_; }
void Stop() override;
// Does not take ownership.
// Should call SetChannel(nullptr) before |channel| is destroyed.
void SetChannel(cricket::VideoChannel* channel) { channel_ = channel; }
private:
bool can_send_track() const { return track_ && ssrc_; }
// Helper function to construct options for
// VideoProviderInterface::SetVideoSend.
void SetVideoSend();
// Helper function to call SetVideoSend with "stop sending" parameters.
void ClearVideoSend();
std::string id_;
std::string stream_id_;
cricket::VideoChannel* channel_ = nullptr;
rtc::scoped_refptr<VideoTrackInterface> track_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
VideoTrackInterface::ContentHint cached_track_content_hint_ =
VideoTrackInterface::ContentHint::kNone;
bool stopped_ = false;
};
} // namespace webrtc
#endif // WEBRTC_PC_RTPSENDER_H_

View file

@ -12,24 +12,24 @@
#include <string>
#include <utility>
#include "webrtc/api/audiotrack.h"
#include "webrtc/api/fakemediacontroller.h"
#include "webrtc/api/localaudiosource.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/remoteaudiosource.h"
#include "webrtc/api/rtpreceiver.h"
#include "webrtc/api/rtpsender.h"
#include "webrtc/api/streamcollection.h"
#include "webrtc/api/test/fakevideotracksource.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/api/videotracksource.h"
#include "webrtc/base/gunit.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/media/base/fakemediaengine.h"
#include "webrtc/media/base/mediachannel.h"
#include "webrtc/media/engine/fakewebrtccall.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/audiotrack.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/fakemediacontroller.h"
#include "webrtc/pc/localaudiosource.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/remoteaudiosource.h"
#include "webrtc/pc/rtpreceiver.h"
#include "webrtc/pc/rtpsender.h"
#include "webrtc/pc/streamcollection.h"
#include "webrtc/pc/test/fakevideotracksource.h"
#include "webrtc/pc/videotrack.h"
#include "webrtc/pc/videotracksource.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/sctputils.h"
#include "webrtc/pc/sctputils.h"
#include "webrtc/base/bytebuffer.h"
#include "webrtc/base/copyonwritebuffer.h"

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_SCTPUTILS_H_
#define WEBRTC_API_SCTPUTILS_H_
#ifndef WEBRTC_PC_SCTPUTILS_H_
#define WEBRTC_PC_SCTPUTILS_H_
#include <string>
@ -38,4 +38,4 @@ bool WriteDataChannelOpenMessage(const std::string& label,
void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload);
} // namespace webrtc
#endif // WEBRTC_API_SCTPUTILS_H_
#endif // WEBRTC_PC_SCTPUTILS_H_

View file

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/sctputils.h"
#include "webrtc/base/bytebuffer.h"
#include "webrtc/base/copyonwritebuffer.h"
#include "webrtc/base/gunit.h"
#include "webrtc/pc/sctputils.h"
class SctpUtilsTest : public testing::Test {
public:

View file

@ -8,16 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/statscollector.h"
#include "webrtc/pc/statscollector.h"
#include <memory>
#include <utility>
#include <vector>
#include "webrtc/api/peerconnection.h"
#include "webrtc/base/base64.h"
#include "webrtc/base/checks.h"
#include "webrtc/pc/channel.h"
#include "webrtc/pc/peerconnection.h"
namespace webrtc {
namespace {

View file

@ -11,8 +11,8 @@
// This file contains a class used for gathering statistics from an ongoing
// libjingle PeerConnection.
#ifndef WEBRTC_API_STATSCOLLECTOR_H_
#define WEBRTC_API_STATSCOLLECTOR_H_
#ifndef WEBRTC_PC_STATSCOLLECTOR_H_
#define WEBRTC_PC_STATSCOLLECTOR_H_
#include <map>
#include <string>
@ -21,7 +21,7 @@
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/statstypes.h"
#include "webrtc/api/webrtcsession.h"
#include "webrtc/pc/webrtcsession.h"
namespace webrtc {
@ -149,4 +149,4 @@ class StatsCollector {
} // namespace webrtc
#endif // WEBRTC_API_STATSCOLLECTOR_H_
#endif // WEBRTC_PC_STATSCOLLECTOR_H_

View file

@ -13,18 +13,9 @@
#include <algorithm>
#include <memory>
#include "webrtc/api/statscollector.h"
#include "webrtc/pc/statscollector.h"
#include "webrtc/api/mediastream.h"
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/mediastreamtrack.h"
#include "webrtc/api/peerconnection.h"
#include "webrtc/api/peerconnectionfactory.h"
#include "webrtc/api/test/fakedatachannelprovider.h"
#include "webrtc/api/test/fakevideotracksource.h"
#include "webrtc/api/test/mock_peerconnection.h"
#include "webrtc/api/test/mock_webrtcsession.h"
#include "webrtc/api/videotrack.h"
#include "webrtc/base/base64.h"
#include "webrtc/base/fakesslidentity.h"
#include "webrtc/base/gunit.h"
@ -35,6 +26,15 @@
#include "webrtc/media/base/test/mock_mediachannel.h"
#include "webrtc/p2p/base/faketransportcontroller.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/pc/mediastream.h"
#include "webrtc/pc/mediastreamtrack.h"
#include "webrtc/pc/peerconnection.h"
#include "webrtc/pc/peerconnectionfactory.h"
#include "webrtc/pc/test/fakedatachannelprovider.h"
#include "webrtc/pc/test/fakevideotracksource.h"
#include "webrtc/pc/test/mock_peerconnection.h"
#include "webrtc/pc/test/mock_webrtcsession.h"
#include "webrtc/pc/videotrack.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"

View file

@ -0,0 +1,108 @@
/*
* Copyright 2011 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.
*/
#ifndef WEBRTC_PC_STREAMCOLLECTION_H_
#define WEBRTC_PC_STREAMCOLLECTION_H_
#include <string>
#include <vector>
#include "webrtc/api/peerconnectioninterface.h"
namespace webrtc {
// Implementation of StreamCollection.
class StreamCollection : public StreamCollectionInterface {
public:
static rtc::scoped_refptr<StreamCollection> Create() {
rtc::RefCountedObject<StreamCollection>* implementation =
new rtc::RefCountedObject<StreamCollection>();
return implementation;
}
static rtc::scoped_refptr<StreamCollection> Create(
StreamCollection* streams) {
rtc::RefCountedObject<StreamCollection>* implementation =
new rtc::RefCountedObject<StreamCollection>(streams);
return implementation;
}
virtual size_t count() {
return media_streams_.size();
}
virtual MediaStreamInterface* at(size_t index) {
return media_streams_.at(index);
}
virtual MediaStreamInterface* find(const std::string& label) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(label) == 0) {
return (*it);
}
}
return NULL;
}
virtual MediaStreamTrackInterface* FindAudioTrack(
const std::string& id) {
for (size_t i = 0; i < media_streams_.size(); ++i) {
MediaStreamTrackInterface* track = media_streams_[i]->FindAudioTrack(id);
if (track) {
return track;
}
}
return NULL;
}
virtual MediaStreamTrackInterface* FindVideoTrack(
const std::string& id) {
for (size_t i = 0; i < media_streams_.size(); ++i) {
MediaStreamTrackInterface* track = media_streams_[i]->FindVideoTrack(id);
if (track) {
return track;
}
}
return NULL;
}
void AddStream(MediaStreamInterface* stream) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(stream->label()) == 0)
return;
}
media_streams_.push_back(stream);
}
void RemoveStream(MediaStreamInterface* remove_stream) {
for (StreamVector::iterator it = media_streams_.begin();
it != media_streams_.end(); ++it) {
if ((*it)->label().compare(remove_stream->label()) == 0) {
media_streams_.erase(it);
break;
}
}
}
protected:
StreamCollection() {}
explicit StreamCollection(StreamCollection* original)
: media_streams_(original->media_streams_) {
}
typedef std::vector<rtc::scoped_refptr<MediaStreamInterface> >
StreamVector;
StreamVector media_streams_;
};
} // namespace webrtc
#endif // WEBRTC_PC_STREAMCOLLECTION_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/test/androidtestinitializer.h"
#include "webrtc/pc/test/androidtestinitializer.h"
#include <pthread.h>

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_TEST_ANDROIDTESTINITIALIZER_H_
#define WEBRTC_API_TEST_ANDROIDTESTINITIALIZER_H_
#ifndef WEBRTC_PC_TEST_ANDROIDTESTINITIALIZER_H_
#define WEBRTC_PC_TEST_ANDROIDTESTINITIALIZER_H_
namespace webrtc {
@ -17,4 +17,4 @@ void InitializeAndroidObjects();
} // namespace webrtc
#endif // WEBRTC_API_TEST_ANDROIDTESTINITIALIZER_H_
#endif // WEBRTC_PC_TEST_ANDROIDTESTINITIALIZER_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/test/fakeaudiocapturemodule.h"
#include "webrtc/pc/test/fakeaudiocapturemodule.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/common.h"

View file

@ -17,8 +17,8 @@
// Note P postfix of a function indicates that it should only be called by the
// processing thread.
#ifndef WEBRTC_API_TEST_FAKEAUDIOCAPTUREMODULE_H_
#define WEBRTC_API_TEST_FAKEAUDIOCAPTUREMODULE_H_
#ifndef WEBRTC_PC_TEST_FAKEAUDIOCAPTUREMODULE_H_
#define WEBRTC_PC_TEST_FAKEAUDIOCAPTUREMODULE_H_
#include <memory>
@ -278,4 +278,4 @@ class FakeAudioCaptureModule
rtc::CriticalSection crit_callback_;
};
#endif // WEBRTC_API_TEST_FAKEAUDIOCAPTUREMODULE_H_
#endif // WEBRTC_PC_TEST_FAKEAUDIOCAPTUREMODULE_H_

View file

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/api/test/fakeaudiocapturemodule.h"
#include "webrtc/pc/test/fakeaudiocapturemodule.h"
#include <algorithm>

View file

@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_
#define WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_
#ifndef WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_
#define WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_
#include "webrtc/api/datachannel.h"
#include "webrtc/base/checks.h"
#include "webrtc/pc/datachannel.h"
class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
public:
@ -144,4 +144,4 @@ class FakeDataChannelProvider : public webrtc::DataChannelProviderInterface {
std::set<uint32_t> send_ssrcs_;
std::set<uint32_t> recv_ssrcs_;
};
#endif // WEBRTC_API_TEST_FAKEDATACHANNELPROVIDER_H_
#endif // WEBRTC_PC_TEST_FAKEDATACHANNELPROVIDER_H_

View file

@ -11,8 +11,8 @@
// FakePeriodicVideoCapturer implements a fake cricket::VideoCapturer that
// creates video frames periodically after it has been started.
#ifndef WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#define WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#ifndef WEBRTC_PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#define WEBRTC_PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#include <vector>
@ -71,4 +71,4 @@ class FakePeriodicVideoCapturer : public cricket::FakeVideoCapturer,
} // namespace webrtc
#endif // WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
#endif // WEBRTC_PC_TEST_FAKEPERIODICVIDEOCAPTURER_H_

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_TEST_FAKERTCCERTIFICATEGENERATOR_H_
#define WEBRTC_API_TEST_FAKERTCCERTIFICATEGENERATOR_H_
#ifndef WEBRTC_PC_TEST_FAKERTCCERTIFICATEGENERATOR_H_
#define WEBRTC_PC_TEST_FAKERTCCERTIFICATEGENERATOR_H_
#include <memory>
#include <string>
@ -228,4 +228,4 @@ class FakeRTCCertificateGenerator
int generated_certificates_ = 0;
};
#endif // WEBRTC_API_TEST_FAKERTCCERTIFICATEGENERATOR_H_
#endif // WEBRTC_PC_TEST_FAKERTCCERTIFICATEGENERATOR_H_

View file

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_
#define WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_
#ifndef WEBRTC_PC_TEST_FAKEVIDEOTRACKRENDERER_H_
#define WEBRTC_PC_TEST_FAKEVIDEOTRACKRENDERER_H_
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/media/base/fakevideorenderer.h"
@ -30,4 +30,4 @@ class FakeVideoTrackRenderer : public cricket::FakeVideoRenderer {
} // namespace webrtc
#endif // WEBRTC_API_TEST_FAKEVIDEOTRACKRENDERER_H_
#endif // WEBRTC_PC_TEST_FAKEVIDEOTRACKRENDERER_H_

View file

@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_API_TEST_FAKEVIDEOTRACKSOURCE_H_
#define WEBRTC_API_TEST_FAKEVIDEOTRACKSOURCE_H_
#ifndef WEBRTC_PC_TEST_FAKEVIDEOTRACKSOURCE_H_
#define WEBRTC_PC_TEST_FAKEVIDEOTRACKSOURCE_H_
#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/videotracksource.h"
#include "webrtc/media/base/fakevideocapturer.h"
#include "webrtc/pc/videotracksource.h"
namespace webrtc {
@ -46,4 +46,4 @@ class FakeVideoTrackSource : public VideoTrackSource {
} // namespace webrtc
#endif // WEBRTC_API_TEST_FAKEVIDEOTRACKSOURCE_H_
#endif // WEBRTC_PC_TEST_FAKEVIDEOTRACKSOURCE_H_

Some files were not shown because too many files have changed in this diff Show more