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 |
(...skipping 23 matching lines...) Expand all Loading... |
34 class ProcessThread; | 34 class ProcessThread; |
35 class RemoteBitrateEstimator; | 35 class RemoteBitrateEstimator; |
36 class RemoteEstimatorProxy; | 36 class RemoteEstimatorProxy; |
37 class SendStatisticsProxy; | 37 class SendStatisticsProxy; |
38 class TransportFeedbackAdapter; | 38 class TransportFeedbackAdapter; |
39 class ViEChannel; | 39 class ViEChannel; |
40 class ViEEncoder; | 40 class ViEEncoder; |
41 class VieRemb; | 41 class VieRemb; |
42 class VoEVideoSync; | 42 class VoEVideoSync; |
43 | 43 |
44 typedef std::list<ViEChannel*> ChannelList; | |
45 | |
46 // Channel group contains data common for several channels. All channels in the | 44 // Channel group contains data common for several channels. All channels in the |
47 // group are assumed to send/receive data to the same end-point. | 45 // group are assumed to send/receive data to the same end-point. |
48 class ChannelGroup : public BitrateObserver { | 46 class ChannelGroup : public BitrateObserver { |
49 public: | 47 public: |
50 explicit ChannelGroup(ProcessThread* process_thread); | 48 explicit ChannelGroup(ProcessThread* process_thread); |
51 ~ChannelGroup(); | 49 ~ChannelGroup(); |
52 bool CreateSendChannel(int channel_id, | |
53 Transport* transport, | |
54 SendStatisticsProxy* stats_proxy, | |
55 I420FrameCallback* pre_encode_callback, | |
56 int number_of_cores, | |
57 const VideoSendStream::Config& config); | |
58 bool CreateReceiveChannel(int channel_id, | 50 bool CreateReceiveChannel(int channel_id, |
59 Transport* transport, | 51 Transport* transport, |
60 int number_of_cores, | 52 int number_of_cores, |
61 const VideoReceiveStream::Config& config); | 53 const VideoReceiveStream::Config& config); |
62 void DeleteChannel(int channel_id); | 54 void DeleteChannel(int channel_id); |
63 ViEChannel* GetChannel(int channel_id) const; | 55 ViEChannel* GetChannel(int channel_id) const; |
64 ViEEncoder* GetEncoder(int channel_id) const; | 56 void AddEncoder(const std::vector<uint32_t>& ssrcs, ViEEncoder* encoder); |
| 57 void RemoveEncoder(ViEEncoder* encoder); |
65 void SetSyncInterface(VoEVideoSync* sync_interface); | 58 void SetSyncInterface(VoEVideoSync* sync_interface); |
66 void SetBweBitrates(int min_bitrate_bps, | 59 void SetBweBitrates(int min_bitrate_bps, |
67 int start_bitrate_bps, | 60 int start_bitrate_bps, |
68 int max_bitrate_bps); | 61 int max_bitrate_bps); |
69 | 62 |
70 void SetChannelRembStatus(bool sender, bool receiver, ViEChannel* channel); | 63 void SetChannelRembStatus(bool sender, bool receiver, ViEChannel* channel); |
71 | 64 |
72 BitrateController* GetBitrateController() const; | 65 BitrateController* GetBitrateController() const; |
| 66 RemoteBitrateEstimator* GetRemoteBitrateEstimator() const; |
73 CallStats* GetCallStats() const; | 67 CallStats* GetCallStats() const; |
74 RemoteBitrateEstimator* GetRemoteBitrateEstimator() const; | |
75 EncoderStateFeedback* GetEncoderStateFeedback() const; | |
76 int64_t GetPacerQueuingDelayMs() const; | 68 int64_t GetPacerQueuingDelayMs() const; |
| 69 PacedSender* pacer() const { return pacer_.get(); } |
| 70 PacketRouter* packet_router() const { return packet_router_.get(); } |
| 71 BitrateAllocator* bitrate_allocator() const { |
| 72 return bitrate_allocator_.get(); } |
| 73 TransportFeedbackObserver* GetTransportFeedbackObserver(); |
| 74 RtcpIntraFrameObserver* GetRtcpIntraFrameObserver() const; |
77 | 75 |
78 // Implements BitrateObserver. | 76 // Implements BitrateObserver. |
79 void OnNetworkChanged(uint32_t target_bitrate_bps, | 77 void OnNetworkChanged(uint32_t target_bitrate_bps, |
80 uint8_t fraction_loss, | 78 uint8_t fraction_loss, |
81 int64_t rtt) override; | 79 int64_t rtt) override; |
82 | 80 |
83 private: | 81 private: |
84 typedef std::map<int, ViEChannel*> ChannelMap; | 82 typedef std::map<int, ViEChannel*> ChannelMap; |
85 typedef std::map<int, ViEEncoder*> EncoderMap; | |
86 | 83 |
87 bool CreateChannel(int channel_id, | 84 bool CreateChannel(int channel_id, |
88 Transport* transport, | 85 Transport* transport, |
89 int number_of_cores, | 86 int number_of_cores, |
90 ViEEncoder* vie_encoder, | |
91 size_t max_rtp_streams, | 87 size_t max_rtp_streams, |
92 bool sender, | 88 bool sender, |
93 RemoteBitrateEstimator* bitrate_estimator, | 89 RemoteBitrateEstimator* bitrate_estimator, |
94 TransportFeedbackObserver* feedback_observer); | 90 TransportFeedbackObserver* feedback_observer); |
95 ViEChannel* PopChannel(int channel_id); | 91 ViEChannel* PopChannel(int channel_id); |
96 | 92 |
97 rtc::scoped_ptr<VieRemb> remb_; | 93 rtc::scoped_ptr<VieRemb> remb_; |
98 rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; | 94 rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_; |
99 rtc::scoped_ptr<CallStats> call_stats_; | 95 rtc::scoped_ptr<CallStats> call_stats_; |
100 rtc::scoped_ptr<PacketRouter> packet_router_; | 96 rtc::scoped_ptr<PacketRouter> packet_router_; |
101 rtc::scoped_ptr<PacedSender> pacer_; | 97 rtc::scoped_ptr<PacedSender> pacer_; |
102 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 98 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
103 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_; | 99 rtc::scoped_ptr<RemoteEstimatorProxy> remote_estimator_proxy_; |
104 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; | 100 rtc::scoped_ptr<EncoderStateFeedback> encoder_state_feedback_; |
105 ChannelMap channel_map_; | 101 ChannelMap channel_map_; |
106 // Maps Channel id -> ViEEncoder. | 102 |
107 mutable rtc::CriticalSection encoder_map_crit_; | 103 mutable rtc::CriticalSection encoder_crit_; |
108 EncoderMap vie_encoder_map_ GUARDED_BY(encoder_map_crit_); | 104 std::vector<ViEEncoder*> encoders_ GUARDED_BY(encoder_crit_); |
109 | 105 |
110 // Registered at construct time and assumed to outlive this class. | 106 // Registered at construct time and assumed to outlive this class. |
111 ProcessThread* const process_thread_; | 107 ProcessThread* const process_thread_; |
112 rtc::scoped_ptr<ProcessThread> pacer_thread_; | 108 rtc::scoped_ptr<ProcessThread> pacer_thread_; |
113 | 109 |
114 rtc::scoped_ptr<BitrateController> bitrate_controller_; | 110 rtc::scoped_ptr<BitrateController> bitrate_controller_; |
115 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_; | 111 rtc::scoped_ptr<TransportFeedbackAdapter> transport_feedback_adapter_; |
116 int min_bitrate_bps_; | 112 int min_bitrate_bps_; |
117 }; | 113 }; |
118 | 114 |
119 } // namespace webrtc | 115 } // namespace webrtc |
120 | 116 |
121 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ | 117 #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_GROUP_H_ |
OLD | NEW |