2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-03-01 18:34:25 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-10-04 14:28:39 +02:00
|
|
|
#ifndef AUDIO_CHANNEL_RECEIVE_H_
|
|
|
|
|
#define AUDIO_CHANNEL_RECEIVE_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-01-17 11:18:31 +01:00
|
|
|
#include <map>
|
2016-02-17 10:04:18 -08:00
|
|
|
#include <memory>
|
Remove CodecInst pt.2
The following APIs on AudioCodingModule are deprecated with this CL:
static int NumberOfCodecs();
static int Codec(int, CodecInst*);
static int Codec(const char*, CodecInst*, int, size_t);
static int Codec(const char*, int, size_t);
absl::optional<CodecInst> SendCodec() const;
bool RegisterReceiveCodec(int, const SdpAudioFormat&);
int RegisterExternalReceiveCodec(int, AudioDecoder*, int, int, const std::string&);
int UnregisterReceiveCodec(uint8_t);
int32_t ReceiveCodec(CodecInst*);
absl::optional<SdpAudioFormat> ReceiveFormat();
As well as this method on RtpRtcp module:
int32_t RegisterSendPayload(const CodecInst&);
Bug: webrtc:7626
Change-Id: I1230732136f1fe9048cf74afdeab767ca57ac9ce
Reviewed-on: https://webrtc-review.googlesource.com/c/113816
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26025}
2018-12-11 12:22:10 +01:00
|
|
|
#include <utility>
|
2018-01-17 11:18:31 +01:00
|
|
|
#include <vector>
|
2016-02-17 10:04:18 -08:00
|
|
|
|
2018-06-15 12:28:07 +02:00
|
|
|
#include "absl/types/optional.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio/audio_mixer.h"
|
2018-11-16 09:50:42 +01:00
|
|
|
#include "api/audio_codecs/audio_decoder_factory.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/call/audio_sink.h"
|
2017-09-21 04:02:53 -07:00
|
|
|
#include "api/call/transport.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "api/crypto/crypto_options.h"
|
2019-11-01 11:47:51 +01:00
|
|
|
#include "api/neteq/neteq_factory.h"
|
2019-09-12 13:59:36 +02:00
|
|
|
#include "api/transport/media/media_transport_config.h"
|
|
|
|
|
#include "api/transport/media/media_transport_interface.h"
|
2019-09-02 15:16:49 +02:00
|
|
|
#include "api/transport/rtp/rtp_source.h"
|
2018-11-16 09:50:42 +01:00
|
|
|
#include "call/rtp_packet_sink_interface.h"
|
2018-08-08 10:49:16 +02:00
|
|
|
#include "call/syncable.h"
|
2019-07-30 15:15:59 +02:00
|
|
|
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
|
|
|
|
#include "system_wrappers/include/clock.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-01-30 09:33:03 +01:00
|
|
|
// TODO(solenberg, nisse): This file contains a few NOLINT marks, to silence
|
2018-11-16 09:50:42 +01:00
|
|
|
// warnings about use of unsigned short.
|
2018-01-30 09:33:03 +01:00
|
|
|
// These need cleanup, in a separate cl.
|
|
|
|
|
|
2014-06-05 20:34:08 +00:00
|
|
|
namespace rtc {
|
|
|
|
|
class TimestampWrapAroundHandler;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-23 23:02:24 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
|
2013-07-16 19:25:04 +00:00
|
|
|
class AudioDeviceModule;
|
2018-10-04 14:22:34 -07:00
|
|
|
class FrameDecryptorInterface;
|
2015-12-07 10:26:18 +01:00
|
|
|
class PacketRouter;
|
2013-08-15 23:38:54 +00:00
|
|
|
class ProcessThread;
|
2016-07-29 12:59:36 +02:00
|
|
|
class RateLimiter;
|
2013-08-15 23:38:54 +00:00
|
|
|
class ReceiveStatistics;
|
2015-09-09 00:09:43 -07:00
|
|
|
class RtcEventLog;
|
2017-02-21 06:28:10 -08:00
|
|
|
class RtpPacketReceived;
|
2013-08-15 23:38:54 +00:00
|
|
|
class RtpRtcp;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-10-04 14:28:39 +02:00
|
|
|
struct CallReceiveStatistics {
|
2017-09-18 07:05:30 -07:00
|
|
|
unsigned int cumulativeLost;
|
|
|
|
|
unsigned int jitterSamples;
|
|
|
|
|
int64_t rttMs;
|
2019-10-09 15:01:33 +02:00
|
|
|
int64_t payload_bytes_rcvd = 0;
|
|
|
|
|
int64_t header_and_padding_bytes_rcvd = 0;
|
2017-09-18 07:05:30 -07:00
|
|
|
int packetsReceived;
|
|
|
|
|
// The capture ntp time (in local timebase) of the first played out audio
|
|
|
|
|
// frame.
|
|
|
|
|
int64_t capture_start_ntp_time_ms_;
|
2019-04-15 17:32:00 +02:00
|
|
|
// The timestamp at which the last packet was received, i.e. the time of the
|
|
|
|
|
// local clock when it was received - not the RTP timestamp of that packet.
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-lastpacketreceivedtimestamp
|
|
|
|
|
absl::optional<int64_t> last_packet_received_timestamp_ms;
|
2017-09-18 07:05:30 -07:00
|
|
|
};
|
|
|
|
|
|
2013-09-23 23:02:24 +00:00
|
|
|
namespace voe {
|
|
|
|
|
|
2018-11-19 10:27:07 +01:00
|
|
|
class ChannelSendInterface;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
// Interface class needed for AudioReceiveStream tests that use a
|
|
|
|
|
// MockChannelReceive.
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
class ChannelReceiveInterface : public RtpPacketSinkInterface {
|
2016-01-28 05:22:45 -08:00
|
|
|
public:
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual ~ChannelReceiveInterface() = default;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual void SetSink(AudioSinkInterface* sink) = 0;
|
2016-06-13 07:34:51 -07:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual void SetReceiveCodecs(
|
|
|
|
|
const std::map<int, SdpAudioFormat>& codecs) = 0;
|
2017-03-27 07:15:49 -07:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual void StartPlayout() = 0;
|
|
|
|
|
virtual void StopPlayout() = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
Remove CodecInst pt.2
The following APIs on AudioCodingModule are deprecated with this CL:
static int NumberOfCodecs();
static int Codec(int, CodecInst*);
static int Codec(const char*, CodecInst*, int, size_t);
static int Codec(const char*, int, size_t);
absl::optional<CodecInst> SendCodec() const;
bool RegisterReceiveCodec(int, const SdpAudioFormat&);
int RegisterExternalReceiveCodec(int, AudioDecoder*, int, int, const std::string&);
int UnregisterReceiveCodec(uint8_t);
int32_t ReceiveCodec(CodecInst*);
absl::optional<SdpAudioFormat> ReceiveFormat();
As well as this method on RtpRtcp module:
int32_t RegisterSendPayload(const CodecInst&);
Bug: webrtc:7626
Change-Id: I1230732136f1fe9048cf74afdeab767ca57ac9ce
Reviewed-on: https://webrtc-review.googlesource.com/c/113816
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26025}
2018-12-11 12:22:10 +01:00
|
|
|
// Payload type and format of last received RTP packet, if any.
|
|
|
|
|
virtual absl::optional<std::pair<int, SdpAudioFormat>> GetReceiveCodec()
|
|
|
|
|
const = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2019-03-05 14:29:42 +01:00
|
|
|
virtual void ReceivedRTCPPacket(const uint8_t* data, size_t length) = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual void SetChannelOutputVolumeScaling(float scaling) = 0;
|
|
|
|
|
virtual int GetSpeechOutputLevelFullRange() const = 0;
|
2017-07-14 12:17:49 -07:00
|
|
|
// See description of "totalAudioEnergy" in the WebRTC stats spec:
|
|
|
|
|
// https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamtrackstats-totalaudioenergy
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual double GetTotalOutputEnergy() const = 0;
|
|
|
|
|
virtual double GetTotalOutputDuration() const = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2017-03-13 02:36:19 -07:00
|
|
|
// Stats.
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual NetworkStatistics GetNetworkStatistics() const = 0;
|
|
|
|
|
virtual AudioDecodingCallStats GetDecodingCallStatistics() const = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2017-03-13 02:36:19 -07:00
|
|
|
// Audio+Video Sync.
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual uint32_t GetDelayEstimate() const = 0;
|
|
|
|
|
virtual void SetMinimumPlayoutDelay(int delay_ms) = 0;
|
2019-10-22 15:23:44 +02:00
|
|
|
virtual bool GetPlayoutRtpTimestamp(uint32_t* rtp_timestamp,
|
|
|
|
|
int64_t* time_ms) const = 0;
|
|
|
|
|
virtual void SetEstimatedPlayoutNtpTimestampMs(int64_t ntp_timestamp_ms,
|
|
|
|
|
int64_t time_ms) = 0;
|
|
|
|
|
virtual absl::optional<int64_t> GetCurrentEstimatedPlayoutNtpTimestampMs(
|
|
|
|
|
int64_t now_ms) const = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2019-02-06 09:45:56 +01:00
|
|
|
// Audio quality.
|
|
|
|
|
// Base minimum delay sets lower bound on minimum delay value which
|
|
|
|
|
// determines minimum delay until audio playout.
|
|
|
|
|
virtual bool SetBaseMinimumPlayoutDelayMs(int delay_ms) = 0;
|
|
|
|
|
virtual int GetBaseMinimumPlayoutDelayMs() const = 0;
|
|
|
|
|
|
2018-08-08 10:49:16 +02:00
|
|
|
// Produces the transport-related timestamps; current_delay_ms is left unset.
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual absl::optional<Syncable::Info> GetSyncInfo() const = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual void RegisterReceiverCongestionControlObjects(
|
|
|
|
|
PacketRouter* packet_router) = 0;
|
|
|
|
|
virtual void ResetReceiverCongestionControlObjects() = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual CallReceiveStatistics GetRTCPStatistics() const = 0;
|
|
|
|
|
virtual void SetNACKStatus(bool enable, int max_packets) = 0;
|
2016-01-28 05:22:45 -08:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo(
|
2016-10-20 14:24:39 -07:00
|
|
|
int sample_rate_hz,
|
2018-11-16 09:50:42 +01:00
|
|
|
AudioFrame* audio_frame) = 0;
|
2016-10-20 06:32:39 -07:00
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
virtual int PreferredSampleRate() const = 0;
|
2017-09-22 06:48:10 -07:00
|
|
|
|
2016-01-28 05:22:45 -08:00
|
|
|
// Associate to a send channel.
|
|
|
|
|
// Used for obtaining RTT for a receive-only channel.
|
2018-11-19 10:27:07 +01:00
|
|
|
virtual void SetAssociatedSendChannel(
|
|
|
|
|
const ChannelSendInterface* channel) = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
|
2018-11-16 09:50:42 +01:00
|
|
|
std::unique_ptr<ChannelReceiveInterface> CreateChannelReceive(
|
2019-03-04 17:43:34 +01:00
|
|
|
Clock* clock,
|
2018-11-16 09:50:42 +01:00
|
|
|
ProcessThread* module_process_thread,
|
2019-11-01 11:47:51 +01:00
|
|
|
NetEqFactory* neteq_factory,
|
2018-11-16 09:50:42 +01:00
|
|
|
AudioDeviceModule* audio_device_module,
|
2019-05-21 11:12:57 -07:00
|
|
|
const MediaTransportConfig& media_transport_config,
|
2018-11-16 09:50:42 +01:00
|
|
|
Transport* rtcp_send_transport,
|
|
|
|
|
RtcEventLog* rtc_event_log,
|
2019-08-21 13:36:20 +02:00
|
|
|
uint32_t local_ssrc,
|
2018-11-16 09:50:42 +01:00
|
|
|
uint32_t remote_ssrc,
|
|
|
|
|
size_t jitter_buffer_max_packets,
|
|
|
|
|
bool jitter_buffer_fast_playout,
|
2018-11-27 15:45:20 +01:00
|
|
|
int jitter_buffer_min_delay_ms,
|
2019-01-10 15:58:36 +01:00
|
|
|
bool jitter_buffer_enable_rtx_handling,
|
2018-11-16 09:50:42 +01:00
|
|
|
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
|
|
|
|
|
absl::optional<AudioCodecPairId> codec_pair_id,
|
|
|
|
|
rtc::scoped_refptr<FrameDecryptorInterface> frame_decryptor,
|
|
|
|
|
const webrtc::CryptoOptions& crypto_options);
|
|
|
|
|
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace voe
|
|
|
|
|
} // namespace webrtc
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2018-10-04 14:28:39 +02:00
|
|
|
#endif // AUDIO_CHANNEL_RECEIVE_H_
|