blob: e92c326c537813270e62e2a2552b40fb37a0464d [file] [log] [blame]
solenbergc7a8b082015-10-16 14:35:07 -07001/*
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_AUDIO_SEND_STREAM_H_
12#define WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_
13
kwibergfffa42b2016-02-23 10:46:32 -080014#include <memory>
15
kjellandera69d9732016-08-31 07:33:05 -070016#include "webrtc/api/call/audio_send_stream.h"
17#include "webrtc/api/call/audio_state.h"
kwiberg4485ffb2016-04-26 08:14:39 -070018#include "webrtc/base/constructormagic.h"
solenberg85a04962015-10-27 03:35:21 -070019#include "webrtc/base/thread_checker.h"
mflodman86cc6ff2016-07-26 04:44:06 -070020#include "webrtc/call/bitrate_allocator.h"
solenbergc7a8b082015-10-16 14:35:07 -070021
22namespace webrtc {
Stefan Holmerb86d4e42015-12-07 10:26:18 +010023class CongestionController;
solenberg3a941542015-11-16 07:34:50 -080024class VoiceEngine;
25
solenberg13725082015-11-25 08:16:52 -080026namespace voe {
27class ChannelProxy;
28} // namespace voe
solenbergc7a8b082015-10-16 14:35:07 -070029
solenberg13725082015-11-25 08:16:52 -080030namespace internal {
mflodman86cc6ff2016-07-26 04:44:06 -070031class AudioSendStream final : public webrtc::AudioSendStream,
32 public webrtc::BitrateAllocatorObserver {
solenbergc7a8b082015-10-16 14:35:07 -070033 public:
solenberg85a04962015-10-27 03:35:21 -070034 AudioSendStream(const webrtc::AudioSendStream::Config& config,
Stefan Holmerb86d4e42015-12-07 10:26:18 +010035 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
perkj26091b12016-09-01 01:17:40 -070036 rtc::TaskQueue* worker_queue,
mflodman86cc6ff2016-07-26 04:44:06 -070037 CongestionController* congestion_controller,
38 BitrateAllocator* bitrate_allocator);
solenbergc7a8b082015-10-16 14:35:07 -070039 ~AudioSendStream() override;
40
pbos1ba8d392016-05-01 20:18:34 -070041 // webrtc::AudioSendStream implementation.
solenbergc7a8b082015-10-16 14:35:07 -070042 void Start() override;
43 void Stop() override;
solenberg8842c3e2016-03-11 03:06:41 -080044 bool SendTelephoneEvent(int payload_type, int event,
45 int duration_ms) override;
solenberg94218532016-06-16 10:53:22 -070046 void SetMuted(bool muted) override;
solenbergc7a8b082015-10-16 14:35:07 -070047 webrtc::AudioSendStream::Stats GetStats() const override;
48
pbos1ba8d392016-05-01 20:18:34 -070049 void SignalNetworkState(NetworkState state);
50 bool DeliverRtcp(const uint8_t* packet, size_t length);
mflodman86cc6ff2016-07-26 04:44:06 -070051
52 // Implements BitrateAllocatorObserver.
53 uint32_t OnBitrateUpdated(uint32_t bitrate_bps,
54 uint8_t fraction_loss,
55 int64_t rtt) override;
56
solenberg85a04962015-10-27 03:35:21 -070057 const webrtc::AudioSendStream::Config& config() const;
solenbergc7a8b082015-10-16 14:35:07 -070058
59 private:
solenberg3a941542015-11-16 07:34:50 -080060 VoiceEngine* voice_engine() const;
61
solenberg85a04962015-10-27 03:35:21 -070062 rtc::ThreadChecker thread_checker_;
perkj26091b12016-09-01 01:17:40 -070063 rtc::TaskQueue* worker_queue_;
solenbergc7a8b082015-10-16 14:35:07 -070064 const webrtc::AudioSendStream::Config config_;
solenberg566ef242015-11-06 15:34:49 -080065 rtc::scoped_refptr<webrtc::AudioState> audio_state_;
kwibergfffa42b2016-02-23 10:46:32 -080066 std::unique_ptr<voe::ChannelProxy> channel_proxy_;
solenberg85a04962015-10-27 03:35:21 -070067
mflodman86cc6ff2016-07-26 04:44:06 -070068 BitrateAllocator* const bitrate_allocator_;
69
solenberg85a04962015-10-27 03:35:21 -070070 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
solenbergc7a8b082015-10-16 14:35:07 -070071};
72} // namespace internal
73} // namespace webrtc
74
75#endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_