OLD | NEW |
| (Empty) |
1 /* | |
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 <memory> | |
15 #include <string> | |
16 #include <vector> | |
17 | |
18 #include "webrtc/config.h" | |
19 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | |
20 #include "webrtc/transport.h" | |
21 #include "webrtc/typedefs.h" | |
22 | |
23 namespace webrtc { | |
24 | |
25 // WORK IN PROGRESS | |
26 // This class is under development and is not yet intended for for use outside | |
27 // of WebRtc/Libjingle. Please use the VoiceEngine API instead. | |
28 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=4690 | |
29 | |
30 class AudioSendStream { | |
31 public: | |
32 struct Stats { | |
33 // TODO(solenberg): Harmonize naming and defaults with receive stream stats. | |
34 uint32_t local_ssrc = 0; | |
35 int64_t bytes_sent = 0; | |
36 int32_t packets_sent = 0; | |
37 int32_t packets_lost = -1; | |
38 float fraction_lost = -1.0f; | |
39 std::string codec_name; | |
40 int32_t ext_seqnum = -1; | |
41 int32_t jitter_ms = -1; | |
42 int64_t rtt_ms = -1; | |
43 int32_t audio_level = -1; | |
44 float aec_quality_min = -1.0f; | |
45 int32_t echo_delay_median_ms = -1; | |
46 int32_t echo_delay_std_ms = -1; | |
47 int32_t echo_return_loss = -100; | |
48 int32_t echo_return_loss_enhancement = -100; | |
49 bool typing_noise_detected = false; | |
50 }; | |
51 | |
52 struct Config { | |
53 Config() = delete; | |
54 explicit Config(Transport* send_transport) | |
55 : send_transport(send_transport) {} | |
56 | |
57 std::string ToString() const; | |
58 | |
59 // Send-stream specific RTP settings. | |
60 struct Rtp { | |
61 std::string ToString() const; | |
62 | |
63 // Sender SSRC. | |
64 uint32_t ssrc = 0; | |
65 | |
66 // RTP header extensions used for the sent stream. | |
67 std::vector<RtpExtension> extensions; | |
68 | |
69 // See NackConfig for description. | |
70 NackConfig nack; | |
71 | |
72 // RTCP CNAME, see RFC 3550. | |
73 std::string c_name; | |
74 } rtp; | |
75 | |
76 // Transport for outgoing packets. The transport is expected to exist for | |
77 // the entire life of the AudioSendStream and is owned by the API client. | |
78 Transport* send_transport = nullptr; | |
79 | |
80 // Underlying VoiceEngine handle, used to map AudioSendStream to lower-level | |
81 // components. | |
82 // TODO(solenberg): Remove when VoiceEngine channels are created outside | |
83 // of Call. | |
84 int voe_channel_id = -1; | |
85 | |
86 // Ownership of the encoder object is transferred to Call when the config is | |
87 // passed to Call::CreateAudioSendStream(). | |
88 // TODO(solenberg): Implement, once we configure codecs through the new API. | |
89 // std::unique_ptr<AudioEncoder> encoder; | |
90 int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator. | |
91 | |
92 // Bitrate limits used for variable audio bitrate streams. Set both to -1 to | |
93 // disable audio bitrate adaptation. | |
94 // Note: This is still an experimental feature and not ready for real usage. | |
95 int min_bitrate_kbps = -1; | |
96 int max_bitrate_kbps = -1; | |
97 }; | |
98 | |
99 // Starts stream activity. | |
100 // When a stream is active, it can receive, process and deliver packets. | |
101 virtual void Start() = 0; | |
102 // Stops stream activity. | |
103 // When a stream is stopped, it can't receive, process or deliver packets. | |
104 virtual void Stop() = 0; | |
105 | |
106 // TODO(solenberg): Make payload_type a config property instead. | |
107 virtual bool SendTelephoneEvent(int payload_type, int event, | |
108 int duration_ms) = 0; | |
109 | |
110 virtual void SetMuted(bool muted) = 0; | |
111 | |
112 virtual Stats GetStats() const = 0; | |
113 | |
114 protected: | |
115 virtual ~AudioSendStream() {} | |
116 }; | |
117 } // namespace webrtc | |
118 | |
119 #endif // WEBRTC_AUDIO_SEND_STREAM_H_ | |
OLD | NEW |