OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ | 11 #ifndef WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ |
12 #define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ | 12 #define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
16 #include <set> | 16 #include <set> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
| 19 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/scoped_ptr.h" | 20 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 21 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 class BitrateAllocator; | 25 class BitrateAllocator; |
25 class CallStats; | 26 class CallStats; |
26 class Config; | 27 class Config; |
27 class EncoderStateFeedback; | 28 class EncoderStateFeedback; |
28 class PacedSender; | 29 class PacedSender; |
(...skipping 10 matching lines...) Expand all Loading... |
39 // Channel group contains data common for several channels. All channels in the | 40 // Channel group contains data common for several channels. All channels in the |
40 // group are assumed to send/receive data to the same end-point. | 41 // group are assumed to send/receive data to the same end-point. |
41 class ChannelGroup : public BitrateObserver { | 42 class ChannelGroup : public BitrateObserver { |
42 public: | 43 public: |
43 explicit ChannelGroup(ProcessThread* process_thread); | 44 explicit ChannelGroup(ProcessThread* process_thread); |
44 ~ChannelGroup(); | 45 ~ChannelGroup(); |
45 bool CreateSendChannel(int channel_id, | 46 bool CreateSendChannel(int channel_id, |
46 int engine_id, | 47 int engine_id, |
47 Transport* transport, | 48 Transport* transport, |
48 int number_of_cores, | 49 int number_of_cores, |
49 const std::vector<uint32_t>& ssrcs, | 50 const std::vector<uint32_t>& ssrcs); |
50 bool disable_default_encoder); | |
51 bool CreateReceiveChannel(int channel_id, | 51 bool CreateReceiveChannel(int channel_id, |
52 int engine_id, | 52 int engine_id, |
53 int base_channel_id, | |
54 Transport* transport, | 53 Transport* transport, |
55 int number_of_cores, | 54 int number_of_cores); |
56 bool disable_default_encoder); | |
57 void DeleteChannel(int channel_id); | 55 void DeleteChannel(int channel_id); |
58 void AddChannel(int channel_id); | |
59 void RemoveChannel(int channel_id); | |
60 bool HasChannel(int channel_id) const; | |
61 bool Empty() const; | |
62 ViEChannel* GetChannel(int channel_id) const; | 56 ViEChannel* GetChannel(int channel_id) const; |
63 ViEEncoder* GetEncoder(int channel_id) const; | 57 ViEEncoder* GetEncoder(int channel_id) const; |
64 std::vector<int> GetChannelIds() const; | |
65 bool OtherChannelsUsingEncoder(int channel_id) const; | |
66 void GetChannelsUsingEncoder(int channel_id, ChannelList* channels) const; | |
67 | |
68 void SetSyncInterface(VoEVideoSync* sync_interface); | 58 void SetSyncInterface(VoEVideoSync* sync_interface); |
69 | 59 |
70 void SetChannelRembStatus(bool sender, bool receiver, ViEChannel* channel); | 60 void SetChannelRembStatus(bool sender, bool receiver, ViEChannel* channel); |
71 | 61 |
72 BitrateController* GetBitrateController() const; | 62 BitrateController* GetBitrateController() const; |
73 CallStats* GetCallStats() const; | 63 CallStats* GetCallStats() const; |
74 RemoteBitrateEstimator* GetRemoteBitrateEstimator() const; | 64 RemoteBitrateEstimator* GetRemoteBitrateEstimator() const; |
75 EncoderStateFeedback* GetEncoderStateFeedback() const; | 65 EncoderStateFeedback* GetEncoderStateFeedback() const; |
76 int64_t GetPacerQueuingDelayMs() const; | 66 int64_t GetPacerQueuingDelayMs() const; |
77 | 67 |
78 // Implements BitrateObserver. | 68 // Implements BitrateObserver. |
79 void OnNetworkChanged(uint32_t target_bitrate_bps, | 69 void OnNetworkChanged(uint32_t target_bitrate_bps, |
80 uint8_t fraction_loss, | 70 uint8_t fraction_loss, |
81 int64_t rtt) override; | 71 int64_t rtt) override; |
82 | 72 |
83 private: | 73 private: |
84 typedef std::map<int, ViEChannel*> ChannelMap; | 74 typedef std::map<int, ViEChannel*> ChannelMap; |
85 typedef std::set<int> ChannelSet; | |
86 typedef std::map<int, ViEEncoder*> EncoderMap; | 75 typedef std::map<int, ViEEncoder*> EncoderMap; |
87 | 76 |
88 bool CreateChannel(int channel_id, | 77 bool CreateChannel(int channel_id, |
89 int engine_id, | 78 int engine_id, |
90 Transport* transport, | 79 Transport* transport, |
91 int number_of_cores, | 80 int number_of_cores, |
92 ViEEncoder* vie_encoder, | 81 ViEEncoder* vie_encoder, |
93 size_t max_rtp_streams, | 82 size_t max_rtp_streams, |
94 bool sender, | 83 bool sender); |
95 bool disable_default_encoder); | |
96 ViEChannel* PopChannel(int channel_id); | 84 ViEChannel* PopChannel(int channel_id); |
97 ViEEncoder* PopEncoder(int channel_id); | |
98 | 85 |
99 rtc::scoped_ptr<VieRemb> remb_; | 86 rtc::scoped_ptr<VieRemb> remb_; |
100 rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; | 87 rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; |
101 rtc::scoped_ptr<CallStats> call_stats_; | 88 rtc::scoped_ptr<CallStats> call_stats_; |
102 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 89 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
103 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; | 90 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; |
104 rtc::scoped_ptr<PacketRouter> packet_router_; | 91 rtc::scoped_ptr<PacketRouter> packet_router_; |
105 rtc::scoped_ptr<PacedSender> pacer_; | 92 rtc::scoped_ptr<PacedSender> pacer_; |
106 ChannelSet channels_; | |
107 ChannelMap channel_map_; | 93 ChannelMap channel_map_; |
108 // Maps Channel id -> ViEEncoder. | 94 // Maps Channel id -> ViEEncoder. |
109 EncoderMap vie_encoder_map_; | 95 mutable rtc::CriticalSection encoder_map_crit_; |
110 EncoderMap send_encoders_; | 96 EncoderMap vie_encoder_map_ GUARDED_BY(encoder_map_crit_); |
111 rtc::scoped_ptr<CriticalSectionWrapper> encoder_map_cs_; | |
112 | 97 |
113 const rtc::scoped_ptr<Config> config_; | 98 const rtc::scoped_ptr<Config> config_; |
114 | 99 |
115 // Registered at construct time and assumed to outlive this class. | 100 // Registered at construct time and assumed to outlive this class. |
116 ProcessThread* process_thread_; | 101 ProcessThread* process_thread_; |
117 rtc::scoped_ptr<ProcessThread> pacer_thread_; | 102 rtc::scoped_ptr<ProcessThread> pacer_thread_; |
118 | 103 |
119 rtc::scoped_ptr<BitrateController> bitrate_controller_; | 104 rtc::scoped_ptr<BitrateController> bitrate_controller_; |
120 }; | 105 }; |
121 | 106 |
122 } // namespace webrtc | 107 } // namespace webrtc |
123 | 108 |
124 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ | 109 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ |
OLD | NEW |