blob: 3e5a518a7d5efce9f9f0194a5dc98e40ec95d733 [file] [log] [blame]
Fredrik Solenberg23fba1f2015-04-29 13:24:011/*
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_RECEIVE_STREAM_H_
12#define WEBRTC_AUDIO_RECEIVE_STREAM_H_
13
Fredrik Solenberg04f49312015-06-08 11:04:5614#include <map>
Fredrik Solenberg23fba1f2015-04-29 13:24:0115#include <string>
16#include <vector>
17
Fredrik Solenberg23fba1f2015-04-29 13:24:0118#include "webrtc/config.h"
Jelena Marusiccd670222015-07-16 07:30:0919#include "webrtc/stream.h"
solenbergcf18b342015-10-01 15:13:4220#include "webrtc/transport.h"
Fredrik Solenberg04f49312015-06-08 11:04:5621#include "webrtc/typedefs.h"
Fredrik Solenberg23fba1f2015-04-29 13:24:0122
23namespace webrtc {
24
Fredrik Solenberg04f49312015-06-08 11:04:5625class AudioDecoder;
26
Jelena Marusiccd670222015-07-16 07:30:0927class AudioReceiveStream : public ReceiveStream {
Fredrik Solenberg23fba1f2015-04-29 13:24:0128 public:
Fredrik Solenberg4f4ec0a2015-10-22 08:49:2729 struct Stats {
30 uint32_t remote_ssrc = 0;
31 int64_t bytes_rcvd = 0;
32 uint32_t packets_rcvd = 0;
33 uint32_t packets_lost = 0;
34 float fraction_lost = 0.0f;
35 std::string codec_name;
36 uint32_t ext_seqnum = 0;
37 uint32_t jitter_ms = 0;
38 uint32_t jitter_buffer_ms = 0;
39 uint32_t jitter_buffer_preferred_ms = 0;
40 uint32_t delay_estimate_ms = 0;
41 int32_t audio_level = -1;
42 float expand_rate = 0.0f;
43 float speech_expand_rate = 0.0f;
44 float secondary_decoded_rate = 0.0f;
45 float accelerate_rate = 0.0f;
46 float preemptive_expand_rate = 0.0f;
47 int32_t decoding_calls_to_silence_generator = 0;
48 int32_t decoding_calls_to_neteq = 0;
49 int32_t decoding_normal = 0;
50 int32_t decoding_plc = 0;
51 int32_t decoding_cng = 0;
52 int32_t decoding_plc_cng = 0;
53 int64_t capture_start_ntp_time_ms = 0;
54 };
Fredrik Solenberg04f49312015-06-08 11:04:5655
Fredrik Solenberg23fba1f2015-04-29 13:24:0156 struct Config {
Fredrik Solenberg23fba1f2015-04-29 13:24:0157 std::string ToString() const;
58
59 // Receive-stream specific RTP settings.
60 struct Rtp {
Fredrik Solenberg23fba1f2015-04-29 13:24:0161 std::string ToString() const;
62
63 // Synchronization source (stream identifier) to be received.
Fredrik Solenberg04f49312015-06-08 11:04:5664 uint32_t remote_ssrc = 0;
65
66 // Sender SSRC used for sending RTCP (such as receiver reports).
67 uint32_t local_ssrc = 0;
Fredrik Solenberg23fba1f2015-04-29 13:24:0168
69 // RTP header extensions used for the received stream.
70 std::vector<RtpExtension> extensions;
71 } rtp;
Fredrik Solenberg04f49312015-06-08 11:04:5672
solenbergcf18b342015-10-01 15:13:4273 Transport* receive_transport = nullptr;
74 Transport* rtcp_send_transport = nullptr;
75
76 // Underlying VoiceEngine handle, used to map AudioReceiveStream to lower-
77 // level components.
78 // TODO(solenberg): Remove when VoiceEngine channels are created outside
79 // of Call.
pbos8fc7fa72015-07-15 15:02:5880 int voe_channel_id = -1;
81
82 // Identifier for an A/V synchronization group. Empty string to disable.
83 // TODO(pbos): Synchronize streams in a sync group, not just one video
84 // stream to one audio stream. Tracked by issue webrtc:4762.
85 std::string sync_group;
86
Fredrik Solenberg04f49312015-06-08 11:04:5687 // Decoders for every payload that we can receive. Call owns the
88 // AudioDecoder instances once the Config is submitted to
89 // Call::CreateReceiveStream().
90 // TODO(solenberg): Use unique_ptr<> once our std lib fully supports C++11.
91 std::map<uint8_t, AudioDecoder*> decoder_map;
pbos6bb1b6e2015-07-24 14:10:1892
93 // TODO(pbos): Remove config option once combined A/V BWE is always on.
94 bool combined_audio_video_bwe = false;
Fredrik Solenberg23fba1f2015-04-29 13:24:0195 };
96
Fredrik Solenberg04f49312015-06-08 11:04:5697 virtual Stats GetStats() const = 0;
Fredrik Solenberg23fba1f2015-04-29 13:24:0198};
Fredrik Solenberg23fba1f2015-04-29 13:24:0199} // namespace webrtc
100
101#endif // WEBRTC_AUDIO_RECEIVE_STREAM_H_