blob: ec2a4db413dd0fd337b8f8fc6e5d32d8b699bccf [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,
mflodman86cc6ff2016-07-26 04:44:06 -070036 CongestionController* congestion_controller,
37 BitrateAllocator* bitrate_allocator);
solenbergc7a8b082015-10-16 14:35:07 -070038 ~AudioSendStream() override;
39
pbos1ba8d392016-05-01 20:18:34 -070040 // webrtc::AudioSendStream implementation.
solenbergc7a8b082015-10-16 14:35:07 -070041 void Start() override;
42 void Stop() override;
solenberg8842c3e2016-03-11 03:06:41 -080043 bool SendTelephoneEvent(int payload_type, int event,
44 int duration_ms) override;
solenberg94218532016-06-16 10:53:22 -070045 void SetMuted(bool muted) override;
solenbergc7a8b082015-10-16 14:35:07 -070046 webrtc::AudioSendStream::Stats GetStats() const override;
47
pbos1ba8d392016-05-01 20:18:34 -070048 void SignalNetworkState(NetworkState state);
49 bool DeliverRtcp(const uint8_t* packet, size_t length);
mflodman86cc6ff2016-07-26 04:44:06 -070050
51 // Implements BitrateAllocatorObserver.
52 uint32_t OnBitrateUpdated(uint32_t bitrate_bps,
53 uint8_t fraction_loss,
54 int64_t rtt) override;
55
solenberg85a04962015-10-27 03:35:21 -070056 const webrtc::AudioSendStream::Config& config() const;
solenbergc7a8b082015-10-16 14:35:07 -070057
58 private:
solenberg3a941542015-11-16 07:34:50 -080059 VoiceEngine* voice_engine() const;
60
solenberg85a04962015-10-27 03:35:21 -070061 rtc::ThreadChecker thread_checker_;
solenbergc7a8b082015-10-16 14:35:07 -070062 const webrtc::AudioSendStream::Config config_;
solenberg566ef242015-11-06 15:34:49 -080063 rtc::scoped_refptr<webrtc::AudioState> audio_state_;
kwibergfffa42b2016-02-23 10:46:32 -080064 std::unique_ptr<voe::ChannelProxy> channel_proxy_;
solenberg85a04962015-10-27 03:35:21 -070065
mflodman86cc6ff2016-07-26 04:44:06 -070066 BitrateAllocator* const bitrate_allocator_;
67
solenberg85a04962015-10-27 03:35:21 -070068 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSendStream);
solenbergc7a8b082015-10-16 14:35:07 -070069};
70} // namespace internal
71} // namespace webrtc
72
73#endif // WEBRTC_AUDIO_AUDIO_SEND_STREAM_H_