Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 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 <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 Marusic | cd67022 | 2015-07-16 09:30:09 +0200 | [diff] [blame] | 20 | #include "webrtc/stream.h" |
solenberg | 4fbae2b | 2015-08-28 04:07:10 -0700 | [diff] [blame] | 21 | #include "webrtc/transport.h" |
Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 22 | #include "webrtc/typedefs.h" |
| 23 | |
| 24 | namespace webrtc { |
| 25 | |
Jelena Marusic | cd67022 | 2015-07-16 09:30:09 +0200 | [diff] [blame] | 26 | class AudioSendStream : public SendStream { |
Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 27 | public: |
solenberg | 85a0496 | 2015-10-27 03:35:21 -0700 | [diff] [blame^] | 28 | 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 Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 47 | |
| 48 | struct Config { |
solenberg | 4fbae2b | 2015-08-28 04:07:10 -0700 | [diff] [blame] | 49 | Config() = delete; |
pbos | 2d56668 | 2015-09-28 09:59:31 -0700 | [diff] [blame] | 50 | explicit Config(Transport* send_transport) |
solenberg | 4fbae2b | 2015-08-28 04:07:10 -0700 | [diff] [blame] | 51 | : send_transport(send_transport) {} |
| 52 | |
Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 53 | 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; |
| 64 | } rtp; |
| 65 | |
solenberg | c7a8b08 | 2015-10-16 14:35:07 -0700 | [diff] [blame] | 66 | // Transport for outgoing packets. The transport is expected to exist for |
| 67 | // the entire life of the AudioSendStream and is owned by the API client. |
pbos | 2d56668 | 2015-09-28 09:59:31 -0700 | [diff] [blame] | 68 | Transport* send_transport = nullptr; |
solenberg | 4fbae2b | 2015-08-28 04:07:10 -0700 | [diff] [blame] | 69 | |
solenberg | cf18b34 | 2015-10-01 08:13:42 -0700 | [diff] [blame] | 70 | // Underlying VoiceEngine handle, used to map AudioSendStream to lower-level |
| 71 | // components. |
| 72 | // TODO(solenberg): Remove when VoiceEngine channels are created outside |
| 73 | // of Call. |
| 74 | int voe_channel_id = -1; |
| 75 | |
solenberg | c7a8b08 | 2015-10-16 14:35:07 -0700 | [diff] [blame] | 76 | // Ownership of the encoder object is transferred to Call when the config is |
| 77 | // passed to Call::CreateAudioSendStream(). |
| 78 | // TODO(solenberg): Implement, once we configure codecs through the new API. |
| 79 | // rtc::scoped_ptr<AudioEncoder> encoder; |
Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 80 | int cng_payload_type = -1; // pt, or -1 to disable Comfort Noise Generator. |
| 81 | int red_payload_type = -1; // pt, or -1 to disable REDundant coding. |
| 82 | }; |
| 83 | |
| 84 | virtual Stats GetStats() const = 0; |
Fredrik Solenberg | 04f4931 | 2015-06-08 13:04:56 +0200 | [diff] [blame] | 85 | }; |
| 86 | } // namespace webrtc |
| 87 | |
| 88 | #endif // WEBRTC_AUDIO_SEND_STREAM_H_ |