2012-03-05 17:12:41 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|
|
|
|
|
#define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|
|
|
|
|
|
2015-03-09 10:06:40 +00:00
|
|
|
#include <list>
|
|
|
|
|
#include <map>
|
2012-03-05 17:12:41 +00:00
|
|
|
#include <set>
|
2015-03-09 10:06:40 +00:00
|
|
|
#include <vector>
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-02-26 14:34:55 +00:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2015-03-04 12:24:26 +00:00
|
|
|
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
|
2012-03-05 17:12:41 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-03-04 12:24:26 +00:00
|
|
|
class BitrateAllocator;
|
2012-11-26 12:40:15 +00:00
|
|
|
class CallStats;
|
2013-05-13 10:50:50 +00:00
|
|
|
class Config;
|
2012-10-05 16:17:41 +00:00
|
|
|
class EncoderStateFeedback;
|
2015-03-26 11:11:06 +01:00
|
|
|
class PacedSender;
|
|
|
|
|
class PacketRouter;
|
2012-03-05 17:12:41 +00:00
|
|
|
class ProcessThread;
|
2013-05-14 12:10:58 +00:00
|
|
|
class RemoteBitrateEstimator;
|
2012-03-05 17:12:41 +00:00
|
|
|
class ViEChannel;
|
|
|
|
|
class ViEEncoder;
|
|
|
|
|
class VieRemb;
|
2015-03-09 10:06:40 +00:00
|
|
|
class VoEVideoSync;
|
|
|
|
|
|
|
|
|
|
typedef std::list<ViEChannel*> ChannelList;
|
2012-03-05 17:12:41 +00:00
|
|
|
|
|
|
|
|
// Channel group contains data common for several channels. All channels in the
|
|
|
|
|
// group are assumed to send/receive data to the same end-point.
|
2015-03-04 12:24:26 +00:00
|
|
|
class ChannelGroup : public BitrateObserver {
|
2012-03-05 17:12:41 +00:00
|
|
|
public:
|
2015-05-28 14:10:39 +02:00
|
|
|
explicit ChannelGroup(ProcessThread* process_thread);
|
2012-03-05 17:12:41 +00:00
|
|
|
~ChannelGroup();
|
2015-03-09 10:06:40 +00:00
|
|
|
bool CreateSendChannel(int channel_id,
|
|
|
|
|
int engine_id,
|
2015-05-28 14:10:39 +02:00
|
|
|
Transport* transport,
|
2015-05-26 11:44:05 +02:00
|
|
|
int number_of_cores,
|
2015-07-20 08:01:17 -07:00
|
|
|
const std::vector<uint32_t>& ssrcs,
|
2015-05-26 11:44:05 +02:00
|
|
|
bool disable_default_encoder);
|
2015-03-09 10:06:40 +00:00
|
|
|
bool CreateReceiveChannel(int channel_id,
|
|
|
|
|
int engine_id,
|
|
|
|
|
int base_channel_id,
|
2015-05-28 14:10:39 +02:00
|
|
|
Transport* transport,
|
2015-05-26 11:44:05 +02:00
|
|
|
int number_of_cores,
|
|
|
|
|
bool disable_default_encoder);
|
2015-03-09 10:06:40 +00:00
|
|
|
void DeleteChannel(int channel_id);
|
2012-03-05 17:12:41 +00:00
|
|
|
void AddChannel(int channel_id);
|
2015-03-09 10:06:40 +00:00
|
|
|
void RemoveChannel(int channel_id);
|
|
|
|
|
bool HasChannel(int channel_id) const;
|
|
|
|
|
bool Empty() const;
|
|
|
|
|
ViEChannel* GetChannel(int channel_id) const;
|
|
|
|
|
ViEEncoder* GetEncoder(int channel_id) const;
|
|
|
|
|
std::vector<int> GetChannelIds() const;
|
|
|
|
|
bool OtherChannelsUsingEncoder(int channel_id) const;
|
|
|
|
|
void GetChannelsUsingEncoder(int channel_id, ChannelList* channels) const;
|
|
|
|
|
|
|
|
|
|
void SetSyncInterface(VoEVideoSync* sync_interface);
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-04-09 14:35:37 +02:00
|
|
|
void SetChannelRembStatus(bool sender, bool receiver, ViEChannel* channel);
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-03-09 10:06:40 +00:00
|
|
|
BitrateController* GetBitrateController() const;
|
|
|
|
|
CallStats* GetCallStats() const;
|
|
|
|
|
RemoteBitrateEstimator* GetRemoteBitrateEstimator() const;
|
|
|
|
|
EncoderStateFeedback* GetEncoderStateFeedback() const;
|
2015-03-26 11:11:06 +01:00
|
|
|
int64_t GetPacerQueuingDelayMs() const;
|
2012-04-27 05:25:53 +00:00
|
|
|
|
2015-03-04 12:24:26 +00:00
|
|
|
// Implements BitrateObserver.
|
|
|
|
|
void OnNetworkChanged(uint32_t target_bitrate_bps,
|
|
|
|
|
uint8_t fraction_loss,
|
|
|
|
|
int64_t rtt) override;
|
|
|
|
|
|
2012-03-05 17:12:41 +00:00
|
|
|
private:
|
2015-03-09 10:06:40 +00:00
|
|
|
typedef std::map<int, ViEChannel*> ChannelMap;
|
2012-03-05 17:12:41 +00:00
|
|
|
typedef std::set<int> ChannelSet;
|
2015-03-09 10:06:40 +00:00
|
|
|
typedef std::map<int, ViEEncoder*> EncoderMap;
|
|
|
|
|
|
|
|
|
|
bool CreateChannel(int channel_id,
|
|
|
|
|
int engine_id,
|
2015-05-28 14:10:39 +02:00
|
|
|
Transport* transport,
|
2015-03-09 10:06:40 +00:00
|
|
|
int number_of_cores,
|
|
|
|
|
ViEEncoder* vie_encoder,
|
2015-07-14 16:08:02 +02:00
|
|
|
size_t max_rtp_streams,
|
2015-05-26 11:44:05 +02:00
|
|
|
bool sender,
|
|
|
|
|
bool disable_default_encoder);
|
2015-03-09 10:06:40 +00:00
|
|
|
ViEChannel* PopChannel(int channel_id);
|
|
|
|
|
ViEEncoder* PopEncoder(int channel_id);
|
2012-03-05 17:12:41 +00:00
|
|
|
|
2015-02-26 14:34:55 +00:00
|
|
|
rtc::scoped_ptr<VieRemb> remb_;
|
2015-03-04 12:24:26 +00:00
|
|
|
rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
|
2015-02-26 14:34:55 +00:00
|
|
|
rtc::scoped_ptr<CallStats> call_stats_;
|
|
|
|
|
rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
|
|
|
|
|
rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_;
|
2015-03-26 11:11:06 +01:00
|
|
|
rtc::scoped_ptr<PacketRouter> packet_router_;
|
|
|
|
|
rtc::scoped_ptr<PacedSender> pacer_;
|
2012-03-05 17:12:41 +00:00
|
|
|
ChannelSet channels_;
|
2015-03-09 10:06:40 +00:00
|
|
|
ChannelMap channel_map_;
|
|
|
|
|
// Maps Channel id -> ViEEncoder.
|
|
|
|
|
EncoderMap vie_encoder_map_;
|
2015-05-13 14:01:38 +02:00
|
|
|
EncoderMap send_encoders_;
|
2015-03-26 11:11:06 +01:00
|
|
|
rtc::scoped_ptr<CriticalSectionWrapper> encoder_map_cs_;
|
|
|
|
|
|
2015-05-28 14:10:39 +02:00
|
|
|
const rtc::scoped_ptr<Config> config_;
|
2012-11-26 12:40:15 +00:00
|
|
|
|
2013-04-22 12:41:57 +00:00
|
|
|
// Registered at construct time and assumed to outlive this class.
|
2012-11-26 12:40:15 +00:00
|
|
|
ProcessThread* process_thread_;
|
2015-03-26 11:11:06 +01:00
|
|
|
rtc::scoped_ptr<ProcessThread> pacer_thread_;
|
|
|
|
|
|
|
|
|
|
rtc::scoped_ptr<BitrateController> bitrate_controller_;
|
2012-03-05 17:12:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_
|