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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 ProcessThread* module_process_thread, | 65 ProcessThread* module_process_thread, |
66 VideoCodingModule* vcm, | 66 VideoCodingModule* vcm, |
67 RemoteBitrateEstimator* remote_bitrate_estimator, | 67 RemoteBitrateEstimator* remote_bitrate_estimator, |
68 RtcpRttStats* rtt_stats, | 68 RtcpRttStats* rtt_stats, |
69 PacedSender* paced_sender, | 69 PacedSender* paced_sender, |
70 PacketRouter* packet_router); | 70 PacketRouter* packet_router); |
71 ~ViEChannel(); | 71 ~ViEChannel(); |
72 | 72 |
73 int32_t Init(); | 73 int32_t Init(); |
74 | 74 |
75 RtpRtcp* rtp_rtcp() const { return vie_receiver_.rtp_rtcp(); } | |
pbos-webrtc
2016/04/22 15:16:58
return rtp_rtcp_ right?
mflodman
2016/04/25 07:03:22
Done.
| |
76 | |
75 void SetProtectionMode(bool enable_nack, | 77 void SetProtectionMode(bool enable_nack, |
76 bool enable_fec, | 78 bool enable_fec, |
77 int payload_type_red, | 79 int payload_type_red, |
78 int payload_type_fec); | 80 int payload_type_fec); |
79 | 81 |
80 RtpState GetRtpStateForSsrc(uint32_t ssrc) const; | 82 RtpState GetRtpStateForSsrc(uint32_t ssrc) const; |
81 | 83 |
82 // Implements RtpFeedback. | 84 // Implements RtpFeedback. |
83 int32_t OnInitializeDecoder(const int8_t payload_type, | 85 int32_t OnInitializeDecoder(const int8_t payload_type, |
84 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 86 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
85 const int frequency, | 87 const int frequency, |
86 const size_t channels, | 88 const size_t channels, |
87 const uint32_t rate) override; | 89 const uint32_t rate) override; |
88 void OnIncomingSSRCChanged(const uint32_t ssrc) override; | 90 void OnIncomingSSRCChanged(const uint32_t ssrc) override; |
89 void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) override; | 91 void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) override; |
90 | 92 |
91 // Gets the module used by the channel. | 93 // Gets the module used by the channel. |
92 RtpRtcp* rtp_rtcp() const; | |
93 ViEReceiver* vie_receiver(); | 94 ViEReceiver* vie_receiver(); |
94 | 95 |
95 CallStatsObserver* GetStatsObserver(); | 96 CallStatsObserver* GetStatsObserver(); |
96 | 97 |
97 // Implements VCMReceiveCallback. | 98 // Implements VCMReceiveCallback. |
98 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT | 99 virtual int32_t FrameToRender(VideoFrame& video_frame); // NOLINT |
99 | 100 |
100 // Implements VCMReceiveCallback. | 101 // Implements VCMReceiveCallback. |
101 virtual int32_t ReceivedDecodedReferenceFrame( | 102 virtual int32_t ReceivedDecodedReferenceFrame( |
102 const uint64_t picture_id); | 103 const uint64_t picture_id); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 | 144 |
144 private: | 145 private: |
145 // Assumed to be protected. | 146 // Assumed to be protected. |
146 void StartDecodeThread(); | 147 void StartDecodeThread(); |
147 void StopDecodeThread(); | 148 void StopDecodeThread(); |
148 | 149 |
149 void ProcessNACKRequest(const bool enable); | 150 void ProcessNACKRequest(const bool enable); |
150 // Compute NACK list parameters for the buffering mode. | 151 // Compute NACK list parameters for the buffering mode. |
151 int GetRequiredNackListSize(int target_delay_ms); | 152 int GetRequiredNackListSize(int target_delay_ms); |
152 | 153 |
153 // ViEChannel exposes methods that allow to modify observers and callbacks | |
154 // to be modified. Such an API-style is cumbersome to implement and maintain | |
155 // at all the levels when comparing to only setting them at construction. As | |
156 // so this class instantiates its children with a wrapper that can be modified | |
157 // at a later time. | |
158 template <class T> | |
159 class RegisterableCallback : public T { | |
160 public: | |
161 RegisterableCallback() : callback_(nullptr) {} | |
162 | |
163 void Set(T* callback) { | |
164 rtc::CritScope lock(&critsect_); | |
165 callback_ = callback; | |
166 } | |
167 | |
168 protected: | |
169 // Note: this should be implemented with a RW-lock to allow simultaneous | |
170 // calls into the callback. However that doesn't seem to be needed for the | |
171 // current type of callbacks covered by this class. | |
172 rtc::CriticalSection critsect_; | |
173 T* callback_ GUARDED_BY(critsect_); | |
174 | |
175 private: | |
176 RTC_DISALLOW_COPY_AND_ASSIGN(RegisterableCallback); | |
177 }; | |
178 | |
179 class RegisterableRtcpPacketTypeCounterObserver | |
180 : public RegisterableCallback<RtcpPacketTypeCounterObserver> { | |
181 public: | |
182 void RtcpPacketTypesCounterUpdated( | |
183 uint32_t ssrc, | |
184 const RtcpPacketTypeCounter& packet_counter) override { | |
185 rtc::CritScope lock(&critsect_); | |
186 if (callback_) | |
187 callback_->RtcpPacketTypesCounterUpdated(ssrc, packet_counter); | |
188 } | |
189 | |
190 private: | |
191 } rtcp_packet_type_counter_observer_; | |
192 | |
193 | |
194 ProcessThread* const module_process_thread_; | 154 ProcessThread* const module_process_thread_; |
195 | 155 |
196 // Used for all registered callbacks except rendering. | 156 // Used for all registered callbacks except rendering. |
197 rtc::CriticalSection crit_; | 157 rtc::CriticalSection crit_; |
198 | 158 |
199 VideoCodingModule* const vcm_; | 159 VideoCodingModule* const vcm_; |
200 ViEReceiver vie_receiver_; | 160 ViEReceiver vie_receiver_; |
161 RtpRtcp* const rtp_rtcp_; | |
201 | 162 |
202 // Helper to report call statistics. | 163 // Helper to report call statistics. |
203 std::unique_ptr<ChannelStatsObserver> stats_observer_; | 164 std::unique_ptr<ChannelStatsObserver> stats_observer_; |
204 | 165 |
205 // Not owned. | 166 // Not owned. |
206 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); | 167 ReceiveStatisticsProxy* receive_stats_callback_ GUARDED_BY(crit_); |
207 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); | 168 FrameCounts receive_frame_counts_ GUARDED_BY(crit_); |
208 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); | 169 IncomingVideoStream* incoming_video_stream_ GUARDED_BY(crit_); |
209 RtcpRttStats* const rtt_stats_; | |
210 PacedSender* const paced_sender_; | |
211 PacketRouter* const packet_router_; | |
212 | 170 |
213 int max_nack_reordering_threshold_; | 171 int max_nack_reordering_threshold_; |
214 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); | 172 I420FrameCallback* pre_render_callback_ GUARDED_BY(crit_); |
215 | 173 |
216 int64_t last_rtt_ms_ GUARDED_BY(crit_); | 174 int64_t last_rtt_ms_ GUARDED_BY(crit_); |
217 | |
218 // RtpRtcp module, declared last as it use other members on construction. | |
219 const std::unique_ptr<RtpRtcp> rtp_rtcp_; | |
220 }; | 175 }; |
221 | 176 |
222 } // namespace webrtc | 177 } // namespace webrtc |
223 | 178 |
224 #endif // WEBRTC_VIDEO_VIE_CHANNEL_H_ | 179 #endif // WEBRTC_VIDEO_VIE_CHANNEL_H_ |
OLD | NEW |