blob: c5db82b91bbf156733967831181a8b5f41ecd28b [file] [log] [blame]
Fredrik Solenberg04f49312015-06-08 13:04:56 +02001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_AUDIO_SEND_STREAM_H_
12#define WEBRTC_AUDIO_SEND_STREAM_H_
13
14#include <string>
15#include <vector>
16
17#include "webrtc/base/scoped_ptr.h"
18#include "webrtc/config.h"
19#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
Jelena Marusiccd670222015-07-16 09:30:09 +020020#include "webrtc/stream.h"
solenberg4fbae2b2015-08-28 04:07:10 -070021#include "webrtc/transport.h"
Fredrik Solenberg04f49312015-06-08 13:04:56 +020022#include "webrtc/typedefs.h"
23
24namespace webrtc {
25
Jelena Marusiccd670222015-07-16 09:30:09 +020026class AudioSendStream : public SendStream {
Fredrik Solenberg04f49312015-06-08 13:04:56 +020027 public:
solenberg85a04962015-10-27 03:35:21 -070028 struct Stats {
29 // TODO(solenberg): Harmonize naming and defaults with receive stream stats.
30 uint32_t local_ssrc = 0;
31 int64_t bytes_sent = 0;
32 int32_t packets_sent = 0;
33 int32_t packets_lost = -1;
34 float fraction_lost = -1.0f;
35 std::string codec_name;
36 int32_t ext_seqnum = -1;
37 int32_t jitter_ms = -1;
38 int64_t rtt_ms = -1;
39 int32_t audio_level = -1;
40 float aec_quality_min = -1.0f;
41 int32_t echo_delay_median_ms = -1;
42 int32_t echo_delay_std_ms = -1;
43 int32_t echo_return_loss = -100;
44 int32_t echo_return_loss_enhancement = -100;
45 bool typing_noise_detected = false;
46 };
Fredrik Solenberg04f49312015-06-08 13:04:56 +020047
48 struct Config {
solenberg4fbae2b2015-08-28 04:07:10 -070049 Config() = delete;
pbos2d566682015-09-28 09:59:31 -070050 explicit Config(Transport* send_transport)
solenberg4fbae2b2015-08-28 04:07:10 -070051 : send_transport(send_transport) {}
52
Fredrik Solenberg04f49312015-06-08 13:04:56 +020053 std::string ToString() const;
54
55 // Receive-stream specific RTP settings.
56 struct Rtp {
57 std::string ToString() const;
58
59 // Sender SSRC.
60 uint32_t ssrc = 0;
61
62 // RTP header extensions used for the received stream.
63 std::vector<RtpExtension> extensions;
solenberg3a941542015-11-16 07:34:50 -080064
65 // RTCP CNAME, see RFC 3550.
66 std::string c_name;
Fredrik Solenberg04f49312015-06-08 13:04:56 +020067 } rtp;
68
solenbergc7a8b082015-10-16 14:35:07 -070069 // Transport for outgoing packets. The transport is expected to exist for
70 // the entire life of the AudioSendStream and is owned by the API client.
pbos2d566682015-09-28 09:59:31 -070071 Transport* send_transport = nullptr;
solenberg4fbae2b2015-08-28 04:07:10 -070072
solenbergcf18b342015-10-01 08:13:42 -070073 // Underlying VoiceEngine handle, used to map AudioSendStream to lower-level
74 // components.
75 // TODO(solenberg): Remove when VoiceEngine channels are created outside
76 // of Call.
77 int voe_channel_id = -1;
78
solenbergc7a8b082015-10-16 14:35:07 -070079 // Ownership of the encoder object is transferred to Call when the config is
80 // passed to Call::CreateAudioSendStream().
81 // TODO(solenberg): Implement, once we configure codecs through the new API.
82 // rtc::scoped_ptr<AudioEncoder> encoder;
Fredrik Solenberg04f49312015-06-08 13:04:56 +020083 int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator.
84 int red_payload_type = -1; // pt, or -1 to disable REDundant coding.
85 };
86
87 virtual Stats GetStats() const = 0;
Fredrik Solenberg04f49312015-06-08 13:04:56 +020088};
89} // namespace webrtc
90
91#endif // WEBRTC_AUDIO_SEND_STREAM_H_