Moved call.h and most of api/call/* into call/
BUG=webrtc:6716
Review-Url: https://codereview.webrtc.org/2550273003
Cr-Commit-Position: refs/heads/master@{#15460}
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index 20cf3fa..e838e7e 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -20,11 +20,7 @@
rtc_source_set("call_api") {
sources = [
- "call/audio_receive_stream.h",
- "call/audio_send_stream.cc",
- "call/audio_send_stream.h",
"call/audio_sink.h",
- "call/audio_state.h",
"call/flexfec_receive_stream.h",
]
diff --git a/webrtc/api/DEPS b/webrtc/api/DEPS
index ee97620..75f756d 100644
--- a/webrtc/api/DEPS
+++ b/webrtc/api/DEPS
@@ -18,10 +18,22 @@
"+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"
+ ],
}
diff --git a/webrtc/api/call/DEPS b/webrtc/api/call/DEPS
deleted file mode 100644
index d1d4309..0000000
--- a/webrtc/api/call/DEPS
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules = [
- "+webrtc/modules/audio_coding/codecs",
-]
-
diff --git a/webrtc/api/call/audio_receive_stream.h b/webrtc/api/call/audio_receive_stream.h
deleted file mode 100644
index ed9ff34..0000000
--- a/webrtc/api/call/audio_receive_stream.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_API_CALL_AUDIO_RECEIVE_STREAM_H_
-#define WEBRTC_API_CALL_AUDIO_RECEIVE_STREAM_H_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "webrtc/api/call/transport.h"
-#include "webrtc/base/optional.h"
-#include "webrtc/base/scoped_ref_ptr.h"
-#include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h"
-#include "webrtc/common_types.h"
-#include "webrtc/config.h"
-#include "webrtc/typedefs.h"
-
-namespace webrtc {
-class AudioSinkInterface;
-
-// WORK IN PROGRESS
-// This class is under development and is not yet intended for for use outside
-// of WebRtc/Libjingle. Please use the VoiceEngine API instead.
-// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690
-
-class AudioReceiveStream {
- public:
- struct Stats {
- uint32_t remote_ssrc = 0;
- int64_t bytes_rcvd = 0;
- uint32_t packets_rcvd = 0;
- uint32_t packets_lost = 0;
- float fraction_lost = 0.0f;
- std::string codec_name;
- rtc::Optional<int> codec_payload_type;
- uint32_t ext_seqnum = 0;
- uint32_t jitter_ms = 0;
- uint32_t jitter_buffer_ms = 0;
- uint32_t jitter_buffer_preferred_ms = 0;
- uint32_t delay_estimate_ms = 0;
- int32_t audio_level = -1;
- float expand_rate = 0.0f;
- float speech_expand_rate = 0.0f;
- float secondary_decoded_rate = 0.0f;
- float accelerate_rate = 0.0f;
- float preemptive_expand_rate = 0.0f;
- int32_t decoding_calls_to_silence_generator = 0;
- int32_t decoding_calls_to_neteq = 0;
- int32_t decoding_normal = 0;
- int32_t decoding_plc = 0;
- int32_t decoding_cng = 0;
- int32_t decoding_plc_cng = 0;
- int32_t decoding_muted_output = 0;
- int64_t capture_start_ntp_time_ms = 0;
- };
-
- struct Config {
- std::string ToString() const;
-
- // Receive-stream specific RTP settings.
- struct Rtp {
- std::string ToString() const;
-
- // Synchronization source (stream identifier) to be received.
- uint32_t remote_ssrc = 0;
-
- // Sender SSRC used for sending RTCP (such as receiver reports).
- uint32_t local_ssrc = 0;
-
- // Enable feedback for send side bandwidth estimation.
- // See
- // https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions
- // for details.
- bool transport_cc = false;
-
- // See NackConfig for description.
- NackConfig nack;
-
- // RTP header extensions used for the received stream.
- std::vector<RtpExtension> extensions;
- } rtp;
-
- Transport* rtcp_send_transport = nullptr;
-
- // Underlying VoiceEngine handle, used to map AudioReceiveStream to lower-
- // level components.
- // TODO(solenberg): Remove when VoiceEngine channels are created outside
- // of Call.
- int voe_channel_id = -1;
-
- // Identifier for an A/V synchronization group. Empty string to disable.
- // TODO(pbos): Synchronize streams in a sync group, not just one video
- // stream to one audio stream. Tracked by issue webrtc:4762.
- std::string sync_group;
-
- // Decoders for every payload that we can receive. Call owns the
- // AudioDecoder instances once the Config is submitted to
- // Call::CreateReceiveStream().
- // TODO(solenberg): Use unique_ptr<> once our std lib fully supports C++11.
- std::map<uint8_t, AudioDecoder*> decoder_map;
-
- rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
- };
-
- // Starts stream activity.
- // When a stream is active, it can receive, process and deliver packets.
- virtual void Start() = 0;
- // Stops stream activity.
- // When a stream is stopped, it can't receive, process or deliver packets.
- virtual void Stop() = 0;
-
- virtual Stats GetStats() const = 0;
-
- // Sets an audio sink that receives unmixed audio from the receive stream.
- // Ownership of the sink is passed to the stream and can be used by the
- // caller to do lifetime management (i.e. when the sink's dtor is called).
- // Only one sink can be set and passing a null sink clears an existing one.
- // NOTE: Audio must still somehow be pulled through AudioTransport for audio
- // to stream through this sink. In practice, this happens if mixed audio
- // is being pulled+rendered and/or if audio is being pulled for the purposes
- // of feeding to the AEC.
- virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink) = 0;
-
- // Sets playback gain of the stream, applied when mixing, and thus after it
- // is potentially forwarded to any attached AudioSinkInterface implementation.
- virtual void SetGain(float gain) = 0;
-
- protected:
- virtual ~AudioReceiveStream() {}
-};
-} // namespace webrtc
-
-#endif // WEBRTC_API_CALL_AUDIO_RECEIVE_STREAM_H_
diff --git a/webrtc/api/call/audio_send_stream.cc b/webrtc/api/call/audio_send_stream.cc
deleted file mode 100644
index b619007..0000000
--- a/webrtc/api/call/audio_send_stream.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "webrtc/api/call/audio_send_stream.h"
-
-#include <string>
-
-namespace {
-
-std::string ToString(const webrtc::CodecInst& codec_inst) {
- std::stringstream ss;
- ss << "{pltype: " << codec_inst.pltype;
- ss << ", plname: \"" << codec_inst.plname << "\"";
- ss << ", plfreq: " << codec_inst.plfreq;
- ss << ", pacsize: " << codec_inst.pacsize;
- ss << ", channels: " << codec_inst.channels;
- ss << ", rate: " << codec_inst.rate;
- ss << '}';
- return ss.str();
-}
-} // namespace
-
-namespace webrtc {
-
-AudioSendStream::Stats::Stats() = default;
-AudioSendStream::Stats::~Stats() = default;
-
-AudioSendStream::Config::Config(Transport* send_transport)
- : send_transport(send_transport) {}
-
-AudioSendStream::Config::~Config() = default;
-
-std::string AudioSendStream::Config::ToString() const {
- std::stringstream ss;
- ss << "{rtp: " << rtp.ToString();
- ss << ", send_transport: " << (send_transport ? "(Transport)" : "nullptr");
- ss << ", voe_channel_id: " << voe_channel_id;
- ss << ", min_bitrate_bps: " << min_bitrate_bps;
- ss << ", max_bitrate_bps: " << max_bitrate_bps;
- ss << ", send_codec_spec: " << send_codec_spec.ToString();
- ss << '}';
- return ss.str();
-}
-
-AudioSendStream::Config::Rtp::Rtp() = default;
-
-AudioSendStream::Config::Rtp::~Rtp() = default;
-
-std::string AudioSendStream::Config::Rtp::ToString() const {
- std::stringstream ss;
- ss << "{ssrc: " << ssrc;
- ss << ", extensions: [";
- for (size_t i = 0; i < extensions.size(); ++i) {
- ss << extensions[i].ToString();
- if (i != extensions.size() - 1) {
- ss << ", ";
- }
- }
- ss << ']';
- ss << ", nack: " << nack.ToString();
- ss << ", c_name: " << c_name;
- ss << '}';
- return ss.str();
-}
-
-AudioSendStream::Config::SendCodecSpec::SendCodecSpec() {
- webrtc::CodecInst empty_inst = {0};
- codec_inst = empty_inst;
- codec_inst.pltype = -1;
-}
-
-std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
- std::stringstream ss;
- ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
- ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
- ss << ", enable_codec_fec: " << (enable_codec_fec ? "true" : "false");
- ss << ", enable_opus_dtx: " << (enable_opus_dtx ? "true" : "false");
- ss << ", opus_max_playback_rate: " << opus_max_playback_rate;
- ss << ", cng_payload_type: " << cng_payload_type;
- ss << ", cng_plfreq: " << cng_plfreq;
- ss << ", min_ptime: " << min_ptime_ms;
- ss << ", max_ptime: " << max_ptime_ms;
- ss << ", codec_inst: " << ::ToString(codec_inst);
- ss << '}';
- return ss.str();
-}
-
-bool AudioSendStream::Config::SendCodecSpec::operator==(
- const AudioSendStream::Config::SendCodecSpec& rhs) const {
- if (nack_enabled == rhs.nack_enabled &&
- transport_cc_enabled == rhs.transport_cc_enabled &&
- enable_codec_fec == rhs.enable_codec_fec &&
- enable_opus_dtx == rhs.enable_opus_dtx &&
- opus_max_playback_rate == rhs.opus_max_playback_rate &&
- cng_payload_type == rhs.cng_payload_type &&
- cng_plfreq == rhs.cng_plfreq && max_ptime_ms == rhs.max_ptime_ms &&
- min_ptime_ms == rhs.min_ptime_ms && codec_inst == rhs.codec_inst) {
- return true;
- }
- return false;
-}
-} // namespace webrtc
diff --git a/webrtc/api/call/audio_send_stream.h b/webrtc/api/call/audio_send_stream.h
deleted file mode 100644
index 487ce98..0000000
--- a/webrtc/api/call/audio_send_stream.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_API_CALL_AUDIO_SEND_STREAM_H_
-#define WEBRTC_API_CALL_AUDIO_SEND_STREAM_H_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "webrtc/api/call/transport.h"
-#include "webrtc/base/optional.h"
-#include "webrtc/config.h"
-#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
-#include "webrtc/typedefs.h"
-
-namespace webrtc {
-
-// WORK IN PROGRESS
-// This class is under development and is not yet intended for for use outside
-// of WebRtc/Libjingle. Please use the VoiceEngine API instead.
-// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690
-
-class AudioSendStream {
- public:
- struct Stats {
- Stats();
- ~Stats();
-
- // TODO(solenberg): Harmonize naming and defaults with receive stream stats.
- uint32_t local_ssrc = 0;
- int64_t bytes_sent = 0;
- int32_t packets_sent = 0;
- int32_t packets_lost = -1;
- float fraction_lost = -1.0f;
- std::string codec_name;
- rtc::Optional<int> codec_payload_type;
- int32_t ext_seqnum = -1;
- int32_t jitter_ms = -1;
- int64_t rtt_ms = -1;
- int32_t audio_level = -1;
- float aec_quality_min = -1.0f;
- int32_t echo_delay_median_ms = -1;
- int32_t echo_delay_std_ms = -1;
- int32_t echo_return_loss = -100;
- int32_t echo_return_loss_enhancement = -100;
- float residual_echo_likelihood = -1.0f;
- bool typing_noise_detected = false;
- };
-
- struct Config {
- Config() = delete;
- explicit Config(Transport* send_transport);
- ~Config();
- std::string ToString() const;
-
- // Send-stream specific RTP settings.
- struct Rtp {
- Rtp();
- ~Rtp();
- std::string ToString() const;
-
- // Sender SSRC.
- uint32_t ssrc = 0;
-
- // RTP header extensions used for the sent stream.
- std::vector<RtpExtension> extensions;
-
- // See NackConfig for description.
- NackConfig nack;
-
- // RTCP CNAME, see RFC 3550.
- std::string c_name;
- } rtp;
-
- // Transport for outgoing packets. The transport is expected to exist for
- // the entire life of the AudioSendStream and is owned by the API client.
- Transport* send_transport = nullptr;
-
- // Underlying VoiceEngine handle, used to map AudioSendStream to lower-level
- // components.
- // TODO(solenberg): Remove when VoiceEngine channels are created outside
- // of Call.
- int voe_channel_id = -1;
-
- // Bitrate limits used for variable audio bitrate streams. Set both to -1 to
- // disable audio bitrate adaptation.
- // Note: This is still an experimental feature and not ready for real usage.
- int min_bitrate_bps = -1;
- int max_bitrate_bps = -1;
-
- // Defines whether to turn on audio network adaptor, and defines its config
- // string.
- rtc::Optional<std::string> audio_network_adaptor_config;
-
- struct SendCodecSpec {
- SendCodecSpec();
- std::string ToString() const;
-
- bool operator==(const SendCodecSpec& rhs) const;
- bool operator!=(const SendCodecSpec& rhs) const {
- return !(*this == rhs);
- }
-
- bool nack_enabled = false;
- bool transport_cc_enabled = false;
- bool enable_codec_fec = false;
- bool enable_opus_dtx = false;
- int opus_max_playback_rate = 0;
- int cng_payload_type = -1;
- int cng_plfreq = -1;
- int max_ptime_ms = -1;
- int min_ptime_ms = -1;
- webrtc::CodecInst codec_inst;
- } send_codec_spec;
- };
-
- // Starts stream activity.
- // When a stream is active, it can receive, process and deliver packets.
- virtual void Start() = 0;
- // Stops stream activity.
- // When a stream is stopped, it can't receive, process or deliver packets.
- virtual void Stop() = 0;
-
- // TODO(solenberg): Make payload_type a config property instead.
- virtual bool SendTelephoneEvent(int payload_type, int payload_frequency,
- int event, int duration_ms) = 0;
-
- virtual void SetMuted(bool muted) = 0;
-
- virtual Stats GetStats() const = 0;
-
- protected:
- virtual ~AudioSendStream() {}
-};
-} // namespace webrtc
-
-#endif // WEBRTC_API_CALL_AUDIO_SEND_STREAM_H_
diff --git a/webrtc/api/call/audio_state.h b/webrtc/api/call/audio_state.h
deleted file mode 100644
index b8dca3f..0000000
--- a/webrtc/api/call/audio_state.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef WEBRTC_API_CALL_AUDIO_STATE_H_
-#define WEBRTC_API_CALL_AUDIO_STATE_H_
-
-#include "webrtc/api/audio/audio_mixer.h"
-#include "webrtc/base/refcount.h"
-#include "webrtc/base/scoped_ref_ptr.h"
-
-namespace webrtc {
-
-class VoiceEngine;
-
-// WORK IN PROGRESS
-// This class is under development and is not yet intended for for use outside
-// of WebRtc/Libjingle. Please use the VoiceEngine API instead.
-// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690
-
-// AudioState holds the state which must be shared between multiple instances of
-// webrtc::Call for audio processing purposes.
-class AudioState : public rtc::RefCountInterface {
- public:
- struct Config {
- // VoiceEngine used for audio streams and audio/video synchronization.
- // AudioState will tickle the VoE refcount to keep it alive for as long as
- // the AudioState itself.
- VoiceEngine* voice_engine = nullptr;
-
- // The audio mixer connected to active receive streams. One per
- // AudioState.
- rtc::scoped_refptr<AudioMixer> audio_mixer;
- };
-
- // TODO(solenberg): Replace scoped_refptr with shared_ptr once we can use it.
- static rtc::scoped_refptr<AudioState> Create(
- const AudioState::Config& config);
-
- virtual ~AudioState() {}
-};
-} // namespace webrtc
-
-#endif // WEBRTC_API_CALL_AUDIO_STATE_H_
diff --git a/webrtc/api/mediacontroller.cc b/webrtc/api/mediacontroller.cc
index 319dd1f..c64ff01 100644
--- a/webrtc/api/mediacontroller.cc
+++ b/webrtc/api/mediacontroller.cc
@@ -15,7 +15,7 @@
#include "webrtc/base/bind.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
-#include "webrtc/call.h"
+#include "webrtc/call/call.h"
#include "webrtc/pc/channelmanager.h"
#include "webrtc/media/base/mediachannel.h"
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 46bdec5..a47b2f2 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -36,7 +36,7 @@
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/trace_event.h"
-#include "webrtc/call.h"
+#include "webrtc/call/call.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/media/sctp/sctpdataengine.h"
#include "webrtc/pc/channelmanager.h"
diff --git a/webrtc/api/webrtcsession.cc b/webrtc/api/webrtcsession.cc
index 0532040..636184b 100644
--- a/webrtc/api/webrtcsession.cc
+++ b/webrtc/api/webrtcsession.cc
@@ -30,7 +30,7 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/stringutils.h"
-#include "webrtc/call.h"
+#include "webrtc/call/call.h"
#include "webrtc/media/base/mediaconstants.h"
#include "webrtc/media/base/videocapturer.h"
#include "webrtc/p2p/base/portallocator.h"