1/*
2 *  Copyright (c) 2012 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_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
12#define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
13
14#include <set>
15
16#include "webrtc/system_wrappers/interface/scoped_ptr.h"
17
18namespace webrtc {
19
20class BitrateController;
21class CallStats;
22class Config;
23class EncoderStateFeedback;
24class ProcessThread;
25class RemoteBitrateEstimator;
26class ViEChannel;
27class ViEEncoder;
28class VieRemb;
29
30// Channel group contains data common for several channels. All channels in the
31// group are assumed to send/receive data to the same end-point.
32class ChannelGroup {
33 public:
34  ChannelGroup(int engine_id, ProcessThread* process_thread,
35               const Config* config);
36  ~ChannelGroup();
37
38  void AddChannel(int channel_id);
39  void RemoveChannel(int channel_id, unsigned int ssrc);
40  bool HasChannel(int channel_id);
41  bool Empty();
42
43  bool SetChannelRembStatus(int channel_id, bool sender, bool receiver,
44                            ViEChannel* channel);
45  void SetBandwidthEstimationConfig(const webrtc::Config& config);
46
47  BitrateController* GetBitrateController();
48  CallStats* GetCallStats();
49  RemoteBitrateEstimator* GetRemoteBitrateEstimator();
50  EncoderStateFeedback* GetEncoderStateFeedback();
51
52 private:
53  typedef std::set<int> ChannelSet;
54
55  scoped_ptr<VieRemb> remb_;
56  scoped_ptr<BitrateController> bitrate_controller_;
57  scoped_ptr<CallStats> call_stats_;
58  scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
59  scoped_ptr<EncoderStateFeedback> encoder_state_feedback_;
60  ChannelSet channels_;
61  const Config* config_;
62  // Placeholder for the case where this owns the config.
63  scoped_ptr<Config> own_config_;
64
65  // Registered at construct time and assumed to outlive this class.
66  ProcessThread* process_thread_;
67};
68
69}  // namespace webrtc
70
71#endif  // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
72