2015-06-08 13:04:56 +02:00
|
|
|
/*
|
|
|
|
|
* 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_AUDIO_SEND_STREAM_H_
|
|
|
|
|
#define WEBRTC_AUDIO_SEND_STREAM_H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
|
|
|
|
#include "webrtc/config.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
2015-07-16 09:30:09 +02:00
|
|
|
#include "webrtc/stream.h"
|
2015-08-28 04:07:10 -07:00
|
|
|
#include "webrtc/transport.h"
|
2015-06-08 13:04:56 +02:00
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-12-03 13:06:20 +01:00
|
|
|
// 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
|
|
|
|
|
|
2015-07-16 09:30:09 +02:00
|
|
|
class AudioSendStream : public SendStream {
|
2015-06-08 13:04:56 +02:00
|
|
|
public:
|
2015-10-27 03:35:21 -07:00
|
|
|
struct 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;
|
|
|
|
|
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;
|
|
|
|
|
bool typing_noise_detected = false;
|
|
|
|
|
};
|
2015-06-08 13:04:56 +02:00
|
|
|
|
|
|
|
|
struct Config {
|
2015-08-28 04:07:10 -07:00
|
|
|
Config() = delete;
|
2015-09-28 09:59:31 -07:00
|
|
|
explicit Config(Transport* send_transport)
|
2015-08-28 04:07:10 -07:00
|
|
|
: send_transport(send_transport) {}
|
|
|
|
|
|
2015-06-08 13:04:56 +02:00
|
|
|
std::string ToString() const;
|
|
|
|
|
|
|
|
|
|
// Receive-stream specific RTP settings.
|
|
|
|
|
struct Rtp {
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
|
|
|
|
// Sender SSRC.
|
|
|
|
|
uint32_t ssrc = 0;
|
|
|
|
|
|
2015-12-07 10:26:18 +01:00
|
|
|
// RTP header extensions used for the sent stream.
|
2015-06-08 13:04:56 +02:00
|
|
|
std::vector<RtpExtension> extensions;
|
2015-11-16 07:34:50 -08:00
|
|
|
|
|
|
|
|
// RTCP CNAME, see RFC 3550.
|
|
|
|
|
std::string c_name;
|
2015-06-08 13:04:56 +02:00
|
|
|
} rtp;
|
|
|
|
|
|
2015-10-16 14:35:07 -07:00
|
|
|
// Transport for outgoing packets. The transport is expected to exist for
|
|
|
|
|
// the entire life of the AudioSendStream and is owned by the API client.
|
2015-09-28 09:59:31 -07:00
|
|
|
Transport* send_transport = nullptr;
|
2015-08-28 04:07:10 -07:00
|
|
|
|
2015-10-01 08:13:42 -07:00
|
|
|
// 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;
|
|
|
|
|
|
2015-10-16 14:35:07 -07:00
|
|
|
// Ownership of the encoder object is transferred to Call when the config is
|
|
|
|
|
// passed to Call::CreateAudioSendStream().
|
|
|
|
|
// TODO(solenberg): Implement, once we configure codecs through the new API.
|
|
|
|
|
// rtc::scoped_ptr<AudioEncoder> encoder;
|
2015-06-08 13:04:56 +02:00
|
|
|
int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator.
|
|
|
|
|
int red_payload_type = -1; // pt, or -1 to disable REDundant coding.
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-04 15:22:19 +01:00
|
|
|
// TODO(solenberg): Make payload_type a config property instead.
|
2016-03-11 03:06:41 -08:00
|
|
|
virtual bool SendTelephoneEvent(int payload_type, int event,
|
|
|
|
|
int duration_ms) = 0;
|
2015-06-08 13:04:56 +02:00
|
|
|
virtual Stats GetStats() const = 0;
|
|
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // WEBRTC_AUDIO_SEND_STREAM_H_
|